Package Scientific :: Package Geometry :: Class Tensor
[hide private]
[frames] | no frames]

Class Tensor



Tensor in 3D space

Tensors support the usual arithmetic operations ('t1', 't2': tensors, 'v': vector, 's': scalar):

The coordinates can be extracted by indexing; a tensor of rank N can be indexed like an array of dimension N.

Tensors are immutable, i.e. their elements cannot be changed.

Tensor elements can be any objects on which the standard arithmetic operations are defined. However, eigenvalue calculation is supported only for float elements.

Instance Methods [hide private]
  __add__(self, other)
  __cmp__(self, other)
  __div__(self, other)
  __getitem__(self, index)
  __init__(self, elements, nocheck=None)
  __len__(self)
  __mul__(self, other)
  __neg__(self)
  __radd__(self, other)
  __rdiv__(self, other)
  __repr__(self)
  __rmul__(self, other)
  __rsub__(self, other)
  __str__(self)
  __sub__(self, other)
Scientific.Geometry.Vector asVector(self)
Returns an equivalent vector object
Tensor asymmetricalPart(self)
Returns the asymmetrical part of the tensor
  diagonal(self, axis1=0, axis2=1)
(Numeric.array, Tensor) diagonalization(self)
Returns the eigenvalues of the tensor and a tensor representing the rotation matrix to the diagonal form
Tensor dot(self, other)
Returns the contraction with other
Numeric.array eigenvalues(self)
Returns the eigenvalues of the tensor
Tensor inverse(self)
Returns the inverse of the tensor
Tensor symmetricalPart(self)
Returns the symmetrical part of the tensor
type of tensor elements trace(self, axis1=0, axis2=1)
Returns the trace of the tensor
Tensor transpose(self)
Returns the transposed (index reversed) tensor

Class Variables [hide private]
  is_tensor = 1

Method Details [hide private]

__add__(self, other)
(Addition operator)

 

__cmp__(self, other)
(Comparison operator)

 

__div__(self, other)

 

__getitem__(self, index)
(Indexing operator)

 

__init__(self, elements, nocheck=None)
(Constructor)

 
Parameters:
  • elements (Numeric.array or list) - 2D array or nested list specifying the nine tensor components [[xx, xy, xz], [yx, yy, yz], [zx, zy, zz]]

__len__(self)
(Length operator)

 

__mul__(self, other)

 

__neg__(self)

 

__radd__(self, other)
(Right-side addition operator)

 

__rdiv__(self, other)

 

__repr__(self)
(Representation operator)

 

__rmul__(self, other)

 

__rsub__(self, other)

 

__str__(self)
(Informal representation operator)

 

__sub__(self, other)
(Subtraction operator)

 

asVector(self)

 
Returns: Scientific.Geometry.Vector
an equivalent vector object
Raises:
  • ValueError - if rank > 1

asymmetricalPart(self)

 
Returns: Tensor
the asymmetrical part of the tensor
Raises:
  • ValueError - if rank !=2

diagonal(self, axis1=0, axis2=1)

 

diagonalization(self)

 
Returns: (Numeric.array, Tensor)
the eigenvalues of the tensor and a tensor representing the rotation matrix to the diagonal form
Raises:
  • ValueError - if rank !=2

dot(self, other)

 
Returns: Tensor
the contraction with other

eigenvalues(self)

 
Returns: Numeric.array
the eigenvalues of the tensor
Raises:
  • ValueError - if rank !=2

inverse(self)

 
Returns: Tensor
the inverse of the tensor
Raises:
  • ValueError - if rank !=2

symmetricalPart(self)

 
Returns: Tensor
the symmetrical part of the tensor
Raises:
  • ValueError - if rank !=2

trace(self, axis1=0, axis2=1)

 
Returns: type of tensor elements
the trace of the tensor
Raises:
  • ValueError - if rank !=2

transpose(self)

 
Returns: Tensor
the transposed (index reversed) tensor

Class Variable Details [hide private]

is_tensor

Value:
1