Santi Peñate-Vera
Santi Peñate-Vera

Reputation: 1186

initialize complex Sparse matrix

I have declared a Sparse complex matrix with the apache commons-math and I have absolutely no clue on how to initialize it, besides, the documentation seems quite poor.

import org.apache.commons.math3.linear.SparseFieldMatrix;

SparseFieldMatrix<Complex> Y;

if I try to set Y equal to a new instance it returns an error of no suitable constructor, and if I call the Y.CreateMatrix(int, int) it will tell that Y is Null.

So, how to initialize Y ?

Upvotes: 0

Views: 236

Answers (1)

NeplatnyUdaj
NeplatnyUdaj

Reputation: 6242

I don't know the library, but looking at the Javadoc I think this should do the trick:

SparseFieldMatrix Y = new SparseFieldMatrix<>(ComplexField.getInstance());

Upvotes: 1

Related Questions