-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.cpp
32 lines (25 loc) · 881 Bytes
/
main.cpp
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
#include <iostream>
#include "nvector.hpp"
#include "ops.hpp"
int main() {
using std::cout;
container<nvector<double>> basis;
basis.push_back(nvector<double>(3, {12, 6, -4}));
basis.push_back(nvector<double>(3, {-51, 167, 24}));
basis.push_back(nvector<double>(3, {4, -68, -41}));
cout << "Basis before orthonormalization: \n";
for (auto i = basis.begin(); i != basis.end(); ++i) {
cout << *i << "\n";
cout << i->norm() << "\n";
}
auto std_inner = [](double v1, double v2) {
return v1 * v2;
};
auto orthonormal = orthonormalize(basis, std_inner);
cout << "Orthonormalized Basis: \n";
for (auto i = orthonormal.begin(); i != orthonormal.end(); ++i) {
cout << *i << "\n";
}
auto check = check_orthonormality(orthonormal, std_inner);
cout << "Orthonormal sum: " << check << "\n";
}