Loading...
Searching...
No Matches
rotations Namespace Reference

## Functions

template<unsigned int Precision>
void | applyrotationsfromtheleft (bool isforward, int m1, int m2, int n1, int n2, const ap::template_1d_array< amp::ampf< Precision > > &c, const ap::template_1d_array< amp::ampf< Precision > > &s, ap::template_2d_array< amp::ampf< Precision > > &a, ap::template_1d_array< amp::ampf< Precision > > &work)
template<unsigned int Precision>
void | applyrotationsfromtheright (bool isforward, int m1, int m2, int n1, int n2, const ap::template_1d_array< amp::ampf< Precision > > &c, const ap::template_1d_array< amp::ampf< Precision > > &s, ap::template_2d_array< amp::ampf< Precision > > &a, ap::template_1d_array< amp::ampf< Precision > > &work)
template<unsigned int Precision>
void | generaterotation (amp::ampf< Precision > f, amp::ampf< Precision > g, amp::ampf< Precision > &cs, amp::ampf< Precision > &sn, amp::ampf< Precision > &r)

## Function Documentation

## applyrotationsfromtheleft()

template<unsigned int Precision>

void rotations::applyrotationsfromtheleft | ( | bool | isforward,
|  | int | m1,
|  | int | m2,
|  | int | n1,
|  | int | n2,
|  | const ap::template_1d_array< amp::ampf< Precision > > & | c,
|  | const ap::template_1d_array< amp::ampf< Precision > > & | s,
|  | ap::template_2d_array< amp::ampf< Precision > > & | a,
|  | ap::template_1d_array< amp::ampf< Precision > > & | work )

Definition at line 100 of file rotations.h.

{
int j;
int jp1;
amp::ampf<Precision> ctemp;
amp::ampf<Precision> stemp;
amp::ampf<Precision> temp;
if( m1>m2 || n1>n2 )
{
return;
}
//
// Form P * A
//
if( isforward )
{
if( n1!=n2 )
{
//
// Common case: N1<>N2
//
for(j=m1; j<=m2-1; j++)
{
ctemp = c(j-m1+1);
stemp = s(j-m1+1);
if( ctemp!=1 || stemp!=0 )
{
jp1 = j+1;
ap::vmove(work.getvector(n1, n2), a.getrow(jp1, n1, n2), ctemp);
ap::vsub(work.getvector(n1, n2), a.getrow(j, n1, n2), stemp);
ap::vmul(a.getrow(j, n1, n2), ctemp);
ap::vadd(a.getrow(j, n1, n2), a.getrow(jp1, n1, n2), stemp);
ap::vmove(a.getrow(jp1, n1, n2), work.getvector(n1, n2));
}
}
}
else
{
//
// Special case: N1=N2
//
for(j=m1; j<=m2-1; j++)
{
ctemp = c(j-m1+1);
stemp = s(j-m1+1);
if( ctemp!=1 || stemp!=0 )
{
temp = a(j+1,n1);
a(j+1,n1) = ctemp*temp-stemp*a(j,n1);
a(j,n1) = stemp*temp+ctemp*a(j,n1);
}
}
}
}
else
{
if( n1!=n2 )
{
//
// Common case: N1<>N2
//
for(j=m2-1; j>=m1; j--)
{
ctemp = c(j-m1+1);
stemp = s(j-m1+1);
if( ctemp!=1 || stemp!=0 )
{
jp1 = j+1;
ap::vmove(work.getvector(n1, n2), a.getrow(jp1, n1, n2), ctemp);
ap::vsub(work.getvector(n1, n2), a.getrow(j, n1, n2), stemp);
ap::vmul(a.getrow(j, n1, n2), ctemp);
ap::vadd(a.getrow(j, n1, n2), a.getrow(jp1, n1, n2), stemp);
ap::vmove(a.getrow(jp1, n1, n2), work.getvector(n1, n2));
}
}
}
else
{
//
// Special case: N1=N2
//
for(j=m2-1; j>=m1; j--)
{
ctemp = c(j-m1+1);
stemp = s(j-m1+1);
if( ctemp!=1 || stemp!=0 )
{
temp = a(j+1,n1);
a(j+1,n1) = ctemp*temp-stemp*a(j,n1);
a(j,n1) = stemp*temp+ctemp*a(j,n1);
}
}
}
}
}
amp::ampf
Definition amp.h:82
ap::template_1d_array::getvector
raw_vector< T > getvector(int iStart, int iEnd)
Definition ap.h:776
ap::template_2d_array::getrow
raw_vector< T > getrow(int iRow, int iColumnStart, int iColumnEnd)
Definition ap.h:939
s
const CanonicalForm int s
Definition facAbsFact.cc:51
j
int j
Definition facHensel.cc:110
ap::vmove
void vmove(raw_vector< T > vdst, const_raw_vector< T > vsrc)
Definition ap.h:237
ap::vadd
void vadd(raw_vector< T > vdst, const_raw_vector< T > vsrc)
Definition ap.h:413
ap::vmul
void vmul(raw_vector< T > vdst, T2 alpha)
Definition ap.h:603
ap::vsub
void vsub(raw_vector< T > vdst, const_raw_vector< T > vsrc)
Definition ap.h:533

## applyrotationsfromtheright()

template<unsigned int Precision>

void rotations::applyrotationsfromtheright | ( | bool | isforward,
|  | int | m1,
|  | int | m2,
|  | int | n1,
|  | int | n2,
|  | const ap::template_1d_array< amp::ampf< Precision > > & | c,
|  | const ap::template_1d_array< amp::ampf< Precision > > & | s,
|  | ap::template_2d_array< amp::ampf< Precision > > & | a,
|  | ap::template_1d_array< amp::ampf< Precision > > & | work )

Definition at line 238 of file rotations.h.

{
int j;
int jp1;
amp::ampf<Precision> ctemp;
amp::ampf<Precision> stemp;
amp::ampf<Precision> temp;
//
// Form A * P'
//
if( isforward )
{
if( m1!=m2 )
{
//
// Common case: M1<>M2
//
for(j=n1; j<=n2-1; j++)
{
ctemp = c(j-n1+1);
stemp = s(j-n1+1);
if( ctemp!=1 || stemp!=0 )
{
jp1 = j+1;
ap::vmove(work.getvector(m1, m2), a.getcolumn(jp1, m1, m2), ctemp);
ap::vsub(work.getvector(m1, m2), a.getcolumn(j, m1, m2), stemp);
ap::vmul(a.getcolumn(j, m1, m2), ctemp);
ap::vadd(a.getcolumn(j, m1, m2), a.getcolumn(jp1, m1, m2), stemp);
ap::vmove(a.getcolumn(jp1, m1, m2), work.getvector(m1, m2));
}
}
}
else
{
//
// Special case: M1=M2
//
for(j=n1; j<=n2-1; j++)
{
ctemp = c(j-n1+1);
stemp = s(j-n1+1);
if( ctemp!=1 || stemp!=0 )
{
temp = a(m1,j+1);
a(m1,j+1) = ctemp*temp-stemp*a(m1,j);
a(m1,j) = stemp*temp+ctemp*a(m1,j);
}
}
}
}
else
{
if( m1!=m2 )
{
//
// Common case: M1<>M2
//
for(j=n2-1; j>=n1; j--)
{
ctemp = c(j-n1+1);
stemp = s(j-n1+1);
if( ctemp!=1 || stemp!=0 )
{
jp1 = j+1;
ap::vmove(work.getvector(m1, m2), a.getcolumn(jp1, m1, m2), ctemp);
ap::vsub(work.getvector(m1, m2), a.getcolumn(j, m1, m2), stemp);
ap::vmul(a.getcolumn(j, m1, m2), ctemp);
ap::vadd(a.getcolumn(j, m1, m2), a.getcolumn(jp1, m1, m2), stemp);
ap::vmove(a.getcolumn(jp1, m1, m2), work.getvector(m1, m2));
}
}
}
else
{
//
// Special case: M1=M2
//
for(j=n2-1; j>=n1; j--)
{
ctemp = c(j-n1+1);
stemp = s(j-n1+1);
if( ctemp!=1 || stemp!=0 )
{
temp = a(m1,j+1);
a(m1,j+1) = ctemp*temp-stemp*a(m1,j);
a(m1,j) = stemp*temp+ctemp*a(m1,j);
}
}
}
}
}
ap::template_2d_array::getcolumn
raw_vector< T > getcolumn(int iColumn, int iRowStart, int iRowEnd)
Definition ap.h:931

## generaterotation()

template<unsigned int Precision>

void rotations::generaterotation | ( | amp::ampf< Precision > | f,
|  | amp::ampf< Precision > | g,
|  | amp::ampf< Precision > & | cs,
|  | amp::ampf< Precision > & | sn,
|  | amp::ampf< Precision > & | r )

Definition at line 355 of file rotations.h.

{
amp::ampf<Precision> f1;
amp::ampf<Precision> g1;
if( g==0 )
{
cs = 1;
sn = 0;
r = f;
}
else
{
if( f==0 )
{
cs = 0;
sn = 1;
r = g;
}
else
{
f1 = f;
g1 = g;
r = amp::sqrt<Precision>(amp::sqr<Precision>(f1)+amp::sqr<Precision>(g1));
cs = f1/r;
sn = g1/r;
if( amp::abs<Precision>(f)>amp::abs<Precision>(g) && cs<0 )
{
cs = -cs;
sn = -sn;
r = -r;
}
}
}
}
g
g
Definition cfModGcd.cc:4098
f
FILE * f
Definition checklibs.c:9
amp::abs
const ampf< Precision > abs(const ampf< Precision > &x)
Definition amp.h:713
amp::sqrt
const ampf< Precision > sqrt(const ampf< Precision > &x)
Definition amp.h:740
amp::sqr
const ampf< Precision > sqr(const ampf< Precision > &x)
Definition amp.h:693