|
Mobios v0.91 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cern.colt.PersistentObject cern.colt.matrix.impl.AbstractMatrix cern.colt.matrix.impl.AbstractMatrix2D cern.colt.matrix.DoubleMatrix2D mobios.util.LargeDenseDoubleMatrix2D
public class LargeDenseDoubleMatrix2D
Large Dense 2-d matrix holding double elements. It aims at huge matrix whose elements
can not be stored in a single array. For matrices that are not that large, consider
DenseDoubleMatrix2D
.
Implementation:
Internally holds a two-dimensional double array, consistent to the topology of the matrix . Note that this implementation is not synchronized.
Field Summary | |
---|---|
static long |
sizeGate
|
Constructor Summary | |
---|---|
LargeDenseDoubleMatrix2D(double[][] values)
Constructs a matrix with a copy of the given values. |
|
LargeDenseDoubleMatrix2D(int rows,
int columns)
Constructs a matrix with a given number of rows and columns. |
Method Summary | |
---|---|
double |
aggregate(cern.colt.function.DoubleDoubleFunction aggr,
cern.colt.function.DoubleFunction f)
|
double |
aggregate(cern.colt.matrix.DoubleMatrix2D other,
cern.colt.function.DoubleDoubleFunction aggr,
cern.colt.function.DoubleDoubleFunction f)
|
cern.colt.matrix.DoubleMatrix2D |
assign(double value)
Sets all cells to the state specified by value. |
cern.colt.matrix.DoubleMatrix2D |
assign(double[][] values)
Sets all cells to the state specified by values. |
cern.colt.matrix.DoubleMatrix2D |
assign(cern.colt.function.DoubleFunction function)
Assigns the result of a function to each cell; x[row,col] = function(x[row,col]). |
cern.colt.matrix.DoubleMatrix2D |
assign(cern.colt.matrix.DoubleMatrix2D source)
Replaces all cell values of the receiver with the values of another matrix. |
cern.colt.matrix.DoubleMatrix2D |
assign(cern.colt.matrix.DoubleMatrix2D y,
cern.colt.function.DoubleDoubleFunction function)
Assigns the result of a function to each cell; x[row,col] = function(x[row,col],y[row,col]). |
int |
cardinality()
|
void |
checkShape(cern.colt.matrix.impl.AbstractMatrix2D B)
|
void |
checkShape(cern.colt.matrix.impl.AbstractMatrix2D B,
cern.colt.matrix.impl.AbstractMatrix2D C)
|
int |
columns()
|
cern.colt.matrix.DoubleMatrix2D |
copy()
|
static cern.colt.matrix.DoubleMatrix2D |
covariance(cern.colt.matrix.DoubleMatrix2D matrix,
boolean trans)
Constructs and returns the covariance matrix of the given matrix. |
static cern.colt.matrix.DoubleMatrix2D |
createDoubleMatrix2D(int row,
int column)
Create a DoubleMatrix2D of the given size. |
static cern.colt.matrix.DoubleMatrix2D |
distance(cern.colt.matrix.DoubleMatrix2D matrix,
boolean trans,
cern.colt.matrix.doublealgo.Statistic.VectorVectorFunction distanceFunction)
Constructs and returns the distance matrix of the given matrix. |
void |
ensureCapacity(int minNonZeros)
|
boolean |
equals(double value)
|
boolean |
equals(Object obj)
|
cern.colt.matrix.DoubleMatrix2D |
forEachNonZero(cern.colt.function.IntIntDoubleFunction function)
|
double |
get(int row,
int column)
|
void |
getNonZeros(cern.colt.list.IntArrayList rowList,
cern.colt.list.IntArrayList columnList,
cern.colt.list.DoubleArrayList valueList)
|
double |
getQuick(int row,
int column)
Returns the matrix cell value at coordinate [row,column]. |
static boolean |
isLarge(int row,
int column)
|
cern.colt.matrix.DoubleMatrix2D |
like()
|
cern.colt.matrix.DoubleMatrix2D |
like(int rows,
int columns)
Construct and returns a new empty matrix of the same dynamic type as the receiver, having the specified number of rows and columns. |
cern.colt.matrix.DoubleMatrix1D |
like1D(int size)
Construct and returns a new 1-d matrix of the corresponding dynamic type, entirelly independent of the receiver. |
static cern.colt.matrix.DoubleMatrix2D |
mult(cern.colt.matrix.DoubleMatrix2D a,
boolean aTrans,
cern.colt.matrix.DoubleMatrix2D b,
boolean bTrans)
return the matrix production of two matrix. |
int |
rows()
|
void |
set(int row,
int column,
double value)
|
void |
setQuick(int row,
int column,
double value)
Sets the matrix cell at coordinate [row,column] to the specified value. |
int |
size()
|
double[][] |
toArray()
|
String |
toString()
|
String |
toStringShort()
|
void |
trimToSize()
|
cern.colt.matrix.DoubleMatrix1D |
viewColumn(int column)
|
cern.colt.matrix.DoubleMatrix2D |
viewColumnFlip()
|
cern.colt.matrix.DoubleMatrix2D |
viewDice()
|
cern.colt.matrix.DoubleMatrix2D |
viewPart(int row,
int column,
int height,
int width)
|
cern.colt.matrix.DoubleMatrix1D |
viewRow(int row)
|
cern.colt.matrix.DoubleMatrix2D |
viewRowFlip()
|
cern.colt.matrix.DoubleMatrix2D |
viewSelection(cern.colt.matrix.DoubleMatrix1DProcedure condition)
|
cern.colt.matrix.DoubleMatrix2D |
viewSelection(int[] rowIndexes,
int[] columnIndexes)
|
cern.colt.matrix.DoubleMatrix2D |
viewSorted(int column)
|
cern.colt.matrix.DoubleMatrix2D |
viewStrides(int rowStride,
int columnStride)
|
void |
zAssign8Neighbors(cern.colt.matrix.DoubleMatrix2D B,
cern.colt.function.Double9Function function)
8 neighbor stencil transformation. |
cern.colt.matrix.DoubleMatrix1D |
zMult(cern.colt.matrix.DoubleMatrix1D y,
cern.colt.matrix.DoubleMatrix1D z)
|
cern.colt.matrix.DoubleMatrix1D |
zMult(cern.colt.matrix.DoubleMatrix1D y,
cern.colt.matrix.DoubleMatrix1D z,
double alpha,
double beta,
boolean transposeA)
|
cern.colt.matrix.DoubleMatrix2D |
zMult(cern.colt.matrix.DoubleMatrix2D B,
cern.colt.matrix.DoubleMatrix2D C)
|
cern.colt.matrix.DoubleMatrix2D |
zMult(cern.colt.matrix.DoubleMatrix2D B,
cern.colt.matrix.DoubleMatrix2D C,
double alpha,
double beta,
boolean transposeA,
boolean transposeB)
|
double |
zSum()
Returns the sum of all cells; Sum( x[i,j] ). |
Methods inherited from class cern.colt.PersistentObject |
---|
clone |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final long sizeGate
Constructor Detail |
---|
public LargeDenseDoubleMatrix2D(double[][] values)
The values are copied. So subsequent changes in values are not reflected in the matrix, and vice-versa.
values
- The values to be filled into the new matrix.
IllegalArgumentException
- if
for any 1 <= row < values.length: values[row].length != values[row-1].length.public LargeDenseDoubleMatrix2D(int rows, int columns)
rows
- the number of rows the matrix shall have.columns
- the number of columns the matrix shall have.
IllegalArgumentException
- if rows<0 || columns<0 || (double)columns*rows > Integer.MAX_VALUE.Method Detail |
---|
public cern.colt.matrix.DoubleMatrix2D assign(double[][] values)
The values are copied. So subsequent changes in values are not reflected in the matrix, and vice-versa.
assign
in class cern.colt.matrix.DoubleMatrix2D
values
- the values to be filled into the cells.
IllegalArgumentException
- if
values.length != rows() || for any 0 <= row < rows(): values[row].length != columns().public cern.colt.matrix.DoubleMatrix2D assign(double value)
assign
in class cern.colt.matrix.DoubleMatrix2D
value
- the value to be filled into the cells.
public cern.colt.matrix.DoubleMatrix2D assign(cern.colt.function.DoubleFunction function)
Example:
matrix = 2 x 2 matrix 0.5 1.5 2.5 3.5 // change each cell to its sine matrix.assign(cern.jet.math.Functions.sin); --> 2 x 2 matrix 0.479426 0.997495 0.598472 -0.350783For further examples, see the package doc.
assign
in class cern.colt.matrix.DoubleMatrix2D
function
- a function object taking as argument the current cell's value.
Functions
public cern.colt.matrix.DoubleMatrix2D assign(cern.colt.matrix.DoubleMatrix2D source)
assign
in class cern.colt.matrix.DoubleMatrix2D
source
- the source matrix to copy from (may be identical to the receiver).
IllegalArgumentException
- if columns() != source.columns() || rows() != source.rows()public cern.colt.matrix.DoubleMatrix2D assign(cern.colt.matrix.DoubleMatrix2D y, cern.colt.function.DoubleDoubleFunction function)
Example:
// assign x[row,col] = x[row,col]<sup>y[row,col]</sup> m1 = 2 x 2 matrix 0 1 2 3 m2 = 2 x 2 matrix 0 2 4 6 m1.assign(m2, cern.jet.math.Functions.pow); --> m1 == 2 x 2 matrix 1 1 16 729For further examples, see the package doc.
assign
in class cern.colt.matrix.DoubleMatrix2D
y
- the secondary matrix to operate on.function
- a function object taking as first argument the current cell's value of this,
and as second argument the current cell's value of y,
IllegalArgumentException
- if columns() != other.columns() || rows() != other.rows()Functions
public double getQuick(int row, int column)
Provided with invalid parameters this method may return invalid objects without throwing any exception. You should only use this method when you are absolutely sure that the coordinate is within bounds. Precondition (unchecked): 0 <= column < columns() && 0 <= row < rows().
getQuick
in class cern.colt.matrix.DoubleMatrix2D
row
- the index of the row-coordinate.column
- the index of the column-coordinate.
public cern.colt.matrix.DoubleMatrix2D like(int rows, int columns)
like
in class cern.colt.matrix.DoubleMatrix2D
rows
- the number of rows the matrix shall have.columns
- the number of columns the matrix shall have.
public cern.colt.matrix.DoubleMatrix1D like1D(int size)
like1D
in class cern.colt.matrix.DoubleMatrix2D
size
- the number of cells the matrix shall have.
public void setQuick(int row, int column, double value)
Provided with invalid parameters this method may access illegal indexes without throwing any exception. You should only use this method when you are absolutely sure that the coordinate is within bounds. Precondition (unchecked): 0 <= column < columns() && 0 <= row < rows().
setQuick
in class cern.colt.matrix.DoubleMatrix2D
row
- the index of the row-coordinate.column
- the index of the column-coordinate.value
- the value to be filled into the specified cell.public void zAssign8Neighbors(cern.colt.matrix.DoubleMatrix2D B, cern.colt.function.Double9Function function)
B[i,j] = function.apply( A[i-1,j-1], A[i-1,j], A[i-1,j+1], A[i, j-1], A[i, j], A[i, j+1], A[i+1,j-1], A[i+1,j], A[i+1,j+1] ) x x x - - x x x - - - - x o x - - x o x - - - - x x x - - x x x ... - x x x - - - - - - - - - x o x - - - - - - - - - x x xMake sure that cells of this and B do not overlap. In case of overlapping views, behaviour is unspecified.
Example:
final double alpha = 0.25; final double beta = 0.75; // 8 neighbors cern.colt.function.Double9Function f = new cern.colt.function.Double9Function() { public final double apply( double a00, double a01, double a02, double a10, double a11, double a12, double a20, double a21, double a22) { return beta*a11 + alpha*(a00+a01+a02 + a10+a12 + a20+a21+a22); } }; A.zAssign8Neighbors(B,f); // 4 neighbors cern.colt.function.Double9Function g = new cern.colt.function.Double9Function() { public final double apply( double a00, double a01, double a02, double a10, double a11, double a12, double a20, double a21, double a22) { return beta*a11 + alpha*(a01+a10+a12+a21); } C.zAssign8Neighbors(B,g); // fast, even though it doesn't look like it };
zAssign8Neighbors
in class cern.colt.matrix.DoubleMatrix2D
B
- the matrix to hold the results.function
- the function to be applied to the 9 cells.
NullPointerException
- if function==null.
IllegalArgumentException
- if rows() != B.rows() || columns() != B.columns().public cern.colt.matrix.DoubleMatrix1D zMult(cern.colt.matrix.DoubleMatrix1D y, cern.colt.matrix.DoubleMatrix1D z, double alpha, double beta, boolean transposeA)
zMult
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix2D zMult(cern.colt.matrix.DoubleMatrix2D B, cern.colt.matrix.DoubleMatrix2D C, double alpha, double beta, boolean transposeA, boolean transposeB)
zMult
in class cern.colt.matrix.DoubleMatrix2D
public double zSum()
zSum
in class cern.colt.matrix.DoubleMatrix2D
public void ensureCapacity(int minNonZeros)
ensureCapacity
in class cern.colt.matrix.impl.AbstractMatrix
public void trimToSize()
trimToSize
in class cern.colt.matrix.impl.AbstractMatrix
public void checkShape(cern.colt.matrix.impl.AbstractMatrix2D B)
checkShape
in class cern.colt.matrix.impl.AbstractMatrix2D
public void checkShape(cern.colt.matrix.impl.AbstractMatrix2D B, cern.colt.matrix.impl.AbstractMatrix2D C)
checkShape
in class cern.colt.matrix.impl.AbstractMatrix2D
public String toStringShort()
toStringShort
in class cern.colt.matrix.impl.AbstractMatrix2D
public double aggregate(cern.colt.function.DoubleDoubleFunction aggr, cern.colt.function.DoubleFunction f)
aggregate
in class cern.colt.matrix.DoubleMatrix2D
public double aggregate(cern.colt.matrix.DoubleMatrix2D other, cern.colt.function.DoubleDoubleFunction aggr, cern.colt.function.DoubleDoubleFunction f)
aggregate
in class cern.colt.matrix.DoubleMatrix2D
public int cardinality()
cardinality
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix2D copy()
copy
in class cern.colt.matrix.DoubleMatrix2D
public boolean equals(double value)
equals
in class cern.colt.matrix.DoubleMatrix2D
public boolean equals(Object obj)
equals
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix2D forEachNonZero(cern.colt.function.IntIntDoubleFunction function)
forEachNonZero
in class cern.colt.matrix.DoubleMatrix2D
public double get(int row, int column)
get
in class cern.colt.matrix.DoubleMatrix2D
public void getNonZeros(cern.colt.list.IntArrayList rowList, cern.colt.list.IntArrayList columnList, cern.colt.list.DoubleArrayList valueList)
getNonZeros
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix2D like()
like
in class cern.colt.matrix.DoubleMatrix2D
public void set(int row, int column, double value)
set
in class cern.colt.matrix.DoubleMatrix2D
public double[][] toArray()
toArray
in class cern.colt.matrix.DoubleMatrix2D
public String toString()
toString
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix1D viewColumn(int column)
viewColumn
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix2D viewColumnFlip()
viewColumnFlip
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix2D viewDice()
viewDice
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix2D viewPart(int row, int column, int height, int width)
viewPart
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix1D viewRow(int row)
viewRow
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix2D viewRowFlip()
viewRowFlip
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix2D viewSelection(cern.colt.matrix.DoubleMatrix1DProcedure condition)
viewSelection
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix2D viewSelection(int[] rowIndexes, int[] columnIndexes)
viewSelection
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix2D viewSorted(int column)
viewSorted
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix2D viewStrides(int rowStride, int columnStride)
viewStrides
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix1D zMult(cern.colt.matrix.DoubleMatrix1D y, cern.colt.matrix.DoubleMatrix1D z)
zMult
in class cern.colt.matrix.DoubleMatrix2D
public cern.colt.matrix.DoubleMatrix2D zMult(cern.colt.matrix.DoubleMatrix2D B, cern.colt.matrix.DoubleMatrix2D C)
zMult
in class cern.colt.matrix.DoubleMatrix2D
public int columns()
columns
in class cern.colt.matrix.impl.AbstractMatrix2D
public int rows()
rows
in class cern.colt.matrix.impl.AbstractMatrix2D
public int size()
size
in class cern.colt.matrix.impl.AbstractMatrix2D
public static cern.colt.matrix.DoubleMatrix2D createDoubleMatrix2D(int row, int column)
DoubleMatrix2D
of the given size. If the size is huge, create a
LargeDenseDoubleMatrix2D
, otherwise create a DenseDoubleMatrix2D
.
row
- column
-
public static boolean isLarge(int row, int column)
public static cern.colt.matrix.DoubleMatrix2D mult(cern.colt.matrix.DoubleMatrix2D a, boolean aTrans, cern.colt.matrix.DoubleMatrix2D b, boolean bTrans)
a
- aTrans
- whether a's transposition should be usedb
- bTrans
- whether b's transposition should be used
public static cern.colt.matrix.DoubleMatrix2D covariance(cern.colt.matrix.DoubleMatrix2D matrix, boolean trans)
matrix
- any matrix; a column holds the values of a given variable.trans
- whether the matrix's transposition should be used instead of the matrix itself
public static cern.colt.matrix.DoubleMatrix2D distance(cern.colt.matrix.DoubleMatrix2D matrix, boolean trans, cern.colt.matrix.doublealgo.Statistic.VectorVectorFunction distanceFunction)
matrix
- any matrix; a column holds the values of a given variable (vector).trans
- whether the input matrix should be transposeddistanceFunction
- (EUCLID, CANBERRA, ..., or any user defined distance function operating on two
vectors).
|
Mobios v0.91 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |