org.lsmp.djep.vectorJep.values
Class Tensor

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

public class Tensor
extends java.lang.Object
implements MatrixValueI

Represents tensor (generalisation of Matrix/Vector).

Version:
1.3.0.2 now extends number
Author:
Rich Morris Created on 07-Jul-2003

Constructor Summary
Tensor(Dimensions dims)
          Creates a Tensor with the given dimension.
Tensor(int len, Dimensions dims)
          Creates a tensor with dimensions [len,dims[0],...
Tensor(Tensor t)
          Creates a Tensor with same dimension as the arguments.
 
Method Summary
protected  void bufferAppend(java.lang.StringBuffer sb, int currank)
          Recursive procedure to print the tensor with lots of brackets.
 MatrixValueI copy()
          returns a copy of this value.
 boolean equals(java.lang.Object obj)
          value of constant ele(1).
 Dimensions getDim()
          Returns the dimension of this object.
 java.lang.Object getEle(int i)
          gets the i-th element, treats data a a linear array.
static MatrixValueI getInstance(Dimensions dims)
          Factory method to return a new Vector, Matrix or Tensor with the given dimensions.
 int getNumEles()
          The total number of elements.
 int hashCode()
          Always override hashCode when you override equals.
 void setEle(int i, java.lang.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.
 java.lang.String toString()
          Returns a string rep of tensor.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Tensor

public Tensor(Dimensions dims)
Creates a Tensor with the given dimension.


Tensor

public Tensor(Tensor t)
Creates a Tensor with same dimension as the arguments.


Tensor

public Tensor(int len,
              Dimensions dims)
Creates a tensor with dimensions [len,dims[0],...,dims[n]]

Method Detail

copy

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

Specified by:
copy in interface MatrixValueI

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

setEle

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

Specified by:
setEle in interface MatrixValueI

getEle

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

Specified by:
getEle in interface MatrixValueI

setEles

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

Specified by:
setEles in interface MatrixValueI

getInstance

public static MatrixValueI getInstance(Dimensions dims)
Factory method to return a new Vector, Matrix or Tensor with the given dimensions.


bufferAppend

protected void bufferAppend(java.lang.StringBuffer sb,
                            int currank)
Recursive procedure to print the tensor with lots of brackets.


toString

public java.lang.String toString()
Returns a string rep of tensor. Uses [[a,b],[c,d]] syntax.

Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
value of constant ele(1).

Overrides:
equals in class java.lang.Object

hashCode

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

Overrides:
hashCode in class java.lang.Object


http://www.singularsys.com/jep Copyright © 2007 Singular Systems