- Timestamp:
- Nov 27, 2009, 10:15:30 AM (17 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- aa1e2cc
- Parents:
- 29c0882
- File:
-
- 1 edited
-
tol_pkg/MatQuery/MatQuery.tol (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol_pkg/MatQuery/MatQuery.tol
r29c0882 r345a4d7 14 14 "vdebuen@tol-project.org" ]]; 15 15 16 //It will be passed to built-in function Pack to convert to the best storage 17 //Default value is set to unknown that will ensure minimum space 18 Real _.packSparsity = ?; 19 20 ////////////////////////////////////////////////////////////////////////////// 21 Real _checkColumnVector(Text method, VMatrix M) 22 ////////////////////////////////////////////////////////////////////////////// 23 { 24 If(VColumns(M)==1,True, 25 { 26 WriteLn("[MatQuery::"+method+"] a column matrix was " 27 "expected instead of ("<<VRows(M)+"x"+VColumns(M)+")","E"); 28 False 29 }) 30 }; 16 31 17 32 ////////////////////////////////////////////////////////////////////////////// … … 21 36 ////////////////////////////////////////////////////////////////////////////// 22 37 { 38 If(!_checkColumnVector("SelectMatch",match),Copy(Empty), { 23 39 Matrix select = VMat2Triplet(Convert(match,"Cholmod.R.Triplet")); 24 40 If(!Rows(select),Copy(Empty), MatSet(Tra(SubCol(select,[[1]])))[1]) 25 }; 26 41 })}; 42 43 ////////////////////////////////////////////////////////////////////////////// 44 Text _.autodoc.member.MatchRowsFullKnown = 45 "Returns a column matrix with True in rows where all cells have konwn values"; 46 VMatrix MatchRowsFullKnown(VMatrix M) 47 ////////////////////////////////////////////////////////////////////////////// 48 { 49 Real m = VRows(M); 50 Real n = VColumns(M); 51 Pack(Not(IsUnknown(M)*Rand(n,1,1,1)),_.packSparsity) 52 }; 27 53 28 54 ////////////////////////////////////////////////////////////////////////////// … … 33 59 ////////////////////////////////////////////////////////////////////////////// 34 60 { 35 If(IsUnknown(value), IsUnknown(M), 61 If(!_checkColumnVector("MatchRowsWithValue",M), Rand(0,0,0,0), { 62 Pack(If(IsUnknown(value), IsUnknown(M), 36 63 { 37 64 Real r = VRows(M); 38 65 VMatrix V = Rand(r,1,value,value); 39 66 EQ(M,V) 40 }) 41 } ;67 }),_.packSparsity) 68 })}; 42 69 43 70 ////////////////////////////////////////////////////////////////////////////// … … 66 93 ////////////////////////////////////////////////////////////////////////////// 67 94 { 95 If(!_checkColumnVector("MatchRowsInInterval",M), Rand(0,0,0,0), { 68 96 Real r = VRows(M); 69 97 VMatrix Min = Rand(r,1,min,min); 70 98 VMatrix Max = Rand(r,1,max,max); 71 Case(99 Pack(Case( 72 100 minIncluded & maxIncluded, And(LE(Min,M),LE(M,Max)), 73 101 !minIncluded & maxIncluded, And(LT(Min,M),LE(M,Max)), 74 102 minIncluded & !maxIncluded, And(LE(Min,M),LT(M,Max)), 75 103 !minIncluded & !maxIncluded, And(LT(Min,M),LT(M,Max)) 76 ) 77 } ;104 ),_.packSparsity) 105 })}; 78 106 79 107 ////////////////////////////////////////////////////////////////////////////// … … 108 136 Group("And",For(1,c, VMatrix(Real k) 109 137 { 110 LE(Abs(SubCol(M,[[k]])-VMatDat(P,1,k)),D)138 Pack(LE(Abs(SubCol(M,[[k]])-VMatDat(P,1,k)),D), _.packSparsity) 111 139 })) 112 140 }; … … 137 165 RPow(SubCol(M,[[k]])-VMatDat(P,1,k),2) 138 166 })); 139 LE(dist2,R2)167 Pack(LE(dist2,R2),_.packSparsity) 140 168 }; 141 169 … … 160 188 ////////////////////////////////////////////////////////////////////////////// 161 189 { 190 If(!_checkColumnVector("ClassifyRowsByRank",M), Rand(0,0,0,0), { 162 191 Real m = VRows(M); 163 192 Real R = Card(rankBound); … … 184 213 }); 185 214 class 186 } 215 })} 216 187 217 188 218
Note: See TracChangeset
for help on using the changeset viewer.
