Loading...
Searching...
No Matches
bidiagonal Namespace Reference

## Functions

template<unsigned int Precision>
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)
template<unsigned int Precision>
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)
template<unsigned int Precision>
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)
template<unsigned int Precision>
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)
template<unsigned int Precision>
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)
template<unsigned int Precision>
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)
template<unsigned int Precision>
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)
template<unsigned int Precision>
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)
template<unsigned int Precision>
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)
template<unsigned int Precision>
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)
template<unsigned int Precision>
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)
template<unsigned int Precision>
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)

## Function Documentation

## multiplybypfrombidiagonal()

template<unsigned int Precision>

void bidiagonal::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 at line 1270 of file bidiagonal.h.

{
int i;
int ip1;
ap::template_1d_array< amp::ampf<Precision> > v;
ap::template_1d_array< amp::ampf<Precision> > work;
int vm;
int mx;
int i1;
int i2;
int istep;
if( m<=0 || n<=0 || zrows<=0 || zcolumns<=0 )
{
return;
}
ap::ap_error::make_assertion(fromtheright && zcolumns==n || !fromtheright && zrows==n);
//
// init
//
mx = ap::maxint(m, n);
mx = ap::maxint(mx, zrows);
mx = ap::maxint(mx, zcolumns);
v.setbounds(1, mx);
work.setbounds(1, mx);
v.setbounds(1, mx);
work.setbounds(1, mx);
if( m>=n )
{
//
// setup
//
if( fromtheright )
{
i1 = n-1;
i2 = 1;
istep = -1;
}
else
{
i1 = 1;
i2 = n-1;
istep = +1;
}
if( !dotranspose )
{
i = i1;
i1 = i2;
i2 = i;
istep = -istep;
}
//
// Process
//
if( n-1>0 )
{
i = i1;
do
{
vm = n-i;
ip1 = i+1;
ap::vmove(v.getvector(1, vm), qp.getrow(i, ip1, n));
v(1) = 1;
if( fromtheright )
{
reflections::applyreflectionfromtheright<Precision>(z, taup(i), v, 1, zrows, i+1, n, work);
}
else
{
reflections::applyreflectionfromtheleft<Precision>(z, taup(i), v, i+1, n, 1, zcolumns, work);
}
i = i+istep;
}
while( i!=i2+istep );
}
}
else
{
//
// setup
//
if( fromtheright )
{
i1 = m;
i2 = 1;
istep = -1;
}
else
{
i1 = 1;
i2 = m;
istep = +1;
}
if( !dotranspose )
{
i = i1;
i1 = i2;
i2 = i;
istep = -istep;
}
//
// Process
//
i = i1;
do
{
vm = n-i+1;
ap::vmove(v.getvector(1, vm), qp.getrow(i, i, n));
v(1) = 1;
if( fromtheright )
{
reflections::applyreflectionfromtheright<Precision>(z, taup(i), v, 1, zrows, i, n, work);
}
else
{
reflections::applyreflectionfromtheleft<Precision>(z, taup(i), v, i, n, 1, zcolumns, work);
}
i = i+istep;
}
while( i!=i2+istep );
}
}
m
int m
Definition cfEzgcd.cc:128
i
int i
Definition cfEzgcd.cc:132
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::getrow
raw_vector< T > getrow(int iRow, int iColumnStart, int iColumnEnd)
Definition ap.h:939
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
ap::maxint
int maxint(int m1, int m2)
Definition ap.cpp:162
ap::vmove
void vmove(raw_vector< T > vdst, const_raw_vector< T > vsrc)
Definition ap.h:237
reflections::applyreflectionfromtheright
void applyreflectionfromtheright(ap::template_2d_array< amp::ampf< Precision > > &c, amp::ampf< Precision > tau, const ap::template_1d_array< amp::ampf< Precision > > &v, int m1, int m2, int n1, int n2, ap::template_1d_array< amp::ampf< Precision > > &work)
Definition reflections.h:280
reflections::applyreflectionfromtheleft
void applyreflectionfromtheleft(ap::template_2d_array< amp::ampf< Precision > > &c, amp::ampf< Precision > tau, const ap::template_1d_array< amp::ampf< Precision > > &v, int m1, int m2, int n1, int n2, ap::template_1d_array< amp::ampf< Precision > > &work)
Definition reflections.h:207

## multiplybyqfrombidiagonal()

template<unsigned int Precision>

void bidiagonal::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 at line 1055 of file bidiagonal.h.

{
int i;
int ip1;
int i1;
int i2;
int istep;
ap::template_1d_array< amp::ampf<Precision> > v;
ap::template_1d_array< amp::ampf<Precision> > work;
int vm;
int mx;
if( m<=0 || n<=0 || zrows<=0 || zcolumns<=0 )
{
return;
}
ap::ap_error::make_assertion(fromtheright && zcolumns==m || !fromtheright && zrows==m);
//
// init
//
mx = ap::maxint(m, n);
mx = ap::maxint(mx, zrows);
mx = ap::maxint(mx, zcolumns);
v.setbounds(1, mx);
work.setbounds(1, mx);
if( m>=n )
{
//
// setup
//
if( fromtheright )
{
i1 = 1;
i2 = n;
istep = +1;
}
else
{
i1 = n;
i2 = 1;
istep = -1;
}
if( dotranspose )
{
i = i1;
i1 = i2;
i2 = i;
istep = -istep;
}
//
// Process
//
i = i1;
do
{
vm = m-i+1;
ap::vmove(v.getvector(1, vm), qp.getcolumn(i, i, m));
v(1) = 1;
if( fromtheright )
{
reflections::applyreflectionfromtheright<Precision>(z, tauq(i), v, 1, zrows, i, m, work);
}
else
{
reflections::applyreflectionfromtheleft<Precision>(z, tauq(i), v, i, m, 1, zcolumns, work);
}
i = i+istep;
}
while( i!=i2+istep );
}
else
{
//
// setup
//
if( fromtheright )
{
i1 = 1;
i2 = m-1;
istep = +1;
}
else
{
i1 = m-1;
i2 = 1;
istep = -1;
}
if( dotranspose )
{
i = i1;
i1 = i2;
i2 = i;
istep = -istep;
}
//
// Process
//
if( m-1>0 )
{
i = i1;
do
{
vm = m-i;
ip1 = i+1;
ap::vmove(v.getvector(1, vm), qp.getcolumn(i, ip1, m));
v(1) = 1;
if( fromtheright )
{
reflections::applyreflectionfromtheright<Precision>(z, tauq(i), v, 1, zrows, i+1, m, work);
}
else
{
reflections::applyreflectionfromtheleft<Precision>(z, tauq(i), v, i+1, m, 1, zcolumns, work);
}
i = i+istep;
}
while( i!=i2+istep );
}
}
}
ap::template_2d_array::getcolumn
raw_vector< T > getcolumn(int iColumn, int iRowStart, int iRowEnd)
Definition ap.h:931

## rmatrixbd()

template<unsigned int Precision>

void bidiagonal::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 at line 194 of file bidiagonal.h.

{
ap::template_1d_array< amp::ampf<Precision> > work;
ap::template_1d_array< amp::ampf<Precision> > t;
int minmn;
int maxmn;
int i;
int j;
amp::ampf<Precision> ltau;
//
// Prepare
//
if( n<=0 || m<=0 )
{
return;
}
minmn = ap::minint(m, n);
maxmn = ap::maxint(m, n);
work.setbounds(0, maxmn);
t.setbounds(0, maxmn);
if( m>=n )
{
tauq.setbounds(0, n-1);
taup.setbounds(0, n-1);
}
else
{
tauq.setbounds(0, m-1);
taup.setbounds(0, m-1);
}
if( m>=n )
{
//
// Reduce to upper bidiagonal form
//
for(i=0; i<=n-1; i++)
{
//
// Generate elementary reflector H(i) to annihilate A(i+1:m-1,i)
//
ap::vmove(t.getvector(1, m-i), a.getcolumn(i, i, m-1));
reflections::generatereflection<Precision>(t, m-i, ltau);
tauq(i) = ltau;
ap::vmove(a.getcolumn(i, i, m-1), t.getvector(1, m-i));
t(1) = 1;
//
// Apply H(i) to A(i:m-1,i+1:n-1) from the left
//
reflections::applyreflectionfromtheleft<Precision>(a, ltau, t, i, m-1, i+1, n-1, work);
if( i<n-1 )
{
//
// Generate elementary reflector G(i) to annihilate
// A(i,i+2:n-1)
//
ap::vmove(t.getvector(1, n-i-1), a.getrow(i, i+1, n-1));
reflections::generatereflection<Precision>(t, n-1-i, ltau);
taup(i) = ltau;
ap::vmove(a.getrow(i, i+1, n-1), t.getvector(1, n-1-i));
t(1) = 1;
//
// Apply G(i) to A(i+1:m-1,i+1:n-1) from the right
//
reflections::applyreflectionfromtheright<Precision>(a, ltau, t, i+1, m-1, i+1, n-1, work);
}
else
{
taup(i) = 0;
}
}
}
else
{
//
// Reduce to lower bidiagonal form
//
for(i=0; i<=m-1; i++)
{
//
// Generate elementary reflector G(i) to annihilate A(i,i+1:n-1)
//
ap::vmove(t.getvector(1, n-i), a.getrow(i, i, n-1));
reflections::generatereflection<Precision>(t, n-i, ltau);
taup(i) = ltau;
ap::vmove(a.getrow(i, i, n-1), t.getvector(1, n-i));
t(1) = 1;
//
// Apply G(i) to A(i+1:m-1,i:n-1) from the right
//
reflections::applyreflectionfromtheright<Precision>(a, ltau, t, i+1, m-1, i, n-1, work);
if( i<m-1 )
{
//
// Generate elementary reflector H(i) to annihilate
// A(i+2:m-1,i)
//
ap::vmove(t.getvector(1, m-1-i), a.getcolumn(i, i+1, m-1));
reflections::generatereflection<Precision>(t, m-1-i, ltau);
tauq(i) = ltau;
ap::vmove(a.getcolumn(i, i+1, m-1), t.getvector(1, m-1-i));
t(1) = 1;
//
// Apply H(i) to A(i+1:m-1,i+1:n-1) from the left
//
reflections::applyreflectionfromtheleft<Precision>(a, ltau, t, i+1, m-1, i+1, n-1, work);
}
else
{
tauq(i) = 0;
}
}
}
}
amp::ampf
Definition amp.h:82
ap::template_1d_array::getvector
raw_vector< T > getvector(int iStart, int iEnd)
Definition ap.h:776
j
int j
Definition facHensel.cc:110
ap::minint
int minint(int m1, int m2)
Definition ap.cpp:167
reflections::generatereflection
void generatereflection(ap::template_1d_array< amp::ampf< Precision > > &x, int n, amp::ampf< Precision > &tau)
Definition reflections.h:112

## rmatrixbdmultiplybyp()

template<unsigned int Precision>

void bidiagonal::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 at line 649 of file bidiagonal.h.

{
int i;
ap::template_1d_array< amp::ampf<Precision> > v;
ap::template_1d_array< amp::ampf<Precision> > work;
int mx;
int i1;
int i2;
int istep;
if( m<=0 || n<=0 || zrows<=0 || zcolumns<=0 )
{
return;
}
ap::ap_error::make_assertion(fromtheright && zcolumns==n || !fromtheright && zrows==n);
//
// init
//
mx = ap::maxint(m, n);
mx = ap::maxint(mx, zrows);
mx = ap::maxint(mx, zcolumns);
v.setbounds(0, mx);
work.setbounds(0, mx);
v.setbounds(0, mx);
work.setbounds(0, mx);
if( m>=n )
{
//
// setup
//
if( fromtheright )
{
i1 = n-2;
i2 = 0;
istep = -1;
}
else
{
i1 = 0;
i2 = n-2;
istep = +1;
}
if( !dotranspose )
{
i = i1;
i1 = i2;
i2 = i;
istep = -istep;
}
//
// Process
//
if( n-1>0 )
{
i = i1;
do
{
ap::vmove(v.getvector(1, n-1-i), qp.getrow(i, i+1, n-1));
v(1) = 1;
if( fromtheright )
{
reflections::applyreflectionfromtheright<Precision>(z, taup(i), v, 0, zrows-1, i+1, n-1, work);
}
else
{
reflections::applyreflectionfromtheleft<Precision>(z, taup(i), v, i+1, n-1, 0, zcolumns-1, work);
}
i = i+istep;
}
while( i!=i2+istep );
}
}
else
{
//
// setup
//
if( fromtheright )
{
i1 = m-1;
i2 = 0;
istep = -1;
}
else
{
i1 = 0;
i2 = m-1;
istep = +1;
}
if( !dotranspose )
{
i = i1;
i1 = i2;
i2 = i;
istep = -istep;
}
//
// Process
//
i = i1;
do
{
ap::vmove(v.getvector(1, n-i), qp.getrow(i, i, n-1));
v(1) = 1;
if( fromtheright )
{
reflections::applyreflectionfromtheright<Precision>(z, taup(i), v, 0, zrows-1, i, n-1, work);
}
else
{
reflections::applyreflectionfromtheleft<Precision>(z, taup(i), v, i, n-1, 0, zcolumns-1, work);
}
i = i+istep;
}
while( i!=i2+istep );
}
}

## rmatrixbdmultiplybyq()

template<unsigned int Precision>

void bidiagonal::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 at line 422 of file bidiagonal.h.

{
int i;
int i1;
int i2;
int istep;
ap::template_1d_array< amp::ampf<Precision> > v;
ap::template_1d_array< amp::ampf<Precision> > work;
int mx;
if( m<=0 || n<=0 || zrows<=0 || zcolumns<=0 )
{
return;
}
ap::ap_error::make_assertion(fromtheright && zcolumns==m || !fromtheright && zrows==m);
//
// init
//
mx = ap::maxint(m, n);
mx = ap::maxint(mx, zrows);
mx = ap::maxint(mx, zcolumns);
v.setbounds(0, mx);
work.setbounds(0, mx);
if( m>=n )
{
//
// setup
//
if( fromtheright )
{
i1 = 0;
i2 = n-1;
istep = +1;
}
else
{
i1 = n-1;
i2 = 0;
istep = -1;
}
if( dotranspose )
{
i = i1;
i1 = i2;
i2 = i;
istep = -istep;
}
//
// Process
//
i = i1;
do
{
ap::vmove(v.getvector(1, m-i), qp.getcolumn(i, i, m-1));
v(1) = 1;
if( fromtheright )
{
reflections::applyreflectionfromtheright<Precision>(z, tauq(i), v, 0, zrows-1, i, m-1, work);
}
else
{
reflections::applyreflectionfromtheleft<Precision>(z, tauq(i), v, i, m-1, 0, zcolumns-1, work);
}
i = i+istep;
}
while( i!=i2+istep );
}
else
{
//
// setup
//
if( fromtheright )
{
i1 = 0;
i2 = m-2;
istep = +1;
}
else
{
i1 = m-2;
i2 = 0;
istep = -1;
}
if( dotranspose )
{
i = i1;
i1 = i2;
i2 = i;
istep = -istep;
}
//
// Process
//
if( m-1>0 )
{
i = i1;
do
{
ap::vmove(v.getvector(1, m-i-1), qp.getcolumn(i, i+1, m-1));
v(1) = 1;
if( fromtheright )
{
reflections::applyreflectionfromtheright<Precision>(z, tauq(i), v, 0, zrows-1, i+1, m-1, work);
}
else
{
reflections::applyreflectionfromtheleft<Precision>(z, tauq(i), v, i+1, m-1, 0, zcolumns-1, work);
}
i = i+istep;
}
while( i!=i2+istep );
}
}
}

## rmatrixbdunpackdiagonals()

template<unsigned int Precision>

void bidiagonal::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 at line 805 of file bidiagonal.h.

{
int i;
isupper = m>=n;
if( m<=0 || n<=0 )
{
return;
}
if( isupper )
{
d.setbounds(0, n-1);
e.setbounds(0, n-1);
for(i=0; i<=n-2; i++)
{
d(i) = b(i,i);
e(i) = b(i,i+1);
}
d(n-1) = b(n-1,n-1);
}
else
{
d.setbounds(0, m-1);
e.setbounds(0, m-1);
for(i=0; i<=m-2; i++)
{
d(i) = b(i,i);
e(i) = b(i+1,i);
}
d(m-1) = b(m-1,m-1);
}
}
b
CanonicalForm b
Definition cfModGcd.cc:4111

## rmatrixbdunpackpt()

template<unsigned int Precision>

void bidiagonal::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 at line 575 of file bidiagonal.h.

{
int i;
int j;
ap::ap_error::make_assertion(ptrows<=n);
ap::ap_error::make_assertion(ptrows>=0);
if( m==0 || n==0 || ptrows==0 )
{
return;
}
//
// prepare PT
//
pt.setbounds(0, ptrows-1, 0, n-1);
for(i=0; i<=ptrows-1; i++)
{
for(j=0; j<=n-1; j++)
{
if( i==j )
{
pt(i,j) = 1;
}
else
{
pt(i,j) = 0;
}
}
}
//
// Calculate
//
rmatrixbdmultiplybyp<Precision>(qp, m, n, taup, pt, ptrows, n, true, true);
}
ap::template_2d_array::setbounds
void setbounds(int iLow1, int iHigh1, int iLow2, int iHigh2)
Definition ap.h:890
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

## rmatrixbdunpackq()

template<unsigned int Precision>

void bidiagonal::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 at line 348 of file bidiagonal.h.

{
int i;
int j;
ap::ap_error::make_assertion(qcolumns<=m);
ap::ap_error::make_assertion(qcolumns>=0);
if( m==0 || n==0 || qcolumns==0 )
{
return;
}
//
// prepare Q
//
q.setbounds(0, m-1, 0, qcolumns-1);
for(i=0; i<=m-1; i++)
{
for(j=0; j<=qcolumns-1; j++)
{
if( i==j )
{
q(i,j) = 1;
}
else
{
q(i,j) = 0;
}
}
}
//
// Calculate
//
rmatrixbdmultiplybyq<Precision>(qp, m, n, tauq, q, m, qcolumns, false, false);
}
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

## tobidiagonal()

template<unsigned int Precision>

void bidiagonal::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 at line 850 of file bidiagonal.h.

{
ap::template_1d_array< amp::ampf<Precision> > work;
ap::template_1d_array< amp::ampf<Precision> > t;
int minmn;
int maxmn;
int i;
amp::ampf<Precision> ltau;
int mmip1;
int nmi;
int ip1;
int nmip1;
int mmi;
minmn = ap::minint(m, n);
maxmn = ap::maxint(m, n);
work.setbounds(1, maxmn);
t.setbounds(1, maxmn);
taup.setbounds(1, minmn);
tauq.setbounds(1, minmn);
if( m>=n )
{
//
// Reduce to upper bidiagonal form
//
for(i=1; i<=n; i++)
{
//
// Generate elementary reflector H(i) to annihilate A(i+1:m,i)
//
mmip1 = m-i+1;
ap::vmove(t.getvector(1, mmip1), a.getcolumn(i, i, m));
reflections::generatereflection<Precision>(t, mmip1, ltau);
tauq(i) = ltau;
ap::vmove(a.getcolumn(i, i, m), t.getvector(1, mmip1));
t(1) = 1;
//
// Apply H(i) to A(i:m,i+1:n) from the left
//
reflections::applyreflectionfromtheleft<Precision>(a, ltau, t, i, m, i+1, n, work);
if( i<n )
{
//
// Generate elementary reflector G(i) to annihilate
// A(i,i+2:n)
//
nmi = n-i;
ip1 = i+1;
ap::vmove(t.getvector(1, nmi), a.getrow(i, ip1, n));
reflections::generatereflection<Precision>(t, nmi, ltau);
taup(i) = ltau;
ap::vmove(a.getrow(i, ip1, n), t.getvector(1, nmi));
t(1) = 1;
//
// Apply G(i) to A(i+1:m,i+1:n) from the right
//
reflections::applyreflectionfromtheright<Precision>(a, ltau, t, i+1, m, i+1, n, work);
}
else
{
taup(i) = 0;
}
}
}
else
{
//
// Reduce to lower bidiagonal form
//
for(i=1; i<=m; i++)
{
//
// Generate elementary reflector G(i) to annihilate A(i,i+1:n)
//
nmip1 = n-i+1;
ap::vmove(t.getvector(1, nmip1), a.getrow(i, i, n));
reflections::generatereflection<Precision>(t, nmip1, ltau);
taup(i) = ltau;
ap::vmove(a.getrow(i, i, n), t.getvector(1, nmip1));
t(1) = 1;
//
// Apply G(i) to A(i+1:m,i:n) from the right
//
reflections::applyreflectionfromtheright<Precision>(a, ltau, t, i+1, m, i, n, work);
if( i<m )
{
//
// Generate elementary reflector H(i) to annihilate
// A(i+2:m,i)
//
mmi = m-i;
ip1 = i+1;
ap::vmove(t.getvector(1, mmi), a.getcolumn(i, ip1, m));
reflections::generatereflection<Precision>(t, mmi, ltau);
tauq(i) = ltau;
ap::vmove(a.getcolumn(i, ip1, m), t.getvector(1, mmi));
t(1) = 1;
//
// Apply H(i) to A(i+1:m,i+1:n) from the left
//
reflections::applyreflectionfromtheleft<Precision>(a, ltau, t, i+1, m, i+1, n, work);
}
else
{
tauq(i) = 0;
}
}
}
}

## unpackdiagonalsfrombidiagonal()

template<unsigned int Precision>

void bidiagonal::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 at line 1413 of file bidiagonal.h.

{
int i;
isupper = m>=n;
if( m==0 || n==0 )
{
return;
}
if( isupper )
{
d.setbounds(1, n);
e.setbounds(1, n);
for(i=1; i<=n-1; i++)
{
d(i) = b(i,i);
e(i) = b(i,i+1);
}
d(n) = b(n,n);
}
else
{
d.setbounds(1, m);
e.setbounds(1, m);
for(i=1; i<=m-1; i++)
{
d(i) = b(i,i);
e(i) = b(i+1,i);
}
d(m) = b(m,m);
}
}

## unpackptfrombidiagonal()

template<unsigned int Precision>

void bidiagonal::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 at line 1196 of file bidiagonal.h.

{
int i;
int j;
int ip1;
ap::template_1d_array< amp::ampf<Precision> > v;
ap::template_1d_array< amp::ampf<Precision> > work;
int vm;
ap::ap_error::make_assertion(ptrows<=n);
if( m==0 || n==0 || ptrows==0 )
{
return;
}
//
// init
//
pt.setbounds(1, ptrows, 1, n);
v.setbounds(1, n);
work.setbounds(1, ptrows);
//
// prepare PT
//
for(i=1; i<=ptrows; i++)
{
for(j=1; j<=n; j++)
{
if( i==j )
{
pt(i,j) = 1;
}
else
{
pt(i,j) = 0;
}
}
}
if( m>=n )
{
for(i=ap::minint(n-1, ptrows-1); i>=1; i--)
{
vm = n-i;
ip1 = i+1;
ap::vmove(v.getvector(1, vm), qp.getrow(i, ip1, n));
v(1) = 1;
reflections::applyreflectionfromtheright<Precision>(pt, taup(i), v, 1, ptrows, i+1, n, work);
}
}
else
{
for(i=ap::minint(m, ptrows); i>=1; i--)
{
vm = n-i+1;
ap::vmove(v.getvector(1, vm), qp.getrow(i, i, n));
v(1) = 1;
reflections::applyreflectionfromtheright<Precision>(pt, taup(i), v, 1, ptrows, i, n, work);
}
}
}

## unpackqfrombidiagonal()

template<unsigned int Precision>

void bidiagonal::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 at line 981 of file bidiagonal.h.

{
int i;
int j;
int ip1;
ap::template_1d_array< amp::ampf<Precision> > v;
ap::template_1d_array< amp::ampf<Precision> > work;
int vm;
ap::ap_error::make_assertion(qcolumns<=m);
if( m==0 || n==0 || qcolumns==0 )
{
return;
}
//
// init
//
q.setbounds(1, m, 1, qcolumns);
v.setbounds(1, m);
work.setbounds(1, qcolumns);
//
// prepare Q
//
for(i=1; i<=m; i++)
{
for(j=1; j<=qcolumns; j++)
{
if( i==j )
{
q(i,j) = 1;
}
else
{
q(i,j) = 0;
}
}
}
if( m>=n )
{
for(i=ap::minint(n, qcolumns); i>=1; i--)
{
vm = m-i+1;
ap::vmove(v.getvector(1, vm), qp.getcolumn(i, i, m));
v(1) = 1;
reflections::applyreflectionfromtheleft<Precision>(q, tauq(i), v, i, m, 1, qcolumns, work);
}
}
else
{
for(i=ap::minint(m-1, qcolumns-1); i>=1; i--)
{
vm = m-i;
ip1 = i+1;
ap::vmove(v.getvector(1, vm), qp.getcolumn(i, ip1, m));
v(1) = 1;
reflections::applyreflectionfromtheleft<Precision>(q, tauq(i), v, i+1, m, 1, qcolumns, work);
}
}
}