diff options
author | Sunil Shetye | 2018-06-26 14:59:47 +0530 |
---|---|---|
committer | Sunil Shetye | 2018-06-26 14:59:47 +0530 |
commit | eb7c8e0cd42d4afe02be3adda2e94b6b0dfdaa00 (patch) | |
tree | 6378935263fe5cafd389b6893ac3b37a1dd4b1a7 /js/MatrixOp/MATMUL.js | |
parent | afed64f1a0eab0b2d742088186d7bc340a2c895b (diff) | |
download | sci2js-eb7c8e0cd42d4afe02be3adda2e94b6b0dfdaa00.tar.gz sci2js-eb7c8e0cd42d4afe02be3adda2e94b6b0dfdaa00.tar.bz2 sci2js-eb7c8e0cd42d4afe02be3adda2e94b6b0dfdaa00.zip |
add return value from scicos_getvalue to global vars
Diffstat (limited to 'js/MatrixOp/MATMUL.js')
-rw-r--r-- | js/MatrixOp/MATMUL.js | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/js/MatrixOp/MATMUL.js b/js/MatrixOp/MATMUL.js index e3f1dd0b..54d5d3b8 100644 --- a/js/MatrixOp/MATMUL.js +++ b/js/MatrixOp/MATMUL.js @@ -34,103 +34,103 @@ function MATMUL() { label[3-1] = sci2exp(1); } while (true) { - [ok,dtype,rule,np,exprs] = scicos_getvalue([["Set MATMUL parameter"],["For the Multipication rule:"],[" 1= Matrix by Matrix"],[" 2= Matrix by Matrix element wise "],[" 3= Matrix by Scalar"],["In the third case the second input will be the scalar"]],[["Datatype(1=real double 2=Complex 3=int32 ...)"],["Multiplication rule"],["Do on Overflow(0=Nothing 1=Saturate 2=Error)"]],list("vec",1,"vec",1,"vec",1),label); + [ok,this.dtype,this.rule,this.np,exprs] = scicos_getvalue([["Set MATMUL parameter"],["For the Multipication rule:"],[" 1= Matrix by Matrix"],[" 2= Matrix by Matrix element wise "],[" 3= Matrix by Scalar"],["In the third case the second input will be the scalar"]],[["Datatype(1=real double 2=Complex 3=int32 ...)"],["Multiplication rule"],["Do on Overflow(0=Nothing 1=Saturate 2=Error)"]],list("vec",1,"vec",1,"vec",1),label); if (!ok) { break; } - rule = int(rule); - if ((dtype<1||dtype>8)) { + this.rule = int(this.rule); + if ((this.dtype<1||this.dtype>8)) { message("type is not supported"); ok = false; } - if ((rule<1||rule>3)) { + if ((this.rule<1||this.rule>3)) { message("Multiplication rule must be only 1,2 or 3"); ok = false; } - if ((dtype==1||dtype==2)) { - np = 0; + if ((this.dtype==1||this.dtype==2)) { + this.np = 0; } TABMIN = [[0],[0],[-(2^31)],[-(2^15)],[-(2^7)],[0],[0],[0]]; TABMAX = [[0],[0],[(2^31)-1],[(2^15)-1],[(2^7)-1],[(2^32)-1],[(2^16)-1],[(2^8)-1]]; - if (rule==2) { - if (np==0) { + if (this.rule==2) { + if (this.np==0) { model.sim = list("matmul2_m",4); - } else if (np==1) { + } else if (this.np==1) { model.sim = list("matmul2_s",4); } else { model.sim = list("matmul2_e",4); } - } else if (rule==3) { - if (np==0) { + } else if (this.rule==3) { + if (this.np==0) { model.sim = list("matbyscal",4); - } else if (np==1) { + } else if (this.np==1) { model.sim = list("matbyscal_s",4); } else { model.sim = list("matbyscal_e",4); } } else { - if ((dtype==1)) { + if ((this.dtype==1)) { model.sim = list("matmul_m",4); - } else if ((dtype==2)) { + } else if ((this.dtype==2)) { model.sim = list("matzmul_m",4); - } else if (dtype==3) { - if (np==0) { + } else if (this.dtype==3) { + if (this.np==0) { model.sim = list("matmul_i32n",4); - } else if (np==1) { + } else if (this.np==1) { model.sim = list("matmul_i32s",4); } else { model.sim = list("matmul_i32e",4); } - } else if (dtype==4) { - if (np==0) { + } else if (this.dtype==4) { + if (this.np==0) { model.sim = list("matmul_i16n",4); - } else if (np==1) { + } else if (this.np==1) { model.sim = list("matmul_i16s",4); } else { model.sim = list("matmul_i16e",4); } - } else if (dtype==5) { - if (np==0) { + } else if (this.dtype==5) { + if (this.np==0) { model.sim = list("matmul_i8n",4); - } else if (np==1) { + } else if (this.np==1) { model.sim = list("matmul_i8s",4); } else { model.sim = list("matmul_i8e",4); } - } else if (dtype==6) { - if (np==0) { + } else if (this.dtype==6) { + if (this.np==0) { model.sim = list("matmul_ui32n",4); - } else if (np==1) { + } else if (this.np==1) { model.sim = list("matmul_ui32s",4); } else { model.sim = list("matmul_ui32e",4); } - } else if (dtype==7) { - if (np==0) { + } else if (this.dtype==7) { + if (this.np==0) { model.sim = list("matmul_ui16n",4); - } else if (np==1) { + } else if (this.np==1) { model.sim = list("matmul_ui16s",4); } else { model.sim = list("matmul_ui16e",4); } - } else if (dtype==8) { - if (np==0) { + } else if (this.dtype==8) { + if (this.np==0) { model.sim = list("matmul_ui8n",4); - } else if (np==1) { + } else if (this.np==1) { model.sim = list("matmul_ui8s",4); } else { model.sim = list("matmul_ui8e",4); } } } - kmin = TABMIN[dtype-1]; - kmax = TABMAX[dtype-1]; - it = dtype*ones(1,2); - ot = dtype; - if (rule==1) { + kmin = TABMIN[this.dtype-1]; + kmax = TABMAX[this.dtype-1]; + it = this.dtype*ones(1,2); + ot = this.dtype; + if (this.rule==1) { in1 = [[-1,-2],[-2,-3]]; out = [-1,-3]; - } else if (rule==2) { + } else if (this.rule==2) { in1 = [[-1,-2],[-1,-2]]; out = [-1,-2]; } else { @@ -140,7 +140,7 @@ function MATMUL() { [model,graphics,ok] = set_io(model,graphics,list(in1,it),list(out,ot),[],[]); if (ok) { label = exprs; - model.ipar = rule; + model.ipar = this.rule; model.rpar = [[kmin],[kmax]]; graphics.exprs = label; this.x.graphics = graphics; |