realroot_doc 0.1.1
|
void mmx::vct::accconv | ( | C * | r, |
int | str, | ||
const C * | a, | ||
unsigned | na, | ||
int | sta, | ||
const C * | b, | ||
unsigned | nb, | ||
int | stb | ||
) |
standard convolution loop, do not initialize r.
r | base address of the result. |
str | increment for r. |
a | base address of first operand. |
na | number of coefficients for a. |
sta | increment for a. |
b | base address of second operand. |
nb | number of coefficients for a. |
stb | increment for b. |
Definition at line 277 of file tensor_vctops.hpp.
Referenced by conv().
{ C * er; const C * ea, * eb; for ( ea = a; ea != a + na*sta; ea += sta, r += str ) for ( er = r, eb = b; eb != b + nb*stb; eb += stb, er += str ) *er += *ea**eb; };
void mmx::vct::accmax | ( | A & | mx, |
const B * | v, | ||
unsigned | n, | ||
int | s = 1 |
||
) | [inline] |
Definition at line 192 of file tensor_vctops.hpp.
Referenced by max().
{ const B * p; for ( p = v; p != v+n*s; p += s ) if ( mx < *p ) mx = *p; };
void mmx::vct::accmin | ( | A & | mn, |
B const * | v, | ||
unsigned | n, | ||
int | s = 1 |
||
) | [inline] |
Definition at line 177 of file tensor_vctops.hpp.
Referenced by min().
{ const B * p; for ( p = v; p != v + n*s; p += s ) if ( mn > *p ) mn = *p; };
void mmx::vct::conv | ( | C * | r, |
unsigned | nr, | ||
int | str, | ||
const C * | a, | ||
unsigned | na, | ||
int | sta, | ||
const C * | b, | ||
unsigned | nb, | ||
int | stb | ||
) |
truncated convolution loop:
r | base address of the result. |
nr | number of coefficients wanted. |
str | increment for r. |
a | base address of first operand. |
na | number of coefficients for a. |
sta | increment for a. |
b | base address of second operand. |
nb | number of coefficients for a. stb increment for b. |
Definition at line 229 of file tensor_vctops.hpp.
References min().
{ if ( na < nb ) { conv(r,nr,str,b,nb,stb,a,na,sta); return; }; int k, l; C * er; const C * ea, * eb, * eeb, * eea; er = r; eb = b; for ( er = r, eb = b, k = 0; k < std::min(nb,nr); k ++, er += str, eb += stb ) for ( eeb = eb, ea = a, *er = 0, l = 0; l <= k; *er += *ea**eeb, l ++, eeb -= stb, ea += sta ) ; for ( ; k < std::min(na,nr) ; k ++, er += str ) for ( *er = 0, l = k-nb+1, eeb = b +(nb-1)*stb , ea = a + l*sta; l <= k; *er+= *ea**eeb, l ++, eeb -= stb, ea += sta ) ; for ( ; k < nr; k ++, er += str ) for ( *er = 0, l = k-nb+1, eeb = b+(nb-1)*stb, ea = a + l*sta; l < na; *er += *ea**eeb, l ++, eeb -= stb, ea += sta ) ; };
void mmx::vct::conv | ( | C * | r, |
int | str, | ||
const C * | a, | ||
unsigned | na, | ||
int | sta, | ||
const C * | b, | ||
unsigned | nb, | ||
int | stb | ||
) |
standard convolution loop.
r | base address of the result. |
str | increment for r. |
a | base address of first operand. |
na | number of coefficients for a. |
sta | increment for a. |
b | base address of second operand. |
nb | number of coefficients for a. |
stb | increment for b. |
Definition at line 300 of file tensor_vctops.hpp.
References accconv().
{ C * er; for ( er = r; er != r + (na+nb-1)*str; *er++ = 0 ) ; accconv(r,str,a,na,sta,b,nb,stb); };
void mmx::vct::copy | ( | A * | a, |
const B * | b, | ||
unsigned | n, | ||
int | sa, | ||
int | sb | ||
) | [inline] |
Definition at line 146 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a + n*sa; *ea = *b, ea += sa, b += sb ) ;
};
void mmx::vct::copy | ( | A * | a, |
const B * | b, | ||
unsigned | n | ||
) | [inline] |
Definition at line 140 of file tensor_vctops.hpp.
Referenced by mmx::tensor::binoms(), and mmerge().
{ std::copy(b,b+n,a) ; };
void mmx::vct::decasteljau | ( | C * | c, |
unsigned | n, | ||
const I & | i, | ||
int | s = 1 |
||
) |
Definition at line 459 of file tensor_vctops.hpp.
{ C *ec, *p; for ( ec = c + (n-1)*s; ec != c; ec -= s ) for ( p = c; p != ec; p += s ) *p = (1.0-i)**p+i**(p+s) ; };
void mmx::vct::dhorner | ( | O & | p, |
O & | dp, | ||
C const *const | c, | ||
unsigned | n, | ||
const I & | t, | ||
int | s = 1 |
||
) | [inline] |
Definition at line 468 of file tensor_vctops.hpp.
{ p = c[n-1], dp = 0.0; for ( int j = (n-2)*s; j >=0; dp=dp*t+p, p=p*t+c[j], j -= s ) ; };
void mmx::vct::diff | ( | C * | dst, |
C const *const | src, | ||
unsigned | sz, | ||
int | st = 1 |
||
) | [inline] |
Definition at line 453 of file tensor_vctops.hpp.
{ for ( unsigned i = 0; i < sz-1; dst[i*st] = (i+1)*src[(i+1)*st], i++ ) ; };
void mmx::vct::fill | ( | C * | a, |
unsigned | n, | ||
int | s, | ||
const C & | x | ||
) |
Definition at line 152 of file tensor_vctops.hpp.
Referenced by binary_sleeve_subdivision< K >::barre(), mmx::tensor::clear(), mmx::realroot::fill_data(), mmx::linear::LUinverse(), mcrossp(), mdotp(), eenv::monoms_print(), msimplify(), and pmmul().
{
for ( C * pa = a; pa != a+n*s; *pa = x, pa += s ) ;
};
void mmx::vct::hhorner | ( | O & | o, |
C const *const | c, | ||
unsigned | n, | ||
const I & | i, | ||
const I & | i0, | ||
int | s = 1 |
||
) | [inline] |
Definition at line 436 of file tensor_vctops.hpp.
Referenced by mmx::tensor::hevalm(), and hhorner().
{ o = O(c[(n-1)*s]); for ( int p = (n-2)*s; p >= 0; o *= i, o += O(c[p])*i0, p -= s ) ; };
texp::sup<C,I>::T mmx::vct::hhorner | ( | C const *const | c, |
unsigned | n, | ||
const I & | i, | ||
const I & | i0, | ||
int | s = 1 |
||
) | [inline] |
Definition at line 444 of file tensor_vctops.hpp.
References hhorner().
{ typename texp::ringof<C,I>::T o(0); hhorner(o,c,n,i,i0,s) ; return o; };
void mmx::vct::horner | ( | O & | o, |
C const *const | c, | ||
unsigned | n, | ||
const I & | i, | ||
int | s = 1 |
||
) | [inline] |
Definition at line 420 of file tensor_vctops.hpp.
Referenced by horner().
{ o = O(0); for ( int p = (n-1)*s; p != 0; o += as<O>(c[p]), o *= i, p -= s ) ; o+= as<O>(c[0]); };
texp::sup<C,I>::T mmx::vct::horner | ( | C const *const | c, |
unsigned | n, | ||
const I & | i, | ||
int | s = 1 |
||
) | [inline] |
Definition at line 428 of file tensor_vctops.hpp.
References horner().
{ typename texp::ringof<C,I>::T o(0); horner(o,c,n,i,s); return o; };
void mmx::vct::icopy | ( | A * | a, |
unsigned * | aadd, | ||
unsigned | nadd, | ||
const B * | b | ||
) | [inline] |
Definition at line 158 of file tensor_vctops.hpp.
Referenced by mmx::tensor::add(), mmx::tensor::extend(), and mmx::tensor::sub().
{ for ( unsigned * ea = aadd; ea != aadd + nadd; a[*ea++] = *b++ ) ; };
void mmx::vct::inverses | ( | A * | a, |
A * | ea | ||
) |
Definition at line 476 of file tensor_vctops.hpp.
Referenced by mmx::tensor::ibinoms().
{ for ( ;a != ea; *a++ = 1/(*a) ) ; };
void mmx::vct::ipadd | ( | A * | a, |
unsigned * | aadd, | ||
unsigned | nadd, | ||
const B * | b | ||
) | [inline] |
Definition at line 164 of file tensor_vctops.hpp.
Referenced by mmx::tensor::add(), and mmx::tensor::waddm().
{ for ( unsigned * ea = aadd; ea != aadd + nadd; a[*ea++] += *b++ ) ; };
void mmx::vct::ipsub | ( | A * | a, |
unsigned * | aadd, | ||
unsigned | nadd, | ||
const B * | b | ||
) | [inline] |
Definition at line 170 of file tensor_vctops.hpp.
Referenced by mmx::tensor::sub(), and mmx::tensor::wsubm().
{ for ( unsigned * ea = aadd; ea != aadd + nadd; a[*ea++] -= *b++ ) ; };
real_t mmx::vct::max | ( | real_t const * | src, |
int | sz, | ||
int | st = 1 |
||
) |
Definition at line 488 of file tensor_vctops.hpp.
{ real_t r = src[0]; for ( int p = st; p != sz*st; p += st ) if ( r < src[p] ) r = src[p]; return r; };
void mmx::vct::max | ( | A & | mx, |
B const * | v, | ||
unsigned | n, | ||
int | s = 1 |
||
) | [inline] |
Definition at line 200 of file tensor_vctops.hpp.
References accmax().
{ mx = v[0]; accmax(mx,v,n,s) ; };
real_t mmx::vct::min | ( | real_t const * | src, |
int | sz, | ||
int | st = 1 |
||
) |
Definition at line 480 of file tensor_vctops.hpp.
{ real_t r = src[0]; for ( int p = st; p != sz*st; p += st ) if ( r > src[p] ) r = src[p]; return r; };
void mmx::vct::min | ( | A & | mn, |
B const * | v, | ||
unsigned | n, | ||
int | s = 1 |
||
) | [inline] |
Definition at line 185 of file tensor_vctops.hpp.
References accmin().
Referenced by conv().
{ mn = v[0]; accmin(mn,v+s,n-1,s) ; };
void mmx::vct::minmax | ( | C & | m, |
C & | M, | ||
const C * | a, | ||
unsigned | n, | ||
unsigned | s = 1 |
||
) | [inline] |
m | minimum value. |
M | maximum value. |
a | base address of coefficients. |
number | of coefficients. |
increment | used to access a. |
Definition at line 317 of file tensor_vctops.hpp.
{ for ( const C * e = a + n*s-s, m = M = *e; a < e; a += 2*s ) { if ( *a > *(a+s) ) { if ( *a > M ) M = *a; if ( *(a+s) < m ) m = *(a+s) ; } else { if ( *a > M ) M = *a; if ( *(a+s) < m ) m = *(a+s) ; }; }; };
unsigned mmx::vct::mmerge | ( | C * | r, |
const C * | a, | ||
const C * | b, | ||
unsigned | na, | ||
unsigned | nb | ||
) | [inline] |
Definition at line 335 of file tensor_vctops.hpp.
References copy().
{ C * er(r); const C * ea(a), * eb(b); a += na; b += nb; for (;;) { while( ea < a && *ea < *eb ) *er++ = *ea++; if ( ea == a ) { std::copy(eb,b,er) ; break; }; if ( *ea == *eb ) { *er++ = *ea++; eb++;}; while( eb < b && *eb < *ea ) *er++ = *eb++; if ( eb == b ) { std::copy(ea,a,er); break; }; if ( *eb == *ea ) { *er++ = *eb++; ea++;}; }; return er-r; };
void mmx::vct::mmerge | ( | C * | r, |
int | str, | ||
const C * | a, | ||
unsigned | na, | ||
int | sta, | ||
const C * | b, | ||
unsigned | nb, | ||
int | stb | ||
) | [inline] |
Definition at line 355 of file tensor_vctops.hpp.
{ C * er(r); const C * ea(a), * eb(b); a += na*sta; b += nb*stb; for (;;) { for (;ea != a && *ea < *eb; *er = *ea, er += str, ea += sta ) ; if ( ea == a ) { for ( ; eb != b; *er = *eb, er += str, eb += stb ) ; break; }; if ( *ea == *eb ) { *er = *ea; er += str; ea += sta; eb += stb; }; for (;eb != b && *eb < *ea; *er = *eb, er += str, eb += stb ) ; if ( eb == b ) { for ( ; ea != a; *er = *ea, er += str, ea += sta ) ; break; }; if ( *eb == *ea ) { *er = *eb; er += str; eb += stb; ea += sta; }; }; return (er - r)/str; };
void mmx::vct::padd | ( | A * | a, |
const B * | b, | ||
unsigned | sz, | ||
int | sta = 1 , |
||
int | stb = 1 |
||
) | [inline] |
Definition at line 13 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a+sz*sta; *ea += *b , ea += sta, b += stb ) {}
};
void mmx::vct::padd | ( | A * | a, |
const B * | b, | ||
const C * | c, | ||
unsigned | sz, | ||
int | sta = 1 , |
||
int | stb = 1 , |
||
int | stc = 1 |
||
) | [inline] |
Definition at line 19 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a+sz*sta; *ea = *b+*c, ea += sta, b += stb, c += stc ) ;
};
void mmx::vct::pdiv | ( | A * | a, |
const B * | b, | ||
const C * | c, | ||
unsigned | sz, | ||
int | sta = 1 , |
||
int | stb = 1 , |
||
int | stc = 1 |
||
) | [inline] |
Definition at line 56 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a+sz*sta; *ea = *b/(*c), ea += sta, b += stb, c += stc ) ;
};
void mmx::vct::pdiv | ( | A * | a, |
const B * | b, | ||
unsigned | sz, | ||
int | sta = 1 , |
||
int | stb = 1 |
||
) | [inline] |
Definition at line 50 of file tensor_vctops.hpp.
Referenced by mmx::tensor::uscale().
{
for ( A * ea = a; ea != a+sz*sta; *ea /= *b, ea += sta, b += stb ) ;
};
void mmx::vct::pmul | ( | A * | a, |
const B * | b, | ||
int | sz, | ||
int | sta = 1 , |
||
int | stb = 1 |
||
) | [inline] |
Definition at line 38 of file tensor_vctops.hpp.
Referenced by mmx::tensor::binoms(), and mmx::tensor::scale().
{
for ( A * ea = a; ea != a+sz*sta; *ea *= *b, ea += sta, b += stb ) ;
};
void mmx::vct::pmul | ( | A * | a, |
const B * | b, | ||
const C * | c, | ||
unsigned | sz, | ||
int | sta = 1 , |
||
int | stb = 1 , |
||
int | stc = 1 |
||
) | [inline] |
Definition at line 44 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a+sz*sta; *ea = *b**c, ea += sta, b += stb, c += stc ) ;
};
void mmx::vct::print | ( | const A * | p, |
unsigned | n, | ||
int | st = 1 , |
||
std::ostream & | o = std::cout |
||
) | [inline] |
Definition at line 206 of file tensor_vctops.hpp.
{ const A * i; o << "[ "; for ( i = p; i != p + (n-1)*st; i += st ) o << *i << ", "; o << *i << " ]"; };
void mmx::vct::psub | ( | A * | a, |
const B * | b, | ||
unsigned | sz, | ||
int | sta = 1 , |
||
int | stb = 1 |
||
) | [inline] |
Definition at line 26 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a+sz*sta; *ea -= *b, ea += sta, b += stb ) ;
};
void mmx::vct::psub | ( | A * | a, |
const B * | b, | ||
const C * | c, | ||
unsigned | sz, | ||
int | sta = 1 , |
||
int | stb = 1 , |
||
int | stc = 1 |
||
) | [inline] |
Definition at line 32 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a+sz*sta; *ea = *b-*c, ea += sta, b += stb, c += stc ) ;
};
void mmx::vct::scadd | ( | A * | a, |
const B & | b, | ||
unsigned | n, | ||
int | s = 1 |
||
) | [inline] |
Definition at line 62 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a + n*s; *a += b, ea += s ) ;
};
void mmx::vct::scadd | ( | A * | a, |
const B * | b, | ||
const C & | c, | ||
unsigned | n, | ||
int | sa = 1 , |
||
int | sb = 1 |
||
) | [inline] |
Definition at line 68 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a + n*sa; *ea = *b + c, ea += sa, b += sb ) ;
};
static void mmx::vct::scale | ( | C * | p, |
const C & | s, | ||
unsigned | n, | ||
int | is = 1 |
||
) | [static] |
Definition at line 413 of file tensor_vctops.hpp.
{
C pw = s;
for (C * cp = p + is; cp != p + n * is; *cp *= pw, pw *= s, cp += is) ;
};
void mmx::vct::scdiv | ( | A * | a, |
const C & | c, | ||
const B * | b, | ||
unsigned | n, | ||
int | sa = 1 , |
||
int | sb = 1 |
||
) | [inline] |
Definition at line 134 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a + n*sa; *ea = c/(*b), ea += sa, b += sb ) ;
}
void mmx::vct::scdiv | ( | A * | a, |
const B * | b, | ||
const C & | c, | ||
unsigned | n, | ||
int | sa = 1 , |
||
int | sb = 1 |
||
) | [inline] |
Definition at line 128 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a + n*sa; *ea = *b/c, ea += sa, b += sb ) ;
}
void mmx::vct::scdiv | ( | const B & | b, |
A * | a, | ||
unsigned | n, | ||
int | s = 1 |
||
) | [inline] |
Definition at line 122 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a+n*s; *ea = b/(*ea), ea += s ) ;
};
void mmx::vct::scdiv | ( | A * | a, |
const B & | b, | ||
unsigned | n, | ||
int | s = 1 |
||
) | [inline] |
Definition at line 116 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a+n*s; *ea /= b, ea += s ) ;
}
void mmx::vct::scmul | ( | A * | a, |
const B & | b, | ||
unsigned | n, | ||
int | s = 1 |
||
) | [inline] |
Definition at line 98 of file tensor_vctops.hpp.
Referenced by mmx::tensor::mdiff().
{
for ( A * ea = a; ea != a+n*s; *ea *= b, ea += s ) ;
}
void mmx::vct::scmul | ( | A * | a, |
const A * | _a, | ||
const B * | b, | ||
const C & | c | ||
) | [inline] |
Definition at line 110 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != _a; *ea++ = *b++*c ) ;
}
void mmx::vct::scmul | ( | A * | a, |
const B * | b, | ||
const C & | c, | ||
unsigned | n, | ||
int | sa = 1 , |
||
int | sb = 1 |
||
) | [inline] |
Definition at line 104 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a + n*sa; *ea = *b*c, ea += sa, b += sb ) ;
}
void mmx::vct::scsub | ( | A * | a, |
const B & | b, | ||
unsigned | n, | ||
int | s = 1 |
||
) | [inline] |
Definition at line 74 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a + n*s; *ea -= b, ea += s ) ;
};
void mmx::vct::scsub | ( | A * | a, |
const B * | b, | ||
const C & | c, | ||
unsigned | n, | ||
int | sa = 1 , |
||
int | sb = 1 |
||
) | [inline] |
Definition at line 86 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a+n*sa; *ea = *b-c, ea += sa, b += sb ) ;
}
void mmx::vct::scsub | ( | A * | a, |
const B & | b, | ||
const C * | c, | ||
unsigned | n, | ||
int | sa = 1 , |
||
int | sb = 1 |
||
) | [inline] |
Definition at line 92 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a+n*sa; *ea = c-*b, ea += sa, b += sb ) ;
};
void mmx::vct::scsub | ( | const B & | b, |
A * | a, | ||
unsigned | n, | ||
int | s = 1 |
||
) | [inline] |
Definition at line 80 of file tensor_vctops.hpp.
{
for ( A * ea = a; ea != a+n*s; *ea = b-*ea, ea += s ) ;
}
static void mmx::vct::shift | ( | C * | p, |
const C & | c, | ||
unsigned | n, | ||
int | is = 1 |
||
) | [static] |
Definition at line 405 of file tensor_vctops.hpp.
{ int j, k, s; for (s = n, j = 0; j <= s - 2; j++) for (k = s - 2; k >= j; p[k * is] += c * p[k * is + is], k--) ; };