-
Notifications
You must be signed in to change notification settings - Fork 5
/
NOTES.txt
117 lines (88 loc) · 3.88 KB
/
NOTES.txt
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
Generalizing CORDIC TO N Dimensions
-----------------------------------
All the code in this directory is 2D-oriented at this point.
There exist CORDIC formulations that handle higher dimensions.
3D or 4D rotations are obviously relevant in many fields,
so I'm trying here to regurgitate those formulations in
terms that I can understand (i.e., no mathematical symbols!).
The way to do this is to think about CORDIC in matrix form.
Let's look at Euclidean rotation mode only.
We can come back later and make adjustments for Euclidean vector,
hyperbolic rotation, and hyperbolic vectoring modes.
2D Circular Rotation in Matrix Form
-----------------------------------
Input: m0 = angle of clockwise rotation about z axis
(sorry, the papers all use clockwise, we can invert signs later)
P = | cos(m0) sin(m0) |
| |
| -sin(m0) cos(m0) |
V = | x0 |
| y0 |
Goal: compute P * V = | x0*cos(m0) + y0*sin(m0) | xn
|-x0*sin(m0) + y0*cos(m0) | yn
n = number of CORDIC shift-and-add iterations (== fractional bits)
i = CORDIC iteration (i=0..n for one application of CORDIC)
For each iteration i, use the elementary rotation:
Ri = | 1 ai*ti |
| |
| -ai*ti 1 |
[I need to add something on how that elementary rotation was created.]
where:
fi = sign( xi )
ti = 2^(-fi)
ai = fi * sign( yi )
R = product( Ri ) forall i
R*V = kP*V where k is the scale factor
dmi = delta(m) = m(i+1) - mi = atan(2^(-i)) atan(2^(-i)) is precomputed into a LUT
dmi0= m0
ki = 1/cos(dmi)
= sqrt( 1 + 2^(-2i) )
k = product( ki ) forall i
= R applied to I = { 1, 0 }
P*V = (1/k)R*V
4D Circular Rotation in Matrix Form (Quaternions)
-------------------------------------------------
Input: m0 = angle of clockwise rotation about ???
[need to figure out how to make this work for an arbitrary unit vector axis]
P = | cos(m0) sin(m0) sin(m0) sin(m0) |
| |
| -sin(m0) cos(m0) -sin(m0) sin(m0) |
| |
| -sin(m0) cos(m0) cos(m0) -sin(m0) |
| |
| -sin(m0) -sin(m0) sin(m0) cos(m0) |
Goal: compute P * V = | x0*cos(m0) + y0*sin(m0) + z0*sin(m0) + w0*sin(m0) | xn
|-x0*sin(m0) + y0*cos(m0) - z0*sin(m0) + w0*sin(m0) | yn
|-x0*sin(m0) + y0*cos(m0) + z0*cos(m0) - w0*sin(m0) | zn
|-x0*sin(m0) - y0*sin(m0) + z0*sin(m0) + w0*cos(m0) | wn
[Need to add something on how one uses that to do useful things.]
V = | x0 |
| y0 |
| z0 |
| w0 |
For each iteration i, use the elementary rotation:
Ri = | 1 ai*ti bi*ti ci*ti |
| |
| -ai*ti 1 -ci*ti bi*ti |
| |
| -bi*ti ci*ti 1 -ai*ti |
| |
| -ci*ti -bi*ti ai*ti 1 |
where:
fi = sign( xi )
ti = 2^(-fi)
ai = fi * sign( yi )
bi = fi * sign( zi )
ci = fi * sign( wi )
R = product( Ri ) forall i
R*V = kP*V where k is the scale factor
dmi = delta(m) = m(i+1) - mi = atan(2^(-i)) atan(2^(-i)) is precomputed into a LUT
dmi0= m0
ki = 1/cos(dmi)
= sqrt( 1 + 3*ti^2 ) (this is probably wrong, octonion: sqrt( 1 + 7*ti^2 )
k = product( ki ) forall i
= R applied to I = { 1, 0, 0, 0 } (I think)
P*V = (1/k)R*V
8D Circular Rotation in Matrix Form (Octonions)
-----------------------------------------------
[Let me get the 4D case 100% correct before coming back here. It looks similar.]