Reduction of a Hermitian matrix which is given by its higher or lower triangular part to a real tridiagonal matrix using unitary 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
| 2611 | October 31, 1992 |
| 2612 | *************************************************************************/ |
| 2613 | void hmatrixtd(ap::complex_2d_array& a, |
| 2614 | int n, |
| 2615 | bool isupper, |
| 2616 | ap::complex_1d_array& tau, |
| 2617 | ap::real_1d_array& d, |
| 2618 | ap::real_1d_array& e) |
| 2619 | { |
| 2620 | int i; |
| 2621 | ap::complex alpha; |
| 2622 | ap::complex taui; |
| 2623 | ap::complex v; |
| 2624 | ap::complex_1d_array t; |
| 2625 | ap::complex_1d_array t2; |
| 2626 | ap::complex_1d_array t3; |
| 2627 | |
| 2628 | if( n<=0 ) |
| 2629 | { |
| 2630 | return; |
| 2631 | } |
| 2632 | for(i = 0; i <= n-1; i++) |
| 2633 | { |
| 2634 | ap::ap_error::make_assertion(ap::fp_eq(a(i,i).y,0), ""); |
| 2635 | } |
| 2636 | if( n>1 ) |
| 2637 | { |
| 2638 | tau.setbounds(0, n-2); |
| 2639 | e.setbounds(0, n-2); |
| 2640 | } |
| 2641 | d.setbounds(0, n-1); |
| 2642 | t.setbounds(0, n-1); |
| 2643 | t2.setbounds(0, n-1); |
| 2644 | t3.setbounds(0, n-1); |
| 2645 | if( isupper ) |
| 2646 | { |
| 2647 | |
| 2648 | // |
| 2649 | // Reduce the upper triangle of A |
| 2650 | // |
| 2651 | a(n-1,n-1) = a(n-1,n-1).x; |
| 2652 | for(i = n-2; i >= 0; i--) |
| 2653 | { |
| 2654 | |
| 2655 | // |
| 2656 | // Generate elementary reflector H = I+1 - tau * v * v' |
| 2657 | // |
| 2658 | alpha = a(i,i+1); |
| 2659 | t(1) = alpha; |
| 2660 | if( i>=1 ) |
| 2661 | { |
| 2662 | ap::vmove(&t(2), 1, &a(0, i+1), a.getstride(), "N", ap::vlen(2,i+1)); |
| 2663 | } |
| 2664 | complexgeneratereflection(t, i+1, taui); |
| 2665 | if( i>=1 ) |
| 2666 | { |
| 2667 | ap::vmove(&a(0, i+1), a.getstride(), &t(2), 1, "N", ap::vlen(0,i-1)); |
| 2668 | } |
| 2669 | alpha = t(1); |
| 2670 | e(i) = alpha.x; |
nothing calls this directly
no test coverage detected