My Project  UNKNOWN_GIT_VERSION
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 318 of file lq.h.

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  }
335 
336 
337  /*************************************************************************
338  Obsolete 1-based subroutine
339  See RMatrixLQUnpackQ for 0-based replacement.
340  *************************************************************************/
341  template<unsigned int Precision>
343  int m,
344  int n,
346  int qrows,
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  //

◆ 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 438 of file lq.h.

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  }
454 } // namespace
455 
456 #endif

◆ 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 143 of file lq.h.

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  }
154 
155 
156  /*************************************************************************
157  Partial unpacking of matrix Q from the LQ decomposition of a matrix A
158 
159  Input parameters:
160  A - matrices L and Q in compact form.
161  Output of RMatrixLQ subroutine.
162  M - number of rows in given matrix A. M>=0.
163  N - number of columns in given matrix A. N>=0.
164  Tau - scalar factors which are used to form Q.
165  Output of the RMatrixLQ subroutine.
166  QRows - required number of rows in matrix Q. N>=QRows>=0.
167 
168  Output parameters:
169  Q - first QRows rows of matrix Q. Array whose indexes range
170  within [0..QRows-1, 0..N-1]. If QRows=0, the array remains
171  unchanged.
172 
173  -- ALGLIB --
174  Copyright 2005 by Bochkanov Sergey
175  *************************************************************************/
176  template<unsigned int Precision>
178  int m,
179  int n,
181  int qrows,
183  {

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

◆ 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 207 of file lq.h.

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  }
235 
236 
237  /*************************************************************************
238  Unpacking of matrix L from the LQ decomposition of a matrix A
239 
240  Input parameters:
241  A - matrices Q and L in compact form.
242  Output of RMatrixLQ subroutine.
243  M - number of rows in given matrix A. M>=0.
244  N - number of columns in given matrix A. N>=0.
245 
246  Output parameters:
247  L - matrix L, array[0..M-1, 0..N-1].
248 
249  -- ALGLIB --
250  Copyright 2005 by Bochkanov Sergey
251  *************************************************************************/
252  template<unsigned int Precision>
254  int m,
255  int n,
257  {
258  int i;
259  int k;
260 
261 
262  if( m<=0 || n<=0 )
263  {
264  return;

◆ 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 372 of file lq.h.

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  }
402 
403 
404  /*************************************************************************
405  Obsolete 1-based subroutine
406  *************************************************************************/
407  template<unsigned int Precision>
409  int m,
410  int n,
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  //
ap::vmove
void vmove(raw_vector< T > vdst, const_raw_vector< T > vsrc)
Definition: ap.h:242
j
int j
Definition: facHensel.cc:105
k
int k
Definition: cfEzgcd.cc:92
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:372
ap::template_1d_array
Definition: ap.h:662
ap::template_2d_array
Definition: ap.h:812
amp::ampf
Definition: amp.h:83
ap::template_2d_array::setbounds
void setbounds(int iLow1, int iHigh1, int iLow2, int iHigh2)
Definition: ap.h:897
lq::rmatrixlqunpackl
void rmatrixlqunpackl(const ap::template_2d_array< amp::ampf< Precision > > &a, int m, int n, ap::template_2d_array< amp::ampf< Precision > > &l)
Definition: lq.h:283
i
int i
Definition: cfEzgcd.cc:125
ap::template_2d_array::getrow
raw_vector< T > getrow(int iRow, int iColumnStart, int iColumnEnd)
Definition: ap.h:946
ap::minint
int minint(int m1, int m2)
Definition: ap.cpp:167
ap::ap_error::make_assertion
static void make_assertion(bool bClause)
Definition: ap.h:61
tau
void tau(int **points, int sizePoints, int k)
Definition: cfNewtonPolygon.cc:461
ap::maxint
int maxint(int m1, int m2)
Definition: ap.cpp:162
m
int m
Definition: cfEzgcd.cc:121
ap::template_1d_array::setbounds
void setbounds(int iLow, int iHigh)
Definition: ap.h:742
l
int l
Definition: cfEzgcd.cc:93
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
lq::lqdecompositionunpacked
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)
Definition: lq.h:438
lq::rmatrixlqunpackq
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)
Definition: lq.h:207