libtnt-1.2.6/0000755000175000017500000000000010205062115012242 5ustar anibalaniballibtnt-1.2.6/html/0000755000175000017500000000000010043045423013211 5ustar anibalaniballibtnt-1.2.6/html/tnt/0000755000175000017500000000000010043044374014022 5ustar anibalaniballibtnt-1.2.6/html/tnt/annotated.html0000644000175000017500000000406107676662370016712 0ustar anibalanibal Annotated Index
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

Template Numerical Toolkit (TNT) Compound List

Here are the classes, structs, unions and interfaces with brief descriptions:
Generated at Thu Jun 26 17:26:15 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Array1D.html0000644000175000017500000005566207676662370020266 0ustar anibalanibal TemplateTNT::Array1D class Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Array1D Class Template Reference

#include <tnt_array1d.h>

List of all members.

Public Types

typedef T value_type

Public Methods

 Array1D ()
 Array1D (int n)
 Array1D (int n, const T &a)
 Array1D (int n, T *a)
 Array1D (const Array1D &A)
 operator T * ()
 operator const T * ()
Array1D& operator= (const T &a)
Array1D& operator= (const Array1D &A)
Array1D& ref (const Array1D &A)
Array1D copy () const
Array1D& inject (const Array1D &A)
T& operator[] (int i)
const T& operator[] (int i) const
int dim1 () const
int dim () const
 ~Array1D ()


Detailed Description

template<class T> class TNT::Array1D

Templated one-dimensional, numerical array which looks like a conventional C array. Elements are accessed via the familiar A[i] notation.

Array assignment is by reference (i.e. shallow assignment). That is, B=A implies that the A and B point to the same array, so modifications to the elements of A will be reflected in B. If an independent copy is required, then B = A.copy() can be used. Note that this facilitates returning arrays from functions without relying on compiler optimizations to eliminate extensive data copying.

The indexing and layout of this array object makes it compatible with C and C++ algorithms that utilize the familiar C[i] notation. This includes numerous textbooks, such as Numercial Recipes, and various public domain codes.


Member Typedef Documentation

template<class T>
typedef T TNT::Array1D<T>::value_type
 


Constructor & Destructor Documentation

template<class T>
TNT::Array1D<T>::Array1D<T> ( )
 

Null constructor. Creates a 0-length (NULL) array. (Reference count is also zero.)

template<class T>
TNT::Array1D<T>::Array1D<T> ( int n ) [explicit]
 

Create a new array (vector) of length n, WIHOUT initializing array elements. To create an initialized array of constants, see Array1D(n,value).

This version avoids the O(n) initialization overhead and is used just before manual assignment.

Parameters:
n   the dimension (length) of the new matrix.

template<class T>
TNT::Array1D<T>::Array1D<T> ( int n,
const T & a )
 

Create a new array of length n, initializing array elements to constant specified by argument. Most often used to create an array of zeros, as in A(n, 0.0).

Parameters:
n   the dimension (length) of the new matrix.
val   the constant value to set all elements of the new array to.

template<class T>
TNT::Array1D<T>::Array1D<T> ( int n,
T * a )
 

Create an n-length array, as a view of an existing one-dimensional C array. (Note that the storage for this pre-existing array will never be destroyed by the Aray1DRef class.)

Parameters:
n   the dimension (length) of the new matrix.
a   the one dimensional C array to use as data storage for the array.

template<class T>
TNT::Array1D<T>::Array1D<T> ( const Array1D<T> & A ) [inline]
 

Copy constructor. Array data is NOT copied, but shared. Thus, in Array1D B(A), subsequent changes to A will be reflected in B. For an indepent copy of A, use Array1D B(A.copy()), or B = A.copy(), instead.

template<class T>
TNT::Array1D<T>::~Array1D<T> ( )
 

Destructor: reclaims all memory possible associated with this array.


Member Function Documentation

template<class T>
Array1D<T> TNT::Array1D<T>::copy ( ) const
 

Create a new of existing matrix. Used in B = A.copy() or in the construction of B, e.g. Array1D B(A.copy()), to create a new array that does not share data.

template<class T>
int TNT::Array1D<T>::dim ( ) const [inline]
 

Returns:
the dimension (number of elements) of the array. This is equivalent to dim1().

template<class T>
int TNT::Array1D<T>::dim1 ( ) const [inline]
 

Returns:
the dimension (number of elements) of the array. This is equivalent to dim().

template<class T>
Array1D<T> & TNT::Array1D<T>::inject ( const Array1D<T> & A )
 

Copy the elements to from one array to another, in place. That is B.inject(A), both A and B must conform (i.e. have identical row and column dimensions).

This differs from B = A.copy() in that references to B before this assignment are also affected. That is, if we have

	Array1D A(n);
	Array1D C(n);
	Array1D B(C);        // elements of B and C are shared. 

then B.inject(A) affects both and C, while B=A.copy() creates a new array B which shares no data with C or A.
Parameters:
A   the array from which elements will be copied
Returns:
an instance of the modifed array. That is, in B.inject(A), it returns B. If A and B are not conformat, no modifications to B is made.

template<class T>
TNT::Array1D<T>::operator T * ( ) [inline]
 

Automatic conversion to a one-dimensional pointer. Useful for integrating with numerical codes that utilize pointer interface interface. Thus, if a function declared as

	void row_max(double *D);
is called with an Array1D<double>, as in
	Array2D<double> A(N);
	f(A);
then A is automatically converted. Likewise,
	double *d = A;
also converts A into a regular C pointer.

template<class T>
TNT::Array1D<T>::operator const T * ( ) [inline]
 

Automatic conversion to a const one-dimensional pointer. Useful for integrating with numerical codes that utilize pointer interface interface. Thus, if a function declared as

	void row_max(const double *D);
is called with an Array1D<double>, as in
	Array1D<double> A(N);
	f(A);
then A is automatically converted. Likewise,
	const double *d = A;
also converts A into a regular C pointer.

template<class T>
Array1D<T> & TNT::Array1D<T>::operator= ( const Array1D<T> & A ) [inline]
 

B = A is shorthand notation for B.ref(A).

template<class T>
Array1D<T> & TNT::Array1D<T>::operator= ( const T & a ) [inline]
 

Assign all elemnts of A to a constant scalar.

template<class T>
const T & TNT::Array1D<T>::operator[] ( int i ) const [inline]
 

A[i] indexes the ith element of A. The first element is A[0]. If TNT_BOUNDS_CHECK is defined, then the index is checked that it fall within the array bounds.

template<class T>
T & TNT::Array1D<T>::operator[] ( int i ) [inline]
 

A[i] indexes the ith element of A. The first element is A[0]. If TNT_BOUNDS_CHECK is defined, then the index is checked that it falls within the array bounds.

template<class T>
Array1D<T> & TNT::Array1D<T>::ref ( const Array1D<T> & A ) [inline]
 

Create a reference (shallow assignment) to another existing array. In B.ref(A), B and A shared the same data and subsequent changes to the array elements of one will be reflected in the other.

This is what operator= calls, and B=A and B.ref(A) are equivalent operations.

Returns:
The new referenced array: in B.ref(A), it returns B.


The documentation for this class was generated from the following file:
Generated at Thu Jun 26 17:26:15 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Array1D-members.html0000644000175000017500000000570107676662372021705 0ustar anibalanibal Member List
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Array1D Member List

This is the complete list of members for TNT::Array1D, including all inherited members.
Generated at Thu Jun 26 17:26:16 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Array2D.html0000644000175000017500000006017107676662400020250 0ustar anibalanibal TemplateTNT::Array2D class Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Array2D Class Template Reference

#include <tnt_array2d.h>

List of all members.

Public Types

typedef T value_type

Public Methods

 Array2D ()
 Array2D (int m, int n)
 Array2D (int m, int n, T *a)
 Array2D (int m, int n, const T &a)
 Array2D (const Array2D &A)
 operator T ** ()
 operator const T ** ()
Array2D& operator= (const T &a)
Array2D& operator= (const Array2D &A)
Array2D& ref (const Array2D &A)
Array2D copy () const
Array2D& inject (const Array2D &A)
T* operator[] (int i)
const T* operator[] (int i) const
int dim1 () const
int dim2 () const
 ~Array2D ()


Detailed Description

template<class T> class TNT::Array2D

Templated two-dimensional, numerical array which looks like a conventional C multiarray. Storage corresponds to C (row-major) ordering. Elements are accessed via A[i][j] notation.

Array assignment is by reference (i.e. shallow assignment). That is, B=A implies that the A and B point to the same array, so modifications to the elements of A will be reflected in B. If an independent copy is required, then B = A.copy() can be used. Note that this facilitates returning arrays from functions without relying on compiler optimizations to eliminate extensive data copying.

The indexing and layout of this array object makes it compatible with C and C++ algorithms that utilize the familiar C[i][j] notation. This includes numerous textbooks, such as Numercial Recipes, and various public domain codes.


Member Typedef Documentation

template<class T>
typedef T TNT::Array2D<T>::value_type
 

Used to determined the data type of array entries. This is most commonly used when requiring scalar temporaries in templated algorithms that have TNT arrays as input. For example,

	template <class ArrayTwoD>
	void foo(ArrayTwoD &A)
	{
		A::value_type first_entry = A[0][0];
		...
	}
	


Constructor & Destructor Documentation

template<class T>
TNT::Array2D<T>::Array2D<T> ( )
 

Create a null array. This is not the same as Array2D(0,0), which consumes some memory overhead.

template<class T>
TNT::Array2D<T>::Array2D<T> ( int m,
int n )
 

Copy constructor. Array data is NOT copied, but shared. Thus, in Array2D B(A), subsequent changes to A will be reflected in B. For an indepent copy of A, use Array2D B(A.copy()), or B = A.copy(), instead.

template<class T>
TNT::Array2D<T>::Array2D<T> ( int m,
int n,
T * a )
 

Create a new (m x n) array, WIHOUT initializing array elements. To create an initialized array of constants, see Array2D(m,n,value).

This version avoids the O(m*n) initialization overhead and is used just before manual assignment.

Parameters:
m   the first (row) dimension of the new matrix.
n   the second (column) dimension of the new matrix.

template<class T>
TNT::Array2D<T>::Array2D<T> ( int m,
int n,
const T & a )
 

Create a new (m x n) array, initializing array elements to constant specified by argument. Most often used to create an array of zeros, as in A(m, n, 0.0).

Parameters:
m   the first (row) dimension of the new matrix.
n   the second (column) dimension of the new matrix.
val   the constant value to set all elements of the new array to.

template<class T>
TNT::Array2D<T>::Array2D<T> ( const Array2D<T> & A ) [inline]
 

Create a new (m x n) array, as a view of an existing one-dimensional array stored in C order, i.e. right-most dimension varying fastest. (Often referred to as "row-major" ordering.) Note that the storage for this pre-existing array will never be garbage collected by the Array2D class.

Parameters:
m   the first (row) dimension of the new matrix.
n   the second (column) dimension of the new matrix.
a   the one dimensional C array to use as data storage for the array.

template<class T>
TNT::Array2D<T>::~Array2D<T> ( )
 

Destructor. Reclaim resouces associated with this view of the array data. Note that elements are still intact if other array views of this data exist.


Member Function Documentation

template<class T>
Array2D<T> TNT::Array2D<T>::copy ( ) const
 

Create a new copy of existing matrix. Used in B = A.copy() or in the construction of B, e.g. Array2D B(A.copy()), to create a new array that does not share data.

template<class T>
int TNT::Array2D<T>::dim1 ( ) const [inline]
 

Returns:
the size of the first dimension of the array, i.e. the number of rows.

template<class T>
int TNT::Array2D<T>::dim2 ( ) const [inline]
 

Returns:
the size of the second dimension of the array, i.e. the number of columns.

template<class T>
Array2D<T> & TNT::Array2D<T>::inject ( const Array2D<T> & A )
 

Copy the elements to from one array to another, in place. That is B.inject(A), both A and B must conform (i.e. have identical row and column dimensions).

This differs from B = A.copy() in that references to B before this assignment are also affected. That is, if we have

	Array2D A(m,n);
	Array2D C(m,n);
	Array2D B(C);        // elements of B and C are shared. 

then B.inject(A) affects both and C, while B=A.copy() creates a new array B which shares no data with C or A.
Parameters:
A   the array from elements will be copied
Returns:
an instance of the modifed array. That is, in B.inject(A), it returns B. If A and B are not conformat, no modifications to B are made.

template<class T>
TNT::Array2D<T>::operator T ** ( ) [inline]
 

Automatic conversion to a two-dimensional C array. Useful for integrating with numerical codes that utilize the A[i][j] interface. Thus, if a function declared as

	void row_max(double **D);
is called with an Array2D<double>, as in
	Array2D<double> A(M,N);
	f(A);
then A is automatically converted. Likewise,
	double **d = A;
also converts A into a regular C pointer.

template<class T>
TNT::Array2D<T>::operator const T ** ( ) [inline]
 

Automatic conversion to a const two-dimensional C array. Useful for integrating with numerical codes that utilize the A[i][j] interface. Thus, if a function declared as

	void row_max(const double **D);
is called with an Array2D<double>, as in
	Array2D<double> A(M,N);
	f(A);
then A is automatically converted. Likewise,
	const double **d = A;
also converts A into a regular C pointer.

template<class T>
Array2D<T> & TNT::Array2D<T>::operator= ( const Array2D<T> & A ) [inline]
 

B = A is shorthand notation for B.ref(A).

template<class T>
Array2D<T> & TNT::Array2D<T>::operator= ( const T & a ) [inline]
 

Assign all elemnts of A to a constant scalar.

template<class T>
const T * TNT::Array2D<T>::operator[] ( int i ) const [inline]
 

template<class T>
T * TNT::Array2D<T>::operator[] ( int i ) [inline]
 

Used for A[i][j] indexing. The first [] operator returns a conventional pointer which can be dereferenced using the same [] notation.

If TNT_BOUNDS_CHECK macro is define, the left-most index (row index) is checked that it falls within the array bounds (via the assert() macro.) Note that bounds checking can occur in the row dimension, but the not column, since this is just a C pointer.

template<class T>
Array2D<T> & TNT::Array2D<T>::ref ( const Array2D<T> & A ) [inline]
 

Create a reference (shallow assignment) to another existing array. In B.ref(A), B and A shared the same data and subsequent changes to the array elements of one will be reflected in the other.

This is what operator= calls, and B=A and B.ref(A) are equivalent operations.

Returns:
The new referenced array: in B.ref(A), it returns B.


The documentation for this class was generated from the following file:
Generated at Thu Jun 26 17:26:22 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Array2D-members.html0000644000175000017500000000570107676662400021676 0ustar anibalanibal Member List
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Array2D Member List

This is the complete list of members for TNT::Array2D, including all inherited members.
Generated at Thu Jun 26 17:26:23 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Array3D.html0000644000175000017500000005447707676662400020265 0ustar anibalanibal TemplateTNT::Array3D class Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Array3D Class Template Reference

#include <tnt_array3d.h>

List of all members.

Public Types

typedef T value_type

Public Methods

 Array3D ()
 Array3D (int m, int n, int k)
 Array3D (int m, int n, int k, T *a)
 Array3D (int m, int n, int k, const T &a)
 Array3D (const Array3D &A)
Array3D& operator= (const T &a)
Array3D& operator= (const Array3D &A)
Array3D& ref (const Array3D &A)
Array3D copy () const
Array3D& inject (const Array3D &A)
T** operator[] (int i)
const T* const* operator[] (int i) const
int dim1 () const
int dim2 () const
int dim3 () const
 ~Array3D ()


Detailed Description

template<class T> class TNT::Array3D

Tempplated three-dimensional, numerical array which looks like a conventional C multiarray. Storage corresponds to conventional C ordering. That is the right-most dimension has contiguous elements. Indexing is via the A[i][j][k] notation.

Array assignment is by reference (i.e. shallow assignment). That is, B=A implies that the A and B point to the same array, so modifications to the elements of A will be reflected in B. If an independent copy is required, then B = A.copy() can be used. Note that this facilitates returning arrays from functions without relying on compiler optimizations to eliminate extensive data copying.

The indexing and layout of this array object makes it compatible with C and C++ algorithms that utilize the familiar C[i][j][k] notation. This includes numerous textbooks, such as Numercial Recipes, and various public domain codes.


Member Typedef Documentation

template<class T>
typedef T TNT::Array3D<T>::value_type
 


Constructor & Destructor Documentation

template<class T>
TNT::Array3D< T >::Array3D<T> ( )
 

Create a null (0x0x0) array.

template<class T>
TNT::Array3D< T >::Array3D<T> ( int m,
int n,
int k )
 

Create a new (m x n x k) array, WIHOUT initializing array elements. To create an initialized array of constants, see Array3D(m,n,k, value).

This version avoids the O(m*n*k) initialization overhead and is used just before manual assignment.

Parameters:
m   the first dimension of the new matrix.
n   the second dimension of the new matrix.
k   the third dimension of the new matrix.

template<class T>
TNT::Array3D< T >::Array3D<T> ( int m,
int n,
int k,
T * a )
 

Create a new (m x n x k) array, as a view of an existing one-dimensional array stored in C order, i.e. right-most dimension varying fastest. (Often referred to as "row-major" ordering.) Note that the storage for this pre-existing array will never be garbage collected by the Array3D class.

Parameters:
m   the first dimension of the new matrix.
n   the second dimension of the new matrix.
k   the third dimension of the new matrix.
a   the one dimensional C array to use as data storage for the array.

template<class T>
TNT::Array3D< T >::Array3D<T> ( int m,
int n,
int k,
const T & val )
 

Create a new (m x n x k) array, initializing array elements to constant specified by argument. Most often used to create an array of zeros, as in A(m, n, k, 0.0).

Parameters:
m   the first dimension of the new matrix.
n   the second dimension of the new matrix.
k   the third dimension of the new matrix.
val   the constant value to set all elements of the new array to.

template<class T>
TNT::Array3D< T >::Array3D<T> ( const Array3D<T> & A ) [inline]
 

Copy constructor. Array data is NOT copied, but shared. Thus, in Array3D B(A), subsequent changes to A will be reflected in B. For an indepent copy of A, use Array3D B(A.copy()), or B = A.copy(), instead.

template<class T>
TNT::Array3D<T>::~Array3D<T> ( )
 


Member Function Documentation

template<class T>
Array3D< T > TNT::Array3D< T >::copy ( ) const
 

Create a new of existing matrix. Used in B = A.copy() or in the construction of B, e.g. Array3D B(A.copy()), to create a new array that does not share data.

template<class T>
int TNT::Array3D< T >::dim1 ( ) const [inline]
 

Returns:
the size of the first dimension of the array.

template<class T>
int TNT::Array3D< T >::dim2 ( ) const [inline]
 

Returns:
the size of the second dimension of the array.

template<class T>
int TNT::Array3D< T >::dim3 ( ) const [inline]
 

Returns:
the size of the third (right-most) dimension of the array.

template<class T>
Array3D< T > & TNT::Array3D< T >::inject ( const Array3D<T> & A )
 

Copy the elements to from one array to another, in place. That is B.inject(A), both A and B must conform (i.e. have identical dimensions).

This differs from B = A.copy() in that references to B before this assignment are also affected. That is, if we have

	Array3D A(m,n,k);
	Array3D C(m,n,k);
	Array3D B(C);        // elements of B and C are shared. 

then B.inject(A) affects both and C, while B=A.copy() creates a new array B which shares no data with C or A.
Parameters:
A   the array from elements will be copied
Returns:
an instance of the modifed array. That is, in B.inject(A), it returns B. If A and B are not conformat, no modifications to B are made.

template<class T>
Array3D< T > & TNT::Array3D< T >::operator= ( const Array3D<T> & A ) [inline]
 

B = A is shorthand notation for B.ref(A).

template<class T>
Array3D< T > & TNT::Array3D< T >::operator= ( const T & a ) [inline]
 

Assign all elemnts of A to a constant scalar.

template<class T>
const T *const * TNT::Array3D< T >::operator[] ( int i ) const [inline]
 

template<class T>
T ** TNT::Array3D< T >::operator[] ( int i ) [inline]
 

Used for A[i][j][k] indexing. The first [] operator returns a conventional pointer which can be dereferenced using the same [] notation.

If TNT_BOUNDS_CHECK macro is define, the left-most index is checked that it falls within the array bounds (via the assert() macro.)

template<class T>
Array3D< T > & TNT::Array3D< T >::ref ( const Array3D<T> & A ) [inline]
 

Create a reference (shallow assignment) to another existing array. In B.ref(A), B and A shared the same data and subsequent changes to the array elements of one will be reflected in the other.

This is what operator= calls, and B=A and B.ref(A) are equivalent operations.

Returns:
The new referenced array: in B.ref(A), it returns B.


The documentation for this class was generated from the following file:
Generated at Thu Jun 26 17:26:23 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Array3D-members.html0000644000175000017500000000555607676662400021707 0ustar anibalanibal Member List
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Array3D Member List

This is the complete list of members for TNT::Array3D, including all inherited members.
Generated at Thu Jun 26 17:26:23 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Fortran_Array1D.html0000644000175000017500000005346007676662400021745 0ustar anibalanibal TemplateTNT::Fortran_Array1D class Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Fortran_Array1D Class Template Reference

#include <tnt_fortran_array1d.h>

List of all members.

Public Types

typedef T value_type

Public Methods

 Fortran_Array1D ()
 Fortran_Array1D (int n)
 Fortran_Array1D (int n, T *a)
 Fortran_Array1D (int n, const T &a)
 Fortran_Array1D (const Fortran_Array1D &A)
Fortran_Array1D& operator= (const T &a)
Fortran_Array1D& operator= (const Fortran_Array1D &A)
Fortran_Array1D& ref (const Fortran_Array1D &A)
Fortran_Array1D copy () const
Fortran_Array1D& inject (const Fortran_Array1D &A)
T& operator() (int i)
const T& operator() (int i) const
int dim () const
int dim1 () const
int ref_count () const
 ~Fortran_Array1D ()


Detailed Description

template<class T> class TNT::Fortran_Array1D

Templated one-dimensional, numerical array which looks like a conventional Fortran array. This is useful when integrating with C/C++ codes translated from Fortran. Indexing is via the A(i) notation and A(1) is the first element.

Array assignment is by reference (i.e. shallow assignment). That is, B=A implies that the A and B point to the same array, so modifications to the elements of A will be reflected in B. If an independent copy is required, then B = A.copy() can be used. Note that this facilitates returning arrays from functions without relying on compiler optimizations to eliminate extensive data copying.

This class employs its own garbage collection via the use of reference counts. That is, whenever an internal array storage no longer has any references to it, it is destoryed.


Member Typedef Documentation

template<class T>
typedef T TNT::Fortran_Array1D<T>::value_type
 


Constructor & Destructor Documentation

template<class T>
TNT::Fortran_Array1D< T >::Fortran_Array1D<T> ( )
 

Create a null (0-length) array.

template<class T>
TNT::Fortran_Array1D< T >::Fortran_Array1D<T> ( int n )
 

Create a new (n) array, WIHOUT initializing array elements. To create an initialized array of constants, see Fortran_Array1D(n, value).

This version avoids the O(n) initialization overhead and is used just before manual assignment.

Parameters:
m   the dimension of the new matrix.

template<class T>
TNT::Fortran_Array1D< T >::Fortran_Array1D<T> ( int n,
T * a )
 

Create a new n-length array, as a view of an existing one-dimensional C array. (Note that the storage for this pre-existing array will never be garbage collected by the Fortran_Array1D class.)

Parameters:
m   the first dimension of the new matrix.
n   the second dimension of the new matrix.
a   the one dimensional C array to use as data storage for the array.

template<class T>
TNT::Fortran_Array1D< T >::Fortran_Array1D<T> ( int n,
const T & val )
 

Create a new n-length array, initializing array elements to constant specified by argument. Most often used to create an array of zeros, as in A(n, 0.0).

Parameters:
m   the dimension of the new matrix.
val   the constant value to set all elements of the new array to.

template<class T>
TNT::Fortran_Array1D< T >::Fortran_Array1D<T> ( const Fortran_Array1D<T> & A ) [inline]
 

Copy constructor. Array data is NOT copied, but shared. Thus, in Fortran_Array1D B(A), subsequent changes to A will be reflected in B. For an indepent copy of A, use Fortran_Array1D B(A.copy()), or B = A.copy(), instead.

template<class T>
TNT::Fortran_Array1D<T>::~Fortran_Array1D<T> ( )
 


Member Function Documentation

template<class T>
Fortran_Array1D< T > TNT::Fortran_Array1D< T >::copy ( ) const
 

Create a new of existing matrix. Used in B = A.copy() or in the construction of B, e.g. Fortran_Array1D B(A.copy()), to create a new array that does not share data.

template<class T>
int TNT::Fortran_Array1D< T >::dim ( ) const [inline]
 

Returns:
the size (dimension of) the array.

template<class T>
int TNT::Fortran_Array1D< T >::dim1 ( ) const [inline]
 

Returns:
the size (dimension of) the array.

template<class T>
Fortran_Array1D< T > & TNT::Fortran_Array1D< T >::inject ( const Fortran_Array1D<T> & A )
 

Copy the elements to from one array to another, in place. That is B.inject(A), both A and B must conform (i.e. have identical dimensions).

This differs from B = A.copy() in that references to B before this assignment are also affected. That is, if we have

	Fortran_Array1D A(n);
	Fortran_Array1D C(n);
	Fortran_Array1D B(C);        // elements of B and C are shared. 

then B.inject(A) affects both and C, while B=A.copy() creates a new array B which shares no data with C or A.
Parameters:
A   the array from elements will be copied
Returns:
an instance of the modifed array. That is, in B.inject(A), it returns B. If A and B are not conformat, no modifications to B are made.

template<class T>
const T & TNT::Fortran_Array1D< T >::operator() ( int i ) const [inline]
 

Read-only version of A(i,j) indexing.

If TNT_BOUNDS_CHECK macro is defined, the indices are checked that they falls within the array bounds (via the assert() macro.)

template<class T>
T & TNT::Fortran_Array1D< T >::operator() ( int i ) [inline]
 

Elements are accessed via A(i) indexing.

If TNT_BOUNDS_CHECK macro is defined, the indices are checked that they falls within the array bounds (via the assert() macro.)

template<class T>
Fortran_Array1D< T > & TNT::Fortran_Array1D< T >::operator= ( const Fortran_Array1D<T> & A ) [inline]
 

B = A is shorthand notation for B.ref(A).

template<class T>
Fortran_Array1D< T > & TNT::Fortran_Array1D< T >::operator= ( const T & a ) [inline]
 

Assign all elemnts of A to a constant scalar.

template<class T>
Fortran_Array1D< T > & TNT::Fortran_Array1D< T >::ref ( const Fortran_Array1D<T> & A ) [inline]
 

Create a reference (shallow assignment) to another existing array. In B.ref(A), B and A shared the same data and subsequent changes to the array elements of one will be reflected in the other.

This is what operator= calls, and B=A and B.ref(A) are equivalent operations.

Returns:
The new referenced array: in B.ref(A), it returns B.

template<class T>
int TNT::Fortran_Array1D<T>::ref_count ( ) const [inline]
 


The documentation for this class was generated from the following file:
Generated at Thu Jun 26 17:26:23 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Fortran_Array1D-members.html0000644000175000017500000000607007676662402023372 0ustar anibalanibal Member List
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Fortran_Array1D Member List

This is the complete list of members for TNT::Fortran_Array1D, including all inherited members.
Generated at Thu Jun 26 17:26:24 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Fortran_Array2D.html0000644000175000017500000005547507676662402021760 0ustar anibalanibal TemplateTNT::Fortran_Array2D class Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Fortran_Array2D Class Template Reference

#include <tnt_fortran_array2d.h>

List of all members.

Public Types

typedef T value_type

Public Methods

 Fortran_Array2D ()
 Fortran_Array2D (int m, int n)
 Fortran_Array2D (int m, int n, T *a)
 Fortran_Array2D (int m, int n, const T &a)
 Fortran_Array2D (const Fortran_Array2D &A)
Fortran_Array2D& operator= (const T &a)
Fortran_Array2D& operator= (const Fortran_Array2D &A)
Fortran_Array2D& ref (const Fortran_Array2D &A)
Fortran_Array2D copy () const
Fortran_Array2D& inject (const Fortran_Array2D &A)
T& operator() (int i, int j)
const T& operator() (int i, int j) const
int dim1 () const
int dim2 () const
int ref_count () const
 ~Fortran_Array2D ()


Detailed Description

template<class T> class TNT::Fortran_Array2D

Templated two-dimensional, numerical array which looks like a conventional Fortran array. This is useful when integrating with C/C++ codes translated from Fortran. Storage corresponds to conventional Fortran ordering. That is, the left-most dimension varies fastest. Indexing is via the A(i,j) notation and A(1,1) is the first element.

Array assignment is by reference (i.e. shallow assignment). That is, B=A implies that the A and B point to the same array, so modifications to the elements of A will be reflected in B. If an independent copy is required, then B = A.copy() can be used. Note that this facilitates returning arrays from functions without relying on compiler optimizations to eliminate extensive data copying.

This class employs its own garbage collection via the use of reference counts. That is, whenever an internal array storage no longer has any references to it, it is destoryed.


Member Typedef Documentation

template<class T>
typedef T TNT::Fortran_Array2D<T>::value_type
 


Constructor & Destructor Documentation

template<class T>
TNT::Fortran_Array2D< T >::Fortran_Array2D<T> ( )
 

Create a null (0x0x0) array.

template<class T>
TNT::Fortran_Array2D< T >::Fortran_Array2D<T> ( int m,
int n )
 

Create a new (m x n) array, WIHOUT initializing array elements. To create an initialized array of constants, see Fortran_Array2D(m,n, value).

This version avoids the O(m*n) initialization overhead and is used just before manual assignment.

Parameters:
m   the first dimension of the new matrix.
n   the second dimension of the new matrix.

template<class T>
TNT::Fortran_Array2D< T >::Fortran_Array2D<T> ( int m,
int n,
T * a )
 

Create a new (m x n) array, as a view of an existing one-dimensional C array, with elements stored in Fortran order, i.e. right-most dimension varying fastest. (Often referred to as "column-major" ordering.) Note that the storage for this pre-existing array will never be garbage collected by the Fortran_Array2D class.

Parameters:
m   the first dimension of the new matrix.
n   the second dimension of the new matrix.
a   the one dimensional C array to use as data storage for the array.

template<class T>
TNT::Fortran_Array2D< T >::Fortran_Array2D<T> ( int m,
int n,
const T & val )
 

Create a new (m x n ) array, initializing array elements to constant specified by argument. Most often used to create an array of zeros, as in A(m, n, k, 0.0).

Parameters:
m   the first dimension of the new matrix.
n   the second dimension of the new matrix.
val   the constant value to set all elements of the new array to.

template<class T>
TNT::Fortran_Array2D< T >::Fortran_Array2D<T> ( const Fortran_Array2D<T> & A ) [inline]
 

Copy constructor. Array data is NOT copied, but shared. Thus, in Fortran_Array2D B(A), subsequent changes to A will be reflected in B. For an indepent copy of A, use Fortran_Array2D B(A.copy()), or B = A.copy(), instead.

template<class T>
TNT::Fortran_Array2D<T>::~Fortran_Array2D<T> ( )
 


Member Function Documentation

template<class T>
Fortran_Array2D< T > TNT::Fortran_Array2D< T >::copy ( ) const
 

Create a new of existing matrix. Used in B = A.copy() or in the construction of B, e.g. Fortran_Array2D B(A.copy()), to create a new array that does not share data.

template<class T>
int TNT::Fortran_Array2D< T >::dim1 ( ) const [inline]
 

Returns:
the size of the first dimension of the array.

template<class T>
int TNT::Fortran_Array2D< T >::dim2 ( ) const [inline]
 

Returns:
the size of the second dimension of the array.

template<class T>
Fortran_Array2D< T > & TNT::Fortran_Array2D< T >::inject ( const Fortran_Array2D<T> & A )
 

Copy the elements to from one array to another, in place. That is B.inject(A), both A and B must conform (i.e. have identical dimensions).

This differs from B = A.copy() in that references to B before this assignment are also affected. That is, if we have

	Fortran_Array2D A(m,n);
	Fortran_Array2D C(m,n);
	Fortran_Array2D B(C);        // elements of B and C are shared. 

then B.inject(A) affects both and C, while B=A.copy() creates a new array B which shares no data with C or A.
Parameters:
A   the array from elements will be copied
Returns:
an instance of the modifed array. That is, in B.inject(A), it returns B. If A and B are not conformat, no modifications to B are made.

template<class T>
const T & TNT::Fortran_Array2D< T >::operator() ( int i,
int j ) const [inline]
 

Read-only version of A(i,j) indexing.

If TNT_BOUNDS_CHECK macro is defined, the indices are checked that they falls within the array bounds (via the assert() macro.)

template<class T>
T & TNT::Fortran_Array2D< T >::operator() ( int i,
int j ) [inline]
 

Elements are accessed via A(i,j) indexing.

If TNT_BOUNDS_CHECK macro is defined, the indices are checked that they falls within the array bounds (via the assert() macro.)

template<class T>
Fortran_Array2D< T > & TNT::Fortran_Array2D< T >::operator= ( const Fortran_Array2D<T> & A ) [inline]
 

B = A is shorthand notation for B.ref(A).

template<class T>
Fortran_Array2D< T > & TNT::Fortran_Array2D< T >::operator= ( const T & a ) [inline]
 

Assign all elemnts of A to a constant scalar.

template<class T>
Fortran_Array2D< T > & TNT::Fortran_Array2D< T >::ref ( const Fortran_Array2D<T> & A ) [inline]
 

Create a reference (shallow assignment) to another existing array. In B.ref(A), B and A shared the same data and subsequent changes to the array elements of one will be reflected in the other.

This is what operator= calls, and B=A and B.ref(A) are equivalent operations.

Returns:
The new referenced array: in B.ref(A), it returns B.

template<class T>
int TNT::Fortran_Array2D<T>::ref_count ( ) const [inline]
 


The documentation for this class was generated from the following file:
Generated at Thu Jun 26 17:26:24 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Fortran_Array2D-members.html0000644000175000017500000000613407676662402023374 0ustar anibalanibal Member List
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Fortran_Array2D Member List

This is the complete list of members for TNT::Fortran_Array2D, including all inherited members.
Generated at Thu Jun 26 17:26:24 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Fortran_Array3D.html0000644000175000017500000006133307676662402021747 0ustar anibalanibal TemplateTNT::Fortran_Array3D class Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Fortran_Array3D Class Template Reference

#include <tnt_fortran_array3d.h>

List of all members.

Public Types

typedef T value_type

Public Methods

 Fortran_Array3D ()
 Fortran_Array3D (int m, int n, int k)
 Fortran_Array3D (int m, int n, int k, T *a)
 Fortran_Array3D (int m, int n, int k, const T &a)
 Fortran_Array3D (const Fortran_Array3D &A)
Fortran_Array3D& operator= (const T &a)
Fortran_Array3D& operator= (const Fortran_Array3D &A)
Fortran_Array3D& ref (const Fortran_Array3D &A)
Fortran_Array3D copy () const
Fortran_Array3D& inject (const Fortran_Array3D &A)
T& operator() (int i, int j, int k)
const T& operator() (int i, int j, int k) const
int dim1 () const
int dim2 () const
int dim3 () const
int ref_count () const
 ~Fortran_Array3D ()


Detailed Description

template<class T> class TNT::Fortran_Array3D

Templated three-dimensional, numerical array which looks like a conventional Fortran array. This is useful when integrating with C/C++ codes translated from Fortran. Storage corresponds to conventional Fortran ordering. That is, the left-most dimension varies fastest. Indexing is via the A(i,j,k) notation and A(1,1,1) is the first element.

Array assignment is by reference (i.e. shallow assignment). That is, B=A implies that the A and B point to the same array, so modifications to the elements of A will be reflected in B. If an independent copy is required, then B = A.copy() can be used. Note that this facilitates returning arrays from functions without relying on compiler optimizations to eliminate extensive data copying.

This class employs its own garbage collection via the use of reference counts. That is, whenever an internal array storage no longer has any references to it, it is destoryed.


Member Typedef Documentation

template<class T>
typedef T TNT::Fortran_Array3D<T>::value_type
 


Constructor & Destructor Documentation

template<class T>
TNT::Fortran_Array3D< T >::Fortran_Array3D<T> ( )
 

Create a null (0x0x0) array.

template<class T>
TNT::Fortran_Array3D< T >::Fortran_Array3D<T> ( int m,
int n,
int k )
 

Create a new (m x n x k) array, WIHOUT initializing array elements. To create an initialized array of constants, see Fortran_Array3D(m,n,k, value).

This version avoids the O(m*n*k) initialization overhead and is used just before manual assignment.

Parameters:
m   the first dimension of the new matrix.
n   the second dimension of the new matrix.
k   the third dimension of the new matrix.

template<class T>
TNT::Fortran_Array3D< T >::Fortran_Array3D<T> ( int m,
int n,
int k,
T * a )
 

Create a new (m x n x k) array, as a view of an existing one-dimensional C array, with elements stored in Fortran order, i.e. right-most dimension varying fastest. (Often referred to as "column-major" ordering.) Note that the storage for this pre-existing array will never be garbage collected by the Fortran_Array3D class.

Parameters:
m   the first dimension of the new matrix.
n   the second dimension of the new matrix.
k   the third dimension of the new matrix.
a   the one dimensional C array to use as data storage for the array.

template<class T>
TNT::Fortran_Array3D< T >::Fortran_Array3D<T> ( int m,
int n,
int k,
const T & val )
 

Create a new (m x n x k) array, initializing array elements to constant specified by argument. Most often used to create an array of zeros, as in A(m, n, k, 0.0).

Parameters:
m   the first dimension of the new matrix.
n   the second dimension of the new matrix.
k   the third dimension of the new matrix.
val   the constant value to set all elements of the new array to.

template<class T>
TNT::Fortran_Array3D< T >::Fortran_Array3D<T> ( const Fortran_Array3D<T> & A ) [inline]
 

Copy constructor. Array data is NOT copied, but shared. Thus, in Fortran_Array3D B(A), subsequent changes to A will be reflected in B. For an indepent copy of A, use Fortran_Array3D B(A.copy()), or B = A.copy(), instead.

template<class T>
TNT::Fortran_Array3D<T>::~Fortran_Array3D<T> ( )
 


Member Function Documentation

template<class T>
Fortran_Array3D< T > TNT::Fortran_Array3D< T >::copy ( ) const
 

Create a new of existing matrix. Used in B = A.copy() or in the construction of B, e.g. Fortran_Array3D B(A.copy()), to create a new array that does not share data.

template<class T>
int TNT::Fortran_Array3D< T >::dim1 ( ) const [inline]
 

Returns:
the size of the first dimension of the array.

template<class T>
int TNT::Fortran_Array3D< T >::dim2 ( ) const [inline]
 

Returns:
the size of the second dimension of the array.

template<class T>
int TNT::Fortran_Array3D< T >::dim3 ( ) const [inline]
 

Returns:
the size of the third (right-most) dimension of the array.

template<class T>
Fortran_Array3D< T > & TNT::Fortran_Array3D< T >::inject ( const Fortran_Array3D<T> & A )
 

Copy the elements to from one array to another, in place. That is B.inject(A), both A and B must conform (i.e. have identical dimensions).

This differs from B = A.copy() in that references to B before this assignment are also affected. That is, if we have

	Fortran_Array3D A(m,n,k);
	Fortran_Array3D C(m,n,k);
	Fortran_Array3D B(C);        // elements of B and C are shared. 

then B.inject(A) affects both and C, while B=A.copy() creates a new array B which shares no data with C or A.
Parameters:
A   the array from elements will be copied
Returns:
an instance of the modifed array. That is, in B.inject(A), it returns B. If A and B are not conformat, no modifications to B are made.

template<class T>
const T & TNT::Fortran_Array3D< T >::operator() ( int i,
int j,
int k ) const [inline]
 

Read-only version of A(i,j,k) indexing.

If TNT_BOUNDS_CHECK macro is defined, the indices are checked that they falls within the array bounds (via the assert() macro.)

template<class T>
T & TNT::Fortran_Array3D< T >::operator() ( int i,
int j,
int k ) [inline]
 

Elements are accessed via A(i,j,k) indexing.

If TNT_BOUNDS_CHECK macro is defined, the indices are checked that they falls within the array bounds (via the assert() macro.)

template<class T>
Fortran_Array3D< T > & TNT::Fortran_Array3D< T >::operator= ( const Fortran_Array3D<T> & A ) [inline]
 

B = A is shorthand notation for B.ref(A).

template<class T>
Fortran_Array3D< T > & TNT::Fortran_Array3D< T >::operator= ( const T & a ) [inline]
 

Assign all elemnts of A to a constant scalar.

template<class T>
Fortran_Array3D< T > & TNT::Fortran_Array3D< T >::ref ( const Fortran_Array3D<T> & A ) [inline]
 

Create a reference (shallow assignment) to another existing array. In B.ref(A), B and A shared the same data and subsequent changes to the array elements of one will be reflected in the other.

This is what operator= calls, and B=A and B.ref(A) are equivalent operations.

Returns:
The new referenced array: in B.ref(A), it returns B.

template<class T>
int TNT::Fortran_Array3D< T >::ref_count ( ) const [inline]
 

Returns:
the number of arrays that share the same storage area as this one. (Must be at least one.)


The documentation for this class was generated from the following file:
Generated at Thu Jun 26 17:26:24 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Fortran_Array3D-members.html0000644000175000017500000000634307676662402023377 0ustar anibalanibal Member List
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Fortran_Array3D Member List

This is the complete list of members for TNT::Fortran_Array3D, including all inherited members.
Generated at Thu Jun 26 17:26:24 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Matrix.html0000644000175000017500000010711507676662402020252 0ustar anibalanibal TemplateTNT::Matrix class Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Matrix Class Template Reference

#include <tnt_cmat.h>

List of all members.

Public Types

typedef Subscript size_type
typedef T value_type
typedef T element_type
typedef T* pointer
typedef T* iterator
typedef T& reference
typedef const T* const_iterator
typedef const T& const_reference

Public Methods

Subscript lbound () const
 operator T ** ()
 operator T ** () const
Subscript size () const
 Matrix ()
 Matrix (const Matrix< T > &A)
 Matrix (Subscript M, Subscript N, const T &value=T())
 Matrix (Subscript M, Subscript N, const T *v)
 Matrix (Subscript M, Subscript N, const char *s)
 ~Matrix ()
Matrix<T>& newsize (Subscript M, Subscript N)
Matrix<T>& operator= (const Matrix< T > &A)
Matrix<T>& operator= (const T &scalar)
Subscript dim (Subscript d) const
Subscript num_rows () const
Subscript num_cols () const
T* operator[] (Subscript i)
const T* operator[] (Subscript i) const
reference operator() (Subscript i)
const_reference operator() (Subscript i) const
reference operator() (Subscript i, Subscript j)
const_reference operator() (Subscript i, Subscript j) const

Protected Attributes

Subscript m_
Subscript n_
Subscript mn_
T* v_
T** row_
T* vm1_
T** rowm1_


Detailed Description

template<class T> class TNT::Matrix

[Deprecatred] Value-based Matrix class from pre-1.0 TNT version. Provides a row-oriented, 0-based [i][j] and 1-based (i,j) indexing. Kept here for backward compatiblity, but should use the newer TNT::Array2D classes instead.


Member Typedef Documentation

template<class T>
typedef const T * TNT::Matrix<T>::const_iterator
 

template<class T>
typedef const T & TNT::Matrix<T>::const_reference
 

template<class T>
typedef T TNT::Matrix<T>::element_type
 

template<class T>
typedef T * TNT::Matrix<T>::iterator
 

template<class T>
typedef T * TNT::Matrix<T>::pointer
 

template<class T>
typedef T & TNT::Matrix<T>::reference
 

template<class T>
typedef Subscript TNT::Matrix<T>::size_type
 

template<class T>
typedef T TNT::Matrix<T>::value_type
 


Constructor & Destructor Documentation

template<class T>
TNT::Matrix<T>::Matrix<T> ( )
 

template<class T>
TNT::Matrix<T>::Matrix<T> ( const Matrix< T > & A )
 

template<class T>
TNT::Matrix<T>::Matrix<T> ( Subscript M,
Subscript N,
const T & value = T() )
 

template<class T>
TNT::Matrix<T>::Matrix<T> ( Subscript M,
Subscript N,
const T * v )
 

template<class T>
TNT::Matrix<T>::Matrix<T> ( Subscript M,
Subscript N,
const char * s )
 

template<class T>
TNT::Matrix<T>::~Matrix<T> ( )
 


Member Function Documentation

template<class T>
Subscript TNT::Matrix<T>::dim ( Subscript d ) const
 

template<class T>
Subscript TNT::Matrix<T>::lbound ( ) const [inline]
 

template<class T>
Matrix<T>& TNT::Matrix<T>::newsize ( Subscript M,
Subscript N )
 

template<class T>
Subscript TNT::Matrix<T>::num_cols ( ) const [inline]
 

template<class T>
Subscript TNT::Matrix<T>::num_rows ( ) const [inline]
 

template<class T>
TNT::Matrix<T>::operator T ** ( ) const [inline]
 

template<class T>
TNT::Matrix<T>::operator T ** ( ) [inline]
 

template<class T>
const_reference TNT::Matrix<T>::operator() ( Subscript i,
Subscript j ) const [inline]
 

template<class T>
reference TNT::Matrix<T>::operator() ( Subscript i,
Subscript j ) [inline]
 

template<class T>
const_reference TNT::Matrix<T>::operator() ( Subscript i ) const [inline]
 

template<class T>
reference TNT::Matrix<T>::operator() ( Subscript i ) [inline]
 

template<class T>
Matrix<T>& TNT::Matrix<T>::operator= ( const T & scalar )
 

template<class T>
Matrix<T>& TNT::Matrix<T>::operator= ( const Matrix< T > & A )
 

template<class T>
const T * TNT::Matrix<T>::operator[] ( Subscript i ) const [inline]
 

template<class T>
T * TNT::Matrix<T>::operator[] ( Subscript i ) [inline]
 

template<class T>
Subscript TNT::Matrix<T>::size ( ) const [inline]
 


Member Data Documentation

template<class T>
Subscript TNT::Matrix<T>::m_ [protected]
 

template<class T>
Subscript TNT::Matrix<T>::mn_ [protected]
 

template<class T>
Subscript TNT::Matrix<T>::n_ [protected]
 

template<class T>
T ** TNT::Matrix<T>::row_ [protected]
 

template<class T>
T ** TNT::Matrix<T>::rowm1_ [protected]
 

template<class T>
T * TNT::Matrix<T>::v_ [protected]
 

template<class T>
T * TNT::Matrix<T>::vm1_ [protected]
 


The documentation for this class was generated from the following file:
Generated at Thu Jun 26 17:26:24 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Matrix-members.html0000644000175000017500000001110707676662402021675 0ustar anibalanibal Member List
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Matrix Member List

This is the complete list of members for TNT::Matrix, including all inherited members.
Generated at Thu Jun 26 17:26:25 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Sparse_Matrix_CompRow.html0000644000175000017500000002737207676662402023243 0ustar anibalanibal TemplateTNT::Sparse_Matrix_CompRow class Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Sparse_Matrix_CompRow Class Template Reference

#include <tnt_sparse_matrix_csr.h>

List of all members.

Public Methods

 Sparse_Matrix_CompRow (const Sparse_Matrix_CompRow &S)
 Sparse_Matrix_CompRow (int M, int N, int nz, const T *val, const int *r, const int *c)
const T& val (int i) const
const int& row_ptr (int i) const
const int& col_ind (int i) const
int dim1 () const
int dim2 () const
int NumNonzeros () const
Sparse_Matrix_CompRow& operator= (const Sparse_Matrix_CompRow &R)


Detailed Description

template<class T> class TNT::Sparse_Matrix_CompRow

Read-only view of a sparse matrix in compressed-row storage format. Neither array elements (nonzeros) nor sparsity structure can be modified. If modifications are required, create a new view.

Index values begin at 0.

Storage requirements: An (m x n) matrix with nz nonzeros requires no more than ((T+I)*nz + M*I) bytes, where T is the size of data elements and I is the size of integers.


Constructor & Destructor Documentation

template<class T>
TNT::Sparse_Matrix_CompRow<T>::Sparse_Matrix_CompRow<T> ( const Sparse_Matrix_CompRow<T> & S )
 

template<class T>
TNT::Sparse_Matrix_CompRow< T >::Sparse_Matrix_CompRow<T> ( int M,
int N,
int nz,
const T * val,
const int * r,
const int * c )
 

Construct a read-only view of existing sparse matrix in compressed-row storage format.

Parameters:
M   the number of rows of sparse matrix
N   the number of columns of sparse matrix
nz   the number of nonzeros
val   a contiguous list of nonzero values
r   row-pointers: r[i] denotes the begining position of row i (i.e. the ith row begins at val[row[i]]).
c   column-indices: c[i] denotes the column location of val[i]


Member Function Documentation

template<class T>
int TNT::Sparse_Matrix_CompRow<T>::NumNonzeros ( ) const
 

template<class T>
const int & TNT::Sparse_Matrix_CompRow<T>::col_ind ( int i ) const [inline]
 

template<class T>
int TNT::Sparse_Matrix_CompRow<T>::dim1 ( ) const [inline]
 

template<class T>
int TNT::Sparse_Matrix_CompRow<T>::dim2 ( ) const [inline]
 

template<class T>
Sparse_Matrix_CompRow<T>& TNT::Sparse_Matrix_CompRow<T>::operator= ( const Sparse_Matrix_CompRow<T> & R )
 

template<class T>
const int & TNT::Sparse_Matrix_CompRow<T>::row_ptr ( int i ) const [inline]
 

template<class T>
const T & TNT::Sparse_Matrix_CompRow<T>::val ( int i ) const [inline]
 


The documentation for this class was generated from the following file:
Generated at Thu Jun 26 17:26:25 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Sparse_Matrix_CompRow-members.html0000644000175000017500000000463507676662402024670 0ustar anibalanibal Member List
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Sparse_Matrix_CompRow Member List

This is the complete list of members for TNT::Sparse_Matrix_CompRow, including all inherited members.
Generated at Thu Jun 26 17:26:25 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Stopwatch.html0000644000175000017500000001554407676662402020766 0ustar anibalanibal TNT::Stopwatch class Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Stopwatch Class Reference

#include <tnt_stopwatch.h>

List of all members.

Public Methods

 Stopwatch ()
void start ()
double stop ()
double read ()
void resume ()
int running ()


Detailed Description

Performance Stopwatch used for benchmarking codes. Measures seconds elapsed as a floating point number. Resolution of the clock is determined by CLOCKS_PER_SEC in time.h. Typical use is given by
	Stopwatch Q;

	Q.start;
	{code to benchmark}
	Q.stop;

	double time_elapsed = Q.read();


Constructor & Destructor Documentation

TNT::Stopwatch::Stopwatch ( )
 

Create an instance of a Stopwatch, with its own internal counter.


Member Function Documentation

double TNT::Stopwatch::read ( ) [inline]
 

Read current time, in seconds. (NOTE: Does NOT stop timing.)

void TNT::Stopwatch::resume ( ) [inline]
 

Resume timing, if currently stopped. Operation has no effect if Stopwatch is already running.

int TNT::Stopwatch::running ( ) [inline]
 

Returns:
Zero (0) if stopwatch is not currently running, i.e. stopped. One (1), otherwise.

void TNT::Stopwatch::start ( ) [inline]
 

Start timing from 0.00.

double TNT::Stopwatch::stop ( ) [inline]
 

Stop timing and return elapsed time (in seconds).


The documentation for this class was generated from the following file:
Generated at Thu Jun 26 17:26:25 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Stopwatch-members.html0000644000175000017500000000355507676662402022415 0ustar anibalanibal Member List
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Stopwatch Member List

This is the complete list of members for TNT::Stopwatch, including all inherited members.
Generated at Thu Jun 26 17:26:25 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Vector.html0000644000175000017500000003621007676662402020245 0ustar anibalanibal TemplateTNT::Vector class Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Vector Class Template Reference

#include <tnt_vec.h>

List of all members.

Public Types

typedef Subscript size_type
typedef T value_type
typedef T element_type
typedef T* pointer
typedef T* iterator
typedef T& reference
typedef const T* const_iterator
typedef const T& const_reference

Public Methods

Subscript lbound () const
iterator begin ()
iterator end ()
const iterator begin () const
const iterator end () const
 ~Vector ()
 Vector ()
 Vector (const Vector< T > &A)


Detailed Description

template<class T> class TNT::Vector

[Deprecatred] Value-based vector class from pre-1.0 TNT version. Kept here for backward compatiblity, but should use the newer TNT::Array1D classes instead.


Member Typedef Documentation

template<class T>
typedef const T * TNT::Vector<T>::const_iterator
 

template<class T>
typedef const T & TNT::Vector<T>::const_reference
 

template<class T>
typedef T TNT::Vector<T>::element_type
 

template<class T>
typedef T * TNT::Vector<T>::iterator
 

template<class T>
typedef T * TNT::Vector<T>::pointer
 

template<class T>
typedef T & TNT::Vector<T>::reference
 

template<class T>
typedef Subscript TNT::Vector<T>::size_type
 

template<class T>
typedef T TNT::Vector<T>::value_type
 


Constructor & Destructor Documentation

template<class T>
TNT::Vector<T>::~Vector<T> ( )
 

template<class T>
TNT::Vector<T>::Vector<T> ( )
 

template<class T>
TNT::Vector<T>::Vector<T> ( const Vector< T > & A )
 


Member Function Documentation

template<class T>
const iterator TNT::Vector<T>::begin ( ) const [inline]
 

template<class T>
iterator TNT::Vector<T>::begin ( ) [inline]
 

template<class T>
const iterator TNT::Vector<T>::end ( ) const [inline]
 

template<class T>
iterator TNT::Vector<T>::end ( ) [inline]
 

template<class T>
Subscript TNT::Vector<T>::lbound ( ) const [inline]
 


The documentation for this class was generated from the following file:
Generated at Thu Jun 26 17:26:25 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/class_TNT__Vector-members.html0000644000175000017500000000512007676662402021671 0ustar anibalanibal Member List
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT::Vector Member List

This is the complete list of members for TNT::Vector, including all inherited members.
Generated at Thu Jun 26 17:26:25 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/doxygen.css0000644000175000017500000000156507676662404016242 0ustar anibalanibalH1 { text-align: center; } A.qindex {} A.qindexRef {} A.el { text-decoration: none; font-weight: bold } A.elRef { font-weight: bold } A.code { text-decoration: none; font-weight: normal; color: #4444ee } A.codeRef { font-weight: normal; color: #4444ee } DL.el { margin-left: -1cm } DIV.fragment { width: 100%; border: none; background-color: #eeeeee } DIV.ah { background-color: black; margin-bottom: 3; margin-top: 3 } TD.md { background-color: #f2f2ff } DIV.groupHeader { margin-left: 16; margin-top: 12; margin-bottom: 6; font-weight: bold } DIV.groupText { margin-left: 16; font-style: italic; font-size: smaller } FONT.keyword { color: #008000 } FONT.keywordtype { color: #604020 } FONT.keywordflow { color: #e08000 } FONT.comment { color: #800000 } FONT.preprocessor { color: #806020 } FONT.stringliteral { color: #002080 } FONT.charliteral { color: #008080 } libtnt-1.2.6/html/tnt/doxygen.gif0000644000175000017500000000451207676662370016214 0ustar anibalanibalGIF89an5çÿÿ⟠¶%%ÿÿàÿÿÜß߯ÿÌÌß²²þüÓ¿¿©ÿÿãøæ“ÿÿÛßßÀõÜvßßÄøæ’ÞܹîÃ,üô½üô¼ýøÉßßÅóÖdûð¯Õ»Wùë¡öâ†ÙÉ÷ᆿ¿¤ÿÿßôÖd=6ýøÈúï¯ ùë ýùÉÝÙ°üõ¼²’!ÜÕ¤ßßÇ?<,¸¥X÷â…õÜu ÿþÛ¿¿ª÷á…ùê¡Ð«&òÐRÿüÓÚÎ@?5ÜÕ¥÷â†úð¯>;(@@9@@7ÛÒ™»°xûï¯ÖÀgúë¡ÝÚ°öá†þüÔ\Q&º¬nßßÃïÆ4ðÊB¹©dÿþÜ õÝv[Q&ÝÚ¯ùê ?=/µœ=ÖÁgÜÒ™úë Õ¼WÙÉ€?>2>:%þøÈÚÎŒ ÷æ“ׯu=7ûï®ýùȾ½ž»´ƒ×ÅuÜј  ¿¿¥@@8ßܹüõ½ôÖeúê¡ØÉðËBßÞÀöÜu¿¿¨ØÆuÖÀf÷æ’ñÊBÒ²:¾¾žC@/ׯt¸¦X¼´ƒÚÍô×d»°yþùÉ^ZBúê ``Uq¼´‚ˆº¬m½·ŽïÅ4ØÅuÿÿÝûð®DD:ÿÿáÞßÀ ó×dÑ­-½¸ßß¿™™>9"_\GïÆ5öÜvÿÿÞaaT``Tûô¼>8"?;( ÜÖ¤_^L»³‚^X< ÞÙ°ãÙŸÒ±:»´‚ÍÆ™ Måⶸ©dßßÁÚÍŒúð®þøÉú﮿¾¥b\?ñÐR^X=¾º—`_P(&¹¬nqc.ÛÍØÅtþýÔ˜c`^L·~öá…öâ… B>+¾»—ÜÑ™=4½·˜†>™‰JîÅ4'%áЄ``R>9!>8!`_ODD;îÆ5 öÝvÛÒ˜µœ>ÜÒ˜…mЭ.“|(îÆ4<4ÝÙ¯ããÇ¿¾¤¿½žDC800)ïÅ5HG<ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ!ùÿ,n5þÿ H° Áƒ*\Ȱ¡Ã‡#JœH±¢Å‹3V¬Ç±c= CZ¬§É8Eª\ɰ^0¤dI³¦@—0 È´É“%Θ3{ ÍøSgСH)Ý™´éÄ¥GJ]uªÕ– *ÁÄõª×›ž>| å©ëפ;>ÀöAÊ´ƽÙñß\‚wáÞµ«—®^Ž9&(`¡á˜(.ð±Þà† ¬˜Ñ8 *HШ^£Á™ñZÞÜq°áÂC >}:³ãËQ“~踀Ÿo+V°¢Þ·ƒãžüc€Û~ŒùQàxïÁË5®€÷ï»uWçÍqFóãÚþPÆ®;{õÐ ë}ǽ›=ãìã+ÎÌžózÆØç7–À æòÕçXy†¹§^€¶Ä[|0À6ÈÖn1ÁàLD(!õ,ÈàZl1aJ=30È¡]k‰õ€r€ø`;)>È‘‹|Ôc ˆÖãbˆ :èVKyÀ€ x„—xÀÀ’ ÈE „’PÈ@€‘ É$2x0F=r¼´ä;õx ƒ•øD …—ÈóM&BÊd&PeB!$yÔ“É’Pz°ML6i–\i  (èPšÄŠFPI0ê(G:D°èõ¢(¥Š¦±i=idʨ7“*£©*þž2JÏ£nH‚–zJiĈŠ)£ðÔA™Î¡ƒ*s @ª¥TYQ˜pB !à ъpB=І1mG1XÁ‹"°SÏ'@«H°0ãºÙ­ hHѼØÂŠ&õÄ ´–Ao`k‚ aóG£aE ×" ­‡Þd (L0 $täÎP@ÁõP ñ$ ñ( *ˆLÁ*õ`±ƒÉ(ÐA$sD‚$§L1Í«`ÁQ'>S@K(ÅÈl2Å*d\³É#WJÎ*„LÇ,S@‡Æ*TlW'`ÐCA°Ð [ ÑAÔƒÁ#l1È9»¼2È# Áþ,,´·Þg°möÙåX‚%yc`ÈÙjˆ=B,A´xׄ­7Û†,²ˆj˜=M/#ô0Îo´¡Kgœ±…×v‰ÁH %Ô D*Sø „W”pEõ SC 4óK6ÑQv “ÊíEpQ‚và.„M‘ð\Ô°{Z>äP‚%!¾¬Þ½EÔpˆ+Á$’ úBÔ“Ãë2Åb<ï-EÁ Ã8À/ÿ»C=–ÀüA^ðÿ·0 ðä1XÁŽ€Á ø–—HÜ!„" ïØÀ@ÞAƒd@ ê¡Áÿq€ lÐ`g˜ž'l€þx:Àgtà‡4HF=ªp„#Ò G8‚¦è‡*ôá‰/X7ºQ†¼àxB=¤0Æ5‘kø *žÐJ<1ˆ3äÈœØü0ˆe¨GŽø BHA „xÁ:ð‚<:¤…p ¦(ŒbŠ ‚ êahA‘œ¢ª "`Ò-h ¦-¤£-@¥'a@…Iþ…#•tàÂ{ Â#°IÖƒ{P¤ByI*,’¬»‰R\ÎAR „À! !¨B.ÀÍ l"Uˆ”Ði*! QЦ4Ó‚zÀ¡!È@‘½„Àíþäˆ2ÀM"£#ÙìB¸)ÍŽðÓ›A File Index
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

Template Numerical Toolkit (TNT) File List

Here is a list of all files with brief descriptions:
Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/functions.html0000644000175000017500000003040107676662370016742 0ustar anibalanibal Compound Member Index
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

Template Numerical Toolkit (TNT) Compound Members

a | b | c | d | e | f | i | l | m | n | o | p | r | s | v | ~

Here is a list of all class members with links to the class documentation for each member:

- a -

- b -

- c -

- d -

- e -

- f -

- i -

- l -

- m -

- n -

- o -

- p -

- r -

- s -

- v -

- ~ -


Generated at Thu Jun 26 17:26:15 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/globals.html0000644000175000017500000000363507676662404016364 0ustar anibalanibal File Member Index
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

Template Numerical Toolkit (TNT) File Members

t

Here is a list of all file members with links to the files they belong to:

- t -


Generated at Thu Jun 26 17:26:26 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/index.html0000644000175000017500000000241107676662370016041 0ustar anibalanibal Main Page
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

Template Numerical Toolkit (TNT) Documentation

1.2


Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/namespacemembers.html0000644000175000017500000000632407676662404020246 0ustar anibalanibal Namespace Member Index
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

Template Numerical Toolkit (TNT) Namespace Members

a | d | h | m | o | s | t

Here is a list of all namespace members with links to the namespace documentation for each member:

- a -

- d -

- h -

- m -

- o -

- s -

- t -


Generated at Thu Jun 26 17:26:26 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/namespaces.html0000644000175000017500000000255107676662402017052 0ustar anibalanibal Namespace Index
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

Template Numerical Toolkit (TNT) Namespace List

Here is a list of all namespaces with brief descriptions:
Generated at Thu Jun 26 17:26:25 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/namespace_TNT.html0000644000175000017500000031150707676662402017420 0ustar anibalanibal TNT Namespace Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

TNT Namespace Reference


Compounds

class  TNT::Array1D
class  TNT::Array2D
class  TNT::Array3D
class  TNT::Fortran_Array1D
class  TNT::Fortran_Array2D
class  TNT::Fortran_Array3D
class  TNT::Matrix
class  TNT::Sparse_Matrix_CompRow
class  TNT::Stopwatch
class  TNT::Vector

Typedefs

typedef TNT_SUBSCRIPT_TYPE Subscript

Functions

template<class T> std::ostream& operator<< (std::ostream &s, const Array1D< T > &A)
std::istream& operator>> (std::istream &s, Array1D< T > &A)
Array1D<T> operator+ (const Array1D< T > &A, const Array1D< T > &B)
Array1D<T> operator- (const Array1D< T > &A, const Array1D< T > &B)
Array1D<T> operator * (const Array1D< T > &A, const Array1D< T > &B)
Array1D<T> operator/ (const Array1D< T > &A, const Array1D< T > &B)
Array1D<T>& operator+= (Array1D< T > &A, const Array1D< T > &B)
Array1D<T>& operator-= (Array1D< T > &A, const Array1D< T > &B)
Array1D<T>& operator *= (Array1D< T > &A, const Array1D< T > &B)
Array1D<T>& operator/= (Array1D< T > &A, const Array1D< T > &B)
template<class T> std::ostream& operator<< (std::ostream &s, const Array2D< T > &A)
std::istream& operator>> (std::istream &s, Array2D< T > &A)
Array2D<T> operator+ (const Array2D< T > &A, const Array2D< T > &B)
Array2D<T> operator- (const Array2D< T > &A, const Array2D< T > &B)
Array2D<T> operator * (const Array2D< T > &A, const Array2D< T > &B)
Array2D<T> operator/ (const Array2D< T > &A, const Array2D< T > &B)
Array2D<T>& operator+= (Array2D< T > &A, const Array2D< T > &B)
Array2D<T>& operator-= (Array2D< T > &A, const Array2D< T > &B)
Array2D<T>& operator *= (Array2D< T > &A, const Array2D< T > &B)
Array2D<T>& operator/= (Array2D< T > &A, const Array2D< T > &B)
Array2D<T> matmult (const Array2D< T > &A, const Array2D< T > &B)
template<class T> std::ostream& operator<< (std::ostream &s, const Array3D< T > &A)
std::istream& operator>> (std::istream &s, Array3D< T > &A)
Array3D<T> operator+ (const Array3D< T > &A, const Array3D< T > &B)
Array3D<T> operator- (const Array3D< T > &A, const Array3D< T > &B)
Array3D<T> operator * (const Array3D< T > &A, const Array3D< T > &B)
Array3D<T> operator/ (const Array3D< T > &A, const Array3D< T > &B)
Array3D<T>& operator+= (Array3D< T > &A, const Array3D< T > &B)
Array3D<T>& operator-= (Array3D< T > &A, const Array3D< T > &B)
Array3D<T>& operator *= (Array3D< T > &A, const Array3D< T > &B)
Array3D<T>& operator/= (Array3D< T > &A, const Array3D< T > &B)
template<class T> std::ostream& operator<< (std::ostream &s, const Matrix< T > &A)
std::istream& operator>> (std::istream &s, Matrix< T > &A)
Matrix<T> operator+ (const Matrix< T > &A, const Matrix< T > &B)
Matrix<T> operator- (const Matrix< T > &A, const Matrix< T > &B)
Matrix<T> mult_element (const Matrix< T > &A, const Matrix< T > &B)
Matrix<T> transpose (const Matrix< T > &A)
Matrix<T> matmult (const Matrix< T > &A, const Matrix< T > &B)
Matrix<T> operator * (const Matrix< T > &A, const Matrix< T > &B)
int matmult (Matrix< T > &C, const Matrix< T > &A, const Matrix< T > &B)
Vector<T> matmult (const Matrix< T > &A, const Vector< T > &x)
Vector<T> operator * (const Matrix< T > &A, const Vector< T > &x)
template<class T> std::ostream& operator<< (std::ostream &s, const Fortran_Array1D< T > &A)
std::istream& operator>> (std::istream &s, Fortran_Array1D< T > &A)
Fortran_Array1D<T> operator+ (const Fortran_Array1D< T > &A, const Fortran_Array1D< T > &B)
Fortran_Array1D<T> operator- (const Fortran_Array1D< T > &A, const Fortran_Array1D< T > &B)
Fortran_Array1D<T> operator * (const Fortran_Array1D< T > &A, const Fortran_Array1D< T > &B)
Fortran_Array1D<T> operator/ (const Fortran_Array1D< T > &A, const Fortran_Array1D< T > &B)
Fortran_Array1D<T>& operator+= (Fortran_Array1D< T > &A, const Fortran_Array1D< T > &B)
Fortran_Array1D<T>& operator-= (Fortran_Array1D< T > &A, const Fortran_Array1D< T > &B)
Fortran_Array1D<T>& operator *= (Fortran_Array1D< T > &A, const Fortran_Array1D< T > &B)
Fortran_Array1D<T>& operator/= (Fortran_Array1D< T > &A, const Fortran_Array1D< T > &B)
template<class T> std::ostream& operator<< (std::ostream &s, const Fortran_Array2D< T > &A)
std::istream& operator>> (std::istream &s, Fortran_Array2D< T > &A)
template<class T> std::ostream& operator<< (std::ostream &s, const Fortran_Array3D< T > &A)
std::istream& operator>> (std::istream &s, Fortran_Array3D< T > &A)
Real hypot (const Real &a, const Real &b)
Scalar min (const Scalar &a, const Scalar &b)
Scalar max (const Scalar &a, const Scalar &b)
Real abs (const Real &a)
template<class T> std::ostream& operator<< (std::ostream &s, const Vector< T > &A)
std::istream& operator>> (std::istream &s, Vector< T > &A)
Vector<T> operator+ (const Vector< T > &A, const Vector< T > &B)
Vector<T> operator- (const Vector< T > &A, const Vector< T > &B)
Vector<T> operator * (const Vector< T > &A, const Vector< T > &B)
dot_prod (const Vector< T > &A, const Vector< T > &B)


Typedef Documentation

typedef TNT_SUBSCRIPT_TYPE TNT::Subscript
 


Function Documentation

Real TNT::abs ( const Real & a )
 

Returns:
the absolute value of a real (no-complex) scalar.

T dot_prod ( const Vector< T > & A,
const Vector< T > & B )
 

Real TNT::hypot ( const Real & a,
const Real & b )
 

Returns:
hypotenuse of real (non-complex) scalars a and b by avoiding underflow/overflow using (a * sqrt( 1 + (b/a) * (b/a))), rather than sqrt(a*a + b*b).

Vector<T> matmult ( const Matrix< T > & A,
const Vector< T > & x )
 

int TNT::matmult ( Matrix< T > & C,
const Matrix< T > & A,
const Matrix< T > & B ) [inline]
 

Matrix< T > TNT::matmult ( const Matrix< T > & A,
const Matrix< T > & B ) [inline]
 

Array2D< T > TNT::matmult ( const Array2D< T > & A,
const Array2D< T > & B )
 

Matrix Multiply: compute C = A*B, where C[i][j] is the dot-product of row i of A and column j of B.

Parameters:
A   an (m x n) array
B   an (n x k) array
Returns:
the (m x k) array A*B, or a null array (0x0) if the matrices are non-conformant (i.e. the number of columns of A are different than the number of rows of B.)

Scalar TNT::max ( const Scalar & a,
const Scalar & b )
 

Returns:
the maximum of scalars a and b.

Scalar TNT::min ( const Scalar & a,
const Scalar & b )
 

Returns:
the minimum of scalars a and b.

Matrix<T> mult_element ( const Matrix< T > & A,
const Matrix< T > & B )
 

Vector<T> operator * ( const Vector< T > & A,
const Vector< T > & B )
 

Fortran_Array1D< T > TNT::operator * ( const Fortran_Array1D< T > & A,
const Fortran_Array1D< T > & B )
 

Array multiplication (element-wise) : compute C = A*B, where each C(i) is A(i) * B(i).

Parameters:
A   an array of n elements
B   an array of n elements
Returns:
the n array A-B, or a null array (0) if the matrices are non-conformant.

Vector< T > TNT::operator * ( const Matrix< T > & A,
const Vector< T > & x ) [inline]
 

Matrix< T > TNT::operator * ( const Matrix< T > & A,
const Matrix< T > & B ) [inline]
 

Array3D< T > TNT::operator * ( const Array3D< T > & A,
const Array3D< T > & B )
 

Array multiplication (element-wise): compute C = A*B, where C[i][j][k] is the product of A[i][j][k] and B[i][j][k].

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A*B, or a null array (0x0x0) if the matrices are non-conformant.

Array2D< T > TNT::operator * ( const Array2D< T > & A,
const Array2D< T > & B )
 

Array (element-wise) multiplication: compute C = A*B, where C[i][j] is A[i][j] * B[i][j]. (Note: this is not matrix multiplcation, see Matrix<T> for linear algebra operations.)

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A*B, or a null array (0x0) if the matrices are non-conformant.

Array1D< T > TNT::operator * ( const Array1D< T > & A,
const Array1D< T > & B )
 

Array multiplication (element-wise) : compute C = A*B, where each C[i] is A[i] * B[i].

Parameters:
A   an array of n elements
B   an array of n elements
Returns:
the n array A-B, or a null array (0) if the matrices are non-conformant.

Fortran_Array1D< T > & TNT::operator *= ( Fortran_Array1D< T > & A,
const Fortran_Array1D< T > & B )
 

Array element-wise multiplication (in place): compute A = A*B, where each A(i) is replaced with A(i) * B(i).

Parameters:
A   an array of length n
B   an array of length n
Returns:
the n-length array A*=B, or the original A if if the matrices are non-conformant.

Array3D< T > & TNT::operator *= ( Array3D< T > & A,
const Array3D< T > & B )
 

Array multiplication (in place): compute A = A*B, where each A[i][j][k] is replaced by A[i][j][k] * B[i][j][k].

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A*B, or a the original array A, if they are non-conformant.

Array2D< T > & TNT::operator *= ( Array2D< T > & A,
const Array2D< T > & B )
 

Array multiplication (in place): compute A = A*B, where each A[i][j] is replaced with A[i][j] * B[i][j].

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A*=B, or the original A if if the matrices are non-conformant.

Array1D< T > & TNT::operator *= ( Array1D< T > & A,
const Array1D< T > & B )
 

Array element-wise multiplication (in place): compute A = A*B, where each A[i] is replaced with A[i] * B[i].

Parameters:
A   an array of length n
B   an array of length n
Returns:
the n-length array A*=B, or the original A if if the matrices are non-conformant.

Vector<T> operator+ ( const Vector< T > & A,
const Vector< T > & B )
 

Fortran_Array1D< T > TNT::operator+ ( const Fortran_Array1D< T > & A,
const Fortran_Array1D< T > & B )
 

Array addition: compute C = A+B, where C(i) is the sum of A(i) and B(i).

Parameters:
A   an array of n elements
B   an array of n elements
Returns:
the n array A+B, or a null array (0) if the matrices are non-conformant.

Matrix<T> operator+ ( const Matrix< T > & A,
const Matrix< T > & B )
 

Array3D< T > TNT::operator+ ( const Array3D< T > & A,
const Array3D< T > & B )
 

Array addition: compute C = A+B, where C[i][j][k] is the sum of A[i][j][k] and B[i][j][k].

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A+B, or a null array (0x0x0) if the matrices are non-conformant.

Array2D< T > TNT::operator+ ( const Array2D< T > & A,
const Array2D< T > & B )
 

Array addition: compute C = A+B, where C[i][j] is the sum of A[i][j] and B[i][j].

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A+B, or a null array (0x0) if the matrices are non-conformant.

Array1D< T > TNT::operator+ ( const Array1D< T > & A,
const Array1D< T > & B )
 

Array addition: compute C = A+B, where C[i] is the sum of A[i] and B[i].

Parameters:
A   an array of n elements
B   an array of n elements
Returns:
the n array A+B, or a null array (0) if the matrices are non-conformant.

Fortran_Array1D< T > & TNT::operator+= ( Fortran_Array1D< T > & A,
const Fortran_Array1D< T > & B )
 

Array addition (in place): compute A = A+B, where each A(i) is replaced with A(i) + B(i).

Parameters:
A   an array of length n
B   an array of length n
Returns:
the n-length array A+=B, or the original A if if the matrices are non-conformant.

Array3D< T > & TNT::operator+= ( Array3D< T > & A,
const Array3D< T > & B )
 

Array addition (in place): compute A = A+B, where each A[i][j][k] is replaced by A[i][j][k] + B[i][j][k].

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A+B, or a the original array A, if they are non-conformant.

Array2D< T > & TNT::operator+= ( Array2D< T > & A,
const Array2D< T > & B )
 

Array addition (in place): compute A = A+B, where each A[i][j] is replaced with A[i][j] + B[i][j].

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A+=B, or the original A if if the matrices are non-conformant.

Array1D< T > & TNT::operator+= ( Array1D< T > & A,
const Array1D< T > & B )
 

Array addition (in place): compute A = A+B, where each A[i] is replaced with A[i] + B[i].

Parameters:
A   an array of length n
B   an array of length n
Returns:
the n-length array A+=B, or the original A if if the matrices are non-conformant.

Vector<T> operator- ( const Vector< T > & A,
const Vector< T > & B )
 

Fortran_Array1D< T > TNT::operator- ( const Fortran_Array1D< T > & A,
const Fortran_Array1D< T > & B )
 

Array subtraction: compute C = A-B, where each C(i) is A(i) - B(i).

Parameters:
A   an array of n elements
B   an array of n elements
Returns:
the n array A-B, or a null array (0) if the matrices are non-conformant.

Matrix<T> operator- ( const Matrix< T > & A,
const Matrix< T > & B )
 

Array3D< T > TNT::operator- ( const Array3D< T > & A,
const Array3D< T > & B )
 

Array subtraction: compute C = A-B, where C[i][j][k] is the sum of A[i][j][k] and B[i][j][k].

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A-B, or a null array (0x0x0) if the matrices are non-conformant.

Array2D< T > TNT::operator- ( const Array2D< T > & A,
const Array2D< T > & B )
 

Array subtraction: compute C = A-B, where C[i][j] is A[i][j] - B[i][j].

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A-B, or a null array (0x0) if the matrices are non-conformant.

Array1D< T > TNT::operator- ( const Array1D< T > & A,
const Array1D< T > & B )
 

Array subtraction: compute C = A-B, where each C[i] is A[i] - B[i].

Parameters:
A   an array of n elements
B   an array of n elements
Returns:
the n array A-B, or a null array (0) if the matrices are non-conformant.

Fortran_Array1D< T > & TNT::operator-= ( Fortran_Array1D< T > & A,
const Fortran_Array1D< T > & B )
 

Array subtraction (in place): compute A = A-B, where each A(i) is replaced with A(i) - B(i).

Parameters:
A   an array of length n
B   an array of length n
Returns:
the n-length array A-=B, or the original A if if the matrices are non-conformant.

Array3D< T > & TNT::operator-= ( Array3D< T > & A,
const Array3D< T > & B )
 

Array subtraction (in place): compute A = A-B, where each A[i][j][k] is replaced by A[i][j][k] - B[i][j][k].

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A-B, or a the original array A, if they are non-conformant.

Array2D< T > & TNT::operator-= ( Array2D< T > & A,
const Array2D< T > & B )
 

Array subtraction (in place): compute A = A-B, where each A[i][j] is replaced with A[i][j] - B[i][j].

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A-=B, or the original A if if the matrices are non-conformant.

Array1D< T > & TNT::operator-= ( Array1D< T > & A,
const Array1D< T > & B )
 

Array subtraction (in place): compute A = A-B, where each A[i] is replaced with A[i] - B[i].

Parameters:
A   an array of length n
B   an array of length n
Returns:
the n-length array A-=B, or the original A if if the matrices are non-conformant.

Fortran_Array1D< T > TNT::operator/ ( const Fortran_Array1D< T > & A,
const Fortran_Array1D< T > & B )
 

Array division (element-wise) : compute C = A*B, where each C(i) is A(i) / B(i).

Parameters:
A   an array of n elements
B   an array of n elements
Returns:
the n array A-B, or a null array (0) if the matrices are non-conformant.

Array3D< T > TNT::operator/ ( const Array3D< T > & A,
const Array3D< T > & B )
 

Array division (element-wise): compute C = A/B, where C[i][j][k] is the A[i][j][k] / B[i][j][k].

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A/B, or a null array (0x0x0) if the matrices are non-conformant.

Array2D< T > TNT::operator/ ( const Array2D< T > & A,
const Array2D< T > & B )
 

Array (element-wise) division: compute C = A/B, where C[i][j] is A[i][j] / B[i][j].

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A/B, or a null array (0x0) if the matrices are non-conformant.

Array1D< T > TNT::operator/ ( const Array1D< T > & A,
const Array1D< T > & B )
 

Array division (element-wise) : compute C = A*B, where each C[i] is A[i] / B[i].

Parameters:
A   an array of n elements
B   an array of n elements
Returns:
the n array A-B, or a null array (0) if the matrices are non-conformant.

Fortran_Array1D< T > & TNT::operator/= ( Fortran_Array1D< T > & A,
const Fortran_Array1D< T > & B )
 

Array element-wise division (in place): compute A = A/B, where each A(i) is replaced with A(i) / B(i).

Parameters:
A   an array of length n
B   an array of length n
Returns:
the n-length array A/=B, or the original A if if the matrices are non-conformant.

Array3D< T > & TNT::operator/= ( Array3D< T > & A,
const Array3D< T > & B )
 

Array division (in place): compute A = A/B, where each A[i][j][k] is replaced by A[i][j][k] / B[i][j][k].

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A/B, or a the original array A, if they are non-conformant.

Array2D< T > & TNT::operator/= ( Array2D< T > & A,
const Array2D< T > & B )
 

Array divsion (in place): compute A = A/B, where each A[i][j] is replaced with A[i][j] / B[i][j].

Parameters:
A   an (m x n) array
B   an (m x n) array
Returns:
the (m x n) array A/=B, or the original A if if the matrices are non-conformant.

Array1D< T > & TNT::operator/= ( Array1D< T > & A,
const Array1D< T > & B )
 

Array element-wise division (in place): compute A = A/B, where each A[i] is replaced with A[i] / B[i].

Parameters:
A   an array of length n
B   an array of length n
Returns:
the n-length array A/=B, or the original A if if the matrices are non-conformant.

template<class T>
std::ostream& operator<< ( std::ostream & s,
const Vector< T > & A )
 

template<class T>
std::ostream & TNT::operator<< ( std::ostream & s,
const Fortran_Array3D< T > & A )
 

Write an array to a character outstream. Output format is one that can be read back in via the in-stream operator: three integers denoting the array dimensions (m x n x k), followed by m (n x k) arrays in "row-major" order.

template<class T>
std::ostream & TNT::operator<< ( std::ostream & s,
const Fortran_Array2D< T > & A )
 

Write an array to a character outstream. Output format is one that can be read back in via the in-stream operator: two integers denoting the array dimensions (m x n), followed by m lines of n elements.

template<class T>
std::ostream & TNT::operator<< ( std::ostream & s,
const Fortran_Array1D< T > & A )
 

Write an array to a character outstream. Output format is one that can be read back in via the in-stream operator: one integer denoting the array dimension (n), followed by n elements, one per line.

template<class T>
std::ostream& operator<< ( std::ostream & s,
const Matrix< T > & A )
 

template<class T>
std::ostream & TNT::operator<< ( std::ostream & s,
const Array3D< T > & A )
 

Write an array to a character outstream. Output format is one that can be read back in via the in-stream operator: three integers denoting the array dimensions (m x n x k), followed by m (n x k) arrays.

template<class T>
std::ostream & TNT::operator<< ( std::ostream & s,
const Array2D< T > & A )
 

Write an array to a character outstream. Output format is one that can be read back in via the in-stream operator: two integers denoting the array dimensions (m x n), followed by m lines of n elements.

template<class T>
std::ostream & TNT::operator<< ( std::ostream & s,
const Array1D< T > & A )
 

Write an array to a character outstream. Output format is one that can be read back in via the in-stream operator: one integer denoting the array dimension (n), followed by n elements, one per line.

std::istream& operator>> ( std::istream & s,
Vector< T > & A )
 

std::istream & TNT::operator>> ( std::istream & s,
Fortran_Array3D< T > & A )
 

Read an array from a character stream. Input format is three integers, denoting the dimensions (m x n x k), followed by m*n*k whitespace-separated elments in "row-major" order (i.e. right-most dimension varying fastest.) Newlines are ignored.

Note: the array being read into references new memory storage. If the intent is to fill an existing conformant array, use cin >> B; A.inject(B) ); instead or read the elements in one-a-time by hand.

Parameters:
s   the charater to read from (typically std::in)
A   the array to read into.

std::istream & TNT::operator>> ( std::istream & s,
Fortran_Array2D< T > & A )
 

Read an array from a character stream. Input format is two integers, denoting the dimensions (m x n), followed by m*n whitespace-separated elments in "row-major" order (i.e. right-most dimension varying fastest.) Newlines are ignored.

Note: the array being read into references new memory storage. If the intent is to fill an existing conformant array, use cin >> B; A.inject(B) ); instead or read the elements in one-a-time by hand.

Parameters:
s   the charater to read from (typically std::in)
A   the array to read into.

std::istream & TNT::operator>> ( std::istream & s,
Fortran_Array1D< T > & A )
 

Read an array from a character stream. Input format is one integer, denoting the dimension (n), followed by n whitespace-separated elments. Newlines are ignored

Note: the array being read into references new memory storage. If the intent is to fill an existing conformant array, use cin >> B; A.inject(B) ); instead or read the elements in one-a-time by hand.

Parameters:
s   the charater to read from (typically std::in)
A   the array to read into.

std::istream& operator>> ( std::istream & s,
Matrix< T > & A )
 

std::istream & TNT::operator>> ( std::istream & s,
Array3D< T > & A )
 

Read an array from a character stream. Input format is three integers, denoting the dimensions (m x n x k), followed by m*n*k whitespace-separated elments in "row-major" order (i.e. right-most dimension varying fastest.) Newlines are ignored.

Note: the array being read into references new memory storage. If the intent is to fill an existing conformant array, use cin >> B; A.inject(B) ); instead or read the elements in one-a-time by hand.

Parameters:
s   the charater to read from (typically std::in)
A   the array to read into.

std::istream & TNT::operator>> ( std::istream & s,
Array2D< T > & A )
 

Read an array from a character stream. Input format is two integers, denoting the dimensions (m x n), followed by m*n whitespace-separated elments in "row-major" order (i.e. right-most dimension varying fastest.) Newlines are ignored.

Note: the array being read into references new memory storage. If the intent is to fill an existing conformant array, use cin >> B; A.inject(B) ); instead or read the elements in one-a-time by hand.

Parameters:
s   the charater to read from (typically std::in)
A   the array to read into.

std::istream & TNT::operator>> ( std::istream & s,
Array1D< T > & A )
 

Read an array from a character stream. Input format is one integer, denoting the dimension (n), followed by n whitespace-separated elments. Newlines are ignored

Note: the array being read into references new memory storage. If the intent is to fill an existing conformant array, use cin >> B; A.inject(B) ); instead or read the elements in one-a-time by hand.

Parameters:
s   the charater to read from (typically std::in)
A   the array to read into.

Matrix<T> transpose ( const Matrix< T > & A )
 


Generated at Thu Jun 26 17:26:25 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_array1d_h.html0000644000175000017500000000320007676662370017466 0ustar anibalanibal tnt_array1d.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_array1d.h File Reference

#include <cstdlib>
#include <iostream>

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_array1d_h-source.html0000644000175000017500000001575307676662370021004 0ustar anibalanibal tnt_array1d.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_array1d.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT)
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 
00021 
00022 #ifndef TNT_ARRAY1D_H
00023 #define TNT_ARRAY1D_H
00024 
00025 #include <cstdlib>
00026 #include <iostream>
00027 
00028 #ifdef TNT_BOUNDS_CHECK
00029 #include <assert.h>
00030 #endif
00031 
00032 
00033 
00034 
00035 namespace TNT
00036 {
00037 
00061 template <class T>
00062 class Array1D 
00063 {
00064 
00065   private:
00066 
00067           /* Define private data members here. */
00068 
00069   public:
00070 
00071     typedef         T   value_type;
00072 
00077 
00078                  Array1D();
00079 
00080 
00092         explicit Array1D(int n);
00093 
00094 
00095 
00096 
00105                  Array1D(int n, const T &a);
00106 
00107 
00117                  Array1D(int n,  T *a);
00118 
00119 
00126     inline   Array1D(const Array1D &A);
00127 
00128 
00129 
00130 
00150         inline operator T*();
00151 
00171         inline operator const T*();
00172 
00173 
00177         inline   Array1D & operator=(const T &a);
00178 
00179 
00183         inline   Array1D & operator=(const Array1D &A);
00184 
00185 
00196         inline   Array1D & ref(const Array1D &A);
00197 
00198 
00205                  Array1D copy() const;
00206 
00207 
00208 
00232                      Array1D & inject(const Array1D & A);
00233 
00234 
00240         inline   T& operator[](int i);
00241 
00247         inline   const T& operator[](int i) const;
00248 
00249 
00254         inline   int dim1() const;
00255 
00260         inline   int dim() const;
00261 
00262 
00266                ~Array1D();
00267 
00268 
00269 /* EXTEND INTERFACE: ADD OTHER FUNCTIONS HERE */        
00270 
00271 };
00272 
00273 
00274 } /* namespace TNT */
00275 
00276 #endif
00277 /* TNT_ARRAY1D_H */
00278 

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_array1d_utils_h.html0000644000175000017500000000322107676662370020711 0ustar anibalanibal tnt_array1d_utils.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_array1d_utils.h File Reference

#include <cstdlib>
#include <cassert>

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_array1d_utils_h-source.html0000644000175000017500000001246107676662370022215 0ustar anibalanibal tnt_array1d_utils.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_array1d_utils.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT)
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 #ifndef TNT_ARRAY1D_UTILS_H
00021 #define TNT_ARRAY1D_UTILS_H
00022 
00023 #include <cstdlib>
00024 #include <cassert>
00025 
00026 namespace TNT
00027 {
00028 
00029 
00037 template <class T>
00038 std::ostream& operator<<(std::ostream &s, const Array1D<T> &A);
00039 
00054 template <class T>
00055 std::istream& operator>>(std::istream &s, Array1D<T> &A);
00056 
00068 template <class T>
00069 Array1D<T> operator+(const Array1D<T> &A, const Array1D<T> &B);
00070 
00071 
00083 template <class T>
00084 Array1D<T> operator-(const Array1D<T> &A, const Array1D<T> &B);
00085 
00086 
00098 template <class T>
00099 Array1D<T> operator*(const Array1D<T> &A, const Array1D<T> &B);
00100 
00112 template <class T>
00113 Array1D<T> operator/(const Array1D<T> &A, const Array1D<T> &B);
00114 
00115 
00116 
00117 
00118 
00119 
00120 
00132 template <class T>
00133 Array1D<T>&  operator+=(Array1D<T> &A, const Array1D<T> &B);
00134 
00135 
00147 template <class T>
00148 Array1D<T>&  operator-=(Array1D<T> &A, const Array1D<T> &B);
00149 
00150 
00162 template <class T>
00163 Array1D<T>&  operator*=(Array1D<T> &A, const Array1D<T> &B);
00164 
00176 template <class T>
00177 Array1D<T>&  operator/=(Array1D<T> &A, const Array1D<T> &B);
00178 
00179 
00180 
00181 
00182 
00183 } // namespace TNT
00184 
00185 #endif

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_array2d_h.html0000644000175000017500000000320007676662370017467 0ustar anibalanibal tnt_array2d.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_array2d.h File Reference

#include <cstdlib>
#include <iostream>

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_array2d_h-source.html0000644000175000017500000001570307676662370021000 0ustar anibalanibal tnt_array2d.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_array2d.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT)
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 
00021 
00022 #ifndef TNT_ARRAY2D_INTERFACE_H
00023 #define TNT_ARRAY2D_INTERFACE_H
00024 
00025 #include <cstdlib>
00026 #include <iostream>
00027 #ifdef TNT_BOUNDS_CHECK
00028 #include <assert.h>
00029 #endif
00030 
00031 
00032 namespace TNT
00033 {
00034 
00059 template <class T>
00060 class Array2D 
00061 {
00062 
00063 
00064   private:
00065 
00066         /* define private members here */
00067 
00068 
00069         
00070 
00071   public:
00072 
00086     typedef         T   value_type;
00087 
00092                Array2D();
00093 
00094 
00101                Array2D(int m, int n);
00102 
00103 
00104 
00116                Array2D(int m, int n,  T *a);
00117 
00118 
00128                Array2D(int m, int n, const T &a);
00129 
00130 
00131 
00132 
00145     inline Array2D(const Array2D &A);
00146 
00147 
00148 
00149 
00169 inline operator T**();
00170 
00171 
00172 
00192 inline operator const T**();
00193 
00194 
00198         inline Array2D & operator=(const T &a);
00199 
00200 
00204         inline Array2D & operator=(const Array2D &A);
00205 
00206 
00207 
00218         inline Array2D & ref(const Array2D &A);
00219 
00220 
00221 
00228                Array2D copy() const;
00229 
00230 
00231 
00255                    Array2D & inject(const Array2D & A);
00256 
00257 
00269         inline T* operator[](int i);
00270         inline const T* operator[](int i) const;
00271 
00276         inline int dim1() const;
00277 
00278 
00283         inline int dim2() const;
00284  
00291      ~Array2D();
00292 
00293 
00294 
00295 
00296 
00297 };
00298 
00299 
00300 
00301 
00302 
00303 } /* namespace TNT */
00304 
00305 #endif
00306 /* TNT_ARRAY2D_INTERFACE_H */
00307 

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_array2d_utils_h.html0000644000175000017500000000322107676662370020712 0ustar anibalanibal tnt_array2d_utils.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_array2d_utils.h File Reference

#include <cstdlib>
#include <cassert>

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_array2d_utils_h-source.html0000644000175000017500000001455307676662370022222 0ustar anibalanibal tnt_array2d_utils.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_array2d_utils.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT)
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 
00021 #ifndef TNT_ARRAY2D_UTILS_H
00022 #define TNT_ARRAY2D_UTILS_H
00023 
00024 #include <cstdlib>
00025 #include <cassert>
00026 
00027 namespace TNT
00028 {
00029 
00030 
00038 template <class T>
00039 std::ostream& operator<<(std::ostream &s, const Array2D<T> &A)
00040 {
00041     int M=A.dim1();
00042     int N=A.dim2();
00043 
00044     s << M << " " << N << "\n";
00045 
00046     for (int i=0; i<M; i++)
00047     {
00048         for (int j=0; j<N; j++)
00049         {
00050             s << A[i][j] << " ";
00051         }
00052         s << "\n";
00053     }
00054 
00055 
00056     return s;
00057 }
00058 
00075 template <class T>
00076 std::istream& operator>>(std::istream &s, Array2D<T> &A);
00077 
00089 template <class T>
00090 Array2D<T> operator+(const Array2D<T> &A, const Array2D<T> &B);
00091 
00103 template <class T>
00104 Array2D<T> operator-(const Array2D<T> &A, const Array2D<T> &B);
00105 
00118 template <class T>
00119 Array2D<T> operator*(const Array2D<T> &A, const Array2D<T> &B);
00120 
00121 
00122 
00134 template <class T>
00135 Array2D<T> operator/(const Array2D<T> &A, const Array2D<T> &B);
00136 
00137 
00138 
00139 
00140 
00152 template <class T>
00153 Array2D<T>&  operator+=(Array2D<T> &A, const Array2D<T> &B);
00154 
00155 
00156 
00168 template <class T>
00169 Array2D<T>&  operator-=(Array2D<T> &A, const Array2D<T> &B);
00170 
00171 
00172 
00184 template <class T>
00185 Array2D<T>&  operator*=(Array2D<T> &A, const Array2D<T> &B);
00186 
00187 
00188 
00189 
00190 
00202 template <class T>
00203 Array2D<T>&  operator/=(Array2D<T> &A, const Array2D<T> &B);
00204 
00218 template <class T>
00219 Array2D<T> matmult(const Array2D<T> &A, const Array2D<T> &B);
00220 
00221 } // namespace TNT
00222 
00223 #endif

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_array3d_h.html0000644000175000017500000000320007676662370017470 0ustar anibalanibal tnt_array3d.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_array3d.h File Reference

#include <cstdlib>
#include <iostream>

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_array3d_h-source.html0000644000175000017500000002240707676662370021000 0ustar anibalanibal tnt_array3d.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_array3d.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT): Three-dimensional numerical array
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 
00021 
00022 #ifndef TNT_ARRAY3D_H
00023 #define TNT_ARRAY3D_H
00024 
00025 #include <cstdlib>
00026 #include <iostream>
00027 #ifdef TNT_BOUNDS_CHECK
00028 #include <assert.h>
00029 #endif
00030 
00031 namespace TNT
00032 {
00033 
00059 template <class T>
00060 class Array3D 
00061 {
00062 
00063 
00064   private:
00065 
00066   public:
00067 
00068     typedef         T   value_type;
00069 
00070                Array3D();
00071                Array3D(int m, int n, int k);
00072                Array3D(int m, int n, int k,  T *a);
00073                Array3D(int m, int n, int k, const T &a);
00074     inline Array3D(const Array3D &A);
00075         inline Array3D & operator=(const T &a);
00076         inline Array3D & operator=(const Array3D &A);
00077         inline Array3D & ref(const Array3D &A);
00078                Array3D copy() const;
00079                    Array3D & inject(const Array3D & A);
00080         inline T** operator[](int i);
00081         inline const T* const * operator[](int i) const;
00082         inline int dim1() const;
00083         inline int dim2() const;
00084         inline int dim3() const;
00085                ~Array3D();
00086 
00087 
00088 };
00089 
00093 template <class T>
00094 Array3D<T>::Array3D();
00095 
00096 
00103 template <class T>
00104 Array3D<T>::Array3D(const Array3D<T> &A);
00105 
00106 
00107 
00120 template <class T>
00121 Array3D<T>::Array3D(int m, int n, int k);
00122 
00123 
00124 
00135 template <class T>
00136 Array3D<T>::Array3D(int m, int n, int k, const T &val);
00137 
00152 template <class T>
00153 Array3D<T>::Array3D(int m, int n, int k, T *a) ; 
00154 
00155 
00165 template <class T>
00166 inline T** Array3D<T>::operator[](int i) ;
00167 
00168 template <class T>
00169 inline const T* const * Array3D<T>::operator[](int i) const;
00170 
00174 template <class T>
00175 Array3D<T> & Array3D<T>::operator=(const T &a);
00176 
00177 
00184 template <class T>
00185 Array3D<T> Array3D<T>::copy() const;
00186 
00187 
00211 template <class T>
00212 Array3D<T> & Array3D<T>::inject(const Array3D &A);
00213 
00214 
00215 
00216 
00227 template <class T>
00228 Array3D<T> & Array3D<T>::ref(const Array3D<T> &A);
00229 
00230 
00234 template <class T>
00235 Array3D<T> & Array3D<T>::operator=(const Array3D<T> &A);
00236 
00240 template <class T>
00241 inline int Array3D<T>::dim1() const ;
00242 
00246 template <class T>
00247 inline int Array3D<T>::dim2() const ;
00248 
00252 template <class T>
00253 inline int Array3D<T>::dim3() const ;
00254 
00255 
00256 
00257 template <class T>
00258 Array3D<T>::~Array3D()
00259 
00260 
00261 } /* namespace TNT */
00262 
00263 #endif
00264 /* TNT_ARRAY3D_H */
00265 

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_array3d_utils_h.html0000644000175000017500000000322107676662370020713 0ustar anibalanibal tnt_array3d_utils.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_array3d_utils.h File Reference

#include <cstdlib>
#include <cassert>

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_array3d_utils_h-source.html0000644000175000017500000001001107676662370022204 0ustar anibalanibal tnt_array3d_utils.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_array3d_utils.h

Go to the documentation of this file.
00001 
00002 
00003 #ifndef TNT_ARRAY3D_UTILS_H
00004 #define TNT_ARRAY3D_UTILS_H
00005 
00006 #include <cstdlib>
00007 #include <cassert>
00008 
00009 namespace TNT
00010 {
00011 
00012 
00020 template <class T>
00021 std::ostream& operator<<(std::ostream &s, const Array3D<T> &A);
00022 
00039 template <class T>
00040 std::istream& operator>>(std::istream &s, Array3D<T> &A);
00041 
00042 
00043 
00055 template <class T>
00056 Array3D<T> operator+(const Array3D<T> &A, const Array3D<T> &B);
00057 
00058 
00070 template <class T>
00071 Array3D<T> operator-(const Array3D<T> &A, const Array3D<T> &B);
00072 
00073 
00074 
00086 template <class T>
00087 Array3D<T> operator*(const Array3D<T> &A, const Array3D<T> &B);
00088 
00100 template <class T>
00101 Array3D<T> operator/(const Array3D<T> &A, const Array3D<T> &B);
00102 
00103 
00115 template <class T>
00116 Array3D<T>& operator+=(Array3D<T> &A, const Array3D<T> &B);
00117 
00118 
00130 template <class T>
00131 Array3D<T>& operator-=(Array3D<T> &A, const Array3D<T> &B);
00132 
00144 template <class T>
00145 Array3D<T>& operator*=(Array3D<T> &A, const Array3D<T> &B);
00146 
00158 template <class T>
00159 Array3D<T>& operator/=(Array3D<T> &A, const Array3D<T> &B);
00160 
00161 
00162 
00163 
00164 } // namespace TNT
00165 
00166 #endif

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_cmat_h.html0000644000175000017500000000360307676662370017056 0ustar anibalanibal tnt_cmat.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_cmat.h File Reference

#include "tnt_subscript.h"
#include "tnt_vec.h"
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <strstream>

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_cmat_h-source.html0000644000175000017500000003107707676662370020362 0ustar anibalanibal tnt_cmat.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_cmat.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT)
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 
00021 
00022 #ifndef TNT_CMAT_H
00023 #define TNT_CMAT_H
00024 
00025 #include "tnt_subscript.h"
00026 #include "tnt_vec.h"
00027 #include <cstdlib>
00028 #include <cassert>
00029 #include <iostream>
00030 #include <strstream>
00031 
00032 namespace TNT
00033 {
00034 
00042 
00043 template <class T>
00044 class Matrix 
00045 {
00046 
00047 
00048   public:
00049 
00050     typedef Subscript   size_type;
00051     typedef         T   value_type;
00052     typedef         T   element_type;
00053     typedef         T*  pointer;
00054     typedef         T*  iterator;
00055     typedef         T&  reference;
00056     typedef const   T*  const_iterator;
00057     typedef const   T&  const_reference;
00058 
00059     Subscript lbound() const { return 1;}
00060  
00061   protected:
00062     Subscript m_;
00063     Subscript n_;
00064     Subscript mn_;      // total size
00065     T* v_;                  
00066     T** row_;           
00067     T* vm1_ ;       // these point to the same data, but are 1-based 
00068     T** rowm1_;
00069 
00070   public:
00071 
00072     operator T**(){ return  row_; }
00073     operator T**() const { return row_; }
00074 
00075 
00076     Subscript size() const { return mn_; }
00077 
00078     // constructors
00079 
00080     Matrix();
00081 
00082     Matrix(const Matrix<T> &A);
00083 
00084     Matrix(Subscript M, Subscript N, const T& value = T());
00085 
00086     Matrix(Subscript M, Subscript N, const T* v);
00087 
00088     Matrix(Subscript M, Subscript N, const char *s);
00089 
00090     ~Matrix();
00091 
00092 
00093     Matrix<T>& newsize(Subscript M, Subscript N);
00094 
00095 
00096 
00097     Matrix<T>& operator=(const Matrix<T> &A);
00098         
00099     Matrix<T>& operator=(const T& scalar);
00100 
00101 
00102     Subscript dim(Subscript d) const ;
00103     Subscript num_rows() const { return m_; }
00104     Subscript num_cols() const { return n_; }
00105 
00106 
00107 
00108 
00109     inline T* operator[](Subscript i);
00110 
00111     inline const T* operator[](Subscript i) const;
00112 
00113     inline reference operator()(Subscript i);
00114 
00115     inline const_reference operator()(Subscript i) const;
00116 
00117 
00118     inline reference operator()(Subscript i, Subscript j);
00119 
00120 
00121     
00122     inline const_reference operator() (Subscript i, Subscript j) const;
00123 
00124 
00125 };
00126 
00127 
00128 /* ***************************  I/O  ********************************/
00129 
00130 template <class T>
00131 std::ostream& operator<<(std::ostream &s, const Matrix<T> &A);
00132 
00133 template <class T>
00134 std::istream& operator>>(std::istream &s, Matrix<T> &A);
00135 
00136 // *******************[ basic matrix algorithms ]***************************
00137 
00138 
00139 template <class T>
00140 Matrix<T> operator+(const Matrix<T> &A, const Matrix<T> &B);
00141 
00142 template <class T> 
00143 Matrix<T> operator-(const Matrix<T> &A, const Matrix<T> &B);
00144 
00145 template <class T> 
00146 Matrix<T> mult_element(const Matrix<T> &A, const Matrix<T> &B);
00147 
00148 
00149 template <class T>
00150 Matrix<T> transpose(const Matrix<T> &A);
00151 
00152 
00153     
00154 template <class T>
00155 inline Matrix<T> matmult(const Matrix<T>  &A, const Matrix<T> &B);
00156 
00157 template <class T>
00158 inline Matrix<T> operator*(const Matrix<T>  &A, const Matrix<T> &B);
00159 
00160 template <class T>
00161 inline int matmult(Matrix<T>& C, const Matrix<T>  &A, const Matrix<T> &B);
00162 
00163 
00164 template <class T>
00165 Vector<T> matmult(const Matrix<T>  &A, const Vector<T> &x);
00166 
00167 template <class T>
00168 inline Vector<T> operator*(const Matrix<T>  &A, const Vector<T> &x) ;
00169 
00170 } // namespace TNT
00171 
00172 #endif
00173 // CMAT_H

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_fortran_array1d_h.html0000644000175000017500000000336507676662370021235 0ustar anibalanibal tnt_fortran_array1d.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_fortran_array1d.h File Reference

#include <cstdlib>
#include <iostream>
#include "tnt_array1d.h"

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_fortran_array1d_h-source.html0000644000175000017500000002232707676662370022532 0ustar anibalanibal tnt_fortran_array1d.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_fortran_array1d.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT): One-dimensional Fortran numerical array
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 
00021 
00022 #ifndef TNT_FORTRAN_ARRAY1D_H
00023 #define TNT_FORTRAN_ARRAY1D_H
00024 
00025 #include <cstdlib>
00026 #include <iostream>
00027 #ifdef TNT_BOUNDS_CHECK
00028 #include <assert.h>
00029 #endif
00030 #include "tnt_array1d.h"
00031 
00032 namespace TNT
00033 {
00034 
00058 template <class T>
00059 class Fortran_Array1D 
00060 {
00061 
00062 
00063   public:
00064 
00065     typedef         T   value_type;
00066 
00067                Fortran_Array1D();
00068                Fortran_Array1D(int n);
00069                Fortran_Array1D(int n,  T *a);
00070                Fortran_Array1D(int n, const T &a);
00071     inline Fortran_Array1D(const Fortran_Array1D &A);
00072         inline Fortran_Array1D & operator=(const T &a);
00073         inline Fortran_Array1D & operator=(const Fortran_Array1D &A);
00074         inline Fortran_Array1D & ref(const Fortran_Array1D &A);
00075                Fortran_Array1D copy() const;
00076                    Fortran_Array1D & inject(const Fortran_Array1D & A);
00077         inline T& operator()(int i);
00078         inline const T& operator()(int i) const ;
00079         inline int dim() const;
00080         inline int dim1() const;
00081         inline int ref_count() const;
00082                ~Fortran_Array1D();
00083 
00084 
00085 };
00086 
00090 template <class T>
00091 Fortran_Array1D<T>::Fortran_Array1D();
00092 
00093 
00100 template <class T>
00101 Fortran_Array1D<T>::Fortran_Array1D(const Fortran_Array1D<T> &A);
00102 
00103 
00104 
00115 template <class T>
00116 Fortran_Array1D<T>::Fortran_Array1D(int n);
00117 
00118 
00119 
00128 template <class T>
00129 Fortran_Array1D<T>::Fortran_Array1D(int n, const T &val);
00130 
00131 
00142 template <class T>
00143 Fortran_Array1D<T>::Fortran_Array1D(int n, T *a);
00144 
00145 
00146 
00147 
00155 template <class T>
00156 inline T& Fortran_Array1D<T>::operator()(int i) ;
00157 
00165 template <class T>
00166 inline const T& Fortran_Array1D<T>::operator()(int i)  const;
00167 
00168 
00172 template <class T>
00173 Fortran_Array1D<T> & Fortran_Array1D<T>::operator=(const T &a);
00174 
00181 template <class T>
00182 Fortran_Array1D<T> Fortran_Array1D<T>::copy() const;
00183 
00207 template <class T>
00208 Fortran_Array1D<T> & Fortran_Array1D<T>::inject(const Fortran_Array1D &A);
00209 
00210 
00211 
00212 
00213 
00224 template <class T>
00225 Fortran_Array1D<T> & Fortran_Array1D<T>::ref(const Fortran_Array1D<T> &A);
00226 
00230 template <class T>
00231 Fortran_Array1D<T> & Fortran_Array1D<T>::operator=(const Fortran_Array1D<T> &A);
00232 
00236 template <class T>
00237 inline int Fortran_Array1D<T>::dim1() const ;
00238 
00239 
00243 template <class T>
00244 inline int Fortran_Array1D<T>::dim() const ; 
00245 
00246 
00247 
00248 
00249 template <class T>
00250 Fortran_Array1D<T>::~Fortran_Array1D();
00251 
00252 
00253 
00254 
00255 } /* namespace TNT */
00256 
00257 #endif
00258 /* TNT_FORTRAN_ARRAY1D_H */
00259 

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_fortran_array1d_utils_h.html0000644000175000017500000000320007676662370022441 0ustar anibalanibal tnt_fortran_array1d_utils.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_fortran_array1d_utils.h File Reference

#include <iostream>

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_fortran_array1d_utils_h-source.html0000644000175000017500000001307507676662370023752 0ustar anibalanibal tnt_fortran_array1d_utils.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_fortran_array1d_utils.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT)
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 #ifndef TNT_FORTRAN_ARRAY1D_UTILS_H
00021 #define TNT_FORTRAN_ARRAY1D_UTILS_H
00022 
00023 #include <iostream>
00024 
00025 namespace TNT
00026 {
00027 
00028 
00036 template <class T>
00037 std::ostream& operator<<(std::ostream &s, const Fortran_Array1D<T> &A);
00038 
00053 template <class T>
00054 std::istream& operator>>(std::istream &s, Fortran_Array1D<T> &A);
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00074 template <class T>
00075 Fortran_Array1D<T> operator+(const Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B);
00076 
00077 
00089 template <class T>
00090 Fortran_Array1D<T> operator-(const Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B);
00091 
00092 
00104 template <class T>
00105 Fortran_Array1D<T> operator*(const Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B);
00106 
00118 template <class T>
00119 Fortran_Array1D<T> operator/(const Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B);
00120 
00121 
00122 
00123 
00124 
00125 
00126 
00138 template <class T>
00139 Fortran_Array1D<T>&  operator+=(Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B);
00140 
00141 
00153 template <class T>
00154 Fortran_Array1D<T>&  operator-=(Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B);
00155 
00156 
00168 template <class T>
00169 Fortran_Array1D<T>&  operator*=(Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B);
00170 
00182 template <class T>
00183 Fortran_Array1D<T>&  operator/=(Fortran_Array1D<T> &A, const Fortran_Array1D<T> &B);
00184 
00185 
00186 
00187 
00188 
00189 
00190 
00191 
00192 
00193 
00194 } // namespace TNT
00195 
00196 #endif

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_fortran_array2d_h.html0000644000175000017500000000336507676662370021236 0ustar anibalanibal tnt_fortran_array2d.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_fortran_array2d.h File Reference

#include <cstdlib>
#include <iostream>
#include "tnt_array2d.h"

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_fortran_array2d_h-source.html0000644000175000017500000002343207676662370022531 0ustar anibalanibal tnt_fortran_array2d.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_fortran_array2d.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT): Two-dimensional Fortran numerical array
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 
00021 
00022 #ifndef TNT_FORTRAN_ARRAY2D_H
00023 #define TNT_FORTRAN_ARRAY2D_H
00024 
00025 #include <cstdlib>
00026 #include <iostream>
00027 
00028 #ifdef TNT_BOUNDS_CHECK
00029 #include <assert.h>
00030 #endif
00031 
00032 #include "tnt_array2d.h"
00033 
00034 namespace TNT
00035 {
00036 
00062 template <class T>
00063 class Fortran_Array2D 
00064 {
00065 
00066 
00067 
00068   public:
00069 
00070     typedef         T   value_type;
00071 
00072                Fortran_Array2D();
00073                Fortran_Array2D(int m, int n);
00074                Fortran_Array2D(int m, int n,  T *a);
00075                Fortran_Array2D(int m, int n, const T &a);
00076     inline Fortran_Array2D(const Fortran_Array2D &A);
00077         inline Fortran_Array2D & operator=(const T &a);
00078         inline Fortran_Array2D & operator=(const Fortran_Array2D &A);
00079         inline Fortran_Array2D & ref(const Fortran_Array2D &A);
00080                Fortran_Array2D copy() const;
00081                    Fortran_Array2D & inject(const Fortran_Array2D & A);
00082         inline T& operator()(int i, int j);
00083         inline const T& operator()(int i, int j) const ;
00084         inline int dim1() const;
00085         inline int dim2() const;
00086         inline int ref_count() const;
00087                ~Fortran_Array2D();
00088 
00089 
00090 };
00091 
00095 template <class T>
00096 Fortran_Array2D<T>::Fortran_Array2D();
00097 
00098 
00105 template <class T>
00106 Fortran_Array2D<T>::Fortran_Array2D(const Fortran_Array2D<T> &A);
00107 
00108 
00109 
00121 template <class T>
00122 Fortran_Array2D<T>::Fortran_Array2D(int m, int n);
00123 
00124 
00125 
00135 template <class T>
00136 Fortran_Array2D<T>::Fortran_Array2D(int m, int n, const T &val);
00137 
00138 
00153 template <class T>
00154 Fortran_Array2D<T>::Fortran_Array2D(int m, int n, T *a);
00155 
00156 
00157 
00158 
00166 template <class T>
00167 inline T& Fortran_Array2D<T>::operator()(int i, int j) ;
00168 
00176 template <class T>
00177 inline const T& Fortran_Array2D<T>::operator()(int i, int j)  const;
00178 
00179 
00183 template <class T>
00184 Fortran_Array2D<T> & Fortran_Array2D<T>::operator=(const T &a);
00185 
00186 
00193 template <class T>
00194 Fortran_Array2D<T> Fortran_Array2D<T>::copy() const;
00195 
00196 
00220 template <class T>
00221 Fortran_Array2D<T> & Fortran_Array2D<T>::inject(const Fortran_Array2D &A);
00222 
00223 
00224 
00225 
00226 
00237 template <class T>
00238 Fortran_Array2D<T> & Fortran_Array2D<T>::ref(const Fortran_Array2D<T> &A);
00239 
00243 template <class T>
00244 Fortran_Array2D<T> & Fortran_Array2D<T>::operator=(const Fortran_Array2D<T> &A);
00245 
00249 template <class T>
00250 inline int Fortran_Array2D<T>::dim1() const ;
00251 
00255 template <class T>
00256 inline int Fortran_Array2D<T>::dim2() const ;
00257 
00258 
00259 
00264 template <class T>
00265 inline int Fortran_Array2D<T>::ref_count() ;
00266 
00267 template <class T>
00268 Fortran_Array2D<T>::~Fortran_Array2D();
00269 
00270 
00271 
00272 
00273 } /* namespace TNT */
00274 
00275 #endif
00276 /* TNT_FORTRAN_ARRAY2D_H */
00277 

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_fortran_array2d_utils_h.html0000644000175000017500000000320007676662370022442 0ustar anibalanibal tnt_fortran_array2d_utils.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_fortran_array2d_utils.h File Reference

#include <iostream>

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_fortran_array2d_utils_h-source.html0000644000175000017500000001165407676662370023754 0ustar anibalanibal tnt_fortran_array2d_utils.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_fortran_array2d_utils.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT)
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 
00021 #ifndef TNT_FORTRAN_ARRAY2D_UTILS_H
00022 #define TNT_FORTRAN_ARRAY2D_UTILS_H
00023 
00024 #include <iostream>
00025 
00026 namespace TNT
00027 {
00028 
00029 
00037 template <class T>
00038 std::ostream& operator<<(std::ostream &s, const Fortran_Array2D<T> &A)
00039 {
00040     int M=A.dim1();
00041     int N=A.dim2();
00042 
00043     s << M << " " << N << "\n";
00044 
00045     for (int i=1; i<=M; i++)
00046     {
00047         for (int j=1; j<=N; j++)
00048         {
00049             s << A(i,j) << " ";
00050         }
00051         s << "\n";
00052     }
00053 
00054 
00055     return s;
00056 }
00057 
00074 template <class T>
00075 std::istream& operator>>(std::istream &s, Fortran_Array2D<T> &A)
00076 {
00077 
00078     int M, N;
00079 
00080     s >> M >> N;
00081 
00082         Fortran_Array2D<T> B(M,N);
00083 
00084     for (int i=1; i<=M; i++)
00085         for (int j=1; j<=N; j++)
00086         {
00087             s >>  B(i,j);
00088         }
00089 
00090         A = B;
00091     return s;
00092 }
00093 
00094 
00095 
00096 
00097 } // namespace TNT
00098 
00099 #endif

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_fortran_array3d_h.html0000644000175000017500000000336507676662370021237 0ustar anibalanibal tnt_fortran_array3d.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_fortran_array3d.h File Reference

#include <cstdlib>
#include <iostream>
#include "tnt_array3d.h"

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_fortran_array3d_h-source.html0000644000175000017500000002514007676662370022530 0ustar anibalanibal tnt_fortran_array3d.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_fortran_array3d.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT): Three-dimensional Fortran numerical array
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 
00021 
00022 #ifndef TNT_FORTRAN_ARRAY3D_H
00023 #define TNT_FORTRAN_ARRAY3D_H
00024 
00025 #include <cstdlib>
00026 #include <iostream>
00027 #ifdef TNT_BOUNDS_CHECK
00028 #include <assert.h>
00029 #endif
00030 #include "tnt_array3d.h"
00031 
00032 namespace TNT
00033 {
00034 
00060 template <class T>
00061 class Fortran_Array3D 
00062 {
00063 
00064 
00065   private: 
00066 
00067 
00068 
00069   public:
00070 
00071     typedef         T   value_type;
00072 
00073                Fortran_Array3D();
00074                Fortran_Array3D(int m, int n, int k);
00075                Fortran_Array3D(int m, int n, int k,  T *a);
00076                Fortran_Array3D(int m, int n, int k, const T &a);
00077     inline Fortran_Array3D(const Fortran_Array3D &A);
00078         inline Fortran_Array3D & operator=(const T &a);
00079         inline Fortran_Array3D & operator=(const Fortran_Array3D &A);
00080         inline Fortran_Array3D & ref(const Fortran_Array3D &A);
00081                Fortran_Array3D copy() const;
00082                    Fortran_Array3D & inject(const Fortran_Array3D & A);
00083         inline T& operator()(int i, int j, int k);
00084         inline const T& operator()(int i, int j, int k) const ;
00085         inline int dim1() const;
00086         inline int dim2() const;
00087         inline int dim3() const;
00088         inline int ref_count() const;
00089                ~Fortran_Array3D();
00090 
00091 
00092 };
00093 
00097 template <class T>
00098 Fortran_Array3D<T>::Fortran_Array3D();
00099 
00100 
00107 template <class T>
00108 Fortran_Array3D<T>::Fortran_Array3D(const Fortran_Array3D<T> &A);
00109 
00110 
00111 
00124 template <class T>
00125 Fortran_Array3D<T>::Fortran_Array3D(int m, int n, int k);
00126 
00127 
00128 
00139 template <class T>
00140 Fortran_Array3D<T>::Fortran_Array3D(int m, int n, int k, const T &val) ; 
00141 
00142 
00156 template <class T>
00157 Fortran_Array3D<T>::Fortran_Array3D(int m, int n, int k, T *a)  ;
00158 
00159 
00160 
00161 
00169 template <class T>
00170 inline T& Fortran_Array3D<T>::operator()(int i, int j, int k) ;
00171 
00179 template <class T>
00180 inline const T& Fortran_Array3D<T>::operator()(int i, int j, int k)  const;
00181 
00182 
00186 template <class T>
00187 Fortran_Array3D<T> & Fortran_Array3D<T>::operator=(const T &a);
00188 
00189 
00196 template <class T>
00197 Fortran_Array3D<T> Fortran_Array3D<T>::copy() const;
00198 
00222 template <class T>
00223 Fortran_Array3D<T> & Fortran_Array3D<T>::inject(const Fortran_Array3D &A);
00224 
00225 
00226 
00227 
00228 
00239 template <class T>
00240 Fortran_Array3D<T> & Fortran_Array3D<T>::ref(const Fortran_Array3D<T> &A);
00241 
00245 template <class T>
00246 Fortran_Array3D<T> & Fortran_Array3D<T>::operator=(const Fortran_Array3D<T> &A);
00247 
00251 template <class T>
00252 inline int Fortran_Array3D<T>::dim1() const;
00253 
00257 template <class T>
00258 inline int Fortran_Array3D<T>::dim2() const ;
00259 
00263 template <class T>
00264 inline int Fortran_Array3D<T>::dim3() const ;
00265 
00266 
00271 template <class T>
00272 inline int Fortran_Array3D<T>::ref_count() const;
00273 
00274 template <class T>
00275 Fortran_Array3D<T>::~Fortran_Array3D();
00276 
00277 
00278 } /* namespace TNT */
00279 
00280 #endif
00281 /* TNT_FORTRAN_ARRAY3D_H */
00282 

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_fortran_array3d_utils_h.html0000644000175000017500000000325107676662370022451 0ustar anibalanibal tnt_fortran_array3d_utils.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_fortran_array3d_utils.h File Reference

#include <cstdlib>
#include <cassert>

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_fortran_array3d_utils_h-source.html0000644000175000017500000001265007676662370023752 0ustar anibalanibal tnt_fortran_array3d_utils.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_fortran_array3d_utils.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT)
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 
00021 #ifndef TNT_FORTRAN_ARRAY3D_UTILS_H
00022 #define TNT_FORTRAN_ARRAY3D_UTILS_H
00023 
00024 #include <cstdlib>
00025 #include <cassert>
00026 
00027 namespace TNT
00028 {
00029 
00030 
00038 template <class T>
00039 std::ostream& operator<<(std::ostream &s, const Fortran_Array3D<T> &A)
00040 {
00041     int M=A.dim1();
00042     int N=A.dim2();
00043     int K=A.dim3();
00044 
00045     s << M << " " << N << " " << K << "\n";
00046 
00047     for (int i=1; i<=M; i++)
00048     {
00049         for (int j=1; j<=N; j++)
00050         {
00051                         for (int k=1; k<=K; k++)
00052                 s << A(i,j,k) << " ";
00053                         s << "\n";
00054         }
00055         s << "\n";
00056     }
00057 
00058 
00059     return s;
00060 }
00061 
00078 template <class T>
00079 std::istream& operator>>(std::istream &s, Fortran_Array3D<T> &A)
00080 {
00081 
00082     int M, N, K;
00083 
00084     s >> M >> N >> K;
00085 
00086         Fortran_Array3D<T> B(M,N,K);
00087 
00088     for (int i=1; i<=M; i++)
00089         for (int j=1; j<=N; j++)
00090                         for (int k=1; k<=K; k++)
00091                 s >>  B(i,j,k);
00092 
00093         A = B;
00094     return s;
00095 }
00096 
00097 
00098 
00099 
00100 } // namespace TNT
00101 
00102 #endif

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_math_utils_h.html0000644000175000017500000000313507676662370020303 0ustar anibalanibal tnt_math_utils.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_math_utils.h File Reference

#include <math.h>

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:15 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_math_utils_h-source.html0000644000175000017500000000757207676662370021612 0ustar anibalanibal tnt_math_utils.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_math_utils.h

Go to the documentation of this file.
00001 #ifndef MATH_UTILS_H
00002 #define MATH_UTILS_H
00003 
00004 #include <math.h>
00005 /* needed for sqrt() below */
00006 
00007 
00008 
00009 namespace TNT
00010 {
00017 template <class Real>
00018 Real hypot(const Real &a, const Real &b)
00019 {
00020         
00021         if (a== 0)
00022                 return abs(b);
00023         else
00024         {
00025                 Real c = b/a;
00026                 return abs(a) * sqrt(1 + c*c);
00027         }
00028 }
00029 
00033 template <class Scalar>
00034 Scalar min(const Scalar &a, const Scalar &b)
00035 {
00036         return  a < b ? a : b;
00037 }
00038 
00042 template <class Scalar>
00043 Scalar max(const Scalar &a, const Scalar &b)
00044 {
00045         return  a > b ? a : b;
00046 }
00047 
00051 template <class Real>
00052 Real abs(const Real &a)
00053 {
00054         return  (a > 0 ? a : -a);
00055 }
00056 
00057 }
00058 
00059 
00060 
00061 
00062 #endif
00063 /* MATH_UTILS_H */

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_sparse_matrix_csr_h.html0000644000175000017500000000311107676662370021654 0ustar anibalanibal tnt_sparse_matrix_csr.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_sparse_matrix_csr.h File Reference

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:15 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_sparse_matrix_csr_h-source.html0000644000175000017500000001371407676662370023164 0ustar anibalanibal tnt_sparse_matrix_csr.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_sparse_matrix_csr.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT)
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 
00021 #ifndef TNT_SPARSE_MATRIX_CSR_H
00022 #define TNT_SPARSE_MATRIX_CSR_H
00023 
00024 
00025 namespace TNT
00026 {
00027 
00028 
00046 template <class T>
00047 class Sparse_Matrix_CompRow {
00048 
00049   
00050 public:
00051 
00052         Sparse_Matrix_CompRow(const Sparse_Matrix_CompRow &S);
00053         Sparse_Matrix_CompRow(int M, int N, int nz, const T *val, 
00054                                                 const int *r, const int *c);
00055     
00056 
00057 
00058     inline   const T&      val(int i) const;
00059     inline   const int&         row_ptr(int i) const;
00060     inline   const int&         col_ind(int i) const;
00061 
00062     inline   int    dim1() const ;
00063     inline   int    dim2() const ;
00064        int          NumNonzeros() const ;
00065 
00066 
00067     Sparse_Matrix_CompRow& operator=( const Sparse_Matrix_CompRow &R);
00068 
00069 
00070 
00071 };
00072 
00085 template <class T>
00086 Sparse_Matrix_CompRow<T>::Sparse_Matrix_CompRow(int M, int N, int nz,
00087         const T *val, const int *r, const int *c);
00088 
00089 
00090 }
00091 // namespace TNT
00092 
00093 #endif

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_stopwatch_h.html0000644000175000017500000000313207676662370020143 0ustar anibalanibal tnt_stopwatch.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_stopwatch.h File Reference

#include <time.h>

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:15 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_stopwatch_h-source.html0000644000175000017500000001021307676662370021437 0ustar anibalanibal tnt_stopwatch.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_stopwatch.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Mathematical and Computational Sciences Division
00004 * National Institute of Technology,
00005 * Gaithersburg, MD USA
00006 *
00007 *
00008 * This software was developed at the National Institute of Standards and
00009 * Technology (NIST) by employees of the Federal Government in the course
00010 * of their official duties. Pursuant to title 17 Section 105 of the
00011 * United States Code, this software is not subject to copyright protection
00012 * and is in the public domain.  NIST assumes no responsibility whatsoever for
00013 * its use by other parties, and makes no guarantees, expressed or implied,
00014 * about its quality, reliability, or any other characteristic.
00015 *
00016 */
00017 
00018 
00019 
00020 #ifndef STOPWATCH_H
00021 #define STOPWATCH_H
00022 
00023 // for clock() and CLOCKS_PER_SEC
00024 #include <time.h>
00025 
00026 
00027 namespace TNT
00028 {
00029 
00030 
00046 class Stopwatch 
00047 {
00048     public:
00053         Stopwatch();
00054 
00055 
00059         inline void start();
00064         inline double stop();
00065 
00069                 inline double read();
00070                 
00075                 inline void resume();
00076 
00081                 inline int running();
00082 };
00083 
00084 
00085 }
00086 #endif
00087     
00088 
00089             

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_subscript_h.html0000644000175000017500000000563107676662370020153 0ustar anibalanibal tnt_subscript.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_subscript.h File Reference

Go to the source code of this file.

Namespaces

namespace  TNT

Defines

#define TNT_SUBSCRIPT_TYPE   int
#define TNT_BASE_OFFSET   (1)


Define Documentation

#define TNT_BASE_OFFSET   (1)
 

#define TNT_SUBSCRIPT_TYPE   int
 


Generated at Thu Jun 26 17:26:15 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_subscript_h-source.html0000644000175000017500000001152707676662370021452 0ustar anibalanibal tnt_subscript.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_subscript.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT)
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 
00021 #ifndef TNT_SUBSCRPT_H
00022 #define TNT_SUBSCRPT_H
00023 
00024 
00025 //---------------------------------------------------------------------
00026 // This definition describes the default TNT data type used for
00027 // indexing into TNT matrices and vectors.  The data type should
00028 // be wide enough to index into large arrays.  It defaults to an
00029 // "int", but can be overriden at compile time redefining TNT_SUBSCRIPT_TYPE,
00030 // e.g.
00031 // 
00032 //      c++ -DTNT_SUBSCRIPT_TYPE='unsigned int'  ...
00033 //
00034 //---------------------------------------------------------------------
00035 //
00036 
00037 #ifndef TNT_SUBSCRIPT_TYPE
00038 #define TNT_SUBSCRIPT_TYPE int
00039 #endif
00040 
00041 namespace TNT
00042 {
00043     typedef TNT_SUBSCRIPT_TYPE Subscript;
00044 }
00045 
00046 
00047 // () indexing in TNT means 1-offset, i.e. x(1) and A(1,1) are the
00048 // first elements.  This offset is left as a macro for future
00049 // purposes, but should not be changed in the current release.
00050 //
00051 //
00052 #define TNT_BASE_OFFSET (1)
00053 
00054 #endif

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_vec_h.html0000644000175000017500000000345307676662370016712 0ustar anibalanibal tnt_vec.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_vec.h File Reference

#include "tnt_subscript.h"
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <strstream>

Go to the source code of this file.

Namespaces

namespace  TNT


Generated at Thu Jun 26 17:26:15 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_vec_h-source.html0000644000175000017500000002275307676662370020214 0ustar anibalanibal tnt_vec.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_vec.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT)
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 
00021 
00022 #ifndef TNT_VEC_H
00023 #define TNT_VEC_H
00024 
00025 #include "tnt_subscript.h"
00026 #include <cstdlib>
00027 #include <cassert>
00028 #include <iostream>
00029 #include <strstream>
00030 
00031 namespace TNT
00032 {
00033 
00040 
00041 template <class T>
00042 class Vector 
00043 {
00044 
00045 
00046   public:
00047 
00048     typedef Subscript   size_type;
00049     typedef         T   value_type;
00050     typedef         T   element_type;
00051     typedef         T*  pointer;
00052     typedef         T*  iterator;
00053     typedef         T&  reference;
00054     typedef const   T*  const_iterator;
00055     typedef const   T&  const_reference;
00056 
00057     Subscript lbound() const { return 1;}
00058  
00059 
00060 
00061   public:
00062 
00063     // access
00064 
00065     iterator begin() { return v_;}
00066     iterator end()   { return v_ + n_; }
00067     const iterator begin() const { return v_;}
00068     const iterator end() const  { return v_ + n_; }
00069 
00070     // destructor
00071 
00072     ~Vector() ;
00073 
00074     // constructors
00075 
00076     Vector();
00077 
00078     Vector(const Vector<T> &A);
00079 
00080     Vector(Subscript N, const T& value = T()) :  v_(0), vm1_(0), n_(0);
00081 
00082     Vector(Subscript N, const T* v) :  v_(0), vm1_(0), n_(0);
00083 
00084     Vector(Subscript N, char *s) :  v_(0), vm1_(0), n_(0);
00085 
00086     Vector<T>& newsize(Subscript N);
00087 
00088 
00089     Vector<T>& operator=(const Vector<T> &A);
00090     Vector<T>& operator=(const T& scalar);
00091 
00092     inline Subscript dim() const ;
00093 
00094     inline Subscript size() const ;
00095 
00096 
00097     inline reference operator()(Subscript i);
00098 
00099     inline const_reference operator() (Subscript i) const;
00100 
00101     inline reference operator[](Subscript i);
00102 
00103     inline const_reference operator[](Subscript i) const;
00104 
00105 
00106 
00107 };
00108 
00109 
00110 /* ***************************  I/O  ********************************/
00111 
00112 template <class T>
00113 std::ostream& operator<<(std::ostream &s, const Vector<T> &A);
00114 
00115 template <class T>
00116 std::istream & operator>>(std::istream &s, Vector<T> &A);
00117 
00118 // *******************[ basic matrix algorithms ]***************************
00119 
00120 
00121 template <class T>
00122 Vector<T> operator+(const Vector<T> &A, const Vector<T> &B);
00123 
00124 template <class T>
00125 Vector<T> operator-(const Vector<T> &A, const Vector<T> &B);
00126 
00127 
00128 template <class T>
00129 Vector<T> operator*(const Vector<T> &A, const Vector<T> &B);
00130 
00131 
00132 template <class T>
00133 T dot_prod(const Vector<T> &A, const Vector<T> &B);
00134 
00135 }   /* namespace TNT */
00136 
00137 #endif
00138 // TNT_VEC_H

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_version_h.html0000644000175000017500000001205707676662370017622 0ustar anibalanibal tnt_version.h File Reference
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_version.h File Reference

Go to the source code of this file.

Defines

#define TNT_VERSION_STRING   "0.0.0"
#define TNT_MAJOR_VERSION   (0)
#define TNT_MINOR_VERSION   (0)
#define TNT_SUBMINOR_VERSION   (0)


Define Documentation

#define TNT_MAJOR_VERSION   (0)
 

Current TNT major version number, respresented as an integer.

See also:
TNT_VERSION_STRING

#define TNT_MINOR_VERSION   (0)
 

Current TNT minor version number, respresented as an integer.

See also:
TNT_VERSION_STRING

#define TNT_SUBMINOR_VERSION   (0)
 

Current TNT subminor version number, respresented as an integer.

See also:
TNT_VERSION_STRING

#define TNT_VERSION_STRING   "0.0.0"
 

Current TNT version, represented as a charater string in the format three dot-seperated integers, "x.y.z", w here x is the major version number, y is the minor version number, and z is the subminor version number.

Can be used to conveniently display TNT version info, as in

	std::cout << TNT_VERSION_STRING;
	


Generated at Thu Jun 26 17:26:15 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/html/tnt/tnt_version_h-source.html0000644000175000017500000000771707676662370021127 0ustar anibalanibal tnt_version.h Source File
Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

tnt_version.h

Go to the documentation of this file.
00001 /*
00002 *
00003 * Template Numerical Toolkit (TNT)
00004 *
00005 * Mathematical and Computational Sciences Division
00006 * National Institute of Technology,
00007 * Gaithersburg, MD USA
00008 *
00009 *
00010 * This software was developed at the National Institute of Standards and
00011 * Technology (NIST) by employees of the Federal Government in the course
00012 * of their official duties. Pursuant to title 17 Section 105 of the
00013 * United States Code, this software is not subject to copyright protection
00014 * and is in the public domain. NIST assumes no responsibility whatsoever for
00015 * its use by other parties, and makes no guarantees, expressed or implied,
00016 * about its quality, reliability, or any other characteristic.
00017 *
00018 */
00019 
00020 #ifndef TNT_VERSION_H
00021 #define TNT_VERSION_H
00022 
00023 
00024 //---------------------------------------------------------------------
00025 //  current version 
00026 //---------------------------------------------------------------------
00027 
00028 
00029 
00044 #define TNT_VERSION_STRING "0.0.0"
00045 
00050 
00051 #define TNT_MAJOR_VERSION    (0)
00052 
00056 #define TNT_MINOR_VERSION    (0)
00057 
00058 
00063 #define TNT_SUBMINOR_VERSION (0)
00064 
00065 
00066 
00067 #endif
00068 // TNT_VERSION_H

Generated at Thu Jun 26 17:26:14 2003 for Template Numerical Toolkit (TNT) by doxygen1.2.5 written by Dimitri van Heesch, © 1997-2001
libtnt-1.2.6/src/0000755000175000017500000000000010066311612013035 5ustar anibalaniballibtnt-1.2.6/src/tnt/0000755000175000017500000000000010205060423013636 5ustar anibalaniballibtnt-1.2.6/src/tnt/tnt.h0000644000175000017500000000332010134035751014621 0ustar anibalanibal/* * * Template Numerical Toolkit (TNT): Linear Algebra Module * * Mathematical and Computational Sciences Division * National Institute of Technology, * Gaithersburg, MD USA * * * This software was developed at the National Institute of Standards and * Technology (NIST) by employees of the Federal Government in the course * of their official duties. Pursuant to title 17 Section 105 of the * United States Code, this software is not subject to copyright protection * and is in the public domain. NIST assumes no responsibility whatsoever for * its use by other parties, and makes no guarantees, expressed or implied, * about its quality, reliability, or any other characteristic. * */ #ifndef TNT_H #define TNT_H //--------------------------------------------------------------------- // Define this macro if you want TNT to track some of the out-of-bounds // indexing. This can encur a small run-time overhead, but is recommended // while developing code. It can be turned off for production runs. // // #define TNT_BOUNDS_CHECK //--------------------------------------------------------------------- // //#define TNT_BOUNDS_CHECK #include "tnt_version.h" #include "tnt_math_utils.h" #include "tnt_array1d.h" #include "tnt_array2d.h" #include "tnt_array3d.h" #include "tnt_array1d_utils.h" #include "tnt_array2d_utils.h" #include "tnt_array3d_utils.h" #include "tnt_fortran_array1d.h" #include "tnt_fortran_array2d.h" #include "tnt_fortran_array3d.h" #include "tnt_fortran_array1d_utils.h" #include "tnt_fortran_array2d_utils.h" #include "tnt_fortran_array3d_utils.h" #include "tnt_sparse_matrix_csr.h" #include "tnt_stopwatch.h" #include "tnt_subscript.h" #include "tnt_vec.h" #include "tnt_cmat.h" #endif // TNT_H libtnt-1.2.6/src/tnt/tnt_array1d.h0000644000175000017500000001142310203202715016240 0ustar anibalanibal/* * * Template Numerical Toolkit (TNT) * * Mathematical and Computational Sciences Division * National Institute of Technology, * Gaithersburg, MD USA * * * This software was developed at the National Institute of Standards and * Technology (NIST) by employees of the Federal Government in the course * of their official duties. Pursuant to title 17 Section 105 of the * United States Code, this software is not subject to copyright protection * and is in the public domain. NIST assumes no responsibility whatsoever for * its use by other parties, and makes no guarantees, expressed or implied, * about its quality, reliability, or any other characteristic. * */ #ifndef TNT_ARRAY1D_H #define TNT_ARRAY1D_H //#include #include #ifdef TNT_BOUNDS_CHECK #include #endif #include "tnt_i_refvec.h" namespace TNT { template class Array1D { private: /* ... */ i_refvec v_; int n_; T* data_; /* this normally points to v_.begin(), but * could also point to a portion (subvector) * of v_. */ void copy_(T* p, const T* q, int len) const; void set_(T* begin, T* end, const T& val); public: typedef T value_type; Array1D(); explicit Array1D(int n); Array1D(int n, const T &a); Array1D(int n, T *a); inline Array1D(const Array1D &A); inline operator T*(); inline operator const T*(); inline Array1D & operator=(const T &a); inline Array1D & operator=(const Array1D &A); inline Array1D & ref(const Array1D &A); Array1D copy() const; Array1D & inject(const Array1D & A); inline T& operator[](int i); inline const T& operator[](int i) const; inline int dim1() const; inline int dim() const; ~Array1D(); /* ... extended interface ... */ inline int ref_count() const; inline Array1D subarray(int i0, int i1); }; template Array1D::Array1D() : v_(), n_(0), data_(0) {} template Array1D::Array1D(const Array1D &A) : v_(A.v_), n_(A.n_), data_(A.data_) { #ifdef TNT_DEBUG std::cout << "Created Array1D(const Array1D &A) \n"; #endif } template Array1D::Array1D(int n) : v_(n), n_(n), data_(v_.begin()) { #ifdef TNT_DEBUG std::cout << "Created Array1D(int n) \n"; #endif } template Array1D::Array1D(int n, const T &val) : v_(n), n_(n), data_(v_.begin()) { #ifdef TNT_DEBUG std::cout << "Created Array1D(int n, const T& val) \n"; #endif set_(data_, data_+ n, val); } template Array1D::Array1D(int n, T *a) : v_(a), n_(n) , data_(v_.begin()) { #ifdef TNT_DEBUG std::cout << "Created Array1D(int n, T* a) \n"; #endif } template inline Array1D::operator T*() { return &(v_[0]); } template inline Array1D::operator const T*() { return &(v_[0]); } template inline T& Array1D::operator[](int i) { #ifdef TNT_BOUNDS_CHECK assert(i>= 0); assert(i < n_); #endif return data_[i]; } template inline const T& Array1D::operator[](int i) const { #ifdef TNT_BOUNDS_CHECK assert(i>= 0); assert(i < n_); #endif return data_[i]; } template Array1D & Array1D::operator=(const T &a) { set_(data_, data_+n_, a); return *this; } template Array1D Array1D::copy() const { Array1D A( n_); copy_(A.data_, data_, n_); return A; } template Array1D & Array1D::inject(const Array1D &A) { if (A.n_ == n_) copy_(data_, A.data_, n_); return *this; } template Array1D & Array1D::ref(const Array1D &A) { if (this != &A) { v_ = A.v_; /* operator= handles the reference counting. */ n_ = A.n_; data_ = A.data_; } return *this; } template Array1D & Array1D::operator=(const Array1D &A) { return ref(A); } template inline int Array1D::dim1() const { return n_; } template inline int Array1D::dim() const { return n_; } template Array1D::~Array1D() {} /* ............................ exented interface ......................*/ template inline int Array1D::ref_count() const { return v_.ref_count(); } template inline Array1D Array1D::subarray(int i0, int i1) { if ((i0 > 0) && (i1 < n_) || (i0 <= i1)) { Array1D X(*this); /* create a new instance of this array. */ X.n_ = i1-i0+1; X.data_ += i0; return X; } else { return Array1D(); } } /* private internal functions */ template void Array1D::set_(T* begin, T* end, const T& a) { for (T* p=begin; p void Array1D::copy_(T* p, const T* q, int len) const { T *end = p + len; while (p #include namespace TNT { template std::ostream& operator<<(std::ostream &s, const Array1D &A) { int N=A.dim1(); #ifdef TNT_DEBUG s << "addr: " << (void *) &A[0] << "\n"; #endif s << N << "\n"; for (int j=0; j std::istream& operator>>(std::istream &s, Array1D &A) { int N; s >> N; Array1D B(N); for (int i=0; i> B[i]; A = B; return s; } template Array1D operator+(const Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() != n ) return Array1D(); else { Array1D C(n); for (int i=0; i Array1D operator-(const Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() != n ) return Array1D(); else { Array1D C(n); for (int i=0; i Array1D operator*(const Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() != n ) return Array1D(); else { Array1D C(n); for (int i=0; i Array1D operator/(const Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() != n ) return Array1D(); else { Array1D C(n); for (int i=0; i Array1D& operator+=(Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() == n) { for (int i=0; i Array1D& operator-=(Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() == n) { for (int i=0; i Array1D& operator*=(Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() == n) { for (int i=0; i Array1D& operator/=(Array1D &A, const Array1D &B) { int n = A.dim1(); if (B.dim1() == n) { for (int i=0; i #include #ifdef TNT_BOUNDS_CHECK #include #endif #include "tnt_array1d.h" namespace TNT { template class Array2D { private: Array1D data_; Array1D v_; int m_; int n_; public: typedef T value_type; Array2D(); Array2D(int m, int n); Array2D(int m, int n, T *a); Array2D(int m, int n, const T &a); inline Array2D(const Array2D &A); inline operator T**(); inline operator const T**(); inline Array2D & operator=(const T &a); inline Array2D & operator=(const Array2D &A); inline Array2D & ref(const Array2D &A); Array2D copy() const; Array2D & inject(const Array2D & A); inline T* operator[](int i); inline const T* operator[](int i) const; inline int dim1() const; inline int dim2() const; ~Array2D(); /* extended interface (not part of the standard) */ inline int ref_count(); inline int ref_count_data(); inline int ref_count_dim1(); Array2D subarray(int i0, int i1, int j0, int j1); }; template Array2D::Array2D() : data_(), v_(), m_(0), n_(0) {} template Array2D::Array2D(const Array2D &A) : data_(A.data_), v_(A.v_), m_(A.m_), n_(A.n_) {} template Array2D::Array2D(int m, int n) : data_(m*n), v_(m), m_(m), n_(n) { if (m>0 && n>0) { T* p = &(data_[0]); for (int i=0; i Array2D::Array2D(int m, int n, const T &val) : data_(m*n), v_(m), m_(m), n_(n) { if (m>0 && n>0) { data_ = val; T* p = &(data_[0]); for (int i=0; i Array2D::Array2D(int m, int n, T *a) : data_(m*n, a), v_(m), m_(m), n_(n) { if (m>0 && n>0) { T* p = &(data_[0]); for (int i=0; i inline T* Array2D::operator[](int i) { #ifdef TNT_BOUNDS_CHECK assert(i >= 0); assert(i < m_); #endif return v_[i]; } template inline const T* Array2D::operator[](int i) const { #ifdef TNT_BOUNDS_CHECK assert(i >= 0); assert(i < m_); #endif return v_[i]; } template Array2D & Array2D::operator=(const T &a) { /* non-optimzied, but will work with subarrays in future verions */ for (int i=0; i Array2D Array2D::copy() const { Array2D A(m_, n_); for (int i=0; i Array2D & Array2D::inject(const Array2D &A) { if (A.m_ == m_ && A.n_ == n_) { for (int i=0; i Array2D & Array2D::ref(const Array2D &A) { if (this != &A) { v_ = A.v_; data_ = A.data_; m_ = A.m_; n_ = A.n_; } return *this; } template Array2D & Array2D::operator=(const Array2D &A) { return ref(A); } template inline int Array2D::dim1() const { return m_; } template inline int Array2D::dim2() const { return n_; } template Array2D::~Array2D() {} template inline Array2D::operator T**() { return &(v_[0]); } template inline Array2D::operator const T**() { return &(v_[0]); } /* ............... extended interface ............... */ /** Create a new view to a subarray defined by the boundaries [i0][i0] and [i1][j1]. The size of the subarray is (i1-i0) by (j1-j0). If either of these lengths are zero or negative, the subarray view is null. */ template Array2D Array2D::subarray(int i0, int i1, int j0, int j1) { Array2D A; int m = i1-i0+1; int n = j1-j0+1; /* if either length is zero or negative, this is an invalide subarray. return a null view. */ if (m<1 || n<1) return A; A.data_ = data_; A.m_ = m; A.n_ = n; A.v_ = Array1D(m); T* p = &(data_[0]) + i0 * n_ + j0; for (int i=0; i inline int Array2D::ref_count() { return ref_count_data(); } template inline int Array2D::ref_count_data() { return data_.ref_count(); } template inline int Array2D::ref_count_dim1() { return v_.ref_count(); } } /* namespace TNT */ #endif /* TNT_ARRAY2D_H */ libtnt-1.2.6/src/tnt/tnt_array2d_utils.h0000644000175000017500000001100510134035751017464 0ustar anibalanibal/* * * Template Numerical Toolkit (TNT) * * Mathematical and Computational Sciences Division * National Institute of Technology, * Gaithersburg, MD USA * * * This software was developed at the National Institute of Standards and * Technology (NIST) by employees of the Federal Government in the course * of their official duties. Pursuant to title 17 Section 105 of the * United States Code, this software is not subject to copyright protection * and is in the public domain. NIST assumes no responsibility whatsoever for * its use by other parties, and makes no guarantees, expressed or implied, * about its quality, reliability, or any other characteristic. * */ #ifndef TNT_ARRAY2D_UTILS_H #define TNT_ARRAY2D_UTILS_H #include #include namespace TNT { template std::ostream& operator<<(std::ostream &s, const Array2D &A) { int M=A.dim1(); int N=A.dim2(); s << M << " " << N << "\n"; for (int i=0; i std::istream& operator>>(std::istream &s, Array2D &A) { int M, N; s >> M >> N; Array2D B(M,N); for (int i=0; i> B[i][j]; } A = B; return s; } template Array2D operator+(const Array2D &A, const Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() != m || B.dim2() != n ) return Array2D(); else { Array2D C(m,n); for (int i=0; i Array2D operator-(const Array2D &A, const Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() != m || B.dim2() != n ) return Array2D(); else { Array2D C(m,n); for (int i=0; i Array2D operator*(const Array2D &A, const Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() != m || B.dim2() != n ) return Array2D(); else { Array2D C(m,n); for (int i=0; i Array2D operator/(const Array2D &A, const Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() != m || B.dim2() != n ) return Array2D(); else { Array2D C(m,n); for (int i=0; i Array2D& operator+=(Array2D &A, const Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() == m || B.dim2() == n ) { for (int i=0; i Array2D& operator-=(Array2D &A, const Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() == m || B.dim2() == n ) { for (int i=0; i Array2D& operator*=(Array2D &A, const Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() == m || B.dim2() == n ) { for (int i=0; i Array2D& operator/=(Array2D &A, const Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() == m || B.dim2() == n ) { for (int i=0; i Array2D matmult(const Array2D &A, const Array2D &B) { if (A.dim2() != B.dim1()) return Array2D(); int M = A.dim1(); int N = A.dim2(); int K = B.dim2(); Array2D C(M,K); for (int i=0; i #include #ifdef TNT_BOUNDS_CHECK #include #endif #include "tnt_array1d.h" #include "tnt_array2d.h" namespace TNT { template class Array3D { private: Array1D data_; Array2D v_; int m_; int n_; int g_; public: typedef T value_type; Array3D(); Array3D(int m, int n, int g); Array3D(int m, int n, int g, T val); Array3D(int m, int n, int g, T *a); inline operator T***(); inline operator const T***(); inline Array3D(const Array3D &A); inline Array3D & operator=(const T &a); inline Array3D & operator=(const Array3D &A); inline Array3D & ref(const Array3D &A); Array3D copy() const; Array3D & inject(const Array3D & A); inline T** operator[](int i); inline const T* const * operator[](int i) const; inline int dim1() const; inline int dim2() const; inline int dim3() const; ~Array3D(); /* extended interface */ inline int ref_count(){ return data_.ref_count(); } Array3D subarray(int i0, int i1, int j0, int j1, int k0, int k1); }; template Array3D::Array3D() : data_(), v_(), m_(0), n_(0) {} template Array3D::Array3D(const Array3D &A) : data_(A.data_), v_(A.v_), m_(A.m_), n_(A.n_), g_(A.g_) { } template Array3D::Array3D(int m, int n, int g) : data_(m*n*g), v_(m,n), m_(m), n_(n), g_(g) { if (m>0 && n>0 && g>0) { T* p = & (data_[0]); int ng = n_*g_; for (int i=0; i Array3D::Array3D(int m, int n, int g, T val) : data_(m*n*g, val), v_(m,n), m_(m), n_(n), g_(g) { if (m>0 && n>0 && g>0) { T* p = & (data_[0]); int ng = n_*g_; for (int i=0; i Array3D::Array3D(int m, int n, int g, T* a) : data_(m*n*g, a), v_(m,n), m_(m), n_(n), g_(g) { if (m>0 && n>0 && g>0) { T* p = & (data_[0]); int ng = n_*g_; for (int i=0; i inline T** Array3D::operator[](int i) { #ifdef TNT_BOUNDS_CHECK assert(i >= 0); assert(i < m_); #endif return v_[i]; } template inline const T* const * Array3D::operator[](int i) const { return v_[i]; } template Array3D & Array3D::operator=(const T &a) { for (int i=0; i Array3D Array3D::copy() const { Array3D A(m_, n_, g_); for (int i=0; i Array3D & Array3D::inject(const Array3D &A) { if (A.m_ == m_ && A.n_ == n_ && A.g_ == g_) for (int i=0; i Array3D & Array3D::ref(const Array3D &A) { if (this != &A) { m_ = A.m_; n_ = A.n_; g_ = A.g_; v_ = A.v_; data_ = A.data_; } return *this; } template Array3D & Array3D::operator=(const Array3D &A) { return ref(A); } template inline int Array3D::dim1() const { return m_; } template inline int Array3D::dim2() const { return n_; } template inline int Array3D::dim3() const { return g_; } template Array3D::~Array3D() {} template inline Array3D::operator T***() { return v_; } template inline Array3D::operator const T***() { return v_; } /* extended interface */ template Array3D Array3D::subarray(int i0, int i1, int j0, int j1, int k0, int k1) { /* check that ranges are valid. */ if (!( 0 <= i0 && i0 <= i1 && i1 < m_ && 0 <= j0 && j0 <= j1 && j1 < n_ && 0 <= k0 && k0 <= k1 && k1 < g_)) return Array3D(); /* null array */ Array3D A; A.data_ = data_; A.m_ = i1-i0+1; A.n_ = j1-j0+1; A.g_ = k1-k0+1; A.v_ = Array2D(A.m_,A.n_); T* p = &(data_[0]) + i0*n_*g_ + j0*g_ + k0; for (int i=0; i #include namespace TNT { template std::ostream& operator<<(std::ostream &s, const Array3D &A) { int M=A.dim1(); int N=A.dim2(); int K=A.dim3(); s << M << " " << N << " " << K << "\n"; for (int i=0; i std::istream& operator>>(std::istream &s, Array3D &A) { int M, N, K; s >> M >> N >> K; Array3D B(M,N,K); for (int i=0; i> B[i][j][k]; A = B; return s; } template Array3D operator+(const Array3D &A, const Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() != m || B.dim2() != n || B.dim3() != p ) return Array3D(); else { Array3D C(m,n,p); for (int i=0; i Array3D operator-(const Array3D &A, const Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() != m || B.dim2() != n || B.dim3() != p ) return Array3D(); else { Array3D C(m,n,p); for (int i=0; i Array3D operator*(const Array3D &A, const Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() != m || B.dim2() != n || B.dim3() != p ) return Array3D(); else { Array3D C(m,n,p); for (int i=0; i Array3D operator/(const Array3D &A, const Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() != m || B.dim2() != n || B.dim3() != p ) return Array3D(); else { Array3D C(m,n,p); for (int i=0; i Array3D& operator+=(Array3D &A, const Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() == m && B.dim2() == n && B.dim3() == p ) { for (int i=0; i Array3D& operator-=(Array3D &A, const Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() == m && B.dim2() == n && B.dim3() == p ) { for (int i=0; i Array3D& operator*=(Array3D &A, const Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() == m && B.dim2() == n && B.dim3() == p ) { for (int i=0; i Array3D& operator/=(Array3D &A, const Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() == m && B.dim2() == n && B.dim3() == p ) { for (int i=0; i #include #include #include namespace TNT { template class Matrix { public: typedef Subscript size_type; typedef T value_type; typedef T element_type; typedef T* pointer; typedef T* iterator; typedef T& reference; typedef const T* const_iterator; typedef const T& const_reference; Subscript lbound() const { return 1;} protected: Subscript m_; Subscript n_; Subscript mn_; // total size T* v_; T** row_; T* vm1_ ; // these point to the same data, but are 1-based T** rowm1_; // internal helper function to create the array // of row pointers void initialize(Subscript M, Subscript N) { mn_ = M*N; m_ = M; n_ = N; v_ = new T[mn_]; row_ = new T*[M]; rowm1_ = new T*[M]; assert(v_ != NULL); assert(row_ != NULL); assert(rowm1_ != NULL); T* p = v_; vm1_ = v_ - 1; for (Subscript i=0; i &A) { initialize(A.m_, A.n_); copy(A.v_); } Matrix(Subscript M, Subscript N, const T& value = T()) { initialize(M,N); set(value); } Matrix(Subscript M, Subscript N, const T* v) { initialize(M,N); copy(v); } Matrix(Subscript M, Subscript N, const char *s) { initialize(M,N); //std::istrstream ins(s); std::istringstream ins(s); Subscript i, j; for (i=0; i> row_[i][j]; } // destructor // ~Matrix() { destroy(); } // reallocating // Matrix& newsize(Subscript M, Subscript N) { if (num_rows() == M && num_cols() == N) return *this; destroy(); initialize(M,N); return *this; } // assignments // Matrix& operator=(const Matrix &A) { if (v_ == A.v_) return *this; if (m_ == A.m_ && n_ == A.n_) // no need to re-alloc copy(A.v_); else { destroy(); initialize(A.m_, A.n_); copy(A.v_); } return *this; } Matrix& operator=(const T& scalar) { set(scalar); return *this; } Subscript dim(Subscript d) const { #ifdef TNT_BOUNDS_CHECK assert( d >= 1); assert( d <= 2); #endif return (d==1) ? m_ : ((d==2) ? n_ : 0); } Subscript num_rows() const { return m_; } Subscript num_cols() const { return n_; } inline T* operator[](Subscript i) { #ifdef TNT_BOUNDS_CHECK assert(0<=i); assert(i < m_) ; #endif return row_[i]; } inline const T* operator[](Subscript i) const { #ifdef TNT_BOUNDS_CHECK assert(0<=i); assert(i < m_) ; #endif return row_[i]; } inline reference operator()(Subscript i) { #ifdef TNT_BOUNDS_CHECK assert(1<=i); assert(i <= mn_) ; #endif return vm1_[i]; } inline const_reference operator()(Subscript i) const { #ifdef TNT_BOUNDS_CHECK assert(1<=i); assert(i <= mn_) ; #endif return vm1_[i]; } inline reference operator()(Subscript i, Subscript j) { #ifdef TNT_BOUNDS_CHECK assert(1<=i); assert(i <= m_) ; assert(1<=j); assert(j <= n_); #endif return rowm1_[i][j]; } inline const_reference operator() (Subscript i, Subscript j) const { #ifdef TNT_BOUNDS_CHECK assert(1<=i); assert(i <= m_) ; assert(1<=j); assert(j <= n_); #endif return rowm1_[i][j]; } }; /* *************************** I/O ********************************/ template std::ostream& operator<<(std::ostream &s, const Matrix &A) { Subscript M=A.num_rows(); Subscript N=A.num_cols(); s << M << " " << N << "\n"; for (Subscript i=0; i std::istream& operator>>(std::istream &s, Matrix &A) { Subscript M, N; s >> M >> N; if ( !(M == A.num_rows() && N == A.num_cols() )) { A.newsize(M,N); } for (Subscript i=0; i> A[i][j]; } return s; } // *******************[ basic matrix algorithms ]*************************** template Matrix operator+(const Matrix &A, const Matrix &B) { Subscript M = A.num_rows(); Subscript N = A.num_cols(); assert(M==B.num_rows()); assert(N==B.num_cols()); Matrix tmp(M,N); Subscript i,j; for (i=0; i Matrix operator-(const Matrix &A, const Matrix &B) { Subscript M = A.num_rows(); Subscript N = A.num_cols(); assert(M==B.num_rows()); assert(N==B.num_cols()); Matrix tmp(M,N); Subscript i,j; for (i=0; i Matrix mult_element(const Matrix &A, const Matrix &B) { Subscript M = A.num_rows(); Subscript N = A.num_cols(); assert(M==B.num_rows()); assert(N==B.num_cols()); Matrix tmp(M,N); Subscript i,j; for (i=0; i Matrix transpose(const Matrix &A) { Subscript M = A.num_rows(); Subscript N = A.num_cols(); Matrix S(N,M); Subscript i, j; for (i=0; i inline Matrix matmult(const Matrix &A, const Matrix &B) { #ifdef TNT_BOUNDS_CHECK assert(A.num_cols() == B.num_rows()); #endif Subscript M = A.num_rows(); Subscript N = A.num_cols(); Subscript K = B.num_cols(); Matrix tmp(M,K); T sum; for (Subscript i=0; i inline Matrix operator*(const Matrix &A, const Matrix &B) { return matmult(A,B); } template inline int matmult(Matrix& C, const Matrix &A, const Matrix &B) { assert(A.num_cols() == B.num_rows()); Subscript M = A.num_rows(); Subscript N = A.num_cols(); Subscript K = B.num_cols(); C.newsize(M,K); T sum; const T* row_i; const T* col_k; for (Subscript i=0; i Vector matmult(const Matrix &A, const Vector &x) { #ifdef TNT_BOUNDS_CHECK assert(A.num_cols() == x.dim()); #endif Subscript M = A.num_rows(); Subscript N = A.num_cols(); Vector tmp(M); T sum; for (Subscript i=0; i inline Vector operator*(const Matrix &A, const Vector &x) { return matmult(A,x); } } // namespace TNT #endif // CMAT_H libtnt-1.2.6/src/tnt/tnt_fortran_array1d.h0000644000175000017500000001231310203202756017777 0ustar anibalanibal/* * * Template Numerical Toolkit (TNT) * * Mathematical and Computational Sciences Division * National Institute of Technology, * Gaithersburg, MD USA * * * This software was developed at the National Institute of Standards and * Technology (NIST) by employees of the Federal Government in the course * of their official duties. Pursuant to title 17 Section 105 of the * United States Code, this software is not subject to copyright protection * and is in the public domain. NIST assumes no responsibility whatsoever for * its use by other parties, and makes no guarantees, expressed or implied, * about its quality, reliability, or any other characteristic. * */ #ifndef TNT_FORTRAN_ARRAY1D_H #define TNT_FORTRAN_ARRAY1D_H #include #include #ifdef TNT_BOUNDS_CHECK #include #endif #include "tnt_i_refvec.h" namespace TNT { template class Fortran_Array1D { private: i_refvec v_; int n_; T* data_; /* this normally points to v_.begin(), but * could also point to a portion (subvector) * of v_. */ void initialize_(int n); void copy_(T* p, const T* q, int len) const; void set_(T* begin, T* end, const T& val); public: typedef T value_type; Fortran_Array1D(); explicit Fortran_Array1D(int n); Fortran_Array1D(int n, const T &a); Fortran_Array1D(int n, T *a); inline Fortran_Array1D(const Fortran_Array1D &A); inline Fortran_Array1D & operator=(const T &a); inline Fortran_Array1D & operator=(const Fortran_Array1D &A); inline Fortran_Array1D & ref(const Fortran_Array1D &A); Fortran_Array1D copy() const; Fortran_Array1D & inject(const Fortran_Array1D & A); inline T& operator()(int i); inline const T& operator()(int i) const; inline int dim1() const; inline int dim() const; ~Fortran_Array1D(); /* ... extended interface ... */ inline int ref_count() const; inline Fortran_Array1D subarray(int i0, int i1); }; template Fortran_Array1D::Fortran_Array1D() : v_(), n_(0), data_(0) {} template Fortran_Array1D::Fortran_Array1D(const Fortran_Array1D &A) : v_(A.v_), n_(A.n_), data_(A.data_) { #ifdef TNT_DEBUG std::cout << "Created Fortran_Array1D(const Fortran_Array1D &A) \n"; #endif } template Fortran_Array1D::Fortran_Array1D(int n) : v_(n), n_(n), data_(v_.begin()) { #ifdef TNT_DEBUG std::cout << "Created Fortran_Array1D(int n) \n"; #endif } template Fortran_Array1D::Fortran_Array1D(int n, const T &val) : v_(n), n_(n), data_(v_.begin()) { #ifdef TNT_DEBUG std::cout << "Created Fortran_Array1D(int n, const T& val) \n"; #endif set_(data_, data_+ n, val); } template Fortran_Array1D::Fortran_Array1D(int n, T *a) : v_(a), n_(n) , data_(v_.begin()) { #ifdef TNT_DEBUG std::cout << "Created Fortran_Array1D(int n, T* a) \n"; #endif } template inline T& Fortran_Array1D::operator()(int i) { #ifdef TNT_BOUNDS_CHECK assert(i>= 1); assert(i <= n_); #endif return data_[i-1]; } template inline const T& Fortran_Array1D::operator()(int i) const { #ifdef TNT_BOUNDS_CHECK assert(i>= 1); assert(i <= n_); #endif return data_[i-1]; } template Fortran_Array1D & Fortran_Array1D::operator=(const T &a) { set_(data_, data_+n_, a); return *this; } template Fortran_Array1D Fortran_Array1D::copy() const { Fortran_Array1D A( n_); copy_(A.data_, data_, n_); return A; } template Fortran_Array1D & Fortran_Array1D::inject(const Fortran_Array1D &A) { if (A.n_ == n_) copy_(data_, A.data_, n_); return *this; } template Fortran_Array1D & Fortran_Array1D::ref(const Fortran_Array1D &A) { if (this != &A) { v_ = A.v_; /* operator= handles the reference counting. */ n_ = A.n_; data_ = A.data_; } return *this; } template Fortran_Array1D & Fortran_Array1D::operator=(const Fortran_Array1D &A) { return ref(A); } template inline int Fortran_Array1D::dim1() const { return n_; } template inline int Fortran_Array1D::dim() const { return n_; } template Fortran_Array1D::~Fortran_Array1D() {} /* ............................ exented interface ......................*/ template inline int Fortran_Array1D::ref_count() const { return v_.ref_count(); } template inline Fortran_Array1D Fortran_Array1D::subarray(int i0, int i1) { #ifdef TNT_DEBUG std::cout << "entered subarray. \n"; #endif if ((i0 > 0) && (i1 < n_) || (i0 <= i1)) { Fortran_Array1D X(*this); /* create a new instance of this array. */ X.n_ = i1-i0+1; X.data_ += i0; return X; } else { #ifdef TNT_DEBUG std::cout << "subarray: null return.\n"; #endif return Fortran_Array1D(); } } /* private internal functions */ template void Fortran_Array1D::set_(T* begin, T* end, const T& a) { for (T* p=begin; p void Fortran_Array1D::copy_(T* p, const T* q, int len) const { T *end = p + len; while (p namespace TNT { /** Write an array to a character outstream. Output format is one that can be read back in via the in-stream operator: one integer denoting the array dimension (n), followed by n elements, one per line. */ template std::ostream& operator<<(std::ostream &s, const Fortran_Array1D &A) { int N=A.dim1(); s << N << "\n"; for (int j=1; j<=N; j++) { s << A(j) << "\n"; } s << "\n"; return s; } /** Read an array from a character stream. Input format is one integer, denoting the dimension (n), followed by n whitespace-separated elments. Newlines are ignored

Note: the array being read into references new memory storage. If the intent is to fill an existing conformant array, use cin >> B; A.inject(B) ); instead or read the elements in one-a-time by hand. @param s the charater to read from (typically std::in) @param A the array to read into. */ template std::istream& operator>>(std::istream &s, Fortran_Array1D &A) { int N; s >> N; Fortran_Array1D B(N); for (int i=1; i<=N; i++) s >> B(i); A = B; return s; } template Fortran_Array1D operator+(const Fortran_Array1D &A, const Fortran_Array1D &B) { int n = A.dim1(); if (B.dim1() != n ) return Fortran_Array1D(); else { Fortran_Array1D C(n); for (int i=1; i<=n; i++) { C(i) = A(i) + B(i); } return C; } } template Fortran_Array1D operator-(const Fortran_Array1D &A, const Fortran_Array1D &B) { int n = A.dim1(); if (B.dim1() != n ) return Fortran_Array1D(); else { Fortran_Array1D C(n); for (int i=1; i<=n; i++) { C(i) = A(i) - B(i); } return C; } } template Fortran_Array1D operator*(const Fortran_Array1D &A, const Fortran_Array1D &B) { int n = A.dim1(); if (B.dim1() != n ) return Fortran_Array1D(); else { Fortran_Array1D C(n); for (int i=1; i<=n; i++) { C(i) = A(i) * B(i); } return C; } } template Fortran_Array1D operator/(const Fortran_Array1D &A, const Fortran_Array1D &B) { int n = A.dim1(); if (B.dim1() != n ) return Fortran_Array1D(); else { Fortran_Array1D C(n); for (int i=1; i<=n; i++) { C(i) = A(i) / B(i); } return C; } } template Fortran_Array1D& operator+=(Fortran_Array1D &A, const Fortran_Array1D &B) { int n = A.dim1(); if (B.dim1() == n) { for (int i=1; i<=n; i++) { A(i) += B(i); } } return A; } template Fortran_Array1D& operator-=(Fortran_Array1D &A, const Fortran_Array1D &B) { int n = A.dim1(); if (B.dim1() == n) { for (int i=1; i<=n; i++) { A(i) -= B(i); } } return A; } template Fortran_Array1D& operator*=(Fortran_Array1D &A, const Fortran_Array1D &B) { int n = A.dim1(); if (B.dim1() == n) { for (int i=1; i<=n; i++) { A(i) *= B(i); } } return A; } template Fortran_Array1D& operator/=(Fortran_Array1D &A, const Fortran_Array1D &B) { int n = A.dim1(); if (B.dim1() == n) { for (int i=1; i<=n; i++) { A(i) /= B(i); } } return A; } } // namespace TNT #endif libtnt-1.2.6/src/tnt/tnt_fortran_array2d.h0000644000175000017500000001045310134035751020005 0ustar anibalanibal/* * * Template Numerical Toolkit (TNT): Two-dimensional Fortran numerical array * * Mathematical and Computational Sciences Division * National Institute of Technology, * Gaithersburg, MD USA * * * This software was developed at the National Institute of Standards and * Technology (NIST) by employees of the Federal Government in the course * of their official duties. Pursuant to title 17 Section 105 of the * United States Code, this software is not subject to copyright protection * and is in the public domain. NIST assumes no responsibility whatsoever for * its use by other parties, and makes no guarantees, expressed or implied, * about its quality, reliability, or any other characteristic. * */ #ifndef TNT_FORTRAN_ARRAY2D_H #define TNT_FORTRAN_ARRAY2D_H #include #include #ifdef TNT_BOUNDS_CHECK #include #endif #include "tnt_i_refvec.h" namespace TNT { template class Fortran_Array2D { private: i_refvec v_; int m_; int n_; T* data_; void initialize_(int n); void copy_(T* p, const T* q, int len); void set_(T* begin, T* end, const T& val); public: typedef T value_type; Fortran_Array2D(); Fortran_Array2D(int m, int n); Fortran_Array2D(int m, int n, T *a); Fortran_Array2D(int m, int n, const T &a); inline Fortran_Array2D(const Fortran_Array2D &A); inline Fortran_Array2D & operator=(const T &a); inline Fortran_Array2D & operator=(const Fortran_Array2D &A); inline Fortran_Array2D & ref(const Fortran_Array2D &A); Fortran_Array2D copy() const; Fortran_Array2D & inject(const Fortran_Array2D & A); inline T& operator()(int i, int j); inline const T& operator()(int i, int j) const ; inline int dim1() const; inline int dim2() const; ~Fortran_Array2D(); /* extended interface */ inline int ref_count() const; }; template Fortran_Array2D::Fortran_Array2D() : v_(), m_(0), n_(0), data_(0) {} template Fortran_Array2D::Fortran_Array2D(const Fortran_Array2D &A) : v_(A.v_), m_(A.m_), n_(A.n_), data_(A.data_) {} template Fortran_Array2D::Fortran_Array2D(int m, int n) : v_(m*n), m_(m), n_(n), data_(v_.begin()) {} template Fortran_Array2D::Fortran_Array2D(int m, int n, const T &val) : v_(m*n), m_(m), n_(n), data_(v_.begin()) { set_(data_, data_+m*n, val); } template Fortran_Array2D::Fortran_Array2D(int m, int n, T *a) : v_(a), m_(m), n_(n), data_(v_.begin()) {} template inline T& Fortran_Array2D::operator()(int i, int j) { #ifdef TNT_BOUNDS_CHECK assert(i >= 1); assert(i <= m_); assert(j >= 1); assert(j <= n_); #endif return v_[ (j-1)*m_ + (i-1) ]; } template inline const T& Fortran_Array2D::operator()(int i, int j) const { #ifdef TNT_BOUNDS_CHECK assert(i >= 1); assert(i <= m_); assert(j >= 1); assert(j <= n_); #endif return v_[ (j-1)*m_ + (i-1) ]; } template Fortran_Array2D & Fortran_Array2D::operator=(const T &a) { set_(data_, data_+m_*n_, a); return *this; } template Fortran_Array2D Fortran_Array2D::copy() const { Fortran_Array2D B(m_,n_); B.inject(*this); return B; } template Fortran_Array2D & Fortran_Array2D::inject(const Fortran_Array2D &A) { if (m_ == A.m_ && n_ == A.n_) copy_(data_, A.data_, m_*n_); return *this; } template Fortran_Array2D & Fortran_Array2D::ref(const Fortran_Array2D &A) { if (this != &A) { v_ = A.v_; m_ = A.m_; n_ = A.n_; data_ = A.data_; } return *this; } template Fortran_Array2D & Fortran_Array2D::operator=(const Fortran_Array2D &A) { return ref(A); } template inline int Fortran_Array2D::dim1() const { return m_; } template inline int Fortran_Array2D::dim2() const { return n_; } template Fortran_Array2D::~Fortran_Array2D() { } template inline int Fortran_Array2D::ref_count() const { return v_.ref_count(); } template void Fortran_Array2D::set_(T* begin, T* end, const T& a) { for (T* p=begin; p void Fortran_Array2D::copy_(T* p, const T* q, int len) { T *end = p + len; while (p namespace TNT { template std::ostream& operator<<(std::ostream &s, const Fortran_Array2D &A) { int M=A.dim1(); int N=A.dim2(); s << M << " " << N << "\n"; for (int i=1; i<=M; i++) { for (int j=1; j<=N; j++) { s << A(i,j) << " "; } s << "\n"; } return s; } template std::istream& operator>>(std::istream &s, Fortran_Array2D &A) { int M, N; s >> M >> N; Fortran_Array2D B(M,N); for (int i=1; i<=M; i++) for (int j=1; j<=N; j++) { s >> B(i,j); } A = B; return s; } template Fortran_Array2D operator+(const Fortran_Array2D &A, const Fortran_Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() != m || B.dim2() != n ) return Fortran_Array2D(); else { Fortran_Array2D C(m,n); for (int i=1; i<=m; i++) { for (int j=1; j<=n; j++) C(i,j) = A(i,j) + B(i,j); } return C; } } template Fortran_Array2D operator-(const Fortran_Array2D &A, const Fortran_Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() != m || B.dim2() != n ) return Fortran_Array2D(); else { Fortran_Array2D C(m,n); for (int i=1; i<=m; i++) { for (int j=1; j<=n; j++) C(i,j) = A(i,j) - B(i,j); } return C; } } template Fortran_Array2D operator*(const Fortran_Array2D &A, const Fortran_Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() != m || B.dim2() != n ) return Fortran_Array2D(); else { Fortran_Array2D C(m,n); for (int i=1; i<=m; i++) { for (int j=1; j<=n; j++) C(i,j) = A(i,j) * B(i,j); } return C; } } template Fortran_Array2D operator/(const Fortran_Array2D &A, const Fortran_Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() != m || B.dim2() != n ) return Fortran_Array2D(); else { Fortran_Array2D C(m,n); for (int i=1; i<=m; i++) { for (int j=1; j<=n; j++) C(i,j) = A(i,j) / B(i,j); } return C; } } template Fortran_Array2D& operator+=(Fortran_Array2D &A, const Fortran_Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() == m || B.dim2() == n ) { for (int i=1; i<=m; i++) { for (int j=1; j<=n; j++) A(i,j) += B(i,j); } } return A; } template Fortran_Array2D& operator-=(Fortran_Array2D &A, const Fortran_Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() == m || B.dim2() == n ) { for (int i=1; i<=m; i++) { for (int j=1; j<=n; j++) A(i,j) -= B(i,j); } } return A; } template Fortran_Array2D& operator*=(Fortran_Array2D &A, const Fortran_Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() == m || B.dim2() == n ) { for (int i=1; i<=m; i++) { for (int j=1; j<=n; j++) A(i,j) *= B(i,j); } } return A; } template Fortran_Array2D& operator/=(Fortran_Array2D &A, const Fortran_Array2D &B) { int m = A.dim1(); int n = A.dim2(); if (B.dim1() == m || B.dim2() == n ) { for (int i=1; i<=m; i++) { for (int j=1; j<=n; j++) A(i,j) /= B(i,j); } } return A; } } // namespace TNT #endif libtnt-1.2.6/src/tnt/tnt_fortran_array3d.h0000644000175000017500000001061110134035751020002 0ustar anibalanibal/* * * Template Numerical Toolkit (TNT): Three-dimensional Fortran numerical array * * Mathematical and Computational Sciences Division * National Institute of Technology, * Gaithersburg, MD USA * * * This software was developed at the National Institute of Standards and * Technology (NIST) by employees of the Federal Government in the course * of their official duties. Pursuant to title 17 Section 105 of the * United States Code, this software is not subject to copyright protection * and is in the public domain. NIST assumes no responsibility whatsoever for * its use by other parties, and makes no guarantees, expressed or implied, * about its quality, reliability, or any other characteristic. * */ #ifndef TNT_FORTRAN_ARRAY3D_H #define TNT_FORTRAN_ARRAY3D_H #include #include #ifdef TNT_BOUNDS_CHECK #include #endif #include "tnt_i_refvec.h" namespace TNT { template class Fortran_Array3D { private: i_refvec v_; int m_; int n_; int k_; T* data_; public: typedef T value_type; Fortran_Array3D(); Fortran_Array3D(int m, int n, int k); Fortran_Array3D(int m, int n, int k, T *a); Fortran_Array3D(int m, int n, int k, const T &a); inline Fortran_Array3D(const Fortran_Array3D &A); inline Fortran_Array3D & operator=(const T &a); inline Fortran_Array3D & operator=(const Fortran_Array3D &A); inline Fortran_Array3D & ref(const Fortran_Array3D &A); Fortran_Array3D copy() const; Fortran_Array3D & inject(const Fortran_Array3D & A); inline T& operator()(int i, int j, int k); inline const T& operator()(int i, int j, int k) const ; inline int dim1() const; inline int dim2() const; inline int dim3() const; inline int ref_count() const; ~Fortran_Array3D(); }; template Fortran_Array3D::Fortran_Array3D() : v_(), m_(0), n_(0), k_(0), data_(0) {} template Fortran_Array3D::Fortran_Array3D(const Fortran_Array3D &A) : v_(A.v_), m_(A.m_), n_(A.n_), k_(A.k_), data_(A.data_) {} template Fortran_Array3D::Fortran_Array3D(int m, int n, int k) : v_(m*n*k), m_(m), n_(n), k_(k), data_(v_.begin()) {} template Fortran_Array3D::Fortran_Array3D(int m, int n, int k, const T &val) : v_(m*n*k), m_(m), n_(n), k_(k), data_(v_.begin()) { for (T* p = data_; p < data_ + m*n*k; p++) *p = val; } template Fortran_Array3D::Fortran_Array3D(int m, int n, int k, T *a) : v_(a), m_(m), n_(n), k_(k), data_(v_.begin()) {} template inline T& Fortran_Array3D::operator()(int i, int j, int k) { #ifdef TNT_BOUNDS_CHECK assert(i >= 1); assert(i <= m_); assert(j >= 1); assert(j <= n_); assert(k >= 1); assert(k <= k_); #endif return data_[(k-1)*m_*n_ + (j-1) * m_ + i-1]; } template inline const T& Fortran_Array3D::operator()(int i, int j, int k) const { #ifdef TNT_BOUNDS_CHECK assert(i >= 1); assert(i <= m_); assert(j >= 1); assert(j <= n_); assert(k >= 1); assert(k <= k_); #endif return data_[(k-1)*m_*n_ + (j-1) * m_ + i-1]; } template Fortran_Array3D & Fortran_Array3D::operator=(const T &a) { T *end = data_ + m_*n_*k_; for (T *p=data_; p != end; *p++ = a); return *this; } template Fortran_Array3D Fortran_Array3D::copy() const { Fortran_Array3D B(m_, n_, k_); B.inject(*this); return B; } template Fortran_Array3D & Fortran_Array3D::inject(const Fortran_Array3D &A) { if (m_ == A.m_ && n_ == A.n_ && k_ == A.k_) { T *p = data_; T *end = data_ + m_*n_*k_; const T* q = A.data_; for (; p < end; *p++ = *q++); } return *this; } template Fortran_Array3D & Fortran_Array3D::ref(const Fortran_Array3D &A) { if (this != &A) { v_ = A.v_; m_ = A.m_; n_ = A.n_; k_ = A.k_; data_ = A.data_; } return *this; } template Fortran_Array3D & Fortran_Array3D::operator=(const Fortran_Array3D &A) { return ref(A); } template inline int Fortran_Array3D::dim1() const { return m_; } template inline int Fortran_Array3D::dim2() const { return n_; } template inline int Fortran_Array3D::dim3() const { return k_; } template inline int Fortran_Array3D::ref_count() const { return v_.ref_count(); } template Fortran_Array3D::~Fortran_Array3D() { } } /* namespace TNT */ #endif /* TNT_FORTRAN_ARRAY3D_H */ libtnt-1.2.6/src/tnt/tnt_fortran_array3d_utils.h0000644000175000017500000001110410134035751021220 0ustar anibalanibal/* * * Template Numerical Toolkit (TNT) * * Mathematical and Computational Sciences Division * National Institute of Technology, * Gaithersburg, MD USA * * * This software was developed at the National Institute of Standards and * Technology (NIST) by employees of the Federal Government in the course * of their official duties. Pursuant to title 17 Section 105 of the * United States Code, this software is not subject to copyright protection * and is in the public domain. NIST assumes no responsibility whatsoever for * its use by other parties, and makes no guarantees, expressed or implied, * about its quality, reliability, or any other characteristic. * */ #ifndef TNT_FORTRAN_ARRAY3D_UTILS_H #define TNT_FORTRAN_ARRAY3D_UTILS_H #include #include namespace TNT { template std::ostream& operator<<(std::ostream &s, const Fortran_Array3D &A) { int M=A.dim1(); int N=A.dim2(); int K=A.dim3(); s << M << " " << N << " " << K << "\n"; for (int i=1; i<=M; i++) { for (int j=1; j<=N; j++) { for (int k=1; k<=K; k++) s << A(i,j,k) << " "; s << "\n"; } s << "\n"; } return s; } template std::istream& operator>>(std::istream &s, Fortran_Array3D &A) { int M, N, K; s >> M >> N >> K; Fortran_Array3D B(M,N,K); for (int i=1; i<=M; i++) for (int j=1; j<=N; j++) for (int k=1; k<=K; k++) s >> B(i,j,k); A = B; return s; } template Fortran_Array3D operator+(const Fortran_Array3D &A, const Fortran_Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() != m || B.dim2() != n || B.dim3() != p ) return Fortran_Array3D(); else { Fortran_Array3D C(m,n,p); for (int i=1; i<=m; i++) for (int j=1; j<=n; j++) for (int k=1; k<=p; k++) C(i,j,k) = A(i,j,k)+ B(i,j,k); return C; } } template Fortran_Array3D operator-(const Fortran_Array3D &A, const Fortran_Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() != m || B.dim2() != n || B.dim3() != p ) return Fortran_Array3D(); else { Fortran_Array3D C(m,n,p); for (int i=1; i<=m; i++) for (int j=1; j<=n; j++) for (int k=1; k<=p; k++) C(i,j,k) = A(i,j,k)- B(i,j,k); return C; } } template Fortran_Array3D operator*(const Fortran_Array3D &A, const Fortran_Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() != m || B.dim2() != n || B.dim3() != p ) return Fortran_Array3D(); else { Fortran_Array3D C(m,n,p); for (int i=1; i<=m; i++) for (int j=1; j<=n; j++) for (int k=1; k<=p; k++) C(i,j,k) = A(i,j,k)* B(i,j,k); return C; } } template Fortran_Array3D operator/(const Fortran_Array3D &A, const Fortran_Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() != m || B.dim2() != n || B.dim3() != p ) return Fortran_Array3D(); else { Fortran_Array3D C(m,n,p); for (int i=1; i<=m; i++) for (int j=1; j<=n; j++) for (int k=1; k<=p; k++) C(i,j,k) = A(i,j,k)/ B(i,j,k); return C; } } template Fortran_Array3D& operator+=(Fortran_Array3D &A, const Fortran_Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() == m && B.dim2() == n && B.dim3() == p ) { for (int i=1; i<=m; i++) for (int j=1; j<=n; j++) for (int k=1; k<=p; k++) A(i,j,k) += B(i,j,k); } return A; } template Fortran_Array3D& operator-=(Fortran_Array3D &A, const Fortran_Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() == m && B.dim2() == n && B.dim3() == p ) { for (int i=1; i<=m; i++) for (int j=1; j<=n; j++) for (int k=1; k<=p; k++) A(i,j,k) -= B(i,j,k); } return A; } template Fortran_Array3D& operator*=(Fortran_Array3D &A, const Fortran_Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() == m && B.dim2() == n && B.dim3() == p ) { for (int i=1; i<=m; i++) for (int j=1; j<=n; j++) for (int k=1; k<=p; k++) A(i,j,k) *= B(i,j,k); } return A; } template Fortran_Array3D& operator/=(Fortran_Array3D &A, const Fortran_Array3D &B) { int m = A.dim1(); int n = A.dim2(); int p = A.dim3(); if (B.dim1() == m && B.dim2() == n && B.dim3() == p ) { for (int i=1; i<=m; i++) for (int j=1; j<=n; j++) for (int k=1; k<=p; k++) A(i,j,k) /= B(i,j,k); } return A; } } // namespace TNT #endif libtnt-1.2.6/src/tnt/tnt_i_refvec.h0000644000175000017500000001045410146454755016505 0ustar anibalanibal/* * * Template Numerical Toolkit (TNT) * * Mathematical and Computational Sciences Division * National Institute of Technology, * Gaithersburg, MD USA * * * This software was developed at the National Institute of Standards and * Technology (NIST) by employees of the Federal Government in the course * of their official duties. Pursuant to title 17 Section 105 of the * United States Code, this software is not subject to copyright protection * and is in the public domain. NIST assumes no responsibility whatsoever for * its use by other parties, and makes no guarantees, expressed or implied, * about its quality, reliability, or any other characteristic. * */ #ifndef TNT_I_REFVEC_H #define TNT_I_REFVEC_H #include #include #ifdef TNT_BOUNDS_CHECK #include #endif #ifndef NULL #define NULL 0 #endif namespace TNT { /* Internal representation of ref-counted array. The TNT arrays all use this building block.

If an array block is created by TNT, then every time an assignment is made, the left-hand-side reference is decreased by one, and the right-hand-side refernce count is increased by one. If the array block was external to TNT, the refernce count is a NULL pointer regardless of how many references are made, since the memory is not freed by TNT. */ template class i_refvec { private: T* data_; int *ref_count_; public: i_refvec(); explicit i_refvec(int n); inline i_refvec(T* data); inline i_refvec(const i_refvec &v); inline T* begin(); inline const T* begin() const; inline T& operator[](int i); inline const T& operator[](int i) const; inline i_refvec & operator=(const i_refvec &V); void copy_(T* p, const T* q, const T* e); void set_(T* p, const T* b, const T* e); inline int ref_count() const; inline int is_null() const; inline void destroy(); ~i_refvec(); }; template void i_refvec::copy_(T* p, const T* q, const T* e) { for (T* t=p; q i_refvec::i_refvec() : data_(NULL), ref_count_(NULL) {} /** In case n is 0 or negative, it does NOT call new. */ template i_refvec::i_refvec(int n) : data_(NULL), ref_count_(NULL) { if (n >= 1) { #ifdef TNT_DEBUG std::cout << "new data storage.\n"; #endif data_ = new T[n]; ref_count_ = new int; *ref_count_ = 1; } } template inline i_refvec::i_refvec(const i_refvec &V): data_(V.data_), ref_count_(V.ref_count_) { if (V.ref_count_ != NULL) (*(V.ref_count_))++; } template i_refvec::i_refvec(T* data) : data_(data), ref_count_(NULL) {} template inline T* i_refvec::begin() { return data_; } template inline const T& i_refvec::operator[](int i) const { return data_[i]; } template inline T& i_refvec::operator[](int i) { return data_[i]; } template inline const T* i_refvec::begin() const { return data_; } template i_refvec & i_refvec::operator=(const i_refvec &V) { if (this == &V) return *this; if (ref_count_ != NULL) { (*ref_count_) --; if ((*ref_count_) == 0) destroy(); } data_ = V.data_; ref_count_ = V.ref_count_; if (V.ref_count_ != NULL) (*(V.ref_count_))++; return *this; } template void i_refvec::destroy() { if (ref_count_ != NULL) { #ifdef TNT_DEBUG std::cout << "destorying data... \n"; #endif delete ref_count_; #ifdef TNT_DEBUG std::cout << "deleted ref_count_ ...\n"; #endif if (data_ != NULL) delete []data_; #ifdef TNT_DEBUG std::cout << "deleted data_[] ...\n"; #endif data_ = NULL; } } /* * return 1 is vector is empty, 0 otherwise * * if is_null() is false and ref_count() is 0, then * */ template int i_refvec::is_null() const { return (data_ == NULL ? 1 : 0); } /* * returns -1 if data is external, * returns 0 if a is NULL array, * otherwise returns the positive number of vectors sharing * this data space. */ template int i_refvec::ref_count() const { if (data_ == NULL) return 0; else return (ref_count_ != NULL ? *ref_count_ : -1) ; } template i_refvec::~i_refvec() { if (ref_count_ != NULL) { (*ref_count_)--; if (*ref_count_ == 0) destroy(); } } } /* namespace TNT */ #endif /* TNT_I_REFVEC_H */ libtnt-1.2.6/src/tnt/tnt_math_utils.h0000644000175000017500000000075610134035751017064 0ustar anibalanibal#ifndef MATH_UTILS_H #define MATH_UTILS_H /* needed for fabs, sqrt() below */ #include namespace TNT { /** @returns hypotenuse of real (non-complex) scalars a and b by avoiding underflow/overflow using (a * sqrt( 1 + (b/a) * (b/a))), rather than sqrt(a*a + b*b). */ template Real hypot(const Real &a, const Real &b) { if (a== 0) return abs(b); else { Real c = b/a; return fabs(a) * sqrt(1 + c*c); } } } /* TNT namespace */ #endif /* MATH_UTILS_H */ libtnt-1.2.6/src/tnt/tnt_sparse_matrix_csr.h0000644000175000017500000000543110134035751020436 0ustar anibalanibal/* * * Template Numerical Toolkit (TNT) * * Mathematical and Computational Sciences Division * National Institute of Technology, * Gaithersburg, MD USA * * * This software was developed at the National Institute of Standards and * Technology (NIST) by employees of the Federal Government in the course * of their official duties. Pursuant to title 17 Section 105 of the * United States Code, this software is not subject to copyright protection * and is in the public domain. NIST assumes no responsibility whatsoever for * its use by other parties, and makes no guarantees, expressed or implied, * about its quality, reliability, or any other characteristic. * */ #ifndef TNT_SPARSE_MATRIX_CSR_H #define TNT_SPARSE_MATRIX_CSR_H #include "tnt_array1d.h" namespace TNT { /** Read-only view of a sparse matrix in compressed-row storage format. Neither array elements (nonzeros) nor sparsity structure can be modified. If modifications are required, create a new view.

Index values begin at 0.

Storage requirements: An (m x n) matrix with nz nonzeros requires no more than ((T+I)*nz + M*I) bytes, where T is the size of data elements and I is the size of integers. */ template class Sparse_Matrix_CompRow { private: Array1D val_; // data values (nz_ elements) Array1D rowptr_; // row_ptr (dim_[0]+1 elements) Array1D colind_; // col_ind (nz_ elements) int dim1_; // number of rows int dim2_; // number of cols public: Sparse_Matrix_CompRow(const Sparse_Matrix_CompRow &S); Sparse_Matrix_CompRow(int M, int N, int nz, const T *val, const int *r, const int *c); inline const T& val(int i) const { return val_[i]; } inline const int& row_ptr(int i) const { return rowptr_[i]; } inline const int& col_ind(int i) const { return colind_[i];} inline int dim1() const {return dim1_;} inline int dim2() const {return dim2_;} int NumNonzeros() const {return val_.dim1();} Sparse_Matrix_CompRow& operator=( const Sparse_Matrix_CompRow &R); }; /** Construct a read-only view of existing sparse matrix in compressed-row storage format. @param M the number of rows of sparse matrix @param N the number of columns of sparse matrix @param nz the number of nonzeros @param val a contiguous list of nonzero values @param r row-pointers: r[i] denotes the begining position of row i (i.e. the ith row begins at val[row[i]]). @param c column-indices: c[i] denotes the column location of val[i] */ template Sparse_Matrix_CompRow::Sparse_Matrix_CompRow(int M, int N, int nz, const T *val, const int *r, const int *c) : val_(nz,val), rowptr_(M, r), colind_(nz, c), dim1_(M), dim2_(N) {} } // namespace TNT #endif libtnt-1.2.6/src/tnt/tnt_stopwatch.h0000644000175000017500000000330510134035751016720 0ustar anibalanibal/* * * Mathematical and Computational Sciences Division * National Institute of Technology, * Gaithersburg, MD USA * * * This software was developed at the National Institute of Standards and * Technology (NIST) by employees of the Federal Government in the course * of their official duties. Pursuant to title 17 Section 105 of the * United States Code, this software is not subject to copyright protection * and is in the public domain. NIST assumes no responsibility whatsoever for * its use by other parties, and makes no guarantees, expressed or implied, * about its quality, reliability, or any other characteristic. * */ #ifndef STOPWATCH_H #define STOPWATCH_H // for clock() and CLOCKS_PER_SEC #include namespace TNT { inline static double seconds(void) { const double secs_per_tick = 1.0 / CLOCKS_PER_SEC; return ( (double) clock() ) * secs_per_tick; } class Stopwatch { private: int running_; double start_time_; double total_; public: inline Stopwatch(); inline void start(); inline double stop(); inline double read(); inline void resume(); inline int running(); }; inline Stopwatch::Stopwatch() : running_(0), start_time_(0.0), total_(0.0) {} void Stopwatch::start() { running_ = 1; total_ = 0.0; start_time_ = seconds(); } double Stopwatch::stop() { if (running_) { total_ += (seconds() - start_time_); running_ = 0; } return total_; } inline void Stopwatch::resume() { if (!running_) { start_time_ = seconds(); running_ = 1; } } inline double Stopwatch::read() { if (running_) { stop(); resume(); } return total_; } } /* TNT namespace */ #endif libtnt-1.2.6/src/tnt/tnt_subscript.h0000644000175000017500000000306110134035751016721 0ustar anibalanibal/* * * Template Numerical Toolkit (TNT) * * Mathematical and Computational Sciences Division * National Institute of Technology, * Gaithersburg, MD USA * * * This software was developed at the National Institute of Standards and * Technology (NIST) by employees of the Federal Government in the course * of their official duties. Pursuant to title 17 Section 105 of the * United States Code, this software is not subject to copyright protection * and is in the public domain. NIST assumes no responsibility whatsoever for * its use by other parties, and makes no guarantees, expressed or implied, * about its quality, reliability, or any other characteristic. * */ #ifndef TNT_SUBSCRPT_H #define TNT_SUBSCRPT_H //--------------------------------------------------------------------- // This definition describes the default TNT data type used for // indexing into TNT matrices and vectors. The data type should // be wide enough to index into large arrays. It defaults to an // "int", but can be overriden at compile time redefining TNT_SUBSCRIPT_TYPE, // e.g. // // c++ -DTNT_SUBSCRIPT_TYPE='unsigned int' ... // //--------------------------------------------------------------------- // #ifndef TNT_SUBSCRIPT_TYPE #define TNT_SUBSCRIPT_TYPE int #endif namespace TNT { typedef TNT_SUBSCRIPT_TYPE Subscript; } /* namespace TNT */ // () indexing in TNT means 1-offset, i.e. x(1) and A(1,1) are the // first elements. This offset is left as a macro for future // purposes, but should not be changed in the current release. // // #define TNT_BASE_OFFSET (1) #endif libtnt-1.2.6/src/tnt/tnt_vec.h0000644000175000017500000001600710146453326015471 0ustar anibalanibal/* * * Template Numerical Toolkit (TNT) * * Mathematical and Computational Sciences Division * National Institute of Technology, * Gaithersburg, MD USA * * * This software was developed at the National Institute of Standards and * Technology (NIST) by employees of the Federal Government in the course * of their official duties. Pursuant to title 17 Section 105 of the * United States Code, this software is not subject to copyright protection * and is in the public domain. NIST assumes no responsibility whatsoever for * its use by other parties, and makes no guarantees, expressed or implied, * about its quality, reliability, or any other characteristic. * */ #ifndef TNT_VEC_H #define TNT_VEC_H #include "tnt_subscript.h" #include #include #include #include namespace TNT { /** [Deprecatred] Value-based vector class from pre-1.0 TNT version. Kept here for backward compatiblity, but should use the newer TNT::Array1D classes instead. */ template class Vector { public: typedef Subscript size_type; typedef T value_type; typedef T element_type; typedef T* pointer; typedef T* iterator; typedef T& reference; typedef const T* const_iterator; typedef const T& const_reference; Subscript lbound() const { return 1;} protected: T* v_; T* vm1_; // pointer adjustment for optimzied 1-offset indexing Subscript n_; // internal helper function to create the array // of row pointers void initialize(Subscript N) { // adjust pointers so that they are 1-offset: // v_[] is the internal contiguous array, it is still 0-offset // assert(v_ == NULL); v_ = new T[N]; assert(v_ != NULL); vm1_ = v_-1; n_ = N; } void copy(const T* v) { Subscript N = n_; Subscript i; #ifdef TNT_UNROLL_LOOPS Subscript Nmod4 = N & 3; Subscript N4 = N - Nmod4; for (i=0; i &A) : v_(0), vm1_(0), n_(0) { initialize(A.n_); copy(A.v_); } Vector(Subscript N, const T& value = T()) : v_(0), vm1_(0), n_(0) { initialize(N); set(value); } Vector(Subscript N, const T* v) : v_(0), vm1_(0), n_(0) { initialize(N); copy(v); } Vector(Subscript N, char *s) : v_(0), vm1_(0), n_(0) { initialize(N); std::istringstream ins(s); Subscript i; for (i=0; i> v_[i]; } // methods // Vector& newsize(Subscript N) { if (n_ == N) return *this; destroy(); initialize(N); return *this; } // assignments // Vector& operator=(const Vector &A) { if (v_ == A.v_) return *this; if (n_ == A.n_) // no need to re-alloc copy(A.v_); else { destroy(); initialize(A.n_); copy(A.v_); } return *this; } Vector& operator=(const T& scalar) { set(scalar); return *this; } inline Subscript dim() const { return n_; } inline Subscript size() const { return n_; } inline reference operator()(Subscript i) { #ifdef TNT_BOUNDS_CHECK assert(1<=i); assert(i <= n_) ; #endif return vm1_[i]; } inline const_reference operator() (Subscript i) const { #ifdef TNT_BOUNDS_CHECK assert(1<=i); assert(i <= n_) ; #endif return vm1_[i]; } inline reference operator[](Subscript i) { #ifdef TNT_BOUNDS_CHECK assert(0<=i); assert(i < n_) ; #endif return v_[i]; } inline const_reference operator[](Subscript i) const { #ifdef TNT_BOUNDS_CHECK assert(0<=i); assert(i < n_) ; #endif return v_[i]; } }; /* *************************** I/O ********************************/ template std::ostream& operator<<(std::ostream &s, const Vector &A) { Subscript N=A.dim(); s << N << "\n"; for (Subscript i=0; i std::istream & operator>>(std::istream &s, Vector &A) { Subscript N; s >> N; if ( !(N == A.size() )) { A.newsize(N); } for (Subscript i=0; i> A[i]; return s; } // *******************[ basic matrix algorithms ]*************************** template Vector operator+(const Vector &A, const Vector &B) { Subscript N = A.dim(); assert(N==B.dim()); Vector tmp(N); Subscript i; for (i=0; i Vector operator-(const Vector &A, const Vector &B) { Subscript N = A.dim(); assert(N==B.dim()); Vector tmp(N); Subscript i; for (i=0; i Vector operator*(const Vector &A, const Vector &B) { Subscript N = A.dim(); assert(N==B.dim()); Vector tmp(N); Subscript i; for (i=0; i T dot_prod(const Vector &A, const Vector &B) { Subscript N = A.dim(); assert(N == B.dim()); Subscript i; T sum = 0; for (i=0; i