Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OSCAR::Tensor Class Reference
[Math]

Represents a tensor (basically an array of matrices). More...

#include <Tensor.h>

Inheritance diagram for OSCAR::Tensor:

Inheritance graph
[legend]
List of all members.

Public Methods

 Tensor (unsigned int nm, Matrix *mp, const String &name=String())
 Tensor (unsigned int nm, unsigned int Nrow, unsigned int Ncol, const String &name=String())
 Tensor (const Tensor &rhs)
virtual ~Tensor ()
unsigned int nMatrix () const
unsigned int nRow () const
unsigned int nCol () const
Tensor & operator= (const Tensor &rhs)
double & at (unsigned int i, unsigned int j, unsigned int k)
const double & at (unsigned int i, unsigned int j, unsigned int k) const
double & operator() (unsigned int i, unsigned int j, unsigned int k)
const double & operator() (unsigned int i, unsigned int j, unsigned int k) const
Vector at (unsigned int i, unsigned int j)
Vector operator() (unsigned int i, unsigned int j)
Matrixat (unsigned int i)
const Matrixat (unsigned int i) const
Matrixoperator() (unsigned int i)
const Matrixoperator() (unsigned int i) const
bool Copy (const Tensor &tensorToCopy)

Protected Methods

Matrixpinit_Matrix_array (unsigned int a, Matrix *ptr=0)
Matrixpinit_Matrix_array (unsigned int a, Matrixp *ptr)

Protected Attributes

Matrixpmpp
unsigned int nmatrix
unsigned int nrow
unsigned int ncol

Detailed Description

Author:
Chetan Kapoor
Represents a tensor (basically an array of matrices). It can be used to represent tensors (ie the Hessian) or to store lists of matrices.


Constructor & Destructor Documentation

OSCAR::Tensor::Tensor unsigned int    nm,
Matrix   mp,
const String   name = String()
 

Constructor.

This is the constructor for an object of type Tensor. Use this to construct an Tensor object from an array of Matrix objects. Matrices must be the same size or an error (tensorMatrixSizeMismatch) will occur. In addition, this Tensor object can be given a name also.

Parameters:
nm The number of matrices to allocate.
mp A pointer to a list of Matrix objects.
name The name of the Tensor object.
Exceptions:
tensorMatrixSizeMismatch tensorMatrixSizeMismatch Call GetError() to get more information.

OSCAR::Tensor::Tensor unsigned int    nm,
unsigned int    Nrow,
unsigned int    Ncol,
const String   name = String()
 

Constructor.

This is the constructor for an object of type Tensor. Use this to construct an empty Tensor object.

Parameters:
nm The number of matrices to allocate.
Nrow The number of rows to be in each matrix.
Ncol The number of columns to be in each matrix.
name The name of the Tensor object.

OSCAR::Tensor::Tensor const Tensor &    rhs
 

Copy Constructor.

This is the Copy Constructor for an object of type Tensor. Use this to construct an Tensor object from an existing Tensor object.

Parameters:
rhs An Tensor object that will be used to initialize this new object.

virtual OSCAR::Tensor::~Tensor   [virtual]
 

Destructor.

This is the Destructor for an object of type Tensor.


Member Function Documentation

const Matrix& OSCAR::Tensor::at unsigned int    i const
 

Get a reference to a const Matrix inside a const Tensor.

This method is used to get a reference to a particular Matrix. This method only does error checking in Debug mode, so it offers increased speed over the operator() in Release mode. This method Displays an error if any of the indices are out of range, but only in Debug mode.

Parameters:
i The matrix index.
Returns:
A reference to a particular Matrix.
Exceptions:
outOfRange outOfRange Call GetError() for more information.

Matrix& OSCAR::Tensor::at unsigned int    i
 

Get a reference to a Matrix inside an Tensor.

This method is used to get a reference to a particular Matrix. This method only does error checking in Debug mode, so it offers increased speed over the operator() in Release mode. This method Displays an error if any of the indices are out of range, but only in Debug mode.

Parameters:
i The matrix index.
Returns:
A reference to a particular Matrix.
Exceptions:
outOfRange outOfRange Call GetError() for more information.

Vector OSCAR::Tensor::at unsigned int    i,
unsigned int    j
 

Get an Vector from within an Tensor.

This method is used to get an Vector from within an Tensor. It will return the jth row from the ith matrix. This method only does error checking in Debug mode, so it offers increased speed over the operator() in Release mode. This method Displays an error if any of the indices are out of range, but only in Debug mode.

Parameters:
i The matrix index.
j The row index.
Returns:
An Vector object.
Exceptions:
outOfRange outOfRange Call GetError() for more information.

const double& OSCAR::Tensor::at unsigned int    i,
unsigned int    j,
unsigned int    k
const
 

Get a const reference to a particular element.

This method is used to get a const reference to a particular element. This method only does error checking in Debug mode, so it offers increased speed over the operator() in Release mode. This method Displays an error if any of the indices are out of range, but only in Debug mode.

Parameters:
i The matrix index.
j The row index.
k The column index.
Returns:
A reference to the particular element.
Exceptions:
outOfRange outOfRange Call GetError() for more information.

double& OSCAR::Tensor::at unsigned int    i,
unsigned int    j,
unsigned int    k
 

Get a reference to a particular element.

This method is used to get a reference to a particular element. This method only does error checking in Debug mode, so it offers increased speed over the operator() in Release mode. This method Displays an error if any of the indices are out of range, but only in Debug mode.

Parameters:
i The matrix index.
j The row index.
k The column index.
Returns:
A reference to the particular element.
Exceptions:
outOfRange outOfRange Call GetError() for more information.

bool OSCAR::Tensor::Copy const Tensor &    tensorToCopy
 

Matrixp* OSCAR::Tensor::init_Matrix_array unsigned int    a,
Matrixp   ptr
[protected]
 

Initialize the array of RRMatrices.

This method is an overloaded version of the previous one, and is used to initialize the array of RRMatrices.

Parameters:
a The number of RRMatrices.
ptr Pointer to the array of RRMatrices.
Returns:
A pointer to the array of initialized RRMatrices.

Matrixp* OSCAR::Tensor::init_Matrix_array unsigned int    a,
Matrix   ptr = 0
[protected]
 

Initialize the array of RRMatrices.

This method is used to initialize the array of RRMatrices. The value of the pointer to the array of RRMatrices is optional, and by default is null.

Parameters:
a The number of RRMatrices.
ptr Pointer to the array of RRMatrices.
Returns:
A pointer to the array of initialized RRMatrices.

unsigned int OSCAR::Tensor::nCol   const
 

Get the number of columns in each matrix.

This method is used to get the number of columns in each matrix.

Returns:
The number of columns in each matrix.

unsigned int OSCAR::Tensor::nMatrix   const
 

Get the number of matrices in the tensor.

This method is used to get the number of matrices.

Returns:
The number of matrices.

unsigned int OSCAR::Tensor::nRow   const
 

Get the number of rows in each matrix.

This method is used to get the number of rows in each matrix.

Returns:
The number of rows in each matrix.

const Matrix& OSCAR::Tensor::operator() unsigned int    i const
 

Overloaded const operator().

This Overloaded operator() is used to get a const reference to a particular Matrix. This method only does error checking in Debug mode, so it offers increased speed over the operator() in Release mode. This method Displays an error if any of the indices are out of range (Debug only).

Parameters:
i The matrix index.
Returns:
A reference to a particular Matrix.
Exceptions:
outOfRange outOfRange Call GetError() for more information.

Matrix& OSCAR::Tensor::operator() unsigned int    i
 

Overloaded operator().

This Overloaded operator() is used to get a reference to a particular Matrix. This method only does error checking in Debug mode, so it offers increased speed over the operator() in Release mode. This method Displays an error if any of the indices are out of range, but only in Debug mode.

Parameters:
i The matrix index.
Returns:
A reference to a particular Matrix.
Exceptions:
outOfRange outOfRange Call GetError() for more information.

Vector OSCAR::Tensor::operator() unsigned int    i,
unsigned int    j
 

Overloaded operator().

This overloaded operator() is used to get an Vector from within an Tensor. It will return the jth row from the ith matrix. This method only does error checking in Debug mode, so it offers increased speed over the operator() in Release mode. This method Displays an error if any of the indices are out of range, but only in Debug mode.

Parameters:
i The matrix index.
j The row index.
Returns:
An Vector object.
Exceptions:
outOfRange outOfRange Call GetError() for more information.

const double& OSCAR::Tensor::operator() unsigned int    i,
unsigned int    j,
unsigned int    k
const
 

Overloaded const operator().

This overloaded operator() is used to get a const reference to a particular element. This method only does error checking in Debug mode, so it offers increased speed over the operator() in Release mode. This method Displays an error if any of the indices are out of range (Debug only).

Parameters:
i The matrix index.
j The row index.
k The column index.
Returns:
A reference to the particular element.
Exceptions:
outOfRange outOfRange Call GetError() for more information.

double& OSCAR::Tensor::operator() unsigned int    i,
unsigned int    j,
unsigned int    k
 

Overloaded operator().

This overloaded operator() is used to get a reference to a particular element. This method only does error checking in Debug mode, so it offers increased speed over the operator() in Release mode. This method Displays an error if any of the indices are out of range (Debug only).

Parameters:
i The matrix index.
j The row index.
k The column index.
Returns:
A reference to the particular element.
Exceptions:
outOfRange outOfRange Call GetError() for more information.

Tensor& OSCAR::Tensor::operator= const Tensor &    rhs
 

Assignment Operator.

This is the Assignment Operator for an object of type Tensor. If both Tensors are of different sizes, then an error occurs.

Parameters:
rhs A Tensor object that goes on the right hand side of the = operator
Returns:
A reference to the object on the left hand side of the = operator
Exceptions:
tensorArraySizeMismatch tensorArraySizeMismatch Call GetError() for more information.


Member Data Documentation

Matrixp* OSCAR::Tensor::mpp [protected]
 

unsigned int OSCAR::Tensor::ncol [protected]
 

unsigned int OSCAR::Tensor::nmatrix [protected]
 

unsigned int OSCAR::Tensor::nrow [protected]
 


The documentation for this class was generated from the following file:
RRG Homepage OSCAR Overview OSCAR Tutorials Simulations