User`s guide
Using Class Methods
Exceptions
The newSparse method throws the following exceptions:
NegativeArraySizeException
Row or column size is negative.
IndexOutOfBoundsException
The specified index parameter is invalid.
ArrayStoreException
Incompatible array type or invalid array data
Example — Constructing a Sparse Array Object with newSparse
Creating a spa rse complex MWNumericArray:
Construct a two-dimensional complex sparse
MWNumericArray from the real
and imaginary
double vectors:
double[][] rData = {{ 0, 0, 0, 16, 0},
{71, 63, 32, 0, 0}};
double[][] iData = {{ 0, 0, 0, 41, 0},
{ 0, 0, 32, 0, 2}};
MWNumericArray A =
MWNumericArray.newSparse(rData, iData, MWClassID.DOUBLE);
System.out.println("A = " + A.toString());
When run, the example displays this output:
A = (2,1) 71.0000
(2,2) 63.0000
(2,3) 32.0000 +32.0000i
4-69