source: tol/tol_pkg/MatQuery/test/test_0003/test.tol @ aa1e2cc

1941-docker-image-to-testdevel
Last change on this file since aa1e2cc was aa1e2cc, checked in by Víctor de Buen <vdebuen@…>, 17 years ago

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@1737 be4846ae-f051-483a-831f-b64e7d08527f

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/* -*- mode: C++ -*- */
2//////////////////////////////////////////////////////////////////////////////
3// FILE   : test.tol
4// PURPOSE: Package MatQuery test
5//////////////////////////////////////////////////////////////////////////////
6
7Text email_ = "vdebuen@tol-project.org";
8Text link_ = "";
9Text summary_ = "checking matrix row selection of unknown values";
10
11//#Require MatQuery;
12//#Embed "../../../_embed_all.tol";
13
14//Write here the initial test TOL code if needed
15Real numErr0 = Copy(NError);
16Real numWar0 = Copy(NWarning);
17
18Real t1 = Copy(Time);
19Real rndSeed = 0;
20Real m = 300;
21Real n = 10;
22
23VMatrix unk.match = LE(Rand(m,n,0,1),Rand(m,n,1,1)*.20);
24VMatrix M = IfVMat(unk.match, Rand(m,n,1,1)*?, Rand(m,n,-10,10));
25
26VMatrix M.unk = Min(IsUnknown(M)*Rand(n,1,1,1), Rand(m,1,1,1));
27
28VMatrix M.rows.known = Pack(Not(IsUnknown(M)*Rand(n,1,1,1)));
29VMatrix M.rows.unknown = Pack(Not(M.rows.known));
30VMatrix M.rows.known_= MatQuery::MatchRowsFullKnown(M);
31
32VMatrix unk.match.1 = LE(Rand(m,1,0,1),Rand(m,1,1,1)*.20);
33VMatrix M1 = IfVMat(unk.match.1, Rand(m,1,1,1)*?, Rand(m,1,-10,10));
34
35VMatrix unk.match.1_ = MatQuery::MatchRowsWithValue(M1,?);
36Real ok.1 = VMatMax(Abs(unk.match.1-unk.match.1))==0;
37
38Set sel.known = MatQuery::SelectMatch(Not(unk.match.1_));
39
40VMatrix extract.known = SubRow(M1, sel.known);
41
42Real ok.2 = VMatSum(IsUnknown(extract.known))==0;
43Real ok.3 = VRows(extract.known)==m-VMatSum(unk.match.1);
44
45
46Real numErr1 = Copy(NError);
47Real numWar1 = Copy(NWarning);
48
49Set partialResults_ = [[numErr0, numErr1,
50                        ok.1, ok.2, ok.3]];
51
52//This is a messure of the success of the test
53Real quality_ = And(numErr1 == numErr0,
54                    numWar1 <= numWar0,
55                    ok.1, ok.2, ok.3);
56
57//Return the results
58Set resultStr_ = @strTestStatus(summary_, link_, quality_,
59                  "Partial results = "<<partialResults_,
60                  "NO DBServerType", "NO DBServerHost", "NO DBAlias",
61                  email_);
62WriteLn(""<<resultStr_);
63resultStr_;
64
65/* */
66
Note: See TracBrowser for help on using the repository browser.