Brian Dolan
Brian Dolan

Reputation: 3136

How to construct a new Matrix() in Chapel?

I'm getting an error with

use LinearAlgebra;
var M = Matrix((3,4, 5.1), (5,6,1.3));

How do I correctly construct M? I feel like I knew the answer once...

Upvotes: 1

Views: 46

Answers (1)

ben-albrecht
ben-albrecht

Reputation: 1865

How do I correctly construct M?

What you meant to do is:

use LinearAlgebra;
var M = Matrix([3.0,4.0, 5.1], [5.0,6.0,1.3]);

The Matrix() overload you were trying to call expects 1D arrays, denoted by the bracket syntax, e.g. [1,2,3]. Instead, your example was passing tuples, denoted by the parentheses syntax, e.g. (1,2,3).

Upvotes: 1

Related Questions