-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
62 lines (47 loc) · 1.55 KB
/
Copy pathmain.cpp
File metadata and controls
62 lines (47 loc) · 1.55 KB
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
53
54
55
56
57
58
59
60
61
#include <iostream>
#include <complex>
#include "matrix.h"
using namespace std;
int main() {
matrix<int> m{{1, 2, 3},
{2, 1, 4}};
matrix<double> m2{{3.5, 2.1, 1.2}};
matrix<int> m4{1, 2, 3};
matrix<double> nn = m * m4.transpose();
cout << nn << endl;
matrix<double> n = m;
const matrix<int> mm = m;
cout << "n size:" << n.size()[0] << " " << n.size()[1] << endl;
cout << n << endl;
cout << mm.transpose().transpose() << endl;
cout << m.transpose() * 2.2 << endl;
cout << 2.2 * -m << endl;
cout << m * m2.transpose() << endl;
cout << m2 * m4.transpose() << endl;
auto m5 = m2 * m4.transpose();
cout << m5 << endl;
//cout << m4 * m4.transpose() * m << endl;
matrix<int> m3 = m * m2.transpose();
cout << m3 << endl;
auto m6 = m5 * m;
cout << m4 * m4.transpose() * m6 << endl;
cout << m6 << "+" << m << "=";
cout << m6 + m << endl;
cout << m6 << "-" << m << "=" << m6 - m << endl;
complex<double> cp{2, 5};
matrix<complex<int>> cmat{{cp, 2}};
cout << "cmat" << cmat << endl;
cout << "cmatT" << cmat.transpose() << endl;
cout << "cmat^2" << cmat * cmat.transpose() << endl;
matrix<int> byinit{{1, 2},
{3, 4}};
cout << byinit << endl;
matrix<double> bysginit{1.1, 2.2, -3.3};
cout << bysginit << endl;
matrix<int> rank_test{{1, 2, 3},
{2, 4, 6},
{1, 5, 7}};
int rankk = rank_test.getRank();
cout << "rank:" << rankk << endl;
return 0;
}