Changeset b83f1d6 in tol for tol_pkg/MulVarFunAprox/DesignC2.tol
- Timestamp:
- Dec 11, 2009, 10:42:36 AM (17 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 0bb1f94
- Parents:
- eaa41f7
- File:
-
- 1 edited
-
tol_pkg/MulVarFunAprox/DesignC2.tol (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol_pkg/MulVarFunAprox/DesignC2.tol
reaa41f7 rb83f1d6 73 73 Real build.border.points(Real void) { False }; 74 74 VMatrix closest.reference.index(VMatrix X); 75 VMatrix match.evaluable(VMatrix X); 75 76 Set get.X.weight(Set X.dif); 76 VMatrix match.evaluable(VMatrix X);77 Set get.X.weight.partial.derivative.1(Set X.dif, Real s); 77 78 78 79 ////////////////////////////////////////////////////////////////////////////// … … 104 105 105 106 ////////////////////////////////////////////////////////////////////////////// 106 VMatrix build.obs .eval(VMatrix X, VMatrix X.h, FunRn2R::@BaseC2.Eval eval)107 VMatrix build.obs(VMatrix X, VMatrix X.h) 107 108 ////////////////////////////////////////////////////////////////////////////// 108 109 { 109 110 Text _MID = "[@DesignC2::build.obs] "; 111 FunRn2R::@BaseC2.Eval.Function eval = 112 FunRn2R::@BaseC2.Eval.Function::New(get.base(0)); 110 113 Real m = VRows(X); 111 114 WriteLn("TRACE "+_MID+"1 m="<<m); … … 144 147 145 148 ////////////////////////////////////////////////////////////////////////////// 146 VMatrix build.obs (VMatrix X, VMatrix X.h)149 VMatrix build.obs.partial.derivative.1(VMatrix X, VMatrix X.h, Real s) 147 150 ////////////////////////////////////////////////////////////////////////////// 148 151 { 149 152 FunRn2R::@BaseC2.Eval.Function eval = 150 153 FunRn2R::@BaseC2.Eval.Function::New(get.base(0)); 151 build.obs.eval(X,X.h,eval) 152 }; 153 ////////////////////////////////////////////////////////////////////////////// 154 VMatrix build.obs.partial.derivative.1(VMatrix X, VMatrix X.h, Real s) 155 ////////////////////////////////////////////////////////////////////////////// 156 { 157 FunRn2R::@BaseC2.Eval.Partial.Derivative.1 eval = 154 FunRn2R::@BaseC2.Eval.Partial.Derivative.1 der = 158 155 FunRn2R::@BaseC2.Eval.Partial.Derivative.1::New(get.base(0), s); 159 build.obs.eval(X,X.h,eval) 160 }; 161 ////////////////////////////////////////////////////////////////////////////// 162 VMatrix build.obs.partial.derivative.2(VMatrix X, VMatrix X.h, 163 Real s1, Real s2) 164 ////////////////////////////////////////////////////////////////////////////// 165 { 166 FunRn2R::@BaseC2.Eval.Partial.Derivative.2 eval = 167 FunRn2R::@BaseC2.Eval.Partial.Derivative.2::New(get.base(0), s1, s2); 168 build.obs.eval(X,X.h,eval) 169 }; 170 ////////////////////////////////////////////////////////////////////////////// 171 VMatrix build.obs.partial.integrate.1(VMatrix X, VMatrix X.h, Real s) 172 ////////////////////////////////////////////////////////////////////////////// 173 { 174 FunRn2R::@BaseC2.Eval.Partial.Integrate.1 eval = 175 FunRn2R::@BaseC2.Eval.Partial.Integrate.1::New(get.base(0), s); 176 build.obs.eval(X,X.h,eval) 177 }; 156 Text _MID = "[@DesignC2::build.obs.partial.derivative.1] "; 157 FunRn2R::@BaseC2.Eval.Function eval = 158 FunRn2R::@BaseC2.Eval.Function::New(get.base(0)); 159 Real m = VRows(X); 160 WriteLn("TRACE "+_MID+"1 m="<<m); 161 If(!m, Rand(0,_.N,0,0), { 162 WriteLn("TRACE "+_MID+"2"); 163 WriteLn("TRACE "+_MID+"3"); 164 VMatrix X.j=DifEq(1/(1-B),Rand(m,1,1,1)); 165 WriteLn("TRACE "+_MID+"4"); 166 Set X.dif = For(1,_.X.maxNeighbour,VMatrix(Real i) 167 { 168 Set X.h.i = VCol2Set(SubCol(X.h,[[i]])); 169 X - SubRow(_.Y,X.h.i) 170 }); 171 WriteLn("TRACE "+_MID+"5"); 172 Set X.weight = get.X.weight(X.dif); 173 Set X.weight.der = get.X.weight.partial.derivative.1(X.dif,s); 174 WriteLn("TRACE "+_MID+"6"); 175 Matrix QX.triplet = Group("ConcatRows", For(1,_.X.maxNeighbour,Matrix(Real i) 176 { 177 VMatrix w.i = X.weight[i]; 178 Set sel.rows = MatQuery::SelectMatch(NE(Drop(Abs(w.i),1.E-15),w.i*0)); 179 VMatrix wi = SubRow(w.i,sel.rows); 180 VMatrix wi.der = SubRow(X.weight.der[i],sel.rows); 181 VMatrix X.hiK = SubRow((SubCol(X.h,[[i]])-1)*_.K,sel.rows); 182 VMatrix Xdif.i = SubRow(X.dif[i],sel.rows); 183 VMatrix X.j.i = SubRow(X.j,sel.rows); 184 Real eval::upgrade.cache(Xdif.i); 185 Real der::upgrade.cache(Xdif.i); 186 Group("ConcatRows", For(1,_.K,Matrix(Real k) 187 { 188 VMatrix pk = eval::evaluate.v(k,Xdif.i); 189 VMatrix pk.der = der::evaluate.v(k,Xdif.i); 190 VMatrix qk = wi$*pk.der+wi.der$*pk; 191 VMat2Mat(X.j.i | (X.hiK+k) | qk) 192 })) 193 })); 194 WriteLn("TRACE "+_MID+"7"); 195 Pack(Convert(Triplet(QX.triplet, m, _.N),"Cholmod.R.Sparse")) 196 })}; 197 178 198 ////////////////////////////////////////////////////////////////////////////// 179 199 VMatrix build.border.prior(Real void)
Note: See TracChangeset
for help on using the changeset viewer.
