程序包 weka.core

类 Matrix

java.lang.Object
weka.core.Matrix
所有已实现的接口:
Serializable, Cloneable, RevisionHandler
直接已知子类:
ConfusionMatrix

public class Matrix extends Object implements Cloneable, Serializable, RevisionHandler
已过时。
Use weka.core.matrix.Matrix instead - only for backwards compatibility.
Class for performing operations on a matrix of floating-point values.

Deprecated: Uses internally the code of the sub-package weka.core.matrix - only for backwards compatibility.

版本:
$Revision: 1.25 $
作者:
Gabi Schmidberger (gabi@cs.waikato.ac.nz), Yong Wang (yongwang@cs.waikato.ac.nz), Eibe Frank (eibe@cs.waikato.ac.nz), Len Trigg (eibe@cs.waikato.ac.nz), Fracpete (fracpete at waikato dot ac dot nz)
另请参阅:
  • 构造器概要

    构造器
    构造器
    说明
    Matrix(double[][] array)
    已过时。
    Constructs a matrix using a given array.
    Matrix(int nr, int nc)
    已过时。
    Constructs a matrix and initializes it with default values.
    已过时。
    Reads a matrix from a reader.
  • 方法概要

    修饰符和类型
    方法
    说明
    final Matrix
    add(Matrix other)
    已过时。
    Returns the sum of this matrix with another.
    final void
    addElement(int rowIndex, int columnIndex, double value)
    已过时。
    Add a value to an element.
    已过时。
    Creates and returns a clone of this object.
    void
    eigenvalueDecomposition(double[][] V, double[] d)
    已过时。
    Performs Eigenvalue Decomposition using Householder QR Factorization Matrix must be symmetrical.
    double[]
    getColumn(int index)
    已过时。
    Gets a column of the matrix and returns it as a double array.
    final double
    getElement(int rowIndex, int columnIndex)
    已过时。
    Returns the value of a cell in the matrix.
    已过时。
    Returns the L part of the matrix.
    已过时。
    Returns the revision string.
    double[]
    getRow(int index)
    已过时。
    Gets a row of the matrix and returns it as double array.
    已过时。
    Returns the U part of the matrix.
    boolean
    已过时。
    Returns true if the matrix is symmetric.
    int[]
    已过时。
    Performs a LUDecomposition on the matrix.
    static void
    main(String[] ops)
    已过时。
    Main method for testing this class.
    final Matrix
    已过时。
    Returns the multiplication of two matrices
    final int
    已过时。
    Returns the number of columns in the matrix.
    final int
    已过时。
    Returns the number of rows in the matrix.
    static Matrix
    已过时。
    creates a matrix from the given Matlab string.
    final double[]
    regression(Matrix y, double ridge)
    已过时。
    Performs a (ridged) linear regression.
    final double[]
    regression(Matrix y, double[] w, double ridge)
    已过时。
    Performs a weighted (ridged) linear regression.
    final void
    setColumn(int index, double[] newColumn)
    已过时。
    Sets a column of the matrix to the given column.
    final void
    setElement(int rowIndex, int columnIndex, double value)
    已过时。
    Sets an element of the matrix to the given value.
    final void
    setRow(int index, double[] newRow)
    已过时。
    Sets a row of the matrix to the given row.
    void
    solve(double[] bb)
    已过时。
    Solve A*X = B using backward substitution.
    已过时。
    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].
    已过时。
    Converts a matrix to a string
    final Matrix
    已过时。
    Returns the transpose of a matrix.
    void
    已过时。
    Writes out a matrix.

    从类继承的方法 java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 构造器详细资料

    • Matrix

      public Matrix(int nr, int nc)
      已过时。
      Constructs a matrix and initializes it with default values.
      参数:
      nr - the number of rows
      nc - the number of columns
    • Matrix

      public Matrix(double[][] array) throws Exception
      已过时。
      Constructs a matrix using a given array.
      参数:
      array - the values of the matrix
      抛出:
      Exception
    • Matrix

      public Matrix(Reader r) throws Exception
      已过时。
      Reads a matrix from a reader. The first line in the file should contain the number of rows and columns. Subsequent lines contain elements of the matrix.
      参数:
      r - the reader containing the matrix
      抛出:
      Exception - if an error occurs
  • 方法详细资料

    • clone

      public Object clone()
      已过时。
      Creates and returns a clone of this object.
      返回:
      a clone of this instance.
      抛出:
      Exception - if an error occurs
    • write

      public void write(Writer w) throws Exception
      已过时。
      Writes out a matrix.
      参数:
      w - the output Writer
      抛出:
      Exception - if an error occurs
    • getElement

      public final double getElement(int rowIndex, int columnIndex)
      已过时。
      Returns the value of a cell in the matrix.
      参数:
      rowIndex - the row's index
      columnIndex - the column's index
      返回:
      the value of the cell of the matrix
    • addElement

      public final void addElement(int rowIndex, int columnIndex, double value)
      已过时。
      Add a value to an element.
      参数:
      rowIndex - the row's index.
      columnIndex - the column's index.
      value - the value to add.
    • numRows

      public final int numRows()
      已过时。
      Returns the number of rows in the matrix.
      返回:
      the number of rows
    • numColumns

      public final int numColumns()
      已过时。
      Returns the number of columns in the matrix.
      返回:
      the number of columns
    • setElement

      public final void setElement(int rowIndex, int columnIndex, double value)
      已过时。
      Sets an element of the matrix to the given value.
      参数:
      rowIndex - the row's index
      columnIndex - the column's index
      value - the value
    • setRow

      public final void setRow(int index, double[] newRow)
      已过时。
      Sets a row of the matrix to the given row. Performs a deep copy.
      参数:
      index - the row's index
      newRow - an array of doubles
    • getRow

      public double[] getRow(int index)
      已过时。
      Gets a row of the matrix and returns it as double array.
      参数:
      index - the row's index
      返回:
      an array of doubles
    • getColumn

      public double[] getColumn(int index)
      已过时。
      Gets a column of the matrix and returns it as a double array.
      参数:
      index - the column's index
      返回:
      an array of doubles
    • setColumn

      public final void setColumn(int index, double[] newColumn)
      已过时。
      Sets a column of the matrix to the given column. Performs a deep copy.
      参数:
      index - the column's index
      newColumn - an array of doubles
    • toString

      public String toString()
      已过时。
      Converts a matrix to a string
      覆盖:
      toString 在类中 Object
      返回:
      the converted string
    • add

      public final Matrix add(Matrix other)
      已过时。
      Returns the sum of this matrix with another.
      返回:
      a matrix containing the sum.
    • transpose

      public final Matrix transpose()
      已过时。
      Returns the transpose of a matrix.
      返回:
      the transposition of this instance.
    • isSymmetric

      public boolean isSymmetric()
      已过时。
      Returns true if the matrix is symmetric.
      返回:
      boolean true if matrix is symmetric.
    • multiply

      public final Matrix multiply(Matrix b)
      已过时。
      Returns the multiplication of two matrices
      参数:
      b - the multiplication matrix
      返回:
      the product matrix
    • regression

      public final double[] regression(Matrix y, double ridge)
      已过时。
      Performs a (ridged) linear regression.
      参数:
      y - the dependent variable vector
      ridge - the ridge parameter
      返回:
      the coefficients
      抛出:
      IllegalArgumentException - if not successful
    • regression

      public final double[] regression(Matrix y, double[] w, double ridge)
      已过时。
      Performs a weighted (ridged) linear regression.
      参数:
      y - the dependent variable vector
      w - the array of data point weights
      ridge - the ridge parameter
      返回:
      the coefficients
      抛出:
      IllegalArgumentException - if the wrong number of weights were provided.
    • getL

      public Matrix getL() throws Exception
      已过时。
      Returns the L part of the matrix. This does only make sense after LU decomposition.
      返回:
      matrix with the L part of the matrix;
      抛出:
      Exception
      另请参阅:
    • getU

      public Matrix getU() throws Exception
      已过时。
      Returns the U part of the matrix. This does only make sense after LU decomposition.
      返回:
      matrix with the U part of a matrix;
      抛出:
      Exception
      另请参阅:
    • LUDecomposition

      public int[] LUDecomposition() throws Exception
      已过时。
      Performs a LUDecomposition on the matrix. It changes the matrix into its LU decomposition.
      返回:
      the indices of the row permutation
      抛出:
      Exception
    • solve

      public void solve(double[] bb) throws Exception
      已过时。
      Solve A*X = B using backward substitution. A is current object (this). Note that this matrix will be changed! B parameter bb. X returned in parameter bb.
      参数:
      bb - first vector B in above equation then X in same equation.
      抛出:
      Exception
    • eigenvalueDecomposition

      public void eigenvalueDecomposition(double[][] V, double[] d) throws Exception
      已过时。
      Performs Eigenvalue Decomposition using Householder QR Factorization Matrix must be symmetrical. Eigenvectors are return in parameter V, as columns of the 2D array. (Real parts of) Eigenvalues are returned in parameter d.
      参数:
      V - double array in which the eigenvectors are returned
      d - array in which the eigenvalues are returned
      抛出:
      Exception - if matrix is not symmetric
    • toMatlab

      public String toMatlab()
      已过时。
      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].
      返回:
      the matrix in Matlab single line format
    • parseMatlab

      public static Matrix parseMatlab(String matlab) throws Exception
      已过时。
      creates a matrix from the given Matlab string.
      参数:
      matlab - the matrix in matlab format
      返回:
      the matrix represented by the given string
      抛出:
      Exception
      另请参阅:
    • getRevision

      public String getRevision()
      已过时。
      Returns the revision string.
      指定者:
      getRevision 在接口中 RevisionHandler
      返回:
      the revision
    • main

      public static void main(String[] ops)
      已过时。
      Main method for testing this class.