Loading...
Searching...
No Matches
qr Namespace Reference

## Functions

template<unsigned int Precision>
void | rmatrixqr (ap::template_2d_array< amp::ampf< Precision > > &a, int m, int n, ap::template_1d_array< amp::ampf< Precision > > &tau)
template<unsigned int Precision>
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)
template<unsigned int Precision>
void | rmatrixqrunpackr (const ap::template_2d_array< amp::ampf< Precision > > &a, int m, int n, ap::template_2d_array< amp::ampf< Precision > > &r)
template<unsigned int Precision>
void | qrdecomposition (ap::template_2d_array< amp::ampf< Precision > > &a, int m, int n, ap::template_1d_array< amp::ampf< Precision > > &tau)
template<unsigned int Precision>
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)
template<unsigned int Precision>
void | qrdecompositionunpacked (ap::template_2d_array< amp::ampf< Precision > > a, int m, int n, ap::template_2d_array< amp::ampf< Precision > > &q, ap::template_2d_array< amp::ampf< Precision > > &r)

## Function Documentation

## qrdecomposition()

template<unsigned int Precision>

void qr::qrdecomposition | ( | ap::template_2d_array< amp::ampf< Precision > > & | a,
|  | int | m,
|  | int | n,
|  | ap::template_1d_array< amp::ampf< Precision > > & | tau )

Definition at line 303 of file qr.h.

{
ap::template_1d_array< amp::ampf<Precision> > work;
ap::template_1d_array< amp::ampf<Precision> > t;
int i;
int k;
int mmip1;
int minmn;
amp::ampf<Precision> tmp;
minmn = ap::minint(m, n);
work.setbounds(1, n);
t.setbounds(1, m);
tau.setbounds(1, minmn);
//
// Test the input arguments
//
k = ap::minint(m, n);
for(i=1; i<=k; 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, tmp);
tau(i) = tmp;
ap::vmove(a.getcolumn(i, i, m), t.getvector(1, mmip1));
t(1) = 1;
if( i<n )
{
//
// Apply H(i) to A(i:m,i+1:n) from the left
//
reflections::applyreflectionfromtheleft<Precision>(a, tau(i), t, i, m, i+1, n, work);
}
}
}
m
int m
Definition cfEzgcd.cc:128
i
int i
Definition cfEzgcd.cc:132
k
int k
Definition cfEzgcd.cc:99
tau
void tau(int **points, int sizePoints, int k)
Definition cfNewtonPolygon.cc:461
amp::ampf
Definition amp.h:82
ap::template_1d_array
Definition ap.h:657
ap::template_1d_array::getvector
raw_vector< T > getvector(int iStart, int iEnd)
Definition ap.h:776
ap::template_1d_array::setbounds
void setbounds(int iLow, int iHigh)
Definition ap.h:735
ap::template_2d_array::getcolumn
raw_vector< T > getcolumn(int iColumn, int iRowStart, int iRowEnd)
Definition ap.h:931
ap::vmove
void vmove(raw_vector< T > vdst, const_raw_vector< T > vsrc)
Definition ap.h:237
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
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

## qrdecompositionunpacked()

template<unsigned int Precision>

void qr::qrdecompositionunpacked | ( | ap::template_2d_array< amp::ampf< Precision > > | a,
|  | int | m,
|  | int | n,
|  | ap::template_2d_array< amp::ampf< Precision > > & | q,
|  | ap::template_2d_array< amp::ampf< Precision > > & | r )

Definition at line 420 of file qr.h.

{
int i;
int k;
ap::template_1d_array< amp::ampf<Precision> > tau;
ap::template_1d_array< amp::ampf<Precision> > work;
ap::template_1d_array< amp::ampf<Precision> > v;
k = ap::minint(m, n);
if( n<=0 )
{
return;
}
work.setbounds(1, m);
v.setbounds(1, m);
q.setbounds(1, m, 1, m);
r.setbounds(1, m, 1, n);
//
// QRDecomposition
//
qrdecomposition<Precision>(a, m, n, tau);
//
// R
//
for(i=1; i<=n; i++)
{
r(1,i) = 0;
}
for(i=2; i<=m; i++)
{
ap::vmove(r.getrow(i, 1, n), r.getrow(1, 1, n));
}
for(i=1; i<=k; i++)
{
ap::vmove(r.getrow(i, i, n), a.getrow(i, i, n));
}
//
// Q
//
unpackqfromqr<Precision>(a, m, n, tau, m, q);
}
ap::template_2d_array::setbounds
void setbounds(int iLow1, int iHigh1, int iLow2, int iHigh2)
Definition ap.h:890
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
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

## rmatrixqr()

template<unsigned int Precision>

void qr::rmatrixqr | ( | ap::template_2d_array< amp::ampf< Precision > > & | a,
|  | int | m,
|  | int | n,
|  | ap::template_1d_array< amp::ampf< Precision > > & | tau )

Definition at line 123 of file qr.h.

{
ap::template_1d_array< amp::ampf<Precision> > work;
ap::template_1d_array< amp::ampf<Precision> > t;
int i;
int k;
int minmn;
amp::ampf<Precision> tmp;
if( m<=0 || n<=0 )
{
return;
}
minmn = ap::minint(m, n);
work.setbounds(0, n-1);
t.setbounds(1, m);
tau.setbounds(0, minmn-1);
//
// Test the input arguments
//
k = minmn;
for(i=0; i<=k-1; i++)
{
//
// Generate elementary reflector H(i) to annihilate A(i+1:m,i)
//
ap::vmove(t.getvector(1, m-i), a.getcolumn(i, i, m-1));
reflections::generatereflection<Precision>(t, m-i, tmp);
tau(i) = tmp;
ap::vmove(a.getcolumn(i, i, m-1), t.getvector(1, m-i));
t(1) = 1;
if( i<n )
{
//
// Apply H(i) to A(i:m-1,i+1:n-1) from the left
//
reflections::applyreflectionfromtheleft<Precision>(a, tau(i), t, i, m-1, i+1, n-1, work);
}
}
}

## rmatrixqrunpackq()

template<unsigned int Precision>

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

{
int i;
int j;
int k;
int minmn;
ap::template_1d_array< amp::ampf<Precision> > v;
ap::template_1d_array< amp::ampf<Precision> > work;
ap::ap_error::make_assertion(qcolumns<=m);
if( m<=0 || n<=0 || qcolumns<=0 )
{
return;
}
//
// init
//
minmn = ap::minint(m, n);
k = ap::minint(minmn, qcolumns);
q.setbounds(0, m-1, 0, qcolumns-1);
v.setbounds(1, m);
work.setbounds(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;
}
}
}
//
// unpack Q
//
for(i=k-1; i>=0; i--)
{
//
// Apply H(i)
//
ap::vmove(v.getvector(1, m-i), a.getcolumn(i, i, m-1));
v(1) = 1;
reflections::applyreflectionfromtheleft<Precision>(q, tau(i), v, i, m-1, 0, qcolumns-1, work);
}
}
ap::ap_error::make_assertion
static void make_assertion(bool bClause)
Definition ap.h:49
j
int j
Definition facHensel.cc:110

## rmatrixqrunpackr()

template<unsigned int Precision>

void qr::rmatrixqrunpackr | ( | const ap::template_2d_array< amp::ampf< Precision > > & | a,
|  | int | m,
|  | int | n,
|  | ap::template_2d_array< amp::ampf< Precision > > & | r )

Definition at line 269 of file qr.h.

{
int i;
int k;
if( m<=0 || n<=0 )
{
return;
}
k = ap::minint(m, n);
r.setbounds(0, m-1, 0, n-1);
for(i=0; i<=n-1; i++)
{
r(0,i) = 0;
}
for(i=1; i<=m-1; i++)
{
ap::vmove(r.getrow(i, 0, n-1), r.getrow(0, 0, n-1));
}
for(i=0; i<=k-1; i++)
{
ap::vmove(r.getrow(i, i, n-1), a.getrow(i, i, n-1));
}
}

## unpackqfromqr()

template<unsigned int Precision>

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

{
int i;
int j;
int k;
int minmn;
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
//
minmn = ap::minint(m, n);
k = ap::minint(minmn, qcolumns);
q.setbounds(1, m, 1, qcolumns);
v.setbounds(1, m);
work.setbounds(1, qcolumns);
for(i=1; i<=m; i++)
{
for(j=1; j<=qcolumns; j++)
{
if( i==j )
{
q(i,j) = 1;
}
else
{
q(i,j) = 0;
}
}
}
//
// unpack Q
//
for(i=k; i>=1; i--)
{
//
// Apply H(i)
//
vm = m-i+1;
ap::vmove(v.getvector(1, vm), a.getcolumn(i, i, m));
v(1) = 1;
reflections::applyreflectionfromtheleft<Precision>(q, tau(i), v, i, m, 1, qcolumns, work);
}
}