Multiplication by matrix Q which reduces matrix A to bidiagonal form. The algorithm allows pre- or post-multiply by Q or Q'. Input parameters: QP - matrices Q and P in compact form. Output of ToBidiagonal subroutine. M - number of rows in matrix A. N - number of columns in matrix A. TAUQ - scalar factors which are u
| 1636 | Bochkanov Sergey |
| 1637 | *************************************************************************/ |
| 1638 | void rmatrixbdmultiplybyq(const ap::real_2d_array& qp, |
| 1639 | int m, |
| 1640 | int n, |
| 1641 | const ap::real_1d_array& tauq, |
| 1642 | ap::real_2d_array& z, |
| 1643 | int zrows, |
| 1644 | int zcolumns, |
| 1645 | bool fromtheright, |
| 1646 | bool dotranspose) |
| 1647 | { |
| 1648 | int i; |
| 1649 | int i1; |
| 1650 | int i2; |
| 1651 | int istep; |
| 1652 | ap::real_1d_array v; |
| 1653 | ap::real_1d_array work; |
| 1654 | int mx; |
| 1655 | |
| 1656 | if( m<=0||n<=0||zrows<=0||zcolumns<=0 ) |
| 1657 | { |
| 1658 | return; |
| 1659 | } |
| 1660 | ap::ap_error::make_assertion((fromtheright&&zcolumns==m)||((!fromtheright)&&(zrows==m)), "RMatrixBDMultiplyByQ: incorrect Z size!"); |
| 1661 | |
| 1662 | // |
| 1663 | // init |
| 1664 | // |
| 1665 | mx = ap::maxint(m, n); |
| 1666 | mx = ap::maxint(mx, zrows); |
| 1667 | mx = ap::maxint(mx, zcolumns); |
| 1668 | v.setlength(mx+1); |
| 1669 | work.setlength(mx+1); |
| 1670 | if( m>=n ) |
| 1671 | { |
| 1672 | |
| 1673 | // |
| 1674 | // setup |
| 1675 | // |
| 1676 | if( fromtheright ) |
| 1677 | { |
| 1678 | i1 = 0; |
| 1679 | i2 = n-1; |
| 1680 | istep = +1; |
| 1681 | } |
| 1682 | else |
| 1683 | { |
| 1684 | i1 = n-1; |
| 1685 | i2 = 0; |
| 1686 | istep = -1; |
| 1687 | } |
| 1688 | if( dotranspose ) |
| 1689 | { |
| 1690 | i = i1; |
| 1691 | i1 = i2; |
| 1692 | i2 = i; |
| 1693 | istep = -istep; |
| 1694 | } |
| 1695 |
no test coverage detected