-
Notifications
You must be signed in to change notification settings - Fork 3
/
blending.cpp
53 lines (40 loc) · 1.73 KB
/
blending.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "dualquat.hpp"
#include <random>
int main () {
using namespace average;
std::mt19937 engine;
engine.seed(0);
std::uniform_real_distribution<double> dist(-1, 1);
size_t N = 10000;
auto q0 = quat<double>(0, 1, 1, 1).exp(); q0.print();
std::vector<double> weights(N, 1.0/N);
std::vector<quat<double>> quats;
for (size_t i = 0; i < N; i++)
quats.push_back( q0*quat<double>(1+dist(engine), dist(engine),
dist(engine), dist(engine)).N());
QLA(quats).print();
std::cout << QLA(quats).logdist(q0) << std::endl;
QLB(quats, weights).print();
std::cout << QLB(quats, weights).logdist(q0) << std::endl;
QIA(quats).print();
std::cout << QIA(quats).logdist(q0) << std::endl;
QIB(quats, weights).print();
std::cout << QIB(quats, weights).logdist(q0) << std::endl;
std::cout << std::endl;
auto Q0 = dualquat<double>(0, 1, 1, 1, 0, 1, 2, 3).exp(); Q0.print();
std::vector<double> Weights(N, 1.0/N);
std::vector<dualquat<double>> Quats;
for (size_t i = 0; i < N; i++)
Quats.push_back(Q0*dualquat<double>(1+dist(engine), dist(engine),
dist(engine), dist(engine),
dist(engine), dist(engine),
dist(engine), dist(engine)).N());
DLA(Quats).print();
std::cout << DLA(Quats).logdist(Q0) << std::endl;
DLB(Quats, Weights).print();
std::cout << DLB(Quats, Weights).logdist(Q0) << std::endl;
DIA(Quats).print();
std::cout << DIA(Quats).logdist(Q0) << std::endl;
DIB(Quats, Weights).print();
std::cout << DIB(Quats, Weights).logdist(Q0) << std::endl;
}