Send a matrix as a proc argument in Chapel -


i'm getting error when try send matrix proc. i'm pretty sure i'm doing wrong, can't figure out.

use linearalgebra;     proc main() {   var = matrix(        [0.0, 0.8, 1.1, 0.0, 2.0]       ,[0.8, 0.0, 1.3, 1.0, 0.0]       ,[1.1, 1.3, 0.0, 0.5, 1.7]       ,[0.0, 1.0, 0.5, 0.0, 1.5]       ,[2.0, 0.0, 1.7, 1.5, 0.0]       );    check_dims(a); }  proc check_dims(a: matrix) {    var t: bool  = false;   if (a.domain.dim(1) == a.domain.dim(2)){     t = true;   }   return t; } 

gives me

mad.chpl:3: in function 'main': mad.chpl:14: error: unresolved call 'check_dims([domain(2,int(64),false)] real(64))' mad.chpl:17: note: candidates are: check_dims(a: matrix) 

i'm using chpl version 1.15.0

linear algebra objects (like matrices , vectors) represented arrays in chapel. therefore, changing matrix (a type not exist) [] (the syntax array-type) should work expected:

use linearalgebra;     proc main() {   var = matrix(        [0.0, 0.8, 1.1, 0.0, 2.0]       ,[0.8, 0.0, 1.3, 1.0, 0.0]       ,[1.1, 1.3, 0.0, 0.5, 1.7]       ,[0.0, 1.0, 0.5, 0.0, 1.5]       ,[2.0, 0.0, 1.7, 1.5, 0.0]       );    check_dims(a); }  proc check_dims(a: []) {    var t: bool  = false;   // method dim()   if (a.domain.dim(1) == a.domain.dim(2)){     t = true;   }   return t; } 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -