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

Function hmatrixtdunpackq

src/ortfac.cpp:2788–2854  ·  view source on GitHub ↗

Unpacking matrix Q which reduces a Hermitian matrix to a real tridiagonal form. Input parameters: A - the result of a HMatrixTD subroutine N - size of matrix A. IsUpper - storage format (a parameter of HMatrixTD subroutine) Tau - the result of a HMatrixTD subroutine Output parameters: Q - transformation matrix. array with eleme

Source from the content-addressed store, hash-verified

2786 Copyright 2005-2010 by Bochkanov Sergey
2787*************************************************************************/
2788void hmatrixtdunpackq(const ap::complex_2d_array& a,
2789 const int& n,
2790 const bool& isupper,
2791 const ap::complex_1d_array& tau,
2792 ap::complex_2d_array& q)
2793{
2794 int i;
2795 int j;
2796 ap::complex_1d_array v;
2797 ap::complex_1d_array work;
2798
2799 if( n==0 )
2800 {
2801 return;
2802 }
2803
2804 //
2805 // init
2806 //
2807 q.setbounds(0, n-1, 0, n-1);
2808 v.setbounds(1, n);
2809 work.setbounds(0, n-1);
2810 for(i = 0; i <= n-1; i++)
2811 {
2812 for(j = 0; j <= n-1; j++)
2813 {
2814 if( i==j )
2815 {
2816 q(i,j) = 1;
2817 }
2818 else
2819 {
2820 q(i,j) = 0;
2821 }
2822 }
2823 }
2824
2825 //
2826 // unpack Q
2827 //
2828 if( isupper )
2829 {
2830 for(i = 0; i <= n-2; i++)
2831 {
2832
2833 //
2834 // Apply H(i)
2835 //
2836 ap::vmove(&v(1), 1, &a(0, i+1), a.getstride(), "N", ap::vlen(1,i+1));
2837 v(i+1) = 1;
2838 complexapplyreflectionfromtheleft(q, tau(i), v, 0, i, 0, n-1, work);
2839 }
2840 }
2841 else
2842 {
2843 for(i = n-2; i >= 0; i--)
2844 {
2845

Callers

nothing calls this directly

Calls 4

vmoveFunction · 0.85
getstrideMethod · 0.80
setboundsMethod · 0.45

Tested by

no test coverage detected