Template Numerical Toolkit
[Home] [Overview] [Examples] [Documentation] [Download]

Revision History

1/23/10: Update to TNT v. 3.0.12

  • bug fix to Array3D null constructor in tnt_array3d.h.

6/1/08: Update to TNT v. 3.0.11

  • update to hqr2() in tnt_linalg.h to correct max expression (line 692).

6/1/08: Update to TNT v. 3.0.10

  • update to mult_eq() and add_eq() in TNT_Matrix class for proper const correctness.

4/10/08: Update to TNT v. 3.0.9

  • inclusion of std::abs() in tnt_math_utils.h for improved ANSI compatibility.

9/24/07: Update to TNT v. 3.0.8

  • included example of linking with external libraries by using TNT Fortran_Arrays to integrate with LAPACK. (see tnt_lapack.h)

8/26/07: Update to TNT v. 3.0.7

  • fixed subarray() bug in extended array interfaces.
  • fixed matrix I/O header for << output
  • replaced abs() with generic

6/28/07: Update to TNT v. 3.0.6

  • update to TNT vector operations.

5/02/07: Update to Jama 1.2.5

  • updated SVD and Cholesky algorithms in Jama to use temporary variables of generic "Real" data types.

11/10/06: Update to TNT v. 3.0.4

  • bug fix in mult_element_eq(Matrix &, const Matrix &)

07/17/06: Update to TNT v. 3.0.3

  • bug fix in TNT_BOUNDS_CHECK for transpose_mult()

02/20/06: Update to TNT Beta v. 3.0.1

06/02/05: Jama Update (version 1.2.4)

  • added TNT namespace to hypot() to QR algorithm.

05/31/05: TNT Update (version 1.2.6)

  • bug fix in subarray() primtive.

04/12/05: Jama Update (version 1.2.3)

  • updated LU getPivot() routine.

02/11/05: TNT Update (version 1.2.5)

  • replaced DEBUG macros in tnt_array1d.h and tnt_fortran_array1d.h with TNT_DEBUG macros.

11/16/04: TNT Update (version 1.2.4)

  • replaced "data" with "data_" in internal tnt_i_revec.h routines. (Does not affect public interface or implementation.)
  • changed all occurences of "endl" with "\n".

11/12/04: Jama Update (version 1.2.2)

  • replaced bitwise OR with boolean OR in SVD routine. (Does not affect correctness, but better programming practice.)
  • removed max and min functions from tnt_math_utils.h to avoid conflict with ANSI C++ definitions.

09/17/04: TNT Update (version 1.2.2)

  • fixed bug in internal vector representation tnt_i_vecref function is_null().

05/04: TNT Update (version 1.2.1)

  • made Stopwatch constructor inline to avoid collisions when linking multiple TNT object files on some compilers.
  • fixed copy_() method in internal implementation

06/03: TNT Version 1.2 (interface update)

  • New Features:
    • added Array operators +,-,*,/,+=,-=,*=,/= to all TNT arrays
    • auto conversion to T** for Array2D< T >, and T*** for Array3D< T >, as well as const versions.
  • Bug fixes, updates
    • fixed memory leak in array allocation from external (to TNT) data.
    • updated deprecated strstream interface in tnt_vec.h and tnt_cmath.h
    • arrays now handle 0-length dimensions properly
    • fixed operator=(scalar) in 2D and 3D Fortran arrays.
    • made copy() methods of Fortran arrays const

03/03: Linear Algebra Update (Jama v. 1.2.1)

  • fixed bug in QR solver

01/03: Linear Algebra Update (Jama v. 1.2) (interface update)

  • added LU solver
  • fixed bug in SVD solver
  • added special-case solvers for 1-d vectors

08/02: TNT Version 1.1

  • 08/31/02 (v. 1.1.1): fixed matmult bug in tnt_array2d_utils.h

06/02: TNT Version 1.0 (interface update)

  • Distinguishes between TNT interface and implemetations. There can be several implementations that incorporate the TNT interface. This site provides a reference implementation which is portable and usable, but developers are encouraged to create others which take advantage of specific features and optimziation strategies, such as the BLAS, or expression templates.
  • New multidimensional arrays: Array1D, Array2D, Array3D, Fortran_Array1D, Fortran_Array2D, Fortran_Array3D
    • Arrays are pass-by-reference, employ shallow-assignment, and utilize reference-counting to manage memory storage. This allows one to return arrays from functions without relying on advanced compiler optimizations to avoid excess copying.
      • Fortran Arrays utilize A(i,j) indexing with A(1,1) as the first element, and employ "column-major" ordering. The internal storage is contiguous.
      • Arrays utilize A[i][j] indexing with A[0][0] as the first element, and employ "row-major" ordering. The internal storage is contiguous, so rows cannot be aliased.
    • Arrays will eventually replace the Vector, Matrix objects from previous versions. (These are maintained in the current release for bakcward compatibility, but will be deprecated in future verions.)
    • Arrays do not overlap memory storage (i.e. Regions are not supported). This simplifies the interface and allows algorithms using TNT arrays to employ aliasing optimizations that were not possible before.
  • New QR, Cholesky, SVD algorithms. The SVD and QR factorizations work with non-square matrices with m >= n.
  • New eigenvalue/eigenvector solver for real general (symmetric and non-symmetric) matrices.
  • New documentation, generated with Doxygen.
  • file names are in the form "tnt_array2d.h", rather than "tnt/array2d.h". This avoids having to put TNT header files in their own directory.
  • Stopwatch timing object has slightly different semantics. The start() operation resets the clock to 0.00. See documentation for details.
  • Deprecated features: (to be removed in future versions)
    • TNT:Vector and TNT::Matrix classes: these were pass-by-value classes, which unfortunately many compiler still cannot optimize adequately. In particular, on many platforms it was still expensive to return a TNT::Vector or TNT::Matrix from a function, although the copying could be avoided. To address this issue, the new Array classes utilize shallow assignment (like C strings) to minimize the overhead.
    • TNT::Region classes: these are rarely needed by users and complicate the interface and implementation, but most importantly they allow for overlapping of memory locations among separate objects, which limits important compiler optimizations.

08/00: Version 0.9.4

  • TNT include files are in their own subdirectory (e.g. tnt/vec.h, tnt/cmat.h).
  • NIST disclaimer attached to each TNT file.
  • some default initalizers were changed from T(0) to T().

09/99: Version 0.9.3

  • fixed operator)) in vec.h.
  • fixed example in,,,
  • fixed comment in
  • upated template Matrix argument in qr.h.
Version 0.9 of the Template Numerical Toolkit represents a significant update achieving ANSI C++ compatibility. Numerous users are now using or are in the process of upgrading to new ANSI compliant C++ compilers and this release reflects that change. This version of TNT was developed and tested with Microsoft Visual C++ 5.0 but should compile with any ANSI C++ compiler (see compilation notes below) .

In particular, the compiler must support templates, namespaces, the typename modifier, and portions of the Standard Template Library (STL). Some examples make use of the standard valarray<> class. Most of the ANSI changes to TNT consist of typename modifiers, filename updates (e.g. < strstream.h > became < sstream >), replacement of the former TNT DComplex class with the standard complex < double >, and the renaming of template arguments. The majority of these changes to TNT were postponed until ratification of the C++ standard by the ANSI committee and the availability of real compilers supporting these new features.

Note that the scope of these changes implies that earlier compilers (e.g. gcc 2.7, Watcom 10.0) will NOT work with the new version of TNT. (If your compiler is not ANSI compatible, contact your compiler vendor.)

NOTE: Neither g++ 2.8.1 or egcs 1.0.2 support ANSI C++ namespaces, hence will NOT be able to compile TNT 0.9.

New Features:

  1. ANSI C++ compatibility: should work with most updated C++ compilers, including Microsoft VC++ 5.0 (see notes.)

  2. TNT namespace: all TNT classes and functions use their own namespace, to avoid naming collision with other packages. (New names are given below.) Some examples use the TNT:: prefix, while most use using namespace TNT; near the begining of the program to allow shorter names.
  3. TNT container adaptors now work with ANSI valarray<> class : Our Vector_adaptor<> class (formerly known as TNT_Vector<>) transforms an STL-like vector class into something more suitable for numerics. In particular, it adds features such as
    • optional bounds check (via compile-time TNT_BOUNDS_CHECK macro)
    • Fortran-like 1-based offsets (using "(i)" rather than "[i]")
    • regions, e.g. A(Index(1,10)) = ...
    • initialization from strings
    • simple I/O for streams
    In this way, one could change the internal class for memory managment (say, utilizing a special memory allocator for imbedded systems) yet still retain TNT's features for matrix/vector computing. TNT's original scheme used begin()/end() methods, patterned after the STL container methods. Since then, however, several vector-like classes (including ANSI's own valarray<> class) have evolved away from these methods. The new version of TNT::Vector_adaptor<> does not rely on begin()/end().

  4. TNT documentation now includes the output files from the examples. (See below.)


  1. New class names: Using a separate namespace allows us to simplify some of the naming schemes, so we took the opportunity to clean up the rest of the TNT classes and functions to give them a more consistent look. In particular, the old C_matrix<> class that provided C-like array access (0-offset, [i][j] indexing) is now simply called Matrix<>.

    Old name
    (Ver. 0.8)
    New name
    (Ver. 0.9)
    Subscript TNT::Subscript
    Vector<> TNT::Vector<>
    C_matrix<> TNT::Matrix<>
    Fortran_matrix<> TNT::Fortran_Matrix<>
    TNT_Vector<> TNT::Vector_Adaptor<>
    Fortran_sparse_vector<> TNT::Fortran_Sparse_Vector<>
    Fortran_compressed_col_matrix<> TNT::Fortran_Sparse_Col_Matrix<>
    Region1D TNT::Region1D
    Region2D TNT::Region2D
    Stopwatch TNT::Stopwatch
    seconds( ) TNT::seconds( )
    DComplex complex< double >

  2. DComplex no longer supported: During the period that complex number support was inconsistent among C++ compilers, we included an intermediate datatype, DComplex, to cloak the underlying double-precision complex class name, so that TNT code would look somewhat uniform. With new compilers supporting the ANSI complex<> standard, there is no longer a need for this, and it has therefore been dropped.

  3. Fortran 77 interfaces no longer supported: There is still no standard methodology for intergrating C/C++ and Fortran on similar platforms. Each compiler relies on various tweaks with underscores and argument massaging. Character string arguments often do not work and often there is confusion at link time about which system libraries to use. On Windows95/NT systems the situation is even worse, due to several incompatible argument-passing schemes (e.g. STDCALL, FORTRAN, PASCAL, CDECL, etc.). There are some examples of f77 calls to the BLAS and LAPACK, but these are included only for demonstration and are not part of TNT. Such interfaces are not difficult to develop for your own platform, but we just do not have the time to provide this support for every system.

Other fixes and updates:

  1. Several of the templated functions used "Matrix" and "Vector" dummy arguments that caused some confusion with the native classes of TNT. These these dummy arguments have been replaced with "MaTRix" and "VecToR".
  2. "Subscript Nmod4 = N & 4" was changed to "N % 4" in vec.h, cmat.h, and fmat.h.
  3. Several of the TNT examples, use the setf() stream modifier to produce formatted output.
  4. Version macros in "version.h" file are now characters. Added TNT_VERSION_STRING macro (e.g. "0.9.0") for easy identification,
  5. Removed _NEEDS_ABS_MIN_ macro from tntmath.h. All of these functions are now in the TNT namespace.
  6. Added "X(const &X)" constructor to fcscmat.h

Compilation Notes

NOTE: Neither g++ 2.8.1 or egcs 1.0.2 support ANSI C++ namespaces, hence will NOT be able to compile TNT 0.9.

This version of TNT has been tested using Microsoft Visual C++ v. 5.0, for which you will need to use the following flags:

Also, be aware that examples using the ANSI C++ valarray class (e.g. may generate spurious warnings.

We would appreciate feedback on using/compiling TNT for other ANSI C++ compatible platforms.

TNT Home Page

Roldan Pozo