File: fastmath_test.cpp

package info (click to toggle)
libitpp 4.0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 7,520 kB
  • ctags: 6,341
  • sloc: cpp: 51,608; sh: 9,248; makefile: 636; fortran: 8
file content (30 lines) | stat: -rw-r--r-- 695 bytes parent folder | download
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
#include <itpp/itbase.h>

using std::cout;
using std::endl;
using namespace itpp;

int main(void)
{
 cout << "====================================================" << endl;
 cout << "              Test of fastmath" << endl;
 cout << "====================================================" << endl;

 mat m0("1 2 3;4 5 6;7 8 9"), mv0("2;3;1");
 vec v0("2 3 1");

 cout << "sub_v_vT_m: the slow and fast way" << endl;
 cout << (m0-mv0*transpose(mv0)*m0) << endl;
 sub_v_vT_m(m0, v0);
 cout << m0 << endl;

 m0 = "1 2 3;4 5 6;7 8 9";

 cout << endl << "sub_m_v_vT: the slow and fast way" << endl;
 cout << (m0-m0*mv0*transpose(mv0)) << endl;
 sub_m_v_vT(m0, v0);
 cout << m0 << endl;

 return 0;

}