1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
lynx -dump http://math.nist.gov/tnt/examples.html > examples
[1]TNT
[2]Template Numerical Toolkit
[3][Home] [4][Overview] [5][Examples] [6][Documentation] [7][Download]
_________________________________________________________________
Examples
* Creating arrays and accessing elements:
#include <tnt/tnt.h>
using namespace TNT;
Array2D< double > A(M,N) = 0.0; /* create MxN array; all zeros */
for (i=0; i < M; i++)
for (j=0; j < N; j++)
A[i][j] = f(i,j); /* initalize array values */
Array2D< double > B = A.copy(); /* create a new copy */
Array2D< double > C(B); /* create a new view of B */
/* Both arrays (B & C) share data */
* Declarations
Array2D< double > A; /* initalize null (empty) array */
Array2D< double > B(M,N); /* create an MxN array; uninitalized*/
Array2D< double > C(M,N) = 0.0; /* create an MxN array; all zeros */
* Assignments
A[i][j] = 3.13; /* individual element assignment */
A = B; /* shallow array assignment */
A = B.copy(); /* explicit array copy */
_____________________________________________________________
[8]TNT Home Page
[9]Roldan Pozo
References
1. http://math.nist.gov/tnt
2. http://math.nist.gov/tnt
3. http://math.nist.gov/tnt/index.html
4. http://math.nist.gov/tnt/overview.html
5. http://math.nist.gov/tnt/examples.html
6. http://math.nist.gov/tnt/documentation.html
7. http://math.nist.gov/tnt/download.html
8. http://math.nist.gov/tnt/index.html
9. http://math.nist.gov/pozo
|