Changeset a4fcb39 in tol
- Timestamp:
- Feb 24, 2011, 11:34:47 AM (16 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- aaaf752
- Parents:
- eb1a00c
- Location:
- tol/stdlib/math
- Files:
-
- 5 edited
-
R/Rapi.tol (modified) (2 diffs)
-
optim/LP/Rglpk.tol (modified) (1 diff)
-
optim/QP/Rquadprog.tol (modified) (1 diff)
-
stat/kde/_rkde.tol (modified) (1 diff)
-
stat/models/bayesian/diagnosis/_rcoda.tol (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/stdlib/math/R/Rapi.tol
reb1a00c ra4fcb39 203 203 204 204 Text R.out = Replace(_tmp.R.out, "%S", rndID); 205 Real OSFilRemove(R.out); 205 206 206 207 Text oscmd = _R.cmd+" \""+in.R+"\" \""+R.out+"\""; … … 208 209 WriteLn(_MID+"Executing :\n<"+oscmd)); 209 210 Real OSCmdWait(oscmd); 210 If (verbose, 211 WriteLn(_MID+"R output was :\n<"+ReadFile(R.out))); 212 213 // Remove remporaly results 214 215 Set EvalSet(tmps.bbm, Real(Text bbm) { 216 Real If(bbm=="", 0, OSFilRemove(bbm)) 217 }); 218 219 Real OSFilRemove(in.R); 220 Real OSFilRemove(args.R); 221 Real OSFilRemove(R.out); 222 223 // Collect results 224 Set result = EvalSet(result.names, Matrix(Text result) { 225 Text res.bbm = Replace(result, "%S", rndID); 226 Matrix matres = MatReadFile(res.bbm); 227 Real OSFilRemove(res.bbm); 228 Matrix matres 229 }) 211 If(!OSFilExist(R.out), 212 { 213 WriteLn("R or a required package seems to be not instaled. Please, " 214 "follow instructions at https://www.tol-project.org/wiki/DownloadTol","E"); 215 Real Stop; 216 Copy(Empty) 217 }, 218 { 219 If (verbose, 220 WriteLn(_MID+"R output was :\n<"+ReadFile(R.out))); 221 222 // Remove remporaly results 223 224 Set EvalSet(tmps.bbm, Real(Text bbm) { 225 Real If(bbm=="", 0, OSFilRemove(bbm)) 226 }); 227 228 Real OSFilRemove(in.R); 229 Real OSFilRemove(args.R); 230 Real OSFilRemove(R.out); 231 232 // Collect results 233 Set result = EvalSet(result.names, Matrix(Text result) { 234 Text res.bbm = Replace(result, "%S", rndID); 235 Matrix matres = MatReadFile(res.bbm); 236 Real OSFilRemove(res.bbm); 237 Matrix matres 238 }) 239 }) 230 240 } 231 232 241 ]] 233 242 -
tol/stdlib/math/optim/LP/Rglpk.tol
reb1a00c ra4fcb39 184 184 "Rglpk_solve_LP.TOL('"+_om.bbm+"','"+_rhs.bbm+"','%A')"; 185 185 186 Set result = Rapi::RunRScript(script, args.bbm, argList, result.names, 187 verbose); 188 Set [[ 189 Real status = MatDat(result[1],1,1), 190 Real objval = MatDat(result[1],1,2), 191 Matrix solution = Sub(result[1],1,3,1,Columns(result[1])-2)]] 186 Set rrs = Rapi::RunRScript(script,args.bbm,argList,result.names,verbose); 187 If(Card(rrs), 188 {[[ 189 Real status = MatDat(result[1],1,1), 190 Real objval = MatDat(result[1],1,2), 191 Matrix solution = Sub(result[1],1,3,1,Columns(result[1])-2) 192 ]]}, 193 { 194 WriteLn("[solveLP] Cannot run R script"); 195 Copy(Empty) 196 }) 192 197 }; 193 198 -
tol/stdlib/math/optim/QP/Rquadprog.tol
reb1a00c ra4fcb39 102 102 _A.bbm+"','"+_b0.bbm+"','%A')"; 103 103 104 Set r esult= Rapi::RunRScript(script, args.bbm, argList, result.names,104 Set rrs = Rapi::RunRScript(script, args.bbm, argList, result.names, 105 105 verbose); 106 [[ 107 Matrix solution = result[1] 108 ]] 106 If(Card(rrs), 107 {[[ 108 Matrix solution = rrs[1] 109 ]]}, 110 { 111 WriteLn("[solveQP] Cannot run R script"); 112 Copy(Empty) 113 }) 114 115 109 116 } 110 117 -
tol/stdlib/math/stat/kde/_rkde.tol
reb1a00c ra4fcb39 102 102 "Rkde_density.TOL('"+_sample.bbm+"','%A')"; 103 103 104 Set r esult= Rapi::RunRScript(script, args.bbm, argList, result.names,104 Set rrs = Rapi::RunRScript(script, args.bbm, argList, result.names, 105 105 verbose); 106 result[1] | result[2] 106 If(Card(rrs), 107 { 108 result[1] | result[2] 109 }, 110 { 111 WriteLn("[density] Cannot run R script"); 112 Rand(0,0,0,0) 113 }) 114 115 107 116 } 108 117 -
tol/stdlib/math/stat/models/bayesian/diagnosis/_rcoda.tol
reb1a00c ra4fcb39 195 195 <<FormatReal(eps,"%.15lg") 196 196 <<")"; 197 Rapi::RunRScript(script, args.bbm, "", 198 result.names, 199 verbose)[1] 197 Set rrs = Rapi::RunRScript(script, args.bbm, "",result.names,verbose); 198 If(Card(rrs), rrs[1], 199 { 200 WriteLn("[raftery.diag] Cannot run R script"); 201 Rand(0,0,0,0) 202 }) 200 203 }; 201 204 … … 282 285 <<FormatReal(autoburnin, "%.0lg") 283 286 <<")"; 284 Set aux= Rapi::RunRScript(script, args.bbm, "",287 Set rrs = Rapi::RunRScript(script, args.bbm, "", 285 288 result.names, 286 289 verbose); 287 [[ 288 Matrix psrf=aux[1]; 289 Real mpsrf = MatDat(aux[2],1,1) 290 ]] 290 If(Card(rrs), 291 {[[ 292 Matrix psrf=rrs[1]; 293 Real mpsrf = MatDat(rrs[2],1,1) 294 ]]}, 295 { 296 WriteLn("[gelman.diag] Cannot run R script"); 297 Copy(Empty) 298 }) 291 299 }; 292 300 … … 354 362 <<qTxt 355 363 <<")"; 356 Set Rapi::RunRScript(script, args.bbm, "", result.names, verbose) 364 Set rrs= Rapi::RunRScript(script, args.bbm, "", result.names, verbose); 365 If(Card(rrs), 366 { 367 rrs 368 }, 369 { 370 WriteLn("[summary] Cannot run R script"); 371 Copy(Empty) 372 }) 373 357 374 } 358 375
Note: See TracChangeset
for help on using the changeset viewer.
