My Project
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions | Variables
ap Namespace Reference

Data Structures

class  ap_error
 
class  complex
 
class  const_raw_vector
 
class  raw_vector
 
class  template_1d_array
 
class  template_2d_array
 

Typedefs

typedef template_1d_array< int > integer_1d_array
 
typedef template_1d_array< double > real_1d_array
 
typedef template_1d_array< complexcomplex_1d_array
 
typedef template_1d_array< bool > boolean_1d_array
 
typedef template_2d_array< int > integer_2d_array
 
typedef template_2d_array< double > real_2d_array
 
typedef template_2d_array< complexcomplex_2d_array
 
typedef template_2d_array< bool > boolean_2d_array
 

Functions

const complex operator/ (const complex &lhs, const complex &rhs)
 
const bool operator== (const complex &lhs, const complex &rhs)
 
const bool operator!= (const complex &lhs, const complex &rhs)
 
const complex operator+ (const complex &lhs)
 
const complex operator- (const complex &lhs)
 
const complex operator+ (const complex &lhs, const complex &rhs)
 
const complex operator+ (const complex &lhs, const double &rhs)
 
const complex operator+ (const double &lhs, const complex &rhs)
 
const complex operator- (const complex &lhs, const complex &rhs)
 
const complex operator- (const complex &lhs, const double &rhs)
 
const complex operator- (const double &lhs, const complex &rhs)
 
const complex operator* (const complex &lhs, const complex &rhs)
 
const complex operator* (const complex &lhs, const double &rhs)
 
const complex operator* (const double &lhs, const complex &rhs)
 
const complex operator/ (const double &lhs, const complex &rhs)
 
const complex operator/ (const complex &lhs, const double &rhs)
 
const double abscomplex (const complex &z)
 
const complex conj (const complex &z)
 
const complex csqr (const complex &z)
 
template<class T >
T vdotproduct (const_raw_vector< T > v1, const_raw_vector< T > v2)
 
template<class T >
void vmove (raw_vector< T > vdst, const_raw_vector< T > vsrc)
 
template<class T >
void vmoveneg (raw_vector< T > vdst, const_raw_vector< T > vsrc)
 
template<class T , class T2 >
void vmove (raw_vector< T > vdst, const_raw_vector< T > vsrc, T2 alpha)
 
template<class T >
void vadd (raw_vector< T > vdst, const_raw_vector< T > vsrc)
 
template<class T , class T2 >
void vadd (raw_vector< T > vdst, const_raw_vector< T > vsrc, T2 alpha)
 
template<class T >
void vsub (raw_vector< T > vdst, const_raw_vector< T > vsrc)
 
template<class T , class T2 >
void vsub (raw_vector< T > vdst, const_raw_vector< T > vsrc, T2 alpha)
 
template<class T , class T2 >
void vmul (raw_vector< T > vdst, T2 alpha)
 
int sign (double x)
 
double randomreal ()
 
int randominteger (int maxv)
 
int round (double x)
 
int trunc (double x)
 
int ifloor (double x)
 
int iceil (double x)
 
double pi ()
 
double sqr (double x)
 
int maxint (int m1, int m2)
 
int minint (int m1, int m2)
 
double maxreal (double m1, double m2)
 
double minreal (double m1, double m2)
 

Variables

const double machineepsilon = 5E-16
 
const double maxrealnumber = 1E300
 
const double minrealnumber = 1E-300
 

Typedef Documentation

◆ boolean_1d_array

Definition at line 976 of file ap.h.

◆ boolean_2d_array

Definition at line 980 of file ap.h.

◆ complex_1d_array

Definition at line 975 of file ap.h.

◆ complex_2d_array

Definition at line 979 of file ap.h.

◆ integer_1d_array

Definition at line 973 of file ap.h.

◆ integer_2d_array

Definition at line 977 of file ap.h.

◆ real_1d_array

Definition at line 974 of file ap.h.

◆ real_2d_array

Definition at line 978 of file ap.h.

Function Documentation

◆ abscomplex()

double ap::abscomplex ( const complex z)

Definition at line 97 of file ap.cpp.

98{
99 double w;
100 double xabs;
101 double yabs;
102 double v;
103
104 xabs = fabs(z.x);
105 yabs = fabs(z.y);
106 w = xabs>yabs ? xabs : yabs;
107 v = xabs<yabs ? xabs : yabs;
108 if( v==0 )
109 return w;
110 else
111 {
112 double t = v/w;
113 return w*sqrt(1+t*t);
114 }
115}
double x
Definition: ap.h:100
double y
Definition: ap.h:100
const CanonicalForm & w
Definition: facAbsFact.cc:51
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
gmp_float sqrt(const gmp_float &a)
Definition: mpr_complex.cc:327

◆ conj()

const complex ap::conj ( const complex z)

Definition at line 117 of file ap.cpp.

118{ return ap::complex(z.x, -z.y); }
Definition: ap.h:60

◆ csqr()

const complex ap::csqr ( const complex z)

Definition at line 120 of file ap.cpp.

121{ return ap::complex(z.x*z.x-z.y*z.y, 2*z.x*z.y); }

◆ iceil()

int ap::iceil ( double  x)

Definition at line 153 of file ap.cpp.

154{ return int(ceil(x)); }
Variable x
Definition: cfModGcd.cc:4082

◆ ifloor()

int ap::ifloor ( double  x)

Definition at line 150 of file ap.cpp.

151{ return int(floor(x)); }

◆ maxint()

int ap::maxint ( int  m1,
int  m2 
)

Definition at line 162 of file ap.cpp.

163{
164 return m1>m2 ? m1 : m2;
165}

◆ maxreal()

double ap::maxreal ( double  m1,
double  m2 
)

Definition at line 172 of file ap.cpp.

173{
174 return m1>m2 ? m1 : m2;
175}

◆ minint()

int ap::minint ( int  m1,
int  m2 
)

Definition at line 167 of file ap.cpp.

168{
169 return m1>m2 ? m2 : m1;
170}

◆ minreal()

double ap::minreal ( double  m1,
double  m2 
)

Definition at line 177 of file ap.cpp.

178{
179 return m1>m2 ? m2 : m1;
180}

◆ operator!=()

bool ap::operator!= ( const complex lhs,
const complex rhs 
)

Definition at line 14 of file ap.cpp.

15{ return lhs.x!=rhs.x || lhs.y!=rhs.y; }

◆ operator*() [1/3]

const complex ap::operator* ( const complex lhs,
const complex rhs 
)

Definition at line 41 of file ap.cpp.

42{ return ap::complex(lhs.x*rhs.x - lhs.y*rhs.y, lhs.x*rhs.y + lhs.y*rhs.x); }

◆ operator*() [2/3]

const complex ap::operator* ( const complex lhs,
const double &  rhs 
)

Definition at line 44 of file ap.cpp.

45{ return ap::complex(lhs.x*rhs, lhs.y*rhs); }

◆ operator*() [3/3]

const complex ap::operator* ( const double &  lhs,
const complex rhs 
)

Definition at line 47 of file ap.cpp.

48{ return ap::complex(lhs*rhs.x, lhs*rhs.y); }

◆ operator+() [1/4]

const complex ap::operator+ ( const complex lhs)

Definition at line 17 of file ap.cpp.

18{ return lhs; }

◆ operator+() [2/4]

const complex ap::operator+ ( const complex lhs,
const complex rhs 
)

Definition at line 23 of file ap.cpp.

24{ ap::complex r = lhs; r += rhs; return r; }

◆ operator+() [3/4]

const complex ap::operator+ ( const complex lhs,
const double &  rhs 
)

Definition at line 26 of file ap.cpp.

27{ ap::complex r = lhs; r += rhs; return r; }

◆ operator+() [4/4]

const complex ap::operator+ ( const double &  lhs,
const complex rhs 
)

Definition at line 29 of file ap.cpp.

30{ ap::complex r = rhs; r += lhs; return r; }

◆ operator-() [1/4]

const complex ap::operator- ( const complex lhs)

Definition at line 20 of file ap.cpp.

21{ return ap::complex(-lhs.x, -lhs.y); }

◆ operator-() [2/4]

const complex ap::operator- ( const complex lhs,
const complex rhs 
)

Definition at line 32 of file ap.cpp.

33{ ap::complex r = lhs; r -= rhs; return r; }

◆ operator-() [3/4]

const complex ap::operator- ( const complex lhs,
const double &  rhs 
)

Definition at line 35 of file ap.cpp.

36{ ap::complex r = lhs; r -= rhs; return r; }

◆ operator-() [4/4]

const complex ap::operator- ( const double &  lhs,
const complex rhs 
)

Definition at line 38 of file ap.cpp.

39{ ap::complex r = lhs; r -= rhs; return r; }

◆ operator/() [1/3]

const complex ap::operator/ ( const complex lhs,
const complex rhs 
)

Definition at line 50 of file ap.cpp.

51{
53 double e;
54 double f;
55 if( fabs(rhs.y)<fabs(rhs.x) )
56 {
57 e = rhs.y/rhs.x;
58 f = rhs.x+rhs.y*e;
59 result.x = (lhs.x+lhs.y*e)/f;
60 result.y = (lhs.y-lhs.x*e)/f;
61 }
62 else
63 {
64 e = rhs.x/rhs.y;
65 f = rhs.y+rhs.x*e;
66 result.x = (lhs.y+lhs.x*e)/f;
67 result.y = (-lhs.x+lhs.y*e)/f;
68 }
69 return result;
70}
FILE * f
Definition: checklibs.c:9
return result
Definition: facAbsBiFact.cc:75

◆ operator/() [2/3]

const complex ap::operator/ ( const complex lhs,
const double &  rhs 
)

Definition at line 94 of file ap.cpp.

95{ return ap::complex(lhs.x/rhs, lhs.y/rhs); }

◆ operator/() [3/3]

const complex ap::operator/ ( const double &  lhs,
const complex rhs 
)

Definition at line 72 of file ap.cpp.

73{
75 double e;
76 double f;
77 if( fabs(rhs.y)<fabs(rhs.x) )
78 {
79 e = rhs.y/rhs.x;
80 f = rhs.x+rhs.y*e;
81 result.x = lhs/f;
82 result.y = -lhs*e/f;
83 }
84 else
85 {
86 e = rhs.x/rhs.y;
87 f = rhs.y+rhs.x*e;
88 result.x = lhs*e/f;
89 result.y = -lhs/f;
90 }
91 return result;
92}

◆ operator==()

bool ap::operator== ( const complex lhs,
const complex rhs 
)

Definition at line 11 of file ap.cpp.

12{ return lhs.x==rhs.x && lhs.y==rhs.y; }

◆ pi()

double ap::pi ( )

Definition at line 156 of file ap.cpp.

157{ return 3.14159265358979323846; }

◆ randominteger()

int ap::randominteger ( int  maxv)

Definition at line 141 of file ap.cpp.

142{ return rand()%maxv; }

◆ randomreal()

double ap::randomreal ( )

Definition at line 133 of file ap.cpp.

134{
135 int i = rand();
136 while(i==RAND_MAX)
137 i =rand();
138 return double(i)/double(RAND_MAX);
139}
int i
Definition: cfEzgcd.cc:132

◆ round()

int ap::round ( double  x)

Definition at line 144 of file ap.cpp.

145{ return int(floor(x+0.5)); }

◆ sign()

int ap::sign ( double  x)

Definition at line 126 of file ap.cpp.

127{
128 if( x>0 ) return 1;
129 if( x<0 ) return -1;
130 return 0;
131}

◆ sqr()

double ap::sqr ( double  x)

Definition at line 159 of file ap.cpp.

160{ return x*x; }

◆ trunc()

int ap::trunc ( double  x)

Definition at line 147 of file ap.cpp.

148{ return int(x>0 ? floor(x) : ceil(x)); }

◆ vadd() [1/2]

template<class T >
void ap::vadd ( raw_vector< T vdst,
const_raw_vector< T vsrc 
)

Definition at line 413 of file ap.h.

414{
415 ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength());
416 if( vdst.GetStep()==1 && vsrc.GetStep()==1 )
417 {
418 //
419 // fast
420 //
421 T *p1 = vdst.GetData();
422 const T *p2 = vsrc.GetData();
423 int imax = vdst.GetLength()/4;
424 int i;
425 for(i=imax; i!=0; i--)
426 {
427 *p1 += *p2;
428 p1[1] += p2[1];
429 p1[2] += p2[2];
430 p1[3] += p2[3];
431 p1 += 4;
432 p2 += 4;
433 }
434 for(i=0; i<vdst.GetLength()%4; i++)
435 *(p1++) += *(p2++);
436 return;
437 }
438 else
439 {
440 //
441 // general
442 //
443 int offset11 = vdst.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11;
444 int offset21 = vsrc.GetStep(), offset22 = 2*offset21, offset23 = 3*offset21, offset24 = 4*offset21;
445 T *p1 = vdst.GetData();
446 const T *p2 = vsrc.GetData();
447 int imax = vdst.GetLength()/4;
448 int i;
449 for(i=0; i<imax; i++)
450 {
451 *p1 += *p2;
452 p1[offset11] += p2[offset21];
453 p1[offset12] += p2[offset22];
454 p1[offset13] += p2[offset23];
455 p1 += offset14;
456 p2 += offset24;
457 }
458 for(i=0; i<vdst.GetLength()%4; i++)
459 {
460 *p1 += *p2;
461 p1 += vdst.GetStep();
462 p2 += vsrc.GetStep();
463 }
464 return;
465 }
466}
int GetStep() const
Definition: ap.h:148
const T * GetData() const
Definition: ap.h:142
int GetLength() const
Definition: ap.h:145
T * GetData()
Definition: ap.h:172
STATIC_VAR jList * T
Definition: janet.cc:30

◆ vadd() [2/2]

template<class T , class T2 >
void ap::vadd ( raw_vector< T vdst,
const_raw_vector< T vsrc,
T2  alpha 
)

Definition at line 473 of file ap.h.

474{
475 ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength());
476 if( vdst.GetStep()==1 && vsrc.GetStep()==1 )
477 {
478 //
479 // fast
480 //
481 T *p1 = vdst.GetData();
482 const T *p2 = vsrc.GetData();
483 int imax = vdst.GetLength()/4;
484 int i;
485 for(i=imax; i!=0; i--)
486 {
487 *p1 += alpha*(*p2);
488 p1[1] += alpha*p2[1];
489 p1[2] += alpha*p2[2];
490 p1[3] += alpha*p2[3];
491 p1 += 4;
492 p2 += 4;
493 }
494 for(i=0; i<vdst.GetLength()%4; i++)
495 *(p1++) += alpha*(*(p2++));
496 return;
497 }
498 else
499 {
500 //
501 // general
502 //
503 int offset11 = vdst.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11;
504 int offset21 = vsrc.GetStep(), offset22 = 2*offset21, offset23 = 3*offset21, offset24 = 4*offset21;
505 T *p1 = vdst.GetData();
506 const T *p2 = vsrc.GetData();
507 int imax = vdst.GetLength()/4;
508 int i;
509 for(i=0; i<imax; i++)
510 {
511 *p1 += alpha*(*p2);
512 p1[offset11] += alpha*p2[offset21];
513 p1[offset12] += alpha*p2[offset22];
514 p1[offset13] += alpha*p2[offset23];
515 p1 += offset14;
516 p2 += offset24;
517 }
518 for(i=0; i<vdst.GetLength()%4; i++)
519 {
520 *p1 += alpha*(*p2);
521 p1 += vdst.GetStep();
522 p2 += vsrc.GetStep();
523 }
524 return;
525 }
526}
Variable alpha
Definition: facAbsBiFact.cc:51

◆ vdotproduct()

template<class T >
T ap::vdotproduct ( const_raw_vector< T v1,
const_raw_vector< T v2 
)

Definition at line 181 of file ap.h.

182{
183 ap_error::make_assertion(v1.GetLength()==v2.GetLength());
184 if( v1.GetStep()==1 && v2.GetStep()==1 )
185 {
186 //
187 // fast
188 //
189 T r = 0;
190 const T *p1 = v1.GetData();
191 const T *p2 = v2.GetData();
192 int imax = v1.GetLength()/4;
193 int i;
194 for(i=imax; i!=0; i--)
195 {
196 r += (*p1)*(*p2) + p1[1]*p2[1] + p1[2]*p2[2] + p1[3]*p2[3];
197 p1+=4;
198 p2+=4;
199 }
200 for(i=0; i<v1.GetLength()%4; i++)
201 r += (*(p1++))*(*(p2++));
202 return r;
203 }
204 else
205 {
206 //
207 // general
208 //
209 int offset11 = v1.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11;
210 int offset21 = v2.GetStep(), offset22 = 2*offset21, offset23 = 3*offset21, offset24 = 4*offset21;
211 T r = 0;
212 const T *p1 = v1.GetData();
213 const T *p2 = v2.GetData();
214 int imax = v1.GetLength()/4;
215 int i;
216 for(i=0; i<imax; i++)
217 {
218 r += (*p1)*(*p2) + p1[offset11]*p2[offset21] + p1[offset12]*p2[offset22] + p1[offset13]*p2[offset23];
219 p1+=offset14;
220 p2+=offset24;
221 }
222 for(i=0; i<v1.GetLength()%4; i++)
223 {
224 r += (*p1)*(*p2);
225 p1+=offset11;
226 p2+=offset21;
227 }
228 return r;
229 }
230}

◆ vmove() [1/2]

template<class T >
void ap::vmove ( raw_vector< T vdst,
const_raw_vector< T vsrc 
)

Definition at line 237 of file ap.h.

238{
239 ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength());
240 if( vdst.GetStep()==1 && vsrc.GetStep()==1 )
241 {
242 //
243 // fast
244 //
245 T *p1 = vdst.GetData();
246 const T *p2 = vsrc.GetData();
247 int imax = vdst.GetLength()/2;
248 int i;
249 for(i=imax; i!=0; i--)
250 {
251 *p1 = *p2;
252 p1[1] = p2[1];
253 p1 += 2;
254 p2 += 2;
255 }
256 if(vdst.GetLength()%2 != 0)
257 *p1 = *p2;
258 return;
259 }
260 else
261 {
262 //
263 // general
264 //
265 int offset11 = vdst.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11;
266 int offset21 = vsrc.GetStep(), offset22 = 2*offset21, offset23 = 3*offset21, offset24 = 4*offset21;
267 T *p1 = vdst.GetData();
268 const T *p2 = vsrc.GetData();
269 int imax = vdst.GetLength()/4;
270 int i;
271 for(i=0; i<imax; i++)
272 {
273 *p1 = *p2;
274 p1[offset11] = p2[offset21];
275 p1[offset12] = p2[offset22];
276 p1[offset13] = p2[offset23];
277 p1 += offset14;
278 p2 += offset24;
279 }
280 for(i=0; i<vdst.GetLength()%4; i++)
281 {
282 *p1 = *p2;
283 p1 += vdst.GetStep();
284 p2 += vsrc.GetStep();
285 }
286 return;
287 }
288}

◆ vmove() [2/2]

template<class T , class T2 >
void ap::vmove ( raw_vector< T vdst,
const_raw_vector< T vsrc,
T2  alpha 
)

Definition at line 353 of file ap.h.

354{
355 ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength());
356 if( vdst.GetStep()==1 && vsrc.GetStep()==1 )
357 {
358 //
359 // fast
360 //
361 T *p1 = vdst.GetData();
362 const T *p2 = vsrc.GetData();
363 int imax = vdst.GetLength()/4;
364 int i;
365 for(i=imax; i!=0; i--)
366 {
367 *p1 = alpha*(*p2);
368 p1[1] = alpha*p2[1];
369 p1[2] = alpha*p2[2];
370 p1[3] = alpha*p2[3];
371 p1 += 4;
372 p2 += 4;
373 }
374 for(i=0; i<vdst.GetLength()%4; i++)
375 *(p1++) = alpha*(*(p2++));
376 return;
377 }
378 else
379 {
380 //
381 // general
382 //
383 int offset11 = vdst.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11;
384 int offset21 = vsrc.GetStep(), offset22 = 2*offset21, offset23 = 3*offset21, offset24 = 4*offset21;
385 T *p1 = vdst.GetData();
386 const T *p2 = vsrc.GetData();
387 int imax = vdst.GetLength()/4;
388 int i;
389 for(i=0; i<imax; i++)
390 {
391 *p1 = alpha*(*p2);
392 p1[offset11] = alpha*p2[offset21];
393 p1[offset12] = alpha*p2[offset22];
394 p1[offset13] = alpha*p2[offset23];
395 p1 += offset14;
396 p2 += offset24;
397 }
398 for(i=0; i<vdst.GetLength()%4; i++)
399 {
400 *p1 = alpha*(*p2);
401 p1 += vdst.GetStep();
402 p2 += vsrc.GetStep();
403 }
404 return;
405 }
406}

◆ vmoveneg()

template<class T >
void ap::vmoveneg ( raw_vector< T vdst,
const_raw_vector< T vsrc 
)

Definition at line 295 of file ap.h.

296{
297 ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength());
298 if( vdst.GetStep()==1 && vsrc.GetStep()==1 )
299 {
300 //
301 // fast
302 //
303 T *p1 = vdst.GetData();
304 const T *p2 = vsrc.GetData();
305 int imax = vdst.GetLength()/2;
306 int i;
307 for(i=0; i<imax; i++)
308 {
309 *p1 = -*p2;
310 p1[1] = -p2[1];
311 p1 += 2;
312 p2 += 2;
313 }
314 if(vdst.GetLength()%2 != 0)
315 *p1 = -*p2;
316 return;
317 }
318 else
319 {
320 //
321 // general
322 //
323 int offset11 = vdst.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11;
324 int offset21 = vsrc.GetStep(), offset22 = 2*offset21, offset23 = 3*offset21, offset24 = 4*offset21;
325 T *p1 = vdst.GetData();
326 const T *p2 = vsrc.GetData();
327 int imax = vdst.GetLength()/4;
328 int i;
329 for(i=imax; i!=0; i--)
330 {
331 *p1 = -*p2;
332 p1[offset11] = -p2[offset21];
333 p1[offset12] = -p2[offset22];
334 p1[offset13] = -p2[offset23];
335 p1 += offset14;
336 p2 += offset24;
337 }
338 for(i=0; i<vdst.GetLength()%4; i++)
339 {
340 *p1 = -*p2;
341 p1 += vdst.GetStep();
342 p2 += vsrc.GetStep();
343 }
344 return;
345 }
346}

◆ vmul()

template<class T , class T2 >
void ap::vmul ( raw_vector< T vdst,
T2  alpha 
)

Definition at line 603 of file ap.h.

604{
605 if( vdst.GetStep()==1 )
606 {
607 //
608 // fast
609 //
610 T *p1 = vdst.GetData();
611 int imax = vdst.GetLength()/4;
612 int i;
613 for(i=imax; i!=0; i--)
614 {
615 *p1 *= alpha;
616 p1[1] *= alpha;
617 p1[2] *= alpha;
618 p1[3] *= alpha;
619 p1 += 4;
620 }
621 for(i=0; i<vdst.GetLength()%4; i++)
622 *(p1++) *= alpha;
623 return;
624 }
625 else
626 {
627 //
628 // general
629 //
630 int offset11 = vdst.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11;
631 T *p1 = vdst.GetData();
632 int imax = vdst.GetLength()/4;
633 int i;
634 for(i=0; i<imax; i++)
635 {
636 *p1 *= alpha;
637 p1[offset11] *= alpha;
638 p1[offset12] *= alpha;
639 p1[offset13] *= alpha;
640 p1 += offset14;
641 }
642 for(i=0; i<vdst.GetLength()%4; i++)
643 {
644 *p1 *= alpha;
645 p1 += vdst.GetStep();
646 }
647 return;
648 }
649}

◆ vsub() [1/2]

template<class T >
void ap::vsub ( raw_vector< T vdst,
const_raw_vector< T vsrc 
)

Definition at line 533 of file ap.h.

534{
535 ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength());
536 if( vdst.GetStep()==1 && vsrc.GetStep()==1 )
537 {
538 //
539 // fast
540 //
541 T *p1 = vdst.GetData();
542 const T *p2 = vsrc.GetData();
543 int imax = vdst.GetLength()/4;
544 int i;
545 for(i=imax; i!=0; i--)
546 {
547 *p1 -= *p2;
548 p1[1] -= p2[1];
549 p1[2] -= p2[2];
550 p1[3] -= p2[3];
551 p1 += 4;
552 p2 += 4;
553 }
554 for(i=0; i<vdst.GetLength()%4; i++)
555 *(p1++) -= *(p2++);
556 return;
557 }
558 else
559 {
560 //
561 // general
562 //
563 int offset11 = vdst.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11;
564 int offset21 = vsrc.GetStep(), offset22 = 2*offset21, offset23 = 3*offset21, offset24 = 4*offset21;
565 T *p1 = vdst.GetData();
566 const T *p2 = vsrc.GetData();
567 int imax = vdst.GetLength()/4;
568 int i;
569 for(i=0; i<imax; i++)
570 {
571 *p1 -= *p2;
572 p1[offset11] -= p2[offset21];
573 p1[offset12] -= p2[offset22];
574 p1[offset13] -= p2[offset23];
575 p1 += offset14;
576 p2 += offset24;
577 }
578 for(i=0; i<vdst.GetLength()%4; i++)
579 {
580 *p1 -= *p2;
581 p1 += vdst.GetStep();
582 p2 += vsrc.GetStep();
583 }
584 return;
585 }
586}

◆ vsub() [2/2]

template<class T , class T2 >
void ap::vsub ( raw_vector< T vdst,
const_raw_vector< T vsrc,
T2  alpha 
)

Definition at line 593 of file ap.h.

594{
595 vadd(vdst, vsrc, -alpha);
596}
void vadd(raw_vector< T > vdst, const_raw_vector< T > vsrc)
Definition: ap.h:413

Variable Documentation

◆ machineepsilon

const double ap::machineepsilon = 5E-16
extern

Definition at line 995 of file svd_si.h.

◆ maxrealnumber

const double ap::maxrealnumber = 1E300
extern

Definition at line 996 of file svd_si.h.

◆ minrealnumber

const double ap::minrealnumber = 1E-300
extern

Definition at line 997 of file svd_si.h.