My Project
Loading...
Searching...
No Matches
Functions
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.

292 {
295 int i;
296 int k;
297 int nmip1;
298 int minmn;
299 int maxmn;
301
302
303 minmn = ap::minint(m, n);
304 maxmn = ap::maxint(m, n);
305 work.setbounds(1, m);
306 t.setbounds(1, n);
307 tau.setbounds(1, minmn);
308
309 //
310 // Test the input arguments
311 //
312 k = ap::minint(m, n);
313 for(i=1; i<=k; i++)
314 {
315
316 //
317 // Generate elementary reflector H(i) to annihilate A(i,i+1:n)
318 //
319 nmip1 = n-i+1;
320 ap::vmove(t.getvector(1, nmip1), a.getrow(i, i, n));
321 reflections::generatereflection<Precision>(t, nmip1, tmp);
322 tau(i) = tmp;
323 ap::vmove(a.getrow(i, i, n), t.getvector(1, nmip1));
324 t(1) = 1;
325 if( i<n )
326 {
327
328 //
329 // Apply H(i) to A(i+1:m,i:n) from the right
330 //
331 reflections::applyreflectionfromtheright<Precision>(a, tau(i), t, i+1, m, i, n, work);
332 }
333 }
334 }
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
int k
Definition: cfEzgcd.cc:99
void tau(int **points, int sizePoints, int k)
Definition: amp.h:82
raw_vector< T > getvector(int iStart, int iEnd)
Definition: ap.h:776
void setbounds(int iLow, int iHigh)
Definition: ap.h:735
raw_vector< T > getrow(int iRow, int iColumnStart, int iColumnEnd)
Definition: ap.h:939
int maxint(int m1, int m2)
Definition: ap.cpp:162
void vmove(raw_vector< T > vdst, const_raw_vector< T > vsrc)
Definition: ap.h:237
int minint(int m1, int m2)
Definition: ap.cpp:167

◆ 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.

413 {
414 int i;
415 int j;
417
418
419 if( n<=0 )
420 {
421 return;
422 }
423 q.setbounds(1, n, 1, n);
424 l.setbounds(1, m, 1, n);
425
426 //
427 // LQDecomposition
428 //
429 lqdecomposition<Precision>(a, m, n, tau);
430
431 //
432 // L
433 //
434 for(i=1; i<=m; i++)
435 {
436 for(j=1; j<=n; j++)
437 {
438 if( j>i )
439 {
440 l(i,j) = 0;
441 }
442 else
443 {
444 l(i,j) = a(i,j);
445 }
446 }
447 }
448
449 //
450 // Q
451 //
452 unpackqfromlq<Precision>(a, m, n, tau, n, q);
453 }
int l
Definition: cfEzgcd.cc:100
void setbounds(int iLow1, int iHigh1, int iLow2, int iHigh2)
Definition: ap.h:890
int j
Definition: facHensel.cc:110

◆ 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.

117 {
120 int i;
121 int k;
122 int minmn;
123 int maxmn;
125
126
127 minmn = ap::minint(m, n);
128 maxmn = ap::maxint(m, n);
129 work.setbounds(0, m);
130 t.setbounds(0, n);
131 tau.setbounds(0, minmn-1);
132 k = ap::minint(m, n);
133 for(i=0; i<=k-1; i++)
134 {
135
136 //
137 // Generate elementary reflector H(i) to annihilate A(i,i+1:n-1)
138 //
139 ap::vmove(t.getvector(1, n-i), a.getrow(i, i, n-1));
140 reflections::generatereflection<Precision>(t, n-i, tmp);
141 tau(i) = tmp;
142 ap::vmove(a.getrow(i, i, n-1), t.getvector(1, n-i));
143 t(1) = 1;
144 if( i<n )
145 {
146
147 //
148 // Apply H(i) to A(i+1:m,i:n) from the right
149 //
150 reflections::applyreflectionfromtheright<Precision>(a, tau(i), t, i+1, m-1, i, n-1, work);
151 }
152 }
153 }

◆ 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.

257 {
258 int i;
259 int k;
260
261
262 if( m<=0 || n<=0 )
263 {
264 return;
265 }
266 l.setbounds(0, m-1, 0, n-1);
267 for(i=0; i<=n-1; i++)
268 {
269 l(0,i) = 0;
270 }
271 for(i=1; i<=m-1; i++)
272 {
273 ap::vmove(l.getrow(i, 0, n-1), l.getrow(0, 0, n-1));
274 }
275 for(i=0; i<=m-1; i++)
276 {
277 k = ap::minint(i, n-1);
278 ap::vmove(l.getrow(i, 0, k), a.getrow(i, 0, k));
279 }
280 }

◆ 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.

183 {
184 int i;
185 int j;
186 int k;
187 int minmn;
190
191
193 if( m<=0 || n<=0 || qrows<=0 )
194 {
195 return;
196 }
197
198 //
199 // init
200 //
201 minmn = ap::minint(m, n);
202 k = ap::minint(minmn, qrows);
203 q.setbounds(0, qrows-1, 0, n-1);
204 v.setbounds(0, n);
205 work.setbounds(0, qrows);
206 for(i=0; i<=qrows-1; i++)
207 {
208 for(j=0; j<=n-1; j++)
209 {
210 if( i==j )
211 {
212 q(i,j) = 1;
213 }
214 else
215 {
216 q(i,j) = 0;
217 }
218 }
219 }
220
221 //
222 // unpack Q
223 //
224 for(i=k-1; i>=0; i--)
225 {
226
227 //
228 // Apply H(i)
229 //
230 ap::vmove(v.getvector(1, n-i), a.getrow(i, i, n-1));
231 v(1) = 1;
232 reflections::applyreflectionfromtheright<Precision>(q, tau(i), v, 0, qrows-1, i, n-1, work);
233 }
234 }
static void make_assertion(bool bClause)
Definition: ap.h:49
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.

348 {
349 int i;
350 int j;
351 int k;
352 int minmn;
355 int vm;
356
357
359 if( m==0 || n==0 || qrows==0 )
360 {
361 return;
362 }
363
364 //
365 // init
366 //
367 minmn = ap::minint(m, n);
368 k = ap::minint(minmn, qrows);
369 q.setbounds(1, qrows, 1, n);
370 v.setbounds(1, n);
371 work.setbounds(1, qrows);
372 for(i=1; i<=qrows; i++)
373 {
374 for(j=1; j<=n; j++)
375 {
376 if( i==j )
377 {
378 q(i,j) = 1;
379 }
380 else
381 {
382 q(i,j) = 0;
383 }
384 }
385 }
386
387 //
388 // unpack Q
389 //
390 for(i=k; i>=1; i--)
391 {
392
393 //
394 // Apply H(i)
395 //
396 vm = n-i+1;
397 ap::vmove(v.getvector(1, vm), a.getrow(i, i, n));
398 v(1) = 1;
399 reflections::applyreflectionfromtheright<Precision>(q, tau(i), v, 1, qrows, i, n, work);
400 }
401 }