1 // This file is part of the ustl library, an STL implementation.
3 // Copyright (C) 2005 by Mike Sharov <msharov@users.sourceforge.net>
4 // This file is free software, distributed under the MIT License.
7 // Tests matrix operations
12 template <size_t NX
, size_t NY
, typename T
>
13 void TestMatrix (void)
15 matrix
<NX
,NY
,T
> m1
, m2
;
17 cout
<< "load_identity(m1)"
29 cout
<< "\nm1 = m1 * m2"
37 cout
<< "\nm1 *= I(2)";
38 cout
<< "\n m1 = " << m1
;
39 iota (m1
.begin(), m1
.end(), 1);
40 cout
<< "\nm1 = iota(1)"
42 cout
<< "\n m1 row [1] = " << m1
.row(1);
43 cout
<< "\n m1 column [2] = " << m1
.column(2);
45 cout
<< "\nm1 *= I(2)"
47 typename matrix
<NX
,NY
,T
>::column_type v
, vt
;
48 iota (v
.begin(), v
.end(), 1);
49 cout
<< "\nv = iota(1)"
53 for (uoff_t y
= 0; y
< NY
- 1; ++ y
)
55 cout
<< "\nm2 = I(2) + T(1)"
58 cout
<< "\nvt = v * m2"
59 "\n vt = " << vt
<< endl
;
62 void TestMatrixAlgorithms (void)
64 cout
<< "========================================\n"
65 "Testing 4x4 int matrix:\n"
66 "========================================\n";
67 TestMatrix
<4,4,int>();
68 cout
<< "========================================\n"
69 "Testing 4x4 float matrix:\n"
70 "========================================\n";
71 cout
.set_precision (1);
72 TestMatrix
<4,4,float>();
75 StdBvtMain (TestMatrixAlgorithms
)