org.lsmp.djep.vectorJep.values
Class Matrix

java.lang.Object
  extended by org.lsmp.djep.vectorJep.values.Matrix
All Implemented Interfaces:
MatrixValueI

public class Matrix
extends Object
implements MatrixValueI

Represents a matrix.

Since:
2.3.2 Added equals method.
Version:
2.3.0.2 now extends number, 2.3.1.1 Bug with non square matrices fixed.
Author:
Rich Morris Created on 07-Jul-2003

Constructor Summary
protected Matrix(int rows, int cols)
          Construct a matrix with given rows and cols.
 
Method Summary
 MatrixValueI copy()
          returns a copy of this value.
 boolean equals(Object obj)
          Are two matrices equal, element by element Overrides Object.
 Dimensions getDim()
          Returns the dimension of this object.
 Object getEle(int n)
          gets the i-th element, treats data a a linear array.
 Object getEle(int i, int j)
           
 Object[][] getEles()
           
static MatrixValueI getInstance(int rows, int cols)
           
 int getNumCols()
           
 int getNumEles()
          The total number of elements.
 int getNumRows()
           
 int hashCode()
          Always override hashCode when you override equals.
 void setEle(int i, int j, Object value)
           
 void setEle(int n, Object value)
          sets the i-th element, treats data a a linear array.
 void setEles(MatrixValueI val)
          sets the elements to those of the arguments.
 String toString()
          Returns a string representation of matrix.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Matrix

protected Matrix(int rows,
                 int cols)
Construct a matrix with given rows and cols.

Method Detail

copy

public MatrixValueI copy()
Description copied from interface: MatrixValueI
returns a copy of this value.

Specified by:
copy in interface MatrixValueI

getInstance

public static MatrixValueI getInstance(int rows,
                                       int cols)

toString

public String toString()
Returns a string representation of matrix. Uses [[a,b],[c,d]] syntax.

Overrides:
toString in class Object

getDim

public Dimensions getDim()
Description copied from interface: MatrixValueI
Returns the dimension of this object.

Specified by:
getDim in interface MatrixValueI

getNumEles

public int getNumEles()
Description copied from interface: MatrixValueI
The total number of elements.

Specified by:
getNumEles in interface MatrixValueI

getNumRows

public int getNumRows()

getNumCols

public int getNumCols()

setEle

public void setEle(int n,
                   Object value)
Description copied from interface: MatrixValueI
sets the i-th element, treats data a a linear array.

Specified by:
setEle in interface MatrixValueI

setEle

public void setEle(int i,
                   int j,
                   Object value)

getEle

public Object getEle(int n)
Description copied from interface: MatrixValueI
gets the i-th element, treats data a a linear array.

Specified by:
getEle in interface MatrixValueI

getEle

public Object getEle(int i,
                     int j)

getEles

public Object[][] getEles()

setEles

public void setEles(MatrixValueI val)
sets the elements to those of the arguments.

Specified by:
setEles in interface MatrixValueI

equals

public boolean equals(Object obj)
Are two matrices equal, element by element Overrides Object.

Overrides:
equals in class Object

hashCode

public int hashCode()
Always override hashCode when you override equals. Effective Java, Joshua Bloch, Sun Press

Overrides:
hashCode in class Object


Copyright © 2014. All rights reserved.