35 #ifndef _BLAZE_MATH_LAPACK_GESVDX_H_ 36 #define _BLAZE_MATH_LAPACK_GESVDX_H_ 44 #include <boost/cast.hpp> 79 template<
typename MT,
bool SO,
typename VT,
bool TF >
80 inline size_t gesvdx( DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& s );
82 template<
typename MT,
bool SO,
typename VT,
bool TF,
typename ST >
83 inline size_t gesvdx( DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& s, ST low, ST upp );
85 template<
typename MT1,
bool SO,
typename MT2,
typename VT,
bool TF >
86 inline size_t gesvdx( DenseMatrix<MT1,SO>& A, DenseMatrix<MT2,SO>& U, DenseVector<VT,TF>& s );
88 template<
typename MT1,
bool SO,
typename MT2,
typename VT,
bool TF,
typename ST >
89 inline size_t gesvdx( DenseMatrix<MT1,SO>& A, DenseMatrix<MT2,SO>& U,
90 DenseVector<VT,TF>& s, ST low, ST upp );
92 template<
typename MT1,
bool SO,
typename VT,
bool TF,
typename MT2 >
93 inline size_t gesvdx( DenseMatrix<MT1,SO>& A, DenseVector<VT,TF>& s, DenseMatrix<MT2,SO>& V );
95 template<
typename MT1,
bool SO,
typename VT,
bool TF,
typename MT2,
typename ST >
96 inline size_t gesvdx( DenseMatrix<MT1,SO>& A, DenseVector<VT,TF>& s,
97 DenseMatrix<MT2,SO>& V, ST low, ST upp );
99 template<
typename MT1,
bool SO,
typename MT2,
typename VT,
bool TF,
typename MT3 >
100 inline size_t gesvdx( DenseMatrix<MT1,SO>& A, DenseMatrix<MT2,SO>& U,
101 DenseVector<VT,TF>& s, DenseMatrix<MT3,SO>& V );
103 template<
typename MT1,
bool SO,
typename MT2,
typename VT,
bool TF,
typename MT3,
typename ST >
104 inline size_t gesvdx( DenseMatrix<MT1,SO>& A, DenseMatrix<MT2,SO>& U,
105 DenseVector<VT,TF>& s, DenseMatrix<MT3,SO>& V, ST low, ST upp );
132 template<
typename MT
137 inline DisableIf_< IsComplex< ElementType_<MT> >,
size_t >
138 gesvdx_backend( DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& s,
139 char range, ST vl, ST vu,
int il,
int iu )
141 using boost::numeric_cast;
143 BLAZE_INTERNAL_ASSERT( range ==
'A' || range ==
'V' || range ==
'I',
"Invalid range flag detected" );
150 using ET = ElementType_<MT>;
152 const size_t M( (~A).
rows() );
153 const size_t N( (~A).
columns() );
154 const size_t mindim(
min( M, N ) );
156 int m ( numeric_cast<int>( SO ? (~A).
rows() : (~A).
columns() ) );
157 int n ( numeric_cast<int>( SO ? (~A).
columns() : (~A).
rows() ) );
158 int lda ( numeric_cast<int>( (~A).
spacing() ) );
162 ET* sptr( (~s).data() );
163 std::unique_ptr<ET[]> stmp;
165 const bool tmpRequired( (~s).
size() < mindim );
168 stmp.reset(
new ET[2UL*mindim] );
172 const int minimum(
min( m, n ) );
174 int lwork( minimum*( minimum*3 + 20 ) + 2 );
175 const std::unique_ptr<ET[]> work (
new ET[lwork] );
176 const std::unique_ptr<int[]> iwork(
new int[12*minimum] );
178 gesvdx(
'N',
'N', range, m, n, (~A).data(), lda, vl, vu, il, iu, &ns, sptr,
179 nullptr, 1,
nullptr, 1, work.get(), lwork, iwork.get(), &info );
181 const size_t num( numeric_cast<size_t>( ns ) );
191 for(
size_t i=0UL; i<(~s).
size(); ++i ) {
224 template<
typename MT
229 inline EnableIf_< IsComplex< ElementType_<MT> >,
size_t >
230 gesvdx_backend( DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& s,
231 char range, ST vl, ST vu,
int il,
int iu )
233 using boost::numeric_cast;
235 BLAZE_INTERNAL_ASSERT( range ==
'A' || range ==
'V' || range ==
'I',
"Invalid range flag detected" );
242 using CT = ElementType_<MT>;
243 using BT = UnderlyingElement_<CT>;
245 const size_t M( (~A).
rows() );
246 const size_t N( (~A).
columns() );
247 const size_t mindim(
min( M, N ) );
249 int m ( numeric_cast<int>( SO ? (~A).
rows() : (~A).
columns() ) );
250 int n ( numeric_cast<int>( SO ? (~A).
columns() : (~A).
rows() ) );
251 int lda ( numeric_cast<int>( (~A).
spacing() ) );
255 BT* sptr( (~s).data() );
256 std::unique_ptr<BT[]> stmp;
258 const bool tmpRequired( (~s).
size() < mindim );
261 stmp.reset(
new BT[2UL*mindim] );
265 const int minimum(
min( m, n ) );
267 int lwork( minimum*( minimum*3 + 20 ) + 2 );
268 const std::unique_ptr<CT[]> work (
new CT[lwork] );
269 const std::unique_ptr<BT[]> rwork(
new BT[17*minimum*minimum] );
270 const std::unique_ptr<int[]> iwork(
new int[12*minimum] );
272 gesvdx(
'N',
'N', range, m, n, (~A).data(), lda, vl, vu, il, iu, &ns, sptr,
273 nullptr, 1,
nullptr, 1, work.get(), lwork, rwork.get(), iwork.get(), &info );
275 const size_t num( numeric_cast<size_t>( ns ) );
285 for(
size_t i=0UL; i<(~s).
size(); ++i ) {
348 template<
typename MT
366 const size_t M( (~A).
rows() );
367 const size_t N( (~A).
columns() );
368 const size_t mindim(
min( M, N ) );
370 resize( ~s, mindim,
false );
372 if( M == 0UL || N == 0UL ) {
376 return gesvdx_backend( ~A, ~s,
'A', UT(), UT(), 0, 0 );
462 template<
typename MT
469 using boost::numeric_cast;
490 const size_t M( (~A).
rows() );
491 const size_t N( (~A).
columns() );
492 const size_t mindim(
min( M, N ) );
499 resize( ~s, expected,
false );
501 if( M == 0UL || N == 0UL ) {
511 const size_t actual( gesvdx_backend( ~A, ~s, range, vl, vu, il, iu ) );
514 resize( ~s, actual,
true );
545 template<
typename MT1
553 char range, ST vl, ST vu,
int il,
int iu )
555 using boost::numeric_cast;
557 BLAZE_INTERNAL_ASSERT( range ==
'A' || range ==
'V' || range ==
'I',
"Invalid range flag detected" );
568 const size_t M( (~A).
rows() );
569 const size_t N( (~A).
columns() );
570 const size_t mindim(
min( M, N ) );
572 int m ( numeric_cast<int>( SO ? M : N ) );
573 int n ( numeric_cast<int>( SO ? N : M ) );
574 int lda ( numeric_cast<int>( (~A).
spacing() ) );
575 int ldu ( numeric_cast<int>( (~U).
spacing() ) );
579 ET* sptr( (~s).data() );
580 ET* uptr( (~U).data() );
581 std::unique_ptr<ET[]> stmp;
582 std::unique_ptr<ET[]> utmp;
584 const bool tmpRequired( (~s).
size() < mindim );
587 stmp.reset(
new ET[2UL*mindim] );
588 utmp.reset(
new ET[M*mindim] );
593 const int minimum(
min( m, n ) );
595 int lwork( minimum*( minimum*3 + 20 ) + 2 );
596 const std::unique_ptr<ET[]> work (
new ET[lwork] );
597 const std::unique_ptr<int[]> iwork(
new int[12*minimum] );
599 gesvdx( ( SO ?
'V' :
'N' ), ( SO ?
'N' :
'V' ), range, m, n,
600 (~A).data(), lda, vl, vu, il, iu, &ns, sptr,
601 ( SO ? uptr :
nullptr ), ( tmpRequired ? m : ( SO ? ldu : 1 ) ),
602 ( SO ?
nullptr : uptr ), ( tmpRequired ? mindim : ( SO ? 1 : ldu ) ),
603 work.get(), lwork, iwork.get(), &info );
605 const size_t num( numeric_cast<size_t>( ns ) );
616 for(
size_t i=0UL; i<(~s).
size(); ++i ) {
622 for(
size_t j=0UL; j<(~U).
columns(); ++j ) {
623 for(
size_t i=0UL; i<(~U).
rows(); ++i ) {
624 (~U)(i,j) = utmp[i+j*M];
630 for(
size_t i=0UL; i<(~U).
rows(); ++i ) {
631 for(
size_t j=0UL; j<(~U).
columns(); ++j ) {
632 (~U)(i,j) = utmp[i*mindim+j];
667 template<
typename MT1
675 char range, ST vl, ST vu,
int il,
int iu )
677 using boost::numeric_cast;
679 BLAZE_INTERNAL_ASSERT( range ==
'A' || range ==
'V' || range ==
'I',
"Invalid range flag detected" );
691 const size_t M( (~A).
rows() );
692 const size_t N( (~A).
columns() );
693 const size_t mindim(
min( M, N ) );
695 int m ( numeric_cast<int>( SO ? M : N ) );
696 int n ( numeric_cast<int>( SO ? N : M ) );
697 int lda ( numeric_cast<int>( (~A).
spacing() ) );
698 int ldu ( numeric_cast<int>( (~U).
spacing() ) );
702 BT* sptr( (~s).data() );
703 CT* uptr( (~U).data() );
704 std::unique_ptr<BT[]> stmp;
705 std::unique_ptr<CT[]> utmp;
707 const bool tmpRequired( (~s).
size() < mindim );
710 stmp.reset(
new BT[2UL*mindim] );
711 utmp.reset(
new CT[M*mindim] );
716 const int minimum(
min( m, n ) );
718 int lwork( minimum*( minimum*3 + 20 ) + 2 );
719 const std::unique_ptr<CT[]> work (
new CT[lwork] );
720 const std::unique_ptr<BT[]> rwork(
new BT[17*minimum*minimum] );
721 const std::unique_ptr<int[]> iwork(
new int[12*minimum] );
723 gesvdx( ( SO ?
'V' :
'N' ), ( SO ?
'N' :
'V' ), range, m, n,
724 (~A).data(), lda, vl, vu, il, iu, &ns, sptr,
725 ( SO ? uptr :
nullptr ), ( tmpRequired ? m : ( SO ? ldu : 1 ) ),
726 ( SO ?
nullptr : uptr ), ( tmpRequired ? mindim : ( SO ? 1 : ldu ) ),
727 work.get(), lwork, rwork.get(), iwork.get(), &info );
729 const size_t num( numeric_cast<size_t>( ns ) );
740 for(
size_t i=0UL; i<(~s).
size(); ++i ) {
746 for(
size_t j=0UL; j<(~U).
columns(); ++j ) {
747 for(
size_t i=0UL; i<(~U).
rows(); ++i ) {
748 (~U)(i,j) = utmp[i+j*M];
754 for(
size_t i=0UL; i<(~U).
rows(); ++i ) {
755 for(
size_t j=0UL; j<(~U).
columns(); ++j ) {
756 (~U)(i,j) = utmp[i*mindim+j];
825 template<
typename MT1
849 const size_t M( (~A).
rows() );
850 const size_t N( (~A).
columns() );
851 const size_t mindim(
min( M, N ) );
853 resize( ~s, mindim,
false );
854 resize( ~U, M, mindim,
false );
856 if( M == 0UL || N == 0UL ) {
860 return gesvdx_backend( ~A, ~U, ~s,
'A', UT(), UT(), 0, 0 );
955 template<
typename MT1
964 using boost::numeric_cast;
990 const size_t M( (~A).
rows() );
991 const size_t N( (~A).
columns() );
992 const size_t mindim(
min( M, N ) );
999 resize( ~s, expected,
false );
1000 resize( ~U, M, expected,
false );
1002 if( M == 0UL || N == 0UL ) {
1012 const size_t actual( gesvdx_backend( ~A, ~U, ~s, range, vl, vu, il, iu ) );
1015 resize( ~s, actual,
true );
1019 resize( ~U, M, actual,
true );
1050 template<
typename MT1
1056 inline DisableIf_< IsComplex< ElementType_<MT1> >,
size_t >
1058 char range, ST vl, ST vu,
int il,
int iu )
1060 using boost::numeric_cast;
1062 BLAZE_INTERNAL_ASSERT( range ==
'A' || range ==
'V' || range ==
'I',
"Invalid range flag detected" );
1073 const size_t M( (~A).
rows() );
1074 const size_t N( (~A).
columns() );
1075 const size_t mindim(
min( M, N ) );
1077 int m ( numeric_cast<int>( SO ? M : N ) );
1078 int n ( numeric_cast<int>( SO ? N : M ) );
1079 int lda ( numeric_cast<int>( (~A).
spacing() ) );
1080 int ldv ( numeric_cast<int>( (~V).
spacing() ) );
1084 ET* sptr( (~s).data() );
1085 ET* vptr( (~V).data() );
1086 std::unique_ptr<ET[]> stmp;
1087 std::unique_ptr<ET[]> vtmp;
1089 const bool tmpRequired( (~s).
size() < mindim );
1092 stmp.reset(
new ET[2UL*mindim] );
1093 vtmp.reset(
new ET[mindim*N] );
1098 const int minimum(
min( m, n ) );
1100 int lwork( minimum*( minimum*3 + 20 ) + 2 );
1101 const std::unique_ptr<ET[]> work (
new ET[lwork] );
1102 const std::unique_ptr<int[]> iwork(
new int[12*minimum] );
1104 gesvdx( ( SO ?
'N' :
'V' ), ( SO ?
'V' :
'N' ), range, m, n,
1105 (~A).data(), lda, vl, vu, il, iu, &ns, sptr,
1106 ( SO ?
nullptr : vptr ), ( tmpRequired ? m : ( SO ? 1 : ldv ) ),
1107 ( SO ? vptr :
nullptr ), ( tmpRequired ? mindim : ( SO ? ldv : 1 ) ),
1108 work.get(), lwork, iwork.get(), &info );
1110 const size_t num( numeric_cast<size_t>( ns ) );
1121 for(
size_t i=0UL; i<(~s).
size(); ++i ) {
1127 for(
size_t j=0UL; j<(~V).
columns(); ++j ) {
1128 for(
size_t i=0UL; i<(~V).
rows(); ++i ) {
1129 (~V)(i,j) = vtmp[i+j*mindim];
1135 for(
size_t i=0UL; i<(~V).
rows(); ++i ) {
1136 for(
size_t j=0UL; j<(~V).
columns(); ++j ) {
1137 (~V)(i,j) = vtmp[i*N+j];
1172 template<
typename MT1
1178 inline EnableIf_< IsComplex< ElementType_<MT1> >,
size_t >
1180 char range, ST vl, ST vu,
int il,
int iu )
1182 using boost::numeric_cast;
1184 BLAZE_INTERNAL_ASSERT( range ==
'A' || range ==
'V' || range ==
'I',
"Invalid range flag detected" );
1196 const size_t M( (~A).
rows() );
1197 const size_t N( (~A).
columns() );
1198 const size_t mindim(
min( M, N ) );
1200 int m ( numeric_cast<int>( SO ? M : N ) );
1201 int n ( numeric_cast<int>( SO ? N : M ) );
1202 int lda ( numeric_cast<int>( (~A).
spacing() ) );
1203 int ldv ( numeric_cast<int>( (~V).
spacing() ) );
1207 BT* sptr( (~s).data() );
1208 CT* vptr( (~V).data() );
1209 std::unique_ptr<BT[]> stmp;
1210 std::unique_ptr<CT[]> vtmp;
1212 const bool tmpRequired( (~s).
size() < mindim );
1215 stmp.reset(
new BT[2UL*mindim] );
1216 vtmp.reset(
new CT[mindim*N] );
1221 const int minimum(
min( m, n ) );
1223 int lwork( minimum*( minimum*3 + 20 ) + 2 );
1224 const std::unique_ptr<CT[]> work (
new CT[lwork] );
1225 const std::unique_ptr<BT[]> rwork(
new BT[17*minimum*minimum] );
1226 const std::unique_ptr<int[]> iwork(
new int[12*minimum] );
1228 gesvdx( ( SO ?
'N' :
'V' ), ( SO ?
'V' :
'N' ), range, m, n,
1229 (~A).data(), lda, vl, vu, il, iu, &ns, sptr,
1230 ( SO ?
nullptr : vptr ), ( tmpRequired ? m : ( SO ? 1 : ldv ) ),
1231 ( SO ? vptr :
nullptr ), ( tmpRequired ? mindim : ( SO ? ldv : 1 ) ),
1232 work.get(), lwork, rwork.get(), iwork.get(), &info );
1234 const size_t num( numeric_cast<size_t>( ns ) );
1245 for(
size_t i=0UL; i<(~s).
size(); ++i ) {
1251 for(
size_t j=0UL; j<(~V).
columns(); ++j ) {
1252 for(
size_t i=0UL; i<(~V).
rows(); ++i ) {
1253 (~V)(i,j) = vtmp[i+j*mindim];
1259 for(
size_t i=0UL; i<(~V).
rows(); ++i ) {
1260 for(
size_t j=0UL; j<(~V).
columns(); ++j ) {
1261 (~V)(i,j) = vtmp[i*N+j];
1330 template<
typename MT1
1354 const size_t M( (~A).
rows() );
1355 const size_t N( (~A).
columns() );
1356 const size_t mindim(
min( M, N ) );
1358 resize( ~s, mindim,
false );
1359 resize( ~V, mindim, N,
false );
1361 if( M == 0UL || N == 0UL ) {
1365 return gesvdx_backend( ~A, ~s, ~V,
'A', UT(), UT(), 0, 0 );
1460 template<
typename MT1
1469 using boost::numeric_cast;
1495 const size_t M( (~A).
rows() );
1496 const size_t N( (~A).
columns() );
1497 const size_t mindim(
min( M, N ) );
1504 resize( ~s, expected,
false );
1505 resize( ~V, expected, N,
false );
1507 if( M == 0UL || N == 0UL ) {
1517 const size_t actual( gesvdx_backend( ~A, ~s, ~V, range, vl, vu, il, iu ) );
1520 resize( ~s, actual,
true );
1524 resize( ~V, actual, N,
true );
1556 template<
typename MT1
1563 inline DisableIf_< IsComplex< ElementType_<MT1> >,
size_t >
1567 using boost::numeric_cast;
1569 BLAZE_INTERNAL_ASSERT( range ==
'A' || range ==
'V' || range ==
'I',
"Invalid range flag detected" );
1582 const size_t M( (~A).
rows() );
1583 const size_t N( (~A).
columns() );
1584 const size_t mindim(
min( M, N ) );
1586 int m ( numeric_cast<int>( SO ? M : N ) );
1587 int n ( numeric_cast<int>( SO ? N : M ) );
1588 int lda ( numeric_cast<int>( (~A).
spacing() ) );
1589 int ldu ( numeric_cast<int>( (~U).
spacing() ) );
1590 int ldv ( numeric_cast<int>( (~V).
spacing() ) );
1594 ET* sptr( (~s).data() );
1595 ET* uptr( (~U).data() );
1596 ET* vptr( (~V).data() );
1597 std::unique_ptr<ET[]> stmp;
1598 std::unique_ptr<ET[]> utmp;
1599 std::unique_ptr<ET[]> vtmp;
1601 const bool tmpRequired( (~s).
size() < mindim );
1604 stmp.reset(
new ET[2UL*mindim] );
1605 utmp.reset(
new ET[M*mindim] );
1606 vtmp.reset(
new ET[mindim*N] );
1612 const int minimum(
min( m, n ) );
1614 int lwork( minimum*( minimum*3 + 20 ) + 2 );
1615 const std::unique_ptr<ET[]> work (
new ET[lwork] );
1616 const std::unique_ptr<int[]> iwork(
new int[12*minimum] );
1618 gesvdx(
'V',
'V', range, m, n, (~A).data(), lda, vl, vu, il, iu, &ns, sptr,
1619 ( SO ? uptr : vptr ), ( tmpRequired ? m : ( SO ? ldu : ldv ) ),
1620 ( SO ? vptr : uptr ), ( tmpRequired ? mindim : ( SO ? ldv : ldu ) ),
1621 work.get(), lwork, iwork.get(), &info );
1623 const size_t num( numeric_cast<size_t>( ns ) );
1634 for(
size_t i=0UL; i<(~s).
size(); ++i ) {
1640 for(
size_t j=0UL; j<(~U).
columns(); ++j ) {
1641 for(
size_t i=0UL; i<(~U).
rows(); ++i ) {
1642 (~U)(i,j) = utmp[i+j*M];
1646 for(
size_t j=0UL; j<(~V).
columns(); ++j ) {
1647 for(
size_t i=0UL; i<(~V).
rows(); ++i ) {
1648 (~V)(i,j) = vtmp[i+j*mindim];
1654 for(
size_t i=0UL; i<(~U).
rows(); ++i ) {
1655 for(
size_t j=0UL; j<(~U).
columns(); ++j ) {
1656 (~U)(i,j) = utmp[i*mindim+j];
1660 for(
size_t i=0UL; i<(~V).
rows(); ++i ) {
1661 for(
size_t j=0UL; j<(~V).
columns(); ++j ) {
1662 (~V)(i,j) = vtmp[i*N+j];
1698 template<
typename MT1
1705 inline EnableIf_< IsComplex< ElementType_<MT1> >,
size_t >
1709 using boost::numeric_cast;
1711 BLAZE_INTERNAL_ASSERT( range ==
'A' || range ==
'V' || range ==
'I',
"Invalid range flag detected" );
1725 const size_t M( (~A).
rows() );
1726 const size_t N( (~A).
columns() );
1727 const size_t mindim(
min( M, N ) );
1729 int m ( numeric_cast<int>( SO ? M : N ) );
1730 int n ( numeric_cast<int>( SO ? N : M ) );
1731 int lda ( numeric_cast<int>( (~A).
spacing() ) );
1732 int ldu ( numeric_cast<int>( (~U).
spacing() ) );
1733 int ldv ( numeric_cast<int>( (~V).
spacing() ) );
1737 BT* sptr( (~s).data() );
1738 CT* uptr( (~U).data() );
1739 CT* vptr( (~V).data() );
1740 std::unique_ptr<BT[]> stmp;
1741 std::unique_ptr<CT[]> utmp;
1742 std::unique_ptr<CT[]> vtmp;
1744 const bool tmpRequired( (~s).
size() < mindim );
1747 stmp.reset(
new BT[2UL*mindim] );
1748 utmp.reset(
new CT[M*mindim] );
1749 vtmp.reset(
new CT[mindim*N] );
1755 const int minimum(
min( m, n ) );
1757 int lwork( minimum*( minimum*3 + 20 ) + 2 );
1758 const std::unique_ptr<CT[]> work (
new CT[lwork] );
1759 const std::unique_ptr<BT[]> rwork(
new BT[17*minimum*minimum] );
1760 const std::unique_ptr<int[]> iwork(
new int[12*minimum] );
1762 gesvdx(
'V',
'V', range, m, n, (~A).data(), lda, vl, vu, il, iu, &ns, sptr,
1763 ( SO ? uptr : vptr ), ( tmpRequired ? m : ( SO ? ldu : ldv ) ),
1764 ( SO ? vptr : uptr ), ( tmpRequired ? mindim : ( SO ? ldv : ldu ) ),
1765 work.get(), lwork, rwork.get(), iwork.get(), &info );
1767 const size_t num( numeric_cast<size_t>( ns ) );
1778 for(
size_t i=0UL; i<(~s).
size(); ++i ) {
1784 for(
size_t j=0UL; j<(~U).
columns(); ++j ) {
1785 for(
size_t i=0UL; i<(~U).
rows(); ++i ) {
1786 (~U)(i,j) = utmp[i+j*M];
1790 for(
size_t j=0UL; j<(~V).
columns(); ++j ) {
1791 for(
size_t i=0UL; i<(~V).
rows(); ++i ) {
1792 (~V)(i,j) = vtmp[i+j*mindim];
1798 for(
size_t i=0UL; i<(~U).
rows(); ++i ) {
1799 for(
size_t j=0UL; j<(~U).
columns(); ++j ) {
1800 (~U)(i,j) = utmp[i*mindim+j];
1804 for(
size_t i=0UL; i<(~V).
rows(); ++i ) {
1805 for(
size_t j=0UL; j<(~V).
columns(); ++j ) {
1806 (~V)(i,j) = vtmp[i*N+j];
1879 template<
typename MT1
1910 const size_t M( (~A).
rows() );
1911 const size_t N( (~A).
columns() );
1912 const size_t mindim(
min( M, N ) );
1914 resize( ~s, mindim,
false );
1915 resize( ~U, M, mindim,
false );
1916 resize( ~V, mindim, N,
false );
1918 if( M == 0UL || N == 0UL ) {
1922 return gesvdx_backend( ~A, ~U, ~s, ~V,
'A', UT(), UT(), 0, 0 );
2024 template<
typename MT1
2034 using boost::numeric_cast;
2065 const size_t M( (~A).
rows() );
2066 const size_t N( (~A).
columns() );
2067 const size_t mindim(
min( M, N ) );
2074 resize( ~s, expected,
false );
2075 resize( ~U, M, expected,
false );
2076 resize( ~V, expected, N,
false );
2078 if( M == 0UL || N == 0UL ) {
2088 const size_t actual( gesvdx_backend( ~A, ~U, ~s, ~V, range, vl, vu, il, iu ) );
2091 resize( ~s, actual,
true );
2095 resize( ~U, M, actual,
true );
2099 resize( ~V, actual, N,
true );
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.This macro encapsulates the default way o...
Definition: Exception.h:235
Constraint on the data type.
BLAZE_ALWAYS_INLINE size_t spacing(const DenseMatrix< MT, SO > &dm) noexcept
Returns the spacing between the beginning of two rows/columns.
Definition: DenseMatrix.h:102
Header file for auxiliary alias declarations.
Header file for mathematical functions.
#define BLAZE_CONSTRAINT_MUST_HAVE_MUTABLE_DATA_ACCESS(T)
Constraint on the data type.In case the given data type T does not provide low-level data access to m...
Definition: MutableDataAccess.h:61
Header file for basic type definitions.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:261
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:81
typename DisableIf< Condition, T >::Type DisableIf_
Auxiliary type for the DisableIf class template.The DisableIf_ alias declaration provides a convenien...
Definition: DisableIf.h:223
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1755
Header file for the DenseVector base class.
Header file for the UnderlyingElement type trait.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ADAPTOR_TYPE(T)
Constraint on the data type.In case the given data type T is an adaptor type (as for instance LowerMa...
Definition: Adaptor.h:81
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes...
Definition: DenseMatrix.h:71
Header file for the implementation of the Subvector view.
Constraint on the data type.
Header file for the DisableIf class template.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the IsFloatingPoint type trait.
Header file for the DenseMatrix base class.
typename UnderlyingElement< T >::Type UnderlyingElement_
Auxiliary alias declaration for the UnderlyingElement type trait.The UnderlyingElement_ alias declara...
Definition: UnderlyingElement.h:133
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Base class for N-dimensional dense vectors.The DenseVector class is a base class for all arbitrarily ...
Definition: DenseVector.h:70
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:336
Header file for the exception macros of the math module.
Compile time check for floating point data types.This type trait tests whether or not the given templ...
Definition: IsFloatingPoint.h:75
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:544
Constraint on the data type.
Header file for the EnableIf class template.
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
Header file for the CLAPACK gesvdx wrapper functions.
Header file for run time assertion macros.
void gesvdx(char jobu, char jobv, char range, int m, int n, float *A, int lda, float vl, float vu, int il, int iu, int *ns, float *s, float *U, int ldu, float *V, int ldv, float *work, int lwork, int *iwork, int *info)
LAPACK kernel for the singular value decomposition (SVD) of the given dense general single precision ...
Definition: gesvdx.h:177
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a BLAS compatible data type (i...
Definition: BLASCompatible.h:61
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
#define BLAZE_CONSTRAINT_MUST_BE_BUILTIN_TYPE(T)
Constraint on the data type.In case the given data type T is not a built-in data type, a compilation error is created.
Definition: Builtin.h:60
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:320
#define BLAZE_THROW_LAPACK_ERROR(MESSAGE)
Macro for the emission of an exception on detection of a LAPACK error.This macro encapsulates the def...
Definition: Exception.h:146
Header file for the IsComplex type trait.
Header file for the IsResizable type trait.
Header file for the Size type trait.
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Constraint on the data type.