I was going through this software library for semantic specs in java.
This particular code for implementing the DivRank has a method that takes a parameter called SparseMatrix: http://code.google.com/p/airhead-research/source/browse/branches/matrix-rank/src/edu/ucla/sspace/matrix/DivRank.java?spec=svn1277&r=1277
The documentation in the package says that SparseMatrix is an interface:
http://airhead-research.googlecode.com/svn/trunk/javadoc/1.7/edu/ucla/sspace/matrix/SparseMatrix.html
My aim is to inject the values I have in a double[][] into this parameter.
SparseMatrix implements another interface called Matrix that has setRow and setColumn functions. When I tried to use that with an object of the interface I made, I got NullPointException. I think it is because I haven’t had an instance of the SparseMatrix interface.
I then realized, I had to use a class that implements that interface and pass that classes object. But the documentation does not show any simple class that suits my need.
Do I need to define a new class that implements this interface and also override the interfaces functions and use the object to pass my values?
I have not looked in details but on the javadoc (your second link), there’s a list called “All Known Implementing Classes”. You could check them and I’m sure you will find one that is a concrete class (i.e. not an interface or an abstract class) and does what you need. For example the SparseHashMatrix has a
set(row, col, value)method that you could use to populate a matrix from yourdouble[][]with a loop.