Application of an elementary reflection to a rectangular matrix of size MxN The algorithm pre-multiplies the matrix by an elementary reflection transformation which is given by column V and scalar Tau (see the description of the GenerateReflection procedure). Not the whole matrix but only a part of it is transformed (rows from M1 to M2, columns from N1 to N2). Only the elements of this submatrix
| 186 | September 30, 1994 |
| 187 | *************************************************************************/ |
| 188 | void applyreflectionfromtheleft(ap::real_2d_array& c, |
| 189 | double tau, |
| 190 | const ap::real_1d_array& v, |
| 191 | int m1, |
| 192 | int m2, |
| 193 | int n1, |
| 194 | int n2, |
| 195 | ap::real_1d_array& work) |
| 196 | { |
| 197 | double t; |
| 198 | int i; |
| 199 | int vm; |
| 200 | |
| 201 | if( ap::fp_eq(tau,0)||n1>n2||m1>m2 ) |
| 202 | { |
| 203 | return; |
| 204 | } |
| 205 | |
| 206 | // |
| 207 | // w := C' * v |
| 208 | // |
| 209 | vm = m2-m1+1; |
| 210 | for(i = n1; i <= n2; i++) |
| 211 | { |
| 212 | work(i) = 0; |
| 213 | } |
| 214 | for(i = m1; i <= m2; i++) |
| 215 | { |
| 216 | t = v(i+1-m1); |
| 217 | ap::vadd(&work(n1), 1, &c(i, n1), 1, ap::vlen(n1,n2), t); |
| 218 | } |
| 219 | |
| 220 | // |
| 221 | // C := C - tau * v * w' |
| 222 | // |
| 223 | for(i = m1; i <= m2; i++) |
| 224 | { |
| 225 | t = v(i-m1+1)*tau; |
| 226 | ap::vsub(&c(i, n1), 1, &work(n1), 1, ap::vlen(n1,n2), t); |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | |
| 231 | /************************************************************************* |
no test coverage detected