weka.core.matrix.Matrix
instead - only for
backwards compatibility.@Deprecated public class Matrix extends Object implements Cloneable, 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(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.
|
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.
|
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(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(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.
|
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].
|
String |
toString()
Deprecated.
Converts a matrix to a string
|
Matrix |
transpose()
Deprecated.
Returns the transpose of a matrix.
|
void |
write(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 Exception
array
- the values of the matrixException
public Matrix(Reader r) throws Exception
r
- the reader containing the matrixException
- if an error occurspublic Object clone()
public void write(Writer w) throws Exception
w
- the output WriterException
- 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 String toString()
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 parameterIllegalArgumentException
- 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 parameterIllegalArgumentException
- if the wrong number of weights were
provided.public Matrix getL() throws Exception
Exception
LUDecomposition()
public Matrix getU() throws Exception
Exception
LUDecomposition()
public int[] LUDecomposition() throws Exception
Exception
public void solve(double[] bb) throws Exception
bb
- first vector B in above equation then X in same equation.Exception
public void eigenvalueDecomposition(double[][] V, double[] d) throws Exception
V
- double array in which the eigenvectors are returnedd
- array in which the eigenvalues are returnedException
- if matrix is not symmetricpublic String toMatlab()
public static Matrix parseMatlab(String matlab) throws Exception
matlab
- the matrix in matlab formatException
toMatlab()
public String getRevision()
getRevision
in interface RevisionHandler
public static void main(String[] ops)
Copyright © 2019 University of Waikato, Hamilton, NZ. All rights reserved.