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

Function smatrixtdunpackq

src/ortfac.cpp:2475–2541  ·  view source on GitHub ↗

Unpacking matrix Q which reduces symmetric matrix to a tridiagonal form. Input parameters: A - the result of a SMatrixTD subroutine N - size of matrix A. IsUpper - storage format (a parameter of SMatrixTD subroutine) Tau - the result of a SMatrixTD subroutine Output parameters: Q - transformation matrix. array with elements [0..

Source from the content-addressed store, hash-verified

2473 Copyright 2005-2010 by Bochkanov Sergey
2474*************************************************************************/
2475void smatrixtdunpackq(const ap::real_2d_array& a,
2476 const int& n,
2477 const bool& isupper,
2478 const ap::real_1d_array& tau,
2479 ap::real_2d_array& q)
2480{
2481 int i;
2482 int j;
2483 ap::real_1d_array v;
2484 ap::real_1d_array work;
2485
2486 if( n==0 )
2487 {
2488 return;
2489 }
2490
2491 //
2492 // init
2493 //
2494 q.setbounds(0, n-1, 0, n-1);
2495 v.setbounds(1, n);
2496 work.setbounds(0, n-1);
2497 for(i = 0; i <= n-1; i++)
2498 {
2499 for(j = 0; j <= n-1; j++)
2500 {
2501 if( i==j )
2502 {
2503 q(i,j) = 1;
2504 }
2505 else
2506 {
2507 q(i,j) = 0;
2508 }
2509 }
2510 }
2511
2512 //
2513 // unpack Q
2514 //
2515 if( isupper )
2516 {
2517 for(i = 0; i <= n-2; i++)
2518 {
2519
2520 //
2521 // Apply H(i)
2522 //
2523 ap::vmove(&v(1), 1, &a(0, i+1), a.getstride(), ap::vlen(1,i+1));
2524 v(i+1) = 1;
2525 applyreflectionfromtheleft(q, tau(i), v, 0, i, 0, n-1, work);
2526 }
2527 }
2528 else
2529 {
2530 for(i = n-2; i >= 0; i--)
2531 {
2532

Callers

nothing calls this directly

Calls 4

vmoveFunction · 0.85
getstrideMethod · 0.80
setboundsMethod · 0.45

Tested by

no test coverage detected