Loading...
Searching...
No Matches
lq Namespace Reference

## Functions

template<unsigned int Precision>
void | rmatrixlq (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 | 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)
template<unsigned int Precision>
void | rmatrixlqunpackl (const ap::template_2d_array< amp::ampf< Precision > > &a, int m, int n, ap::template_2d_array< amp::ampf< Precision > > &l)
template<unsigned int Precision>
void | lqdecomposition (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 | 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)
template<unsigned int Precision>
void | lqdecompositionunpacked (ap::template_2d_array< amp::ampf< Precision > > a, int m, int n, ap::template_2d_array< amp::ampf< Precision > > &l, ap::template_2d_array< amp::ampf< Precision > > &q)

## Function Documentation

## lqdecomposition()

template<unsigned int Precision>

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

Definition at line 288 of file lq.h.

{
ap::template_1d_array< amp::ampf<Precision> > work;
ap::template_1d_array< amp::ampf<Precision> > t;
int i;
int k;
int nmip1;
int minmn;
int maxmn;
amp::ampf<Precision> tmp;
minmn = ap::minint(m, n);
maxmn = ap::maxint(m, n);
work.setbounds(1, m);
t.setbounds(1, n);
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,i+1:n)
//
nmip1 = n-i+1;
ap::vmove(t.getvector(1, nmip1), a.getrow(i, i, n));
reflections::generatereflection<Precision>(t, nmip1, tmp);
tau(i) = tmp;
ap::vmove(a.getrow(i, i, n), t.getvector(1, nmip1));
t(1) = 1;
if( i<n )
{
//
// Apply H(i) to A(i+1:m,i:n) from the right
//
reflections::applyreflectionfromtheright<Precision>(a, tau(i), t, i+1, m, i, 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::getrow
raw_vector< T > getrow(int iRow, int iColumnStart, int iColumnEnd)
Definition ap.h:939
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
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::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

## lqdecompositionunpacked()

template<unsigned int Precision>

void lq::lqdecompositionunpacked | ( | ap::template_2d_array< amp::ampf< Precision > > | a,
|  | int | m,
|  | int | n,
|  | ap::template_2d_array< amp::ampf< Precision > > & | l,
|  | ap::template_2d_array< amp::ampf< Precision > > & | q )

Definition at line 408 of file lq.h.

{
int i;
int j;
ap::template_1d_array< amp::ampf<Precision> > tau;
if( n<=0 )
{
return;
}
q.setbounds(1, n, 1, n);
l.setbounds(1, m, 1, n);
//
// LQDecomposition
//
lqdecomposition<Precision>(a, m, n, tau);
//
// L
//
for(i=1; i<=m; i++)
{
for(j=1; j<=n; j++)
{
if( j>i )
{
l(i,j) = 0;
}
else
{
l(i,j) = a(i,j);
}
}
}
//
// Q
//
unpackqfromlq<Precision>(a, m, n, tau, n, q);
}
l
int l
Definition cfEzgcd.cc:100
ap::template_2d_array::setbounds
void setbounds(int iLow1, int iHigh1, int iLow2, int iHigh2)
Definition ap.h:890
j
int j
Definition facHensel.cc:110
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

## rmatrixlq()

template<unsigned int Precision>

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

Definition at line 113 of file lq.h.

{
ap::template_1d_array< amp::ampf<Precision> > work;
ap::template_1d_array< amp::ampf<Precision> > t;
int i;
int k;
int minmn;
int maxmn;
amp::ampf<Precision> tmp;
minmn = ap::minint(m, n);
maxmn = ap::maxint(m, n);
work.setbounds(0, m);
t.setbounds(0, n);
tau.setbounds(0, minmn-1);
k = ap::minint(m, n);
for(i=0; i<=k-1; i++)
{
//
// Generate elementary reflector H(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, tmp);
tau(i) = tmp;
ap::vmove(a.getrow(i, i, n-1), t.getvector(1, n-i));
t(1) = 1;
if( i<n )
{
//
// Apply H(i) to A(i+1:m,i:n) from the right
//
reflections::applyreflectionfromtheright<Precision>(a, tau(i), t, i+1, m-1, i, n-1, work);
}
}
}

## rmatrixlqunpackl()

template<unsigned int Precision>

void lq::rmatrixlqunpackl | ( | const ap::template_2d_array< amp::ampf< Precision > > & | a,
|  | int | m,
|  | int | n,
|  | ap::template_2d_array< amp::ampf< Precision > > & | l )

Definition at line 253 of file lq.h.

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

## rmatrixlqunpackq()

template<unsigned int Precision>

void lq::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 at line 177 of file lq.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(qrows<=n);
if( m<=0 || n<=0 || qrows<=0 )
{
return;
}
//
// init
//
minmn = ap::minint(m, n);
k = ap::minint(minmn, qrows);
q.setbounds(0, qrows-1, 0, n-1);
v.setbounds(0, n);
work.setbounds(0, qrows);
for(i=0; i<=qrows-1; i++)
{
for(j=0; j<=n-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, n-i), a.getrow(i, i, n-1));
v(1) = 1;
reflections::applyreflectionfromtheright<Precision>(q, tau(i), v, 0, qrows-1, i, n-1, work);
}
}
ap::ap_error::make_assertion
static void make_assertion(bool bClause)
Definition ap.h:49
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39

## unpackqfromlq()

template<unsigned int Precision>

void lq::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 at line 342 of file lq.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(qrows<=n);
if( m==0 || n==0 || qrows==0 )
{
return;
}
//
// init
//
minmn = ap::minint(m, n);
k = ap::minint(minmn, qrows);
q.setbounds(1, qrows, 1, n);
v.setbounds(1, n);
work.setbounds(1, qrows);
for(i=1; i<=qrows; i++)
{
for(j=1; j<=n; 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 = n-i+1;
ap::vmove(v.getvector(1, vm), a.getrow(i, i, n));
v(1) = 1;
reflections::applyreflectionfromtheright<Precision>(q, tau(i), v, 1, qrows, i, n, work);
}
}