Class Matrix

Class Matrix (ver. 1.3)

java.lang.Object
   |
   +----Matrix

public class Matrix
extends Object
Matrix is a class for matrix objects with basic linear calculation methods.

Constructor Index

 o Matrix(int)
Construct a square matrix object.
 o Matrix(int, int)
Construct a rectangle matrix object.

Method Index

 o copy()
Copy the matrix.
 o crossSqDistance(Matrix)
Cross squared Euclidean distance Matrix: Z_{ij} = ||X_i - Y_j||^2
 o diagonal()
If the matrix is a row or column vector, make a diagonal matrix from it.
 o dividedBy(Matrix)
Matrix division: X\Y.
 o dividedBy(Matrix, int)
Matrix division with bandwidth: X\Y.
 o eigenvalues(double, int)
Make a row vector including the eigenvalues of the matrix.
 o horizontalSum()
Make a horizontal-summation vector.
 o identity(int)
Make an identity matrix.
 o linearConv(double, double, Matrix)
Linear conversion: a*X + b*Y.
 o mulipliedEntriesWith(Matrix)
Multiply entries.
 o multipliedBy(double)
Scalar product: aX.
 o multipliedBy(Matrix)
Matrix multiplication: X*Y.
 o random(int, int)
Same as random(row, col, 1).
 o random(int, int, int)
Make a standard Gaussian random Matrix.
 o sumEntries()
Summation of all entries.
 o sumSqrEntries()
Summation of squared entries.
 o transpose()
Transpose: X'.
 o updateDivideByRowVector(Matrix)
X_{ij} = X_{ij}/v_{j}.
 o updateExp()
Update by exponential : exp(X_{ij})
 o updateLinearConv(double, double, Matrix)
Update by Linear conversion: X = a*X + b*Y.
 o verticalSum()
Make a vertical-summation vector.

Constructors

 o Matrix
  public Matrix(int n)
Construct a square matrix object.
Parameters:
n - size
 o Matrix
  public Matrix(int row,
                int col)
Construct a rectangle matrix object.
Parameters:
row - number of row
col - number of column

Methods

 o identity
  public static Matrix identity(int n)
Make an identity matrix.
Parameters:
n - size
 o random
  public static Matrix random(int row,
                              int col,
                              int seed)
Make a standard Gaussian random Matrix.
Parameters:
row - number of row
col - number of column
seed - random seed
 o random
  public static Matrix random(int row,
                              int col)
Same as random(row, col, 1).
 o copy
  public Matrix copy()
Copy the matrix.
 o transpose
  public Matrix transpose()
Transpose: X'.
 o linearConv
  public Matrix linearConv(double a,
                           double b,
                           Matrix Y)
Linear conversion: a*X + b*Y.
 o updateLinearConv
  public void updateLinearConv(double a,
                               double b,
                               Matrix Y)
Update by Linear conversion: X = a*X + b*Y.
 o multipliedBy
  public Matrix multipliedBy(double a)
Scalar product: aX.
 o multipliedBy
  public Matrix multipliedBy(Matrix Y)
Matrix multiplication: X*Y.
 o dividedBy
  public Matrix dividedBy(Matrix Y)
Matrix division: X\Y.
 o dividedBy
  public Matrix dividedBy(Matrix Y,
                          int bw)
Matrix division with bandwidth: X\Y.
 o crossSqDistance
  public Matrix crossSqDistance(Matrix Y)
Cross squared Euclidean distance Matrix: Z_{ij} = ||X_i - Y_j||^2
 o updateExp
  public void updateExp()
Update by exponential : exp(X_{ij})
 o horizontalSum
  public Matrix horizontalSum()
Make a horizontal-summation vector.
 o verticalSum
  public Matrix verticalSum()
Make a vertical-summation vector.
 o sumEntries
  public double sumEntries()
Summation of all entries.
 o sumSqrEntries
  public double sumSqrEntries()
Summation of squared entries.
 o mulipliedEntriesWith
  public Matrix mulipliedEntriesWith(Matrix Y)
Multiply entries.
 o updateDivideByRowVector
  public void updateDivideByRowVector(Matrix vec)
X_{ij} = X_{ij}/v_{j}.
 o diagonal
  public Matrix diagonal()
If the matrix is a row or column vector, make a diagonal matrix from it. Otherwise extract its diagonal as a row vector.
 o eigenvalues
  public Matrix eigenvalues(double eps,
                            int lmax)
Make a row vector including the eigenvalues of the matrix.
Parameters:
eps - allowable absolute value of off-diagonal entries

Akio Utsugi

National Institute of Bioscience and Human-Technology