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

Function smatrixtd

src/ortfac.cpp:2311–2455  ·  view source on GitHub ↗

Reduction of a symmetric matrix which is given by its higher or lower triangular part to a tridiagonal matrix using orthogonal similarity transformation: Q'*A*Q=T. Input parameters: A - matrix to be transformed array with elements [0..N-1, 0..N-1]. N - size of matrix A. IsUpper - storage format. If IsUpper = True, then matrix A is given

Source from the content-addressed store, hash-verified

2309 October 31, 1992
2310*************************************************************************/
2311void smatrixtd(ap::real_2d_array& a,
2312 int n,
2313 bool isupper,
2314 ap::real_1d_array& tau,
2315 ap::real_1d_array& d,
2316 ap::real_1d_array& e)
2317{
2318 int i;
2319 double alpha;
2320 double taui;
2321 double v;
2322 ap::real_1d_array t;
2323 ap::real_1d_array t2;
2324 ap::real_1d_array t3;
2325
2326 if( n<=0 )
2327 {
2328 return;
2329 }
2330 t.setbounds(1, n);
2331 t2.setbounds(1, n);
2332 t3.setbounds(1, n);
2333 if( n>1 )
2334 {
2335 tau.setbounds(0, n-2);
2336 }
2337 d.setbounds(0, n-1);
2338 if( n>1 )
2339 {
2340 e.setbounds(0, n-2);
2341 }
2342 if( isupper )
2343 {
2344
2345 //
2346 // Reduce the upper triangle of A
2347 //
2348 for(i = n-2; i >= 0; i--)
2349 {
2350
2351 //
2352 // Generate elementary reflector H() = E - tau * v * v'
2353 //
2354 if( i>=1 )
2355 {
2356 ap::vmove(&t(2), 1, &a(0, i+1), a.getstride(), ap::vlen(2,i+1));
2357 }
2358 t(1) = a(i,i+1);
2359 generatereflection(t, i+1, taui);
2360 if( i>=1 )
2361 {
2362 ap::vmove(&a(0, i+1), a.getstride(), &t(2), 1, ap::vlen(0,i-1));
2363 }
2364 a(i,i+1) = t(1);
2365 e(i) = a(i,i+1);
2366 if( ap::fp_neq(taui,0) )
2367 {
2368

Callers

nothing calls this directly

Calls 8

vmoveFunction · 0.85
generatereflectionFunction · 0.85
vdotproductFunction · 0.85
vaddFunction · 0.85
symmetricrank2updateFunction · 0.85
getstrideMethod · 0.80
setboundsMethod · 0.45

Tested by

no test coverage detected