MCPcopy Create free account
hub / github.com/BoevaLab/FREEC / applyrotationsfromtheleft

Function applyrotationsfromtheleft

src/rotations.cpp:55–163  ·  view source on GitHub ↗

Application of a sequence of elementary rotations to a matrix The algorithm pre-multiplies the matrix by a sequence of rotation transformations which is given by arrays C and S. Depending on the value of the IsForward parameter either 1 and 2, 3 and 4 and so on (if IsForward=true) rows are rotated, or the rows N and N-1, N-2 and N-3 and so on, are rotated. Not the whole matrix but only a part o

Source from the content-addressed store, hash-verified

53Utility subroutine.
54*************************************************************************/
55void applyrotationsfromtheleft(bool isforward,
56 int m1,
57 int m2,
58 int n1,
59 int n2,
60 const ap::real_1d_array& c,
61 const ap::real_1d_array& s,
62 ap::real_2d_array& a,
63 ap::real_1d_array& work)
64{
65 int j;
66 int jp1;
67 double ctemp;
68 double stemp;
69 double temp;
70
71 if( m1>m2||n1>n2 )
72 {
73 return;
74 }
75
76 //
77 // Form P * A
78 //
79 if( isforward )
80 {
81 if( n1!=n2 )
82 {
83
84 //
85 // Common case: N1<>N2
86 //
87 for(j = m1; j <= m2-1; j++)
88 {
89 ctemp = c(j-m1+1);
90 stemp = s(j-m1+1);
91 if( ap::fp_neq(ctemp,1)||ap::fp_neq(stemp,0) )
92 {
93 jp1 = j+1;
94 ap::vmove(&work(n1), 1, &a(jp1, n1), 1, ap::vlen(n1,n2), ctemp);
95 ap::vsub(&work(n1), 1, &a(j, n1), 1, ap::vlen(n1,n2), stemp);
96 ap::vmul(&a(j, n1), 1, ap::vlen(n1,n2), ctemp);
97 ap::vadd(&a(j, n1), 1, &a(jp1, n1), 1, ap::vlen(n1,n2), stemp);
98 ap::vmove(&a(jp1, n1), 1, &work(n1), 1, ap::vlen(n1,n2));
99 }
100 }
101 }
102 else
103 {
104
105 //
106 // Special case: N1=N2
107 //
108 for(j = m1; j <= m2-1; j++)
109 {
110 ctemp = c(j-m1+1);
111 stemp = s(j-m1+1);
112 if( ap::fp_neq(ctemp,1)||ap::fp_neq(stemp,0) )

Callers 1

Calls 4

vmoveFunction · 0.85
vsubFunction · 0.85
vmulFunction · 0.85
vaddFunction · 0.85

Tested by

no test coverage detected