|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.Matrix
weka.core.matrix.Matrix
instead - only for
backwards compatibility.
public class Matrix
Class for performing operations on a matrix of floating-point values.
Deprecated: Uses internally the code of the sub-packageweka.core.matrix
- only for backwards compatibility.
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
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 matrix
java.lang.Exception
public Matrix(java.io.Reader r) throws java.lang.Exception
r
- the reader containing the matrix
java.lang.Exception
- if an error occursMethod Detail |
---|
public 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 Writer
java.lang.Exception
- if an error occurspublic final double getElement(int rowIndex, int columnIndex)
rowIndex
- the row's indexcolumnIndex
- the column's index
public 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 index
public double[] getColumn(int index)
index
- the column's index
public 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 matrix
public final double[] regression(Matrix y, double ridge)
y
- the dependent variable vectorridge
- the ridge parameter
java.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 parameter
java.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 returned
java.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 format
java.lang.Exception
toMatlab()
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
public static void main(java.lang.String[] ops)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |