com.croftsoft.core.math
Class Matrix

java.lang.Object
  extended by com.croftsoft.core.math.Matrix

public class Matrix
extends Object

A mathematical matrix class.

Version:
1998-12-27
Author:
David Wallace Croft

Field Summary
 int cols
           
 double[][] data
           
 int rows
           
 
Constructor Summary
Matrix(int rows, int cols)
          Constructs a Matrix with all of the element values set to zero.
Matrix(int rows, int cols, double value)
          Constructs a Matrix with all of the element values set to a specified constant.
Matrix(Matrix old)
           
 
Method Summary
 Matrix add(double addend)
           
 Matrix add(Matrix addend)
           
 Matrix clip(double min, double max)
           
 void display()
           
static Matrix identity(int rows_cols)
          Returns a square matrix with the diagonal values set to 1.0 and all others set to 0.0.
static void main()
          Test/demo method.
 Matrix multiply(double factor)
           
 Matrix multiply(Matrix right)
           
static Matrix multiply(Matrix left, Matrix right)
           
static Matrix multiplyPairwise(Matrix a, Matrix b)
           
 Matrix randomizeUniform(double min, double max)
           
 Matrix sigmoid()
           
 Matrix sigmoidDerivative()
           
 Matrix submatrix(int row_start, int row_end, int col_start, int col_end)
           
 Matrix subtract(Matrix subtractor)
           
 double sum()
           
 Matrix transpose()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rows

public int rows

cols

public int cols

data

public double[][] data
Constructor Detail

Matrix

public Matrix(int rows,
              int cols)
Constructs a Matrix with all of the element values set to zero.


Matrix

public Matrix(int rows,
              int cols,
              double value)
Constructs a Matrix with all of the element values set to a specified constant.

Parameters:
value - All of the element values will be set to this constant.

Matrix

public Matrix(Matrix old)
Method Detail

main

public static void main()
Test/demo method.


identity

public static Matrix identity(int rows_cols)
Returns a square matrix with the diagonal values set to 1.0 and all others set to 0.0.

Parameters:
rows_cols - The number of rows and columns on a side.

multiply

public static Matrix multiply(Matrix left,
                              Matrix right)

multiplyPairwise

public static Matrix multiplyPairwise(Matrix a,
                                      Matrix b)

add

public Matrix add(double addend)

add

public Matrix add(Matrix addend)

clip

public Matrix clip(double min,
                   double max)

display

public void display()

multiply

public Matrix multiply(double factor)

multiply

public Matrix multiply(Matrix right)

randomizeUniform

public Matrix randomizeUniform(double min,
                               double max)

sigmoid

public Matrix sigmoid()

sigmoidDerivative

public Matrix sigmoidDerivative()

submatrix

public Matrix submatrix(int row_start,
                        int row_end,
                        int col_start,
                        int col_end)

subtract

public Matrix subtract(Matrix subtractor)

sum

public double sum()

transpose

public Matrix transpose()

CroftSoft Javadoc

CroftSoft Core Javadoc (2008-09-28 20:58:02)