Loading...
Searching...
No Matches
svd Namespace Reference

## Functions

template<unsigned int Precision>
bool | rmatrixsvd (ap::template_2d_array< amp::ampf< Precision > > a, int m, int n, int uneeded, int vtneeded, int additionalmemory, ap::template_1d_array< amp::ampf< Precision > > &w, ap::template_2d_array< amp::ampf< Precision > > &u, ap::template_2d_array< amp::ampf< Precision > > &vt)
template<unsigned int Precision>
bool | svddecomposition (ap::template_2d_array< amp::ampf< Precision > > a, int m, int n, int uneeded, int vtneeded, int additionalmemory, ap::template_1d_array< amp::ampf< Precision > > &w, ap::template_2d_array< amp::ampf< Precision > > &u, ap::template_2d_array< amp::ampf< Precision > > &vt)

## Function Documentation

## rmatrixsvd()

template<unsigned int Precision>

bool svd::rmatrixsvd | ( | ap::template_2d_array< amp::ampf< Precision > > | a,
|  | int | m,
|  | int | n,
|  | int | uneeded,
|  | int | vtneeded,
|  | int | additionalmemory,
|  | ap::template_1d_array< amp::ampf< Precision > > & | w,
|  | ap::template_2d_array< amp::ampf< Precision > > & | u,
|  | ap::template_2d_array< amp::ampf< Precision > > & | vt )

Definition at line 140 of file svd.h.

{
bool result;
ap::template_1d_array< amp::ampf<Precision> > tauq;
ap::template_1d_array< amp::ampf<Precision> > taup;
ap::template_1d_array< amp::ampf<Precision> > tau;
ap::template_1d_array< amp::ampf<Precision> > e;
ap::template_1d_array< amp::ampf<Precision> > work;
ap::template_2d_array< amp::ampf<Precision> > t2;
bool isupper;
int minmn;
int ncu;
int nrvt;
int nru;
int ncvt;
int i;
int j;
int im1;
amp::ampf<Precision> sm;
result = true;
if( m==0 || n==0 )
{
return result;
}
ap::ap_error::make_assertion(uneeded>=0 && uneeded<=2);
ap::ap_error::make_assertion(vtneeded>=0 && vtneeded<=2);
ap::ap_error::make_assertion(additionalmemory>=0 && additionalmemory<=2);
//
// initialize
//
minmn = ap::minint(m, n);
w.setbounds(1, minmn);
ncu = 0;
nru = 0;
if( uneeded==1 )
{
nru = m;
ncu = minmn;
u.setbounds(0, nru-1, 0, ncu-1);
}
if( uneeded==2 )
{
nru = m;
ncu = m;
u.setbounds(0, nru-1, 0, ncu-1);
}
nrvt = 0;
ncvt = 0;
if( vtneeded==1 )
{
nrvt = minmn;
ncvt = n;
vt.setbounds(0, nrvt-1, 0, ncvt-1);
}
if( vtneeded==2 )
{
nrvt = n;
ncvt = n;
vt.setbounds(0, nrvt-1, 0, ncvt-1);
}
//
// M much larger than N
// Use bidiagonal reduction with QR-decomposition
//
if( m>amp::ampf<Precision>("1.6")*n )
{
if( uneeded==0 )
{
//
// No left singular vectors to be computed
//
qr::rmatrixqr<Precision>(a, m, n, tau);
for(i=0; i<=n-1; i++)
{
for(j=0; j<=i-1; j++)
{
a(i,j) = 0;
}
}
bidiagonal::rmatrixbd<Precision>(a, n, n, tauq, taup);
bidiagonal::rmatrixbdunpackpt<Precision>(a, n, n, taup, nrvt, vt);
bidiagonal::rmatrixbdunpackdiagonals<Precision>(a, n, n, isupper, w, e);
result = bdsvd::rmatrixbdsvd<Precision>(w, e, n, isupper, false, u, 0, a, 0, vt, ncvt);
return result;
}
else
{
//
// Left singular vectors (may be full matrix U) to be computed
//
qr::rmatrixqr<Precision>(a, m, n, tau);
qr::rmatrixqrunpackq<Precision>(a, m, n, tau, ncu, u);
for(i=0; i<=n-1; i++)
{
for(j=0; j<=i-1; j++)
{
a(i,j) = 0;
}
}
bidiagonal::rmatrixbd<Precision>(a, n, n, tauq, taup);
bidiagonal::rmatrixbdunpackpt<Precision>(a, n, n, taup, nrvt, vt);
bidiagonal::rmatrixbdunpackdiagonals<Precision>(a, n, n, isupper, w, e);
if( additionalmemory<1 )
{
//
// No additional memory can be used
//
bidiagonal::rmatrixbdmultiplybyq<Precision>(a, n, n, tauq, u, m, n, true, false);
result = bdsvd::rmatrixbdsvd<Precision>(w, e, n, isupper, false, u, m, a, 0, vt, ncvt);
}
else
{
//
// Large U. Transforming intermediate matrix T2
//
work.setbounds(1, ap::maxint(m, n));
bidiagonal::rmatrixbdunpackq<Precision>(a, n, n, tauq, n, t2);
blas::copymatrix<Precision>(u, 0, m-1, 0, n-1, a, 0, m-1, 0, n-1);
blas::inplacetranspose<Precision>(t2, 0, n-1, 0, n-1, work);
result = bdsvd::rmatrixbdsvd<Precision>(w, e, n, isupper, false, u, 0, t2, n, vt, ncvt);
blas::matrixmatrixmultiply<Precision>(a, 0, m-1, 0, n-1, false, t2, 0, n-1, 0, n-1, true, amp::ampf<Precision>("1.0"), u, 0, m-1, 0, n-1, amp::ampf<Precision>("0.0"), work);
}
return result;
}
}
//
// N much larger than M
// Use bidiagonal reduction with LQ-decomposition
//
if( n>amp::ampf<Precision>("1.6")*m )
{
if( vtneeded==0 )
{
//
// No right singular vectors to be computed
//
lq::rmatrixlq<Precision>(a, m, n, tau);
for(i=0; i<=m-1; i++)
{
for(j=i+1; j<=m-1; j++)
{
a(i,j) = 0;
}
}
bidiagonal::rmatrixbd<Precision>(a, m, m, tauq, taup);
bidiagonal::rmatrixbdunpackq<Precision>(a, m, m, tauq, ncu, u);
bidiagonal::rmatrixbdunpackdiagonals<Precision>(a, m, m, isupper, w, e);
work.setbounds(1, m);
blas::inplacetranspose<Precision>(u, 0, nru-1, 0, ncu-1, work);
result = bdsvd::rmatrixbdsvd<Precision>(w, e, m, isupper, false, a, 0, u, nru, vt, 0);
blas::inplacetranspose<Precision>(u, 0, nru-1, 0, ncu-1, work);
return result;
}
else
{
//
// Right singular vectors (may be full matrix VT) to be computed
//
lq::rmatrixlq<Precision>(a, m, n, tau);
lq::rmatrixlqunpackq<Precision>(a, m, n, tau, nrvt, vt);
for(i=0; i<=m-1; i++)
{
for(j=i+1; j<=m-1; j++)
{
a(i,j) = 0;
}
}
bidiagonal::rmatrixbd<Precision>(a, m, m, tauq, taup);
bidiagonal::rmatrixbdunpackq<Precision>(a, m, m, tauq, ncu, u);
bidiagonal::rmatrixbdunpackdiagonals<Precision>(a, m, m, isupper, w, e);
work.setbounds(1, ap::maxint(m, n));
blas::inplacetranspose<Precision>(u, 0, nru-1, 0, ncu-1, work);
if( additionalmemory<1 )
{
//
// No additional memory available
//
bidiagonal::rmatrixbdmultiplybyp<Precision>(a, m, m, taup, vt, m, n, false, true);
result = bdsvd::rmatrixbdsvd<Precision>(w, e, m, isupper, false, a, 0, u, nru, vt, n);
}
else
{
//
// Large VT. Transforming intermediate matrix T2
//
bidiagonal::rmatrixbdunpackpt<Precision>(a, m, m, taup, m, t2);
result = bdsvd::rmatrixbdsvd<Precision>(w, e, m, isupper, false, a, 0, u, nru, t2, m);
blas::copymatrix<Precision>(vt, 0, m-1, 0, n-1, a, 0, m-1, 0, n-1);
blas::matrixmatrixmultiply<Precision>(t2, 0, m-1, 0, m-1, false, a, 0, m-1, 0, n-1, false, amp::ampf<Precision>("1.0"), vt, 0, m-1, 0, n-1, amp::ampf<Precision>("0.0"), work);
}
blas::inplacetranspose<Precision>(u, 0, nru-1, 0, ncu-1, work);
return result;
}
}
//
// M<=N
// We can use inplace transposition of U to get rid of columnwise operations
//
if( m<=n )
{
bidiagonal::rmatrixbd<Precision>(a, m, n, tauq, taup);
bidiagonal::rmatrixbdunpackq<Precision>(a, m, n, tauq, ncu, u);
bidiagonal::rmatrixbdunpackpt<Precision>(a, m, n, taup, nrvt, vt);
bidiagonal::rmatrixbdunpackdiagonals<Precision>(a, m, n, isupper, w, e);
work.setbounds(1, m);
blas::inplacetranspose<Precision>(u, 0, nru-1, 0, ncu-1, work);
result = bdsvd::rmatrixbdsvd<Precision>(w, e, minmn, isupper, false, a, 0, u, nru, vt, ncvt);
blas::inplacetranspose<Precision>(u, 0, nru-1, 0, ncu-1, work);
return result;
}
//
// Simple bidiagonal reduction
//
bidiagonal::rmatrixbd<Precision>(a, m, n, tauq, taup);
bidiagonal::rmatrixbdunpackq<Precision>(a, m, n, tauq, ncu, u);
bidiagonal::rmatrixbdunpackpt<Precision>(a, m, n, taup, nrvt, vt);
bidiagonal::rmatrixbdunpackdiagonals<Precision>(a, m, n, isupper, w, e);
if( additionalmemory<2 || uneeded==0 )
{
//
// We cant use additional memory or there is no need in such operations
//
result = bdsvd::rmatrixbdsvd<Precision>(w, e, minmn, isupper, false, u, nru, a, 0, vt, ncvt);
}
else
{
//
// We can use additional memory
//
t2.setbounds(0, minmn-1, 0, m-1);
blas::copyandtranspose<Precision>(u, 0, m-1, 0, minmn-1, t2, 0, minmn-1, 0, m-1);
result = bdsvd::rmatrixbdsvd<Precision>(w, e, minmn, isupper, false, u, 0, t2, m, vt, ncvt);
blas::copyandtranspose<Precision>(t2, 0, minmn-1, 0, m-1, u, 0, m-1, 0, minmn-1);
}
return result;
}
m
int m
Definition cfEzgcd.cc:128
i
int i
Definition cfEzgcd.cc:132
tau
void tau(int **points, int sizePoints, int k)
Definition cfNewtonPolygon.cc:461
amp::ampf
Definition amp.h:82
ap::ap_error::make_assertion
static void make_assertion(bool bClause)
Definition ap.h:49
ap::template_1d_array
Definition ap.h:657
ap::template_1d_array::setbounds
void setbounds(int iLow, int iHigh)
Definition ap.h:735
ap::template_2d_array
Definition ap.h:807
ap::template_2d_array::setbounds
void setbounds(int iLow1, int iHigh1, int iLow2, int iHigh2)
Definition ap.h:890
result
return result
Definition facAbsBiFact.cc:76
w
const CanonicalForm & w
Definition facAbsFact.cc:51
j
int j
Definition facHensel.cc:110
ap::maxint
int maxint(int m1, int m2)
Definition ap.cpp:162
ap::minint
int minint(int m1, int m2)
Definition ap.cpp:167
bdsvd::rmatrixbdsvd
bool rmatrixbdsvd(ap::template_1d_array< amp::ampf< Precision > > &d, ap::template_1d_array< amp::ampf< Precision > > e, int n, bool isupper, bool isfractionalaccuracyrequired, ap::template_2d_array< amp::ampf< Precision > > &u, int nru, ap::template_2d_array< amp::ampf< Precision > > &c, int ncc, ap::template_2d_array< amp::ampf< Precision > > &vt, int ncvt)
Definition bdsvd.h:186
bidiagonal::rmatrixbdunpackpt
void rmatrixbdunpackpt(const ap::template_2d_array< amp::ampf< Precision > > &qp, int m, int n, const ap::template_1d_array< amp::ampf< Precision > > &taup, int ptrows, ap::template_2d_array< amp::ampf< Precision > > &pt)
Definition bidiagonal.h:575
bidiagonal::rmatrixbdunpackq
void rmatrixbdunpackq(const ap::template_2d_array< amp::ampf< Precision > > &qp, int m, int n, const ap::template_1d_array< amp::ampf< Precision > > &tauq, int qcolumns, ap::template_2d_array< amp::ampf< Precision > > &q)
Definition bidiagonal.h:348
bidiagonal::rmatrixbdmultiplybyq
void rmatrixbdmultiplybyq(const ap::template_2d_array< amp::ampf< Precision > > &qp, int m, int n, const ap::template_1d_array< amp::ampf< Precision > > &tauq, ap::template_2d_array< amp::ampf< Precision > > &z, int zrows, int zcolumns, bool fromtheright, bool dotranspose)
Definition bidiagonal.h:422
bidiagonal::rmatrixbdunpackdiagonals
void rmatrixbdunpackdiagonals(const ap::template_2d_array< amp::ampf< Precision > > &b, int m, int n, bool &isupper, ap::template_1d_array< amp::ampf< Precision > > &d, ap::template_1d_array< amp::ampf< Precision > > &e)
Definition bidiagonal.h:805
bidiagonal::rmatrixbd
void rmatrixbd(ap::template_2d_array< amp::ampf< Precision > > &a, int m, int n, ap::template_1d_array< amp::ampf< Precision > > &tauq, ap::template_1d_array< amp::ampf< Precision > > &taup)
Definition bidiagonal.h:194
bidiagonal::rmatrixbdmultiplybyp
void rmatrixbdmultiplybyp(const ap::template_2d_array< amp::ampf< Precision > > &qp, int m, int n, const ap::template_1d_array< amp::ampf< Precision > > &taup, ap::template_2d_array< amp::ampf< Precision > > &z, int zrows, int zcolumns, bool fromtheright, bool dotranspose)
Definition bidiagonal.h:649
blas::matrixmatrixmultiply
void matrixmatrixmultiply(const ap::template_2d_array< amp::ampf< Precision > > &a, int ai1, int ai2, int aj1, int aj2, bool transa, const ap::template_2d_array< amp::ampf< Precision > > &b, int bi1, int bi2, int bj1, int bj2, bool transb, amp::ampf< Precision > alpha, ap::template_2d_array< amp::ampf< Precision > > &c, int ci1, int ci2, int cj1, int cj2, amp::ampf< Precision > beta, ap::template_1d_array< amp::ampf< Precision > > &work)
Definition blas.h:505
blas::copyandtranspose
void copyandtranspose(const ap::template_2d_array< amp::ampf< Precision > > &a, int is1, int is2, int js1, int js2, ap::template_2d_array< amp::ampf< Precision > > &b, int id1, int id2, int jd1, int jd2)
Definition blas.h:351
blas::inplacetranspose
void inplacetranspose(ap::template_2d_array< amp::ampf< Precision > > &a, int i1, int i2, int j1, int j2, ap::template_1d_array< amp::ampf< Precision > > &work)
Definition blas.h:318
blas::copymatrix
void copymatrix(const ap::template_2d_array< amp::ampf< Precision > > &a, int is1, int is2, int js1, int js2, ap::template_2d_array< amp::ampf< Precision > > &b, int id1, int id2, int jd1, int jd2)
Definition blas.h:288
lq::rmatrixlq
void rmatrixlq(ap::template_2d_array< amp::ampf< Precision > > &a, int m, int n, ap::template_1d_array< amp::ampf< Precision > > &tau)
Definition lq.h:113
lq::rmatrixlqunpackq
void rmatrixlqunpackq(const ap::template_2d_array< amp::ampf< Precision > > &a, int m, int n, const ap::template_1d_array< amp::ampf< Precision > > &tau, int qrows, ap::template_2d_array< amp::ampf< Precision > > &q)
Definition lq.h:177
qr::rmatrixqr
void rmatrixqr(ap::template_2d_array< amp::ampf< Precision > > &a, int m, int n, ap::template_1d_array< amp::ampf< Precision > > &tau)
Definition qr.h:123
qr::rmatrixqrunpackq
void rmatrixqrunpackq(const ap::template_2d_array< amp::ampf< Precision > > &a, int m, int n, const ap::template_1d_array< amp::ampf< Precision > > &tau, int qcolumns, ap::template_2d_array< amp::ampf< Precision > > &q)
Definition qr.h:193

## svddecomposition()

template<unsigned int Precision>

bool svd::svddecomposition | ( | ap::template_2d_array< amp::ampf< Precision > > | a,
|  | int | m,
|  | int | n,
|  | int | uneeded,
|  | int | vtneeded,
|  | int | additionalmemory,
|  | ap::template_1d_array< amp::ampf< Precision > > & | w,
|  | ap::template_2d_array< amp::ampf< Precision > > & | u,
|  | ap::template_2d_array< amp::ampf< Precision > > & | vt )

Definition at line 408 of file svd.h.

{
bool result;
ap::template_1d_array< amp::ampf<Precision> > tauq;
ap::template_1d_array< amp::ampf<Precision> > taup;
ap::template_1d_array< amp::ampf<Precision> > tau;
ap::template_1d_array< amp::ampf<Precision> > e;
ap::template_1d_array< amp::ampf<Precision> > work;
ap::template_2d_array< amp::ampf<Precision> > t2;
bool isupper;
int minmn;
int ncu;
int nrvt;
int nru;
int ncvt;
int i;
int j;
int im1;
amp::ampf<Precision> sm;
result = true;
if( m==0 || n==0 )
{
return result;
}
ap::ap_error::make_assertion(uneeded>=0 && uneeded<=2);
ap::ap_error::make_assertion(vtneeded>=0 && vtneeded<=2);
ap::ap_error::make_assertion(additionalmemory>=0 && additionalmemory<=2);
//
// initialize
//
minmn = ap::minint(m, n);
w.setbounds(1, minmn);
ncu = 0;
nru = 0;
if( uneeded==1 )
{
nru = m;
ncu = minmn;
u.setbounds(1, nru, 1, ncu);
}
if( uneeded==2 )
{
nru = m;
ncu = m;
u.setbounds(1, nru, 1, ncu);
}
nrvt = 0;
ncvt = 0;
if( vtneeded==1 )
{
nrvt = minmn;
ncvt = n;
vt.setbounds(1, nrvt, 1, ncvt);
}
if( vtneeded==2 )
{
nrvt = n;
ncvt = n;
vt.setbounds(1, nrvt, 1, ncvt);
}
//
// M much larger than N
// Use bidiagonal reduction with QR-decomposition
//
if( m>amp::ampf<Precision>("1.6")*n )
{
if( uneeded==0 )
{
//
// No left singular vectors to be computed
//
qr::qrdecomposition<Precision>(a, m, n, tau);
for(i=2; i<=n; i++)
{
for(j=1; j<=i-1; j++)
{
a(i,j) = 0;
}
}
bidiagonal::tobidiagonal<Precision>(a, n, n, tauq, taup);
bidiagonal::unpackptfrombidiagonal<Precision>(a, n, n, taup, nrvt, vt);
bidiagonal::unpackdiagonalsfrombidiagonal<Precision>(a, n, n, isupper, w, e);
result = bdsvd::bidiagonalsvddecomposition<Precision>(w, e, n, isupper, false, u, 0, a, 0, vt, ncvt);
return result;
}
else
{
//
// Left singular vectors (may be full matrix U) to be computed
//
qr::qrdecomposition<Precision>(a, m, n, tau);
qr::unpackqfromqr<Precision>(a, m, n, tau, ncu, u);
for(i=2; i<=n; i++)
{
for(j=1; j<=i-1; j++)
{
a(i,j) = 0;
}
}
bidiagonal::tobidiagonal<Precision>(a, n, n, tauq, taup);
bidiagonal::unpackptfrombidiagonal<Precision>(a, n, n, taup, nrvt, vt);
bidiagonal::unpackdiagonalsfrombidiagonal<Precision>(a, n, n, isupper, w, e);
if( additionalmemory<1 )
{
//
// No additional memory can be used
//
bidiagonal::multiplybyqfrombidiagonal<Precision>(a, n, n, tauq, u, m, n, true, false);
result = bdsvd::bidiagonalsvddecomposition<Precision>(w, e, n, isupper, false, u, m, a, 0, vt, ncvt);
}
else
{
//
// Large U. Transforming intermediate matrix T2
//
work.setbounds(1, ap::maxint(m, n));
bidiagonal::unpackqfrombidiagonal<Precision>(a, n, n, tauq, n, t2);
blas::copymatrix<Precision>(u, 1, m, 1, n, a, 1, m, 1, n);
blas::inplacetranspose<Precision>(t2, 1, n, 1, n, work);
result = bdsvd::bidiagonalsvddecomposition<Precision>(w, e, n, isupper, false, u, 0, t2, n, vt, ncvt);
blas::matrixmatrixmultiply<Precision>(a, 1, m, 1, n, false, t2, 1, n, 1, n, true, amp::ampf<Precision>("1.0"), u, 1, m, 1, n, amp::ampf<Precision>("0.0"), work);
}
return result;
}
}
//
// N much larger than M
// Use bidiagonal reduction with LQ-decomposition
//
if( n>amp::ampf<Precision>("1.6")*m )
{
if( vtneeded==0 )
{
//
// No right singular vectors to be computed
//
lq::lqdecomposition<Precision>(a, m, n, tau);
for(i=1; i<=m-1; i++)
{
for(j=i+1; j<=m; j++)
{
a(i,j) = 0;
}
}
bidiagonal::tobidiagonal<Precision>(a, m, m, tauq, taup);
bidiagonal::unpackqfrombidiagonal<Precision>(a, m, m, tauq, ncu, u);
bidiagonal::unpackdiagonalsfrombidiagonal<Precision>(a, m, m, isupper, w, e);
work.setbounds(1, m);
blas::inplacetranspose<Precision>(u, 1, nru, 1, ncu, work);
result = bdsvd::bidiagonalsvddecomposition<Precision>(w, e, m, isupper, false, a, 0, u, nru, vt, 0);
blas::inplacetranspose<Precision>(u, 1, nru, 1, ncu, work);
return result;
}
else
{
//
// Right singular vectors (may be full matrix VT) to be computed
//
lq::lqdecomposition<Precision>(a, m, n, tau);
lq::unpackqfromlq<Precision>(a, m, n, tau, nrvt, vt);
for(i=1; i<=m-1; i++)
{
for(j=i+1; j<=m; j++)
{
a(i,j) = 0;
}
}
bidiagonal::tobidiagonal<Precision>(a, m, m, tauq, taup);
bidiagonal::unpackqfrombidiagonal<Precision>(a, m, m, tauq, ncu, u);
bidiagonal::unpackdiagonalsfrombidiagonal<Precision>(a, m, m, isupper, w, e);
work.setbounds(1, ap::maxint(m, n));
blas::inplacetranspose<Precision>(u, 1, nru, 1, ncu, work);
if( additionalmemory<1 )
{
//
// No additional memory available
//
bidiagonal::multiplybypfrombidiagonal<Precision>(a, m, m, taup, vt, m, n, false, true);
result = bdsvd::bidiagonalsvddecomposition<Precision>(w, e, m, isupper, false, a, 0, u, nru, vt, n);
}
else
{
//
// Large VT. Transforming intermediate matrix T2
//
bidiagonal::unpackptfrombidiagonal<Precision>(a, m, m, taup, m, t2);
result = bdsvd::bidiagonalsvddecomposition<Precision>(w, e, m, isupper, false, a, 0, u, nru, t2, m);
blas::copymatrix<Precision>(vt, 1, m, 1, n, a, 1, m, 1, n);
blas::matrixmatrixmultiply<Precision>(t2, 1, m, 1, m, false, a, 1, m, 1, n, false, amp::ampf<Precision>("1.0"), vt, 1, m, 1, n, amp::ampf<Precision>("0.0"), work);
}
blas::inplacetranspose<Precision>(u, 1, nru, 1, ncu, work);
return result;
}
}
//
// M<=N
// We can use inplace transposition of U to get rid of columnwise operations
//
if( m<=n )
{
bidiagonal::tobidiagonal<Precision>(a, m, n, tauq, taup);
bidiagonal::unpackqfrombidiagonal<Precision>(a, m, n, tauq, ncu, u);
bidiagonal::unpackptfrombidiagonal<Precision>(a, m, n, taup, nrvt, vt);
bidiagonal::unpackdiagonalsfrombidiagonal<Precision>(a, m, n, isupper, w, e);
work.setbounds(1, m);
blas::inplacetranspose<Precision>(u, 1, nru, 1, ncu, work);
result = bdsvd::bidiagonalsvddecomposition<Precision>(w, e, minmn, isupper, false, a, 0, u, nru, vt, ncvt);
blas::inplacetranspose<Precision>(u, 1, nru, 1, ncu, work);
return result;
}
//
// Simple bidiagonal reduction
//
bidiagonal::tobidiagonal<Precision>(a, m, n, tauq, taup);
bidiagonal::unpackqfrombidiagonal<Precision>(a, m, n, tauq, ncu, u);
bidiagonal::unpackptfrombidiagonal<Precision>(a, m, n, taup, nrvt, vt);
bidiagonal::unpackdiagonalsfrombidiagonal<Precision>(a, m, n, isupper, w, e);
if( additionalmemory<2 || uneeded==0 )
{
//
// We cant use additional memory or there is no need in such operations
//
result = bdsvd::bidiagonalsvddecomposition<Precision>(w, e, minmn, isupper, false, u, nru, a, 0, vt, ncvt);
}
else
{
//
// We can use additional memory
//
t2.setbounds(1, minmn, 1, m);
blas::copyandtranspose<Precision>(u, 1, m, 1, minmn, t2, 1, minmn, 1, m);
result = bdsvd::bidiagonalsvddecomposition<Precision>(w, e, minmn, isupper, false, u, 0, t2, m, vt, ncvt);
blas::copyandtranspose<Precision>(t2, 1, minmn, 1, m, u, 1, m, 1, minmn);
}
return result;
}
bdsvd::bidiagonalsvddecomposition
bool bidiagonalsvddecomposition(ap::template_1d_array< amp::ampf< Precision > > &d, ap::template_1d_array< amp::ampf< Precision > > e, int n, bool isupper, bool isfractionalaccuracyrequired, ap::template_2d_array< amp::ampf< Precision > > &u, int nru, ap::template_2d_array< amp::ampf< Precision > > &c, int ncc, ap::template_2d_array< amp::ampf< Precision > > &vt, int ncvt)
Definition bdsvd.h:229
bidiagonal::unpackptfrombidiagonal
void unpackptfrombidiagonal(const ap::template_2d_array< amp::ampf< Precision > > &qp, int m, int n, const ap::template_1d_array< amp::ampf< Precision > > &taup, int ptrows, ap::template_2d_array< amp::ampf< Precision > > &pt)
Definition bidiagonal.h:1196
bidiagonal::multiplybyqfrombidiagonal
void multiplybyqfrombidiagonal(const ap::template_2d_array< amp::ampf< Precision > > &qp, int m, int n, const ap::template_1d_array< amp::ampf< Precision > > &tauq, ap::template_2d_array< amp::ampf< Precision > > &z, int zrows, int zcolumns, bool fromtheright, bool dotranspose)
Definition bidiagonal.h:1055
bidiagonal::unpackqfrombidiagonal
void unpackqfrombidiagonal(const ap::template_2d_array< amp::ampf< Precision > > &qp, int m, int n, const ap::template_1d_array< amp::ampf< Precision > > &tauq, int qcolumns, ap::template_2d_array< amp::ampf< Precision > > &q)
Definition bidiagonal.h:981
bidiagonal::unpackdiagonalsfrombidiagonal
void unpackdiagonalsfrombidiagonal(const ap::template_2d_array< amp::ampf< Precision > > &b, int m, int n, bool &isupper, ap::template_1d_array< amp::ampf< Precision > > &d, ap::template_1d_array< amp::ampf< Precision > > &e)
Definition bidiagonal.h:1413
bidiagonal::tobidiagonal
void tobidiagonal(ap::template_2d_array< amp::ampf< Precision > > &a, int m, int n, ap::template_1d_array< amp::ampf< Precision > > &tauq, ap::template_1d_array< amp::ampf< Precision > > &taup)
Definition bidiagonal.h:850
bidiagonal::multiplybypfrombidiagonal
void multiplybypfrombidiagonal(const ap::template_2d_array< amp::ampf< Precision > > &qp, int m, int n, const ap::template_1d_array< amp::ampf< Precision > > &taup, ap::template_2d_array< amp::ampf< Precision > > &z, int zrows, int zcolumns, bool fromtheright, bool dotranspose)
Definition bidiagonal.h:1270
lq::lqdecomposition
void lqdecomposition(ap::template_2d_array< amp::ampf< Precision > > &a, int m, int n, ap::template_1d_array< amp::ampf< Precision > > &tau)
Definition lq.h:288
lq::unpackqfromlq
void unpackqfromlq(const ap::template_2d_array< amp::ampf< Precision > > &a, int m, int n, const ap::template_1d_array< amp::ampf< Precision > > &tau, int qrows, ap::template_2d_array< amp::ampf< Precision > > &q)
Definition lq.h:342
qr::qrdecomposition
void qrdecomposition(ap::template_2d_array< amp::ampf< Precision > > &a, int m, int n, ap::template_1d_array< amp::ampf< Precision > > &tau)
Definition qr.h:303
qr::unpackqfromqr
void unpackqfromqr(const ap::template_2d_array< amp::ampf< Precision > > &a, int m, int n, const ap::template_1d_array< amp::ampf< Precision > > &tau, int qcolumns, ap::template_2d_array< amp::ampf< Precision > > &q)
Definition qr.h:354