Unpacking matrix Q which reduces matrix A to upper Hessenberg form Input parameters: A - output of RMatrixHessenberg subroutine. N - size of matrix A. Tau - scalar factors which are used to form Q. Output of RMatrixHessenberg subroutine. Output parameters: Q - matrix Q. Array whose indexes range within [0..N-1, 0..N-1]. -- ALGLIB -- 2
| 2148 | Bochkanov Sergey |
| 2149 | *************************************************************************/ |
| 2150 | void rmatrixhessenbergunpackq(const ap::real_2d_array& a, |
| 2151 | int n, |
| 2152 | const ap::real_1d_array& tau, |
| 2153 | ap::real_2d_array& q) |
| 2154 | { |
| 2155 | int i; |
| 2156 | int j; |
| 2157 | ap::real_1d_array v; |
| 2158 | ap::real_1d_array work; |
| 2159 | |
| 2160 | if( n==0 ) |
| 2161 | { |
| 2162 | return; |
| 2163 | } |
| 2164 | |
| 2165 | // |
| 2166 | // init |
| 2167 | // |
| 2168 | q.setbounds(0, n-1, 0, n-1); |
| 2169 | v.setbounds(0, n-1); |
| 2170 | work.setbounds(0, n-1); |
| 2171 | for(i = 0; i <= n-1; i++) |
| 2172 | { |
| 2173 | for(j = 0; j <= n-1; j++) |
| 2174 | { |
| 2175 | if( i==j ) |
| 2176 | { |
| 2177 | q(i,j) = 1; |
| 2178 | } |
| 2179 | else |
| 2180 | { |
| 2181 | q(i,j) = 0; |
| 2182 | } |
| 2183 | } |
| 2184 | } |
| 2185 | |
| 2186 | // |
| 2187 | // unpack Q |
| 2188 | // |
| 2189 | for(i = 0; i <= n-2; i++) |
| 2190 | { |
| 2191 | |
| 2192 | // |
| 2193 | // Apply H(i) |
| 2194 | // |
| 2195 | ap::vmove(&v(1), 1, &a(i+1, i), a.getstride(), ap::vlen(1,n-i-1)); |
| 2196 | v(1) = 1; |
| 2197 | applyreflectionfromtheright(q, tau(i), v, 0, n-1, i+1, n-1, work); |
| 2198 | } |
| 2199 | } |
| 2200 | |
| 2201 | |
| 2202 | /************************************************************************* |
nothing calls this directly
no test coverage detected