weka.core.matrix.Matrix
instead - only for
backwards compatibility.@Deprecated public class Matrix extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable, RevisionHandler
weka.core.matrix
- only for backwards compatibility.Constructor and Description |
---|
Matrix(double[][] array)
Deprecated.
Constructs a matrix using a given array.
|
Matrix(int nr,
int nc)
Deprecated.
Constructs a matrix and initializes it with default values.
|
Matrix(java.io.Reader r)
Deprecated.
Reads a matrix from a reader.
|
Modifier and Type | Method and Description |
---|---|
Matrix |
add(Matrix other)
Deprecated.
Returns the sum of this matrix with another.
|
void |
addElement(int rowIndex,
int columnIndex,
double value)
Deprecated.
Add a value to an element.
|
java.lang.Object |
clone()
Deprecated.
Creates and returns a clone of this object.
|
void |
eigenvalueDecomposition(double[][] V,
double[] d)
Deprecated.
Performs Eigenvalue Decomposition using Householder QR Factorization
Matrix must be symmetrical.
|
double[] |
getColumn(int index)
Deprecated.
Gets a column of the matrix and returns it as a double array.
|
double |
getElement(int rowIndex,
int columnIndex)
Deprecated.
Returns the value of a cell in the matrix.
|
Matrix |
getL()
Deprecated.
Returns the L part of the matrix.
|
java.lang.String |
getRevision()
Deprecated.
Returns the revision string.
|
double[] |
getRow(int index)
Deprecated.
Gets a row of the matrix and returns it as double array.
|
Matrix |
getU()
Deprecated.
Returns the U part of the matrix.
|
boolean |
isSymmetric()
Deprecated.
Returns true if the matrix is symmetric.
|
int[] |
LUDecomposition()
Deprecated.
Performs a LUDecomposition on the matrix.
|
static void |
main(java.lang.String[] ops)
Deprecated.
Main method for testing this class.
|
Matrix |
multiply(Matrix b)
Deprecated.
Returns the multiplication of two matrices
|
int |
numColumns()
Deprecated.
Returns the number of columns in the matrix.
|
int |
numRows()
Deprecated.
Returns the number of rows in the matrix.
|
static Matrix |
parseMatlab(java.lang.String matlab)
Deprecated.
creates a matrix from the given Matlab string.
|
double[] |
regression(Matrix y,
double ridge)
Deprecated.
Performs a (ridged) linear regression.
|
double[] |
regression(Matrix y,
double[] w,
double ridge)
Deprecated.
Performs a weighted (ridged) linear regression.
|
void |
setColumn(int index,
double[] newColumn)
Deprecated.
Sets a column of the matrix to the given column.
|
void |
setElement(int rowIndex,
int columnIndex,
double value)
Deprecated.
Sets an element of the matrix to the given value.
|
void |
setRow(int index,
double[] newRow)
Deprecated.
Sets a row of the matrix to the given row.
|
void |
solve(double[] bb)
Deprecated.
Solve A*X = B using backward substitution.
|
java.lang.String |
toMatlab()
Deprecated.
converts the Matrix into a single line Matlab string: matrix is enclosed by
parentheses, rows are separated by semicolon and single cells by blanks,
e.g., [1 2; 3 4].
|
java.lang.String |
toString()
Deprecated.
Converts a matrix to a string
|
Matrix |
transpose()
Deprecated.
Returns the transpose of a matrix.
|
void |
write(java.io.Writer w)
Deprecated.
Writes out a matrix.
|
public Matrix(int nr, int nc)
nr
- the number of rowsnc
- the number of columnspublic Matrix(double[][] array) throws java.lang.Exception
array
- the values of the matrixjava.lang.Exception
public Matrix(java.io.Reader r) throws java.lang.Exception
r
- the reader containing the matrixjava.lang.Exception
- if an error occurspublic java.lang.Object clone()
clone
in class java.lang.Object
java.lang.Exception
- if an error occurspublic void write(java.io.Writer w) throws java.lang.Exception
w
- the output Writerjava.lang.Exception
- if an error occurspublic final double getElement(int rowIndex, int columnIndex)
rowIndex
- the row's indexcolumnIndex
- the column's indexpublic final void addElement(int rowIndex, int columnIndex, double value)
rowIndex
- the row's index.columnIndex
- the column's index.value
- the value to add.public final int numRows()
public final int numColumns()
public final void setElement(int rowIndex, int columnIndex, double value)
rowIndex
- the row's indexcolumnIndex
- the column's indexvalue
- the valuepublic final void setRow(int index, double[] newRow)
index
- the row's indexnewRow
- an array of doublespublic double[] getRow(int index)
index
- the row's indexpublic double[] getColumn(int index)
index
- the column's indexpublic final void setColumn(int index, double[] newColumn)
index
- the column's indexnewColumn
- an array of doublespublic java.lang.String toString()
toString
in class java.lang.Object
public final Matrix add(Matrix other)
public final Matrix transpose()
public boolean isSymmetric()
public final Matrix multiply(Matrix b)
b
- the multiplication matrixpublic final double[] regression(Matrix y, double ridge)
y
- the dependent variable vectorridge
- the ridge parameterjava.lang.IllegalArgumentException
- if not successfulpublic final double[] regression(Matrix y, double[] w, double ridge)
y
- the dependent variable vectorw
- the array of data point weightsridge
- the ridge parameterjava.lang.IllegalArgumentException
- if the wrong number of weights were
provided.public Matrix getL() throws java.lang.Exception
java.lang.Exception
LUDecomposition()
public Matrix getU() throws java.lang.Exception
java.lang.Exception
LUDecomposition()
public int[] LUDecomposition() throws java.lang.Exception
java.lang.Exception
public void solve(double[] bb) throws java.lang.Exception
bb
- first vector B in above equation then X in same equation.java.lang.Exception
public void eigenvalueDecomposition(double[][] V, double[] d) throws java.lang.Exception
V
- double array in which the eigenvectors are returnedd
- array in which the eigenvalues are returnedjava.lang.Exception
- if matrix is not symmetricpublic java.lang.String toMatlab()
public static Matrix parseMatlab(java.lang.String matlab) throws java.lang.Exception
matlab
- the matrix in matlab formatjava.lang.Exception
toMatlab()
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
public static void main(java.lang.String[] ops)