mp
Class MPSimpleMatrix
java.lang.Object
mp.MPDictionary
mp.MPSimpleMatrix
- public class MPSimpleMatrix
- extends MPDictionary
This class is a simple matrix implementation of the MPDictionary superclass.
In fact, it is as simple as possible and only the necessary methods are implemented.
The dictionary is represented columnwise as a matrix D
of size N×K
,
i.e. as a length K
array of column vectors,
each is a length N
array.
Constructor Summary |
MPSimpleMatrix(int iN,
int iK,
double[] val)
Constructs a N×K matrix or dictionary with values
from given one-dimensional array (which represents the matrix).
|
Method Summary |
double |
getValue(int n,
int k)
Returns an entry of the matrix, i.e. a single entry of a dictionary element (atom).
|
void |
setValue(int n,
int k,
double val)
Set an entry (a value) in the dictionary.
|
Methods inherited from class mp.MPDictionary |
addColumn, getColumn, getColumn, getColumns, getK, getN, getRow, getRow, getRows, innerProduct, isNormalized, multiply, multiply, normalize, setColumn, setRow, transposeMultiply, transposeMultiply |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MPSimpleMatrix
public MPSimpleMatrix(int iN,
int iK,
double[] val)
- Constructs a
N×K
matrix or dictionary with values
from given one-dimensional array (which represents the matrix).
Length of the array should be N*K
.
- Parameters:
iN
- length of dictionary elements, i.e. column vectors of the matrixiK
- number of dictionary elementsval
- the values (ordered by column, i.e. by dictionary elements)
getValue
public double getValue(int n,
int k)
- Returns an entry of the matrix, i.e. a single entry of a dictionary element (atom).
Note that the row, i.e. position in the column, is given first,
the second argument is the column number i.e. the number of the dictionary atom.
We should have:
0 <= n < N
and 0 <= k < K
.
If any argument is outside legal range 0.0 is returned without error or warning.
- Specified by:
getValue
in class MPDictionary
- Parameters:
n
- row number for the returned entry value.k
- column number for the returned entry value.
setValue
public void setValue(int n,
int k,
double val)
- Set an entry (a value) in the dictionary.
Note that the row, i.e. position in the column, is given first,
the second argument is the column number i.e. the number of the dictionary atom.
We should have:
0 <= n < N
and 0 <= k < K
.
If any argument is outside legal range nothing is done.
- Specified by:
setValue
in class MPDictionary
- Parameters:
n
- row number for the entry value to be changed.k
- column number for the entry value to be changed.val
- the value to be put into the given entry of the dictionary.