|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cc.mallet.types.SparseMatrixn
public class SparseMatrixn
Implementation of Matrix that allows arbitrary number of dimensions. This implementation simply uses a flat array. Created: Tue Sep 16 14:52:37 2003
Constructor Summary | |
---|---|
SparseMatrixn(double[] vals)
Create a 1-d dense matrix with the given values. |
|
SparseMatrixn(int[] szs)
Create a dense matrix with the given dimensions. |
|
SparseMatrixn(int[] szs,
double[] vals)
|
|
SparseMatrixn(int[] szs,
int[] idxs,
double[] vals)
Create a sparse matrix with the given dimensions and the given values. |
Method Summary | |
---|---|
double |
absNorm()
|
double |
absNormalize()
|
java.lang.Object |
clone()
|
ConstantMatrix |
cloneMatrix()
|
void |
divideEquals(double factor)
|
double |
dotProduct(ConstantMatrix m)
|
void |
elementwiseDivideEquals(ConstantMatrix m)
|
void |
elementwiseDivideEquals(ConstantMatrix m,
double factor)
|
void |
elementwiseTimesEquals(ConstantMatrix m)
|
void |
elementwiseTimesEquals(ConstantMatrix m,
double factor)
|
boolean |
equals(java.lang.Object o)
|
void |
equalsPlus(double factor,
ConstantMatrix m)
|
int |
getDimensions(int[] szs)
|
int[] |
getIndices()
Returns an array of all the present indices. |
int |
getNumDimensions()
|
void |
incrementSingleValue(int i,
double delta)
|
int |
indexAtLocation(int location)
|
double |
infinityNorm()
|
double |
infinityNormalize()
|
boolean |
isNaN()
|
int |
location(int index)
|
int |
numLocations()
|
double |
oneNorm()
|
double |
oneNormalize()
|
void |
plusEquals(ConstantMatrix m)
|
void |
plusEquals(ConstantMatrix m,
double factor)
|
void |
print()
|
void |
set(ConstantMatrix m)
|
void |
setAll(double v)
|
void |
setSingleValue(int i,
double value)
|
void |
setValue(int[] indices,
double value)
|
void |
setValueAtLocation(int location,
double value)
|
void |
setWithAddend(ConstantMatrix m,
double addend)
|
void |
setWithFactor(ConstantMatrix m,
double factor)
|
int |
singleIndex(int[] indices)
|
static int |
singleIndex(int[] szs,
int[] indices)
|
int |
singleSize()
|
void |
singleToIndices(int single,
int[] indices)
|
double |
singleValue(int i)
|
void |
timesEquals(double factor)
|
double[] |
toArray()
Returns a one-dimensional array representation of the matrix. |
double |
twoNorm()
|
double |
twoNormalize()
|
double |
value(int[] indices)
|
double |
valueAtLocation(int location)
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SparseMatrixn(double[] vals)
public SparseMatrixn(int[] szs)
szs
- An array containing the maximum for
each dimension.public SparseMatrixn(int[] szs, double[] vals)
public SparseMatrixn(int[] szs, int[] idxs, double[] vals)
szs
- An array containing the maximum for
each dimension.idxs
- An array containing the single index
for each entry of the matrix. A single index is
an integer computed from the indices of each dimension.
as returned by Matrixn.singleIndex(int[])
.vals
- A flat array of the entries of the
matrix, in row-major order.Method Detail |
---|
public int getNumDimensions()
getNumDimensions
in interface ConstantMatrix
public int getDimensions(int[] szs)
getDimensions
in interface ConstantMatrix
public double value(int[] indices)
value
in interface ConstantMatrix
public void setValue(int[] indices, double value)
setValue
in interface Matrix
public int[] getIndices()
public ConstantMatrix cloneMatrix()
cloneMatrix
in interface ConstantMatrix
public java.lang.Object clone()
clone
in class java.lang.Object
public int singleIndex(int[] indices)
singleIndex
in interface ConstantMatrix
public static int singleIndex(int[] szs, int[] indices)
public void singleToIndices(int single, int[] indices)
singleToIndices
in interface ConstantMatrix
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public double[] toArray()
public double singleValue(int i)
singleValue
in interface ConstantMatrix
public int singleSize()
singleSize
in interface ConstantMatrix
public int numLocations()
numLocations
in interface ConstantMatrix
public int location(int index)
location
in interface ConstantMatrix
public double valueAtLocation(int location)
valueAtLocation
in interface ConstantMatrix
public void setValueAtLocation(int location, double value)
setValueAtLocation
in interface Matrix
public int indexAtLocation(int location)
indexAtLocation
in interface ConstantMatrix
public double dotProduct(ConstantMatrix m)
dotProduct
in interface ConstantMatrix
public double absNorm()
absNorm
in interface ConstantMatrix
public double oneNorm()
oneNorm
in interface ConstantMatrix
public double twoNorm()
twoNorm
in interface ConstantMatrix
public double infinityNorm()
infinityNorm
in interface ConstantMatrix
public void print()
print
in interface ConstantMatrix
public boolean isNaN()
isNaN
in interface ConstantMatrix
public void setSingleValue(int i, double value)
setSingleValue
in interface Matrix
public void incrementSingleValue(int i, double delta)
incrementSingleValue
in interface Matrix
public void setAll(double v)
setAll
in interface Matrix
public void set(ConstantMatrix m)
set
in interface Matrix
public void setWithAddend(ConstantMatrix m, double addend)
setWithAddend
in interface Matrix
public void setWithFactor(ConstantMatrix m, double factor)
setWithFactor
in interface Matrix
public void plusEquals(ConstantMatrix m)
plusEquals
in interface Matrix
public void plusEquals(ConstantMatrix m, double factor)
plusEquals
in interface Matrix
public void equalsPlus(double factor, ConstantMatrix m)
equalsPlus
in interface Matrix
public void timesEquals(double factor)
timesEquals
in interface Matrix
public void elementwiseTimesEquals(ConstantMatrix m)
elementwiseTimesEquals
in interface Matrix
public void elementwiseTimesEquals(ConstantMatrix m, double factor)
elementwiseTimesEquals
in interface Matrix
public void divideEquals(double factor)
divideEquals
in interface Matrix
public void elementwiseDivideEquals(ConstantMatrix m)
elementwiseDivideEquals
in interface Matrix
public void elementwiseDivideEquals(ConstantMatrix m, double factor)
elementwiseDivideEquals
in interface Matrix
public double oneNormalize()
oneNormalize
in interface Matrix
public double twoNormalize()
twoNormalize
in interface Matrix
public double absNormalize()
absNormalize
in interface Matrix
public double infinityNormalize()
infinityNormalize
in interface Matrix
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |