My Project
Loading...
Searching...
No Matches
Functions
reflections Namespace Reference

Functions

template<unsigned int Precision>
void generatereflection (ap::template_1d_array< amp::ampf< Precision > > &x, int n, amp::ampf< Precision > &tau)
 
template<unsigned int Precision>
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)
 
template<unsigned int Precision>
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)
 

Function Documentation

◆ applyreflectionfromtheleft()

template<unsigned int Precision>
void reflections::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 at line 207 of file reflections.h.

215 {
217 int i;
218 int vm;
219
220
221 if( tau==0 || n1>n2 || m1>m2 )
222 {
223 return;
224 }
225
226 //
227 // w := C' * v
228 //
229 vm = m2-m1+1;
230 for(i=n1; i<=n2; i++)
231 {
232 work(i) = 0;
233 }
234 for(i=m1; i<=m2; i++)
235 {
236 t = v(i+1-m1);
237 ap::vadd(work.getvector(n1, n2), c.getrow(i, n1, n2), t);
238 }
239
240 //
241 // C := C - tau * v * w'
242 //
243 for(i=m1; i<=m2; i++)
244 {
245 t = v(i-m1+1)*tau;
246 ap::vsub(c.getrow(i, n1, n2), work.getvector(n1, n2), t);
247 }
248 }
int i
Definition: cfEzgcd.cc:132
void tau(int **points, int sizePoints, int k)
Definition: amp.h:82
raw_vector< T > getvector(int iStart, int iEnd)
Definition: ap.h:776
raw_vector< T > getrow(int iRow, int iColumnStart, int iColumnEnd)
Definition: ap.h:939
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
void vadd(raw_vector< T > vdst, const_raw_vector< T > vsrc)
Definition: ap.h:413
void vsub(raw_vector< T > vdst, const_raw_vector< T > vsrc)
Definition: ap.h:533

◆ applyreflectionfromtheright()

template<unsigned int Precision>
void reflections::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 at line 280 of file reflections.h.

288 {
290 int i;
291 int vm;
292
293
294 if( tau==0 || n1>n2 || m1>m2 )
295 {
296 return;
297 }
298
299 //
300 // w := C * v
301 //
302 vm = n2-n1+1;
303 for(i=m1; i<=m2; i++)
304 {
305 t = ap::vdotproduct(c.getrow(i, n1, n2), v.getvector(1, vm));
306 work(i) = t;
307 }
308
309 //
310 // C := C - w * v'
311 //
312 for(i=m1; i<=m2; i++)
313 {
314 t = work(i)*tau;
315 ap::vsub(c.getrow(i, n1, n2), v.getvector(1, vm), t);
316 }
317 }
T vdotproduct(const_raw_vector< T > v1, const_raw_vector< T > v2)
Definition: ap.h:181

◆ generatereflection()

template<unsigned int Precision>
void reflections::generatereflection ( ap::template_1d_array< amp::ampf< Precision > > &  x,
int  n,
amp::ampf< Precision > &  tau 
)

Definition at line 112 of file reflections.h.

115 {
116 int j;
122
123
124
125 //
126 // Executable Statements ..
127 //
128 if( n<=1 )
129 {
130 tau = 0;
131 return;
132 }
133
134 //
135 // XNORM = DNRM2( N-1, X, INCX )
136 //
137 alpha = x(1);
138 mx = 0;
139 for(j=2; j<=n; j++)
140 {
141 mx = amp::maximum<Precision>(amp::abs<Precision>(x(j)), mx);
142 }
143 xnorm = 0;
144 if( mx!=0 )
145 {
146 for(j=2; j<=n; j++)
147 {
148 xnorm = xnorm+amp::sqr<Precision>(x(j)/mx);
149 }
150 xnorm = amp::sqrt<Precision>(xnorm)*mx;
151 }
152 if( xnorm==0 )
153 {
154
155 //
156 // H = I
157 //
158 tau = 0;
159 return;
160 }
161
162 //
163 // general case
164 //
165 mx = amp::maximum<Precision>(amp::abs<Precision>(alpha), amp::abs<Precision>(xnorm));
166 beta = -mx*amp::sqrt<Precision>(amp::sqr<Precision>(alpha/mx)+amp::sqr<Precision>(xnorm/mx));
167 if( alpha<0 )
168 {
169 beta = -beta;
170 }
171 tau = (beta-alpha)/beta;
172 v = 1/(alpha-beta);
173 ap::vmul(x.getvector(2, n), v);
174 x(1) = beta;
175 }
Variable x
Definition: cfModGcd.cc:4082
Variable alpha
Definition: facAbsBiFact.cc:51
Variable beta
Definition: facAbsFact.cc:95
int j
Definition: facHensel.cc:110
void vmul(raw_vector< T > vdst, T2 alpha)
Definition: ap.h:603