Fix missing import in finiterectlat-scatter.py
[qpms.git] / oldtests / quaternion_O3.c
blobda234eb7126ff3a9a32f6a8a0a4d6e8f07276144
1 #include <qpms/wigner.h>
2 #include <stdio.h>
4 int main() {
5 cart3_t v = {1, 2, 3};
6 qpms_quat4d_t q4[8] = {
7 {1, 0, 0, 0},
8 {0, 1, 0, 0},
9 {0, 0, 1, 0},
10 {0, 0, 0, 1},
11 {-1, 0, 0, 0},
12 {0, -1, 0, 0},
13 {0, 0, -1, 0},
14 {0, 0, 0, -1},
16 printf("original: (%g, %g, %g)\n", v.x, v.y, v.z);
17 for(int i = 0; i < 8; ++i) {
18 for (int det = -1; det < 2; det += 2) {
19 const qpms_quat4d_t qr = q4[i];
20 const qpms_quat_t qc = qpms_quat_2c_from_4d(qr);
21 const qpms_irot3_t r = {qc, det};
22 const cart3_t w = qpms_irot3_apply_cart3(r, v);
23 printf("[%+g %+g %+g %+g] -> [%+g%+gj %+g%+g] *%+d: ==> (%g, %g, %g)\n",
24 qr.c1, qr.ci, qr.cj, qr.ck, creal(qc.a), cimag(qc.a), creal(qc.b), cimag(qc.b),
25 det, w.x, w.y, w.z);
28 return 0;