JSci.physics.relativity
Class Rank1Tensor

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

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 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.

Parameters:
a - a 1st rank tensor

toString

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


hashCode

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


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