0

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 ?

Santi Peñate-Vera
  • 1,053
  • 4
  • 33
  • 68

1 Answers1

1

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

SparseFieldMatrix Y = new SparseFieldMatrix<>(ComplexField.getInstance());
walkmn
  • 2,322
  • 22
  • 29
NeplatnyUdaj
  • 6,052
  • 6
  • 43
  • 76