public class SparseMatrix
{
static SparseObjectMatrix2D matrix = new SparseObjectMatrix2D(1000000, 1000000);
public static void main(String[] args)
{
matrix.set(1, 2, 3.0);
}
}
Here is the error that I'm getting:
java.lang.ExceptionInInitializerError Caused by:
java.lang.IllegalArgumentException: matrix too large at
cern.colt.matrix.impl.AbstractMatrix2D.setUp(Unknown Source) at
cern.colt.matrix.impl.AbstractMatrix2D.setUp(Unknown Source) at
cern.colt.matrix.impl.SparseObjectMatrix2D.<init>(Unknown Source) at
cern.colt.matrix.impl.SparseObjectMatrix2D.<init>(Unknown Source) at
SparseMatrix.<clinit>(SparseMatrix.java:18) Exception in thread "main"
You cannot. From the documentation:
Instead of creating a matrix addressed with x and y coordinates, returning a
Value
, create aHashMap<Coordinates, Value>
, whereCoordinates
is a simple class holding x and y.