JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util.formulae
Class MathVector

java.lang.Object
  |
  +--com.klg.jclass.util.formulae.MathValue
        |
        +--com.klg.jclass.util.formulae.MathVector
All Implemented Interfaces:
Cloneable, Expression, Result

public class MathVector
extends MathValue

The class of vectors (in a linear algebra sense) for matrix math. NOTE: We probably do not need to implement this for the first version but I include it here as a potential consideration for future development


Field Summary
protected  Number[] realValues
          The values are stored in an array
protected  int size
          Size is the number of elements in the vector
 
Fields inherited from class com.klg.jclass.util.formulae.MathValue
dataFormat
 
Constructor Summary
MathVector()
          Create a default vector (all entries initialised to 0)
MathVector(double[] values)
          Create a vector from an array of double values
MathVector(int[] values)
          Create a vector from an array of integer values
MathVector(Number[] values)
          Create a vector from an array of Numbers
 
Method Summary
 com.klg.jclass.util.formulae.Expression getValueAt(int index)
          Retrieve the value at a particular index in the vector
 Number[][] matrixValue()
          Get the contents of this MathValue as a matrix of Numbers
 Number numberValue()
          Get the contents of this MathValue as a Number
 void setValueAt(int index, Number value)
          Set the value at a particular index in the vector
 String toString()
          Output the value of this vector as a string
 Number[] vectorValue()
          Get the contents of this MathValue as a vector of Numbers
 
Methods inherited from class com.klg.jclass.util.formulae.MathValue
clone, evaluate, getDataFormat, setDataFormat
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

realValues

protected Number[] realValues
The values are stored in an array


size

protected int size
Size is the number of elements in the vector

Constructor Detail

MathVector

public MathVector()
Create a default vector (all entries initialised to 0)


MathVector

public MathVector(double[] values)
Create a vector from an array of double values


MathVector

public MathVector(int[] values)
Create a vector from an array of integer values


MathVector

public MathVector(Number[] values)
Create a vector from an array of Numbers

Method Detail

numberValue

public Number numberValue()
Get the contents of this MathValue as a Number

Specified by:
numberValue in class MathValue
Returns:
A Number which is the contents of this MathValue

vectorValue

public Number[] vectorValue()
Get the contents of this MathValue as a vector of Numbers

Specified by:
vectorValue in class MathValue
Returns:
A vector of Numbers which is the contents of this MathValue

matrixValue

public Number[][] matrixValue()
Get the contents of this MathValue as a matrix of Numbers

Specified by:
matrixValue in class MathValue
Returns:
A matrix of Numbers which is the contents of this MathValue

getValueAt

public com.klg.jclass.util.formulae.Expression getValueAt(int index)
Retrieve the value at a particular index in the vector

Parameters:
index - The location at which to find the value
Returns:
The MathValue stored at a given location

setValueAt

public void setValueAt(int index,
                       Number value)
Set the value at a particular index in the vector

Parameters:
index - The location at which to store the value
value - The MathValue to store at the given location

toString

public String toString()
Output the value of this vector as a string

Overrides:
toString in class Object
Returns:
A string representation of this vector

Copyright © 2004 Quest Software Inc..
All rights reserved.