JSci.physics.relativity
Class Rank1Tensor

java.lang.Object
  extended by JSci.physics.relativity.Tensor
      extended by JSci.physics.relativity.Rank1Tensor
All Implemented Interfaces:
java.io.Serializable, Member

public class Rank1Tensor
extends Tensor

The Rank1Tensor class encapsulates 1st rank tensors.

See Also:
Serialized Form

Field Summary
protected  double[] rank1
           
 
Constructor Summary
Rank1Tensor()
          Constructs a 1st rank tensor.
Rank1Tensor(double s, Double3Vector v)
          Constructs a 1st rank tensor.
Rank1Tensor(double s, double v1, double v2, double v3)
          Constructs a 1st rank tensor.
 
Method Summary
 Rank1Tensor add(Rank1Tensor t)
          Returns the addition of this tensor and another.
 boolean equals(java.lang.Object a)
          Compares two tensors for equality.
 double getComponent(int i)
          Returns a component of this tensor.
 int hashCode()
          Returns a hashcode for this tensor.
 double norm()
          Returns the norm (invariant).
 void setComponent(int i, double x)
          Sets the value of a component of this tensor.
 Rank1Tensor subtract(Rank1Tensor t)
          Returns the subtraction of this tensor by another.
 Rank2Tensor tensorProduct(Rank1Tensor t)
          Returns the tensor product of this tensor and another.
 Rank3Tensor tensorProduct(Rank2Tensor t)
          Returns the tensor product of this tensor and another.
 Rank4Tensor tensorProduct(Rank3Tensor t)
          Returns the tensor product of this tensor and another.
 java.lang.String toString()
          Returns a comma delimited string representing the value of this tensor.
 
Methods inherited from class JSci.physics.relativity.Tensor
getSet
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

rank1

protected double[] rank1
Constructor Detail

Rank1Tensor

public Rank1Tensor()
Constructs a 1st rank tensor.


Rank1Tensor

public Rank1Tensor(double s,
                   Double3Vector v)
Constructs a 1st rank tensor.

Parameters:
s - a scalar
v - a 3-vector

Rank1Tensor

public Rank1Tensor(double s,
                   double v1,
                   double v2,
                   double v3)
Constructs a 1st rank tensor.

Parameters:
s - a scalar
v1 - 1st 3-vector component
v2 - 2nd 3-vector component
v3 - 3rd 3-vector component
Method Detail

equals

public boolean equals(java.lang.Object a)
Compares two tensors for equality.

Overrides:
equals in class java.lang.Object
Parameters:
a - a 1st rank tensor

toString

public java.lang.String toString()
Returns a comma delimited string representing the value of this tensor.

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Returns a hashcode for this tensor.

Overrides:
hashCode in class java.lang.Object

getComponent

public double getComponent(int i)
Returns a component of this tensor.

Parameters:
i - 1st index
Throws:
DimensionException - If attempting to access an invalid component.

setComponent

public void setComponent(int i,
                         double x)
Sets the value of a component of this tensor.

Parameters:
i - 1st index
x - value
Throws:
DimensionException - If attempting to access an invalid component.

norm

public double norm()
Returns the norm (invariant).


add

public Rank1Tensor add(Rank1Tensor t)
Returns the addition of this tensor and another.

Parameters:
t - a 1st rank tensor

subtract

public Rank1Tensor subtract(Rank1Tensor t)
Returns the subtraction of this tensor by another.

Parameters:
t - a 1st rank tensor

tensorProduct

public Rank2Tensor tensorProduct(Rank1Tensor t)
Returns the tensor product of this tensor and another.

Parameters:
t - a 1st rank tensor

tensorProduct

public Rank3Tensor tensorProduct(Rank2Tensor t)
Returns the tensor product of this tensor and another.

Parameters:
t - a 2nd rank tensor

tensorProduct

public Rank4Tensor tensorProduct(Rank3Tensor t)
Returns the tensor product of this tensor and another.

Parameters:
t - a 3rd rank tensor