47 data(nDim,
Tps<
T>(0, nVar)), variables(nVar)
53 data(rhs.data), variables(rhs.variables) {
60 data(x.nrows()), variables(x.ncols()) {
61 for(
int i = 0; i < x.
nrows(); i++) {
64 for(
int j = 0; j < x.
ncols(); j++) {
65 data[i][j+1] = x(i, j);
73 data(x.size()), variables(0) {
74 for(
int i = 0; i < getDimension(); i++) data[i] = Tps<T>(x[i]);
101 throw SizeError(
"Vps::setComponent()",
"Index out of range.");
111 for(
const Tps<T> *p = data.begin(); p != data.end(); ++p) {
112 if(
int var = p->getVariables()) {
113 if(variables != 0 && var != variables) {
115 "Vps has inconsistent number of variables.");
131 Vps<T> z(getDimension(), variables);
132 for(
int i = 0; i < getDimension(); i++) z[i] = - data[i];
139 for(
int i = 0; i < getDimension(); i++) data[i] *= y;
147 for(
int i = 0; i < getDimension(); i++) data[i] *= t;
154 for(
int i = 0; i < getDimension(); i++) data[i] *= y;
163 for(
int i = 0; i < getDimension(); i++) data[i] *= t;
171 throw SizeError(
"Vps::operator+=()",
"Inconsistent dimensions.");
174 for(
int i = 0; i < getDimension(); i++) data[i] += y.
data[i];
182 throw SizeError(
"Vps::operator-=()",
"Inconsistent dimensions.");
185 for(
int i = 0; i < getDimension(); i++) data[i] -= y.
data[i];
192 if(getDimension() != y.
size()) {
193 throw SizeError(
"Vps::operator+=()",
"Inconsistent dimensions.");
196 for(
int i = 0; i < getDimension(); i++) data[i] += y[i];
203 if(getDimension() != y.
size()) {
204 throw SizeError(
"Vps::operator-=()",
"Inconsistent dimensions.");
207 for(
int i = 0; i < getDimension(); i++) data[i] -= y[i];
215 is.flags(std::ios::skipws);
218 if(std::strcmp(head,
"Vps") != 0) {
219 throw FormatError(
"Vps::get()",
"Flag word \"Vps\" missing.");
226 throw FormatError(
"Vps::get()",
"Zero Vps dimension");
230 for(
int i = 0; i < nDim; i++) is >> data[i];
239 int nDim = getDimension();
241 for(
int i = 0; i < nDim; i++) os << data[i];
254 const Tps<T> *p = data.begin();
257 while(++p < data.end()) {
267 const Tps<T> *p = data.begin();
270 while(++p < data.end()) {
288 Vps<T> z(getDimension(), variables);
290 for(
int i = 0; i < getDimension(); i++) {
291 z.
data[i] = data[i].filter(lowOrder, highOrder);
301 Vps<T> z(getDimension(), variables);
303 for(
int i = 0; i < getDimension(); i++) {
304 z.
data[i] = data[i].truncate(trunc);
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
T::PETE_Expr_t::PETE_Return_t min(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Inform & endl(Inform &inf)
int size() const
Get array size.
int nrows() const
Get number of rows.
int ncols() const
Get number of columns.
int getVariables() const
Get number of variables.
Tps< T > inverse(int order=truncOrder) const
Reciprocal value.
int getTruncOrder() const
Get truncation order.
int getMaxOrder() const
Get maximal order.
Vector truncated power series.
void setComponent(int index, const Tps< T > &value)
Set component.
int getTopOrder() const
Get highest order contained in any component.
Vps< T > & operator-=(const Vps< T > &y)
Subtraction.
std::ostream & put(std::ostream &os) const
Put a Vps<T> to stream os.
std::istream & get(std::istream &is)
Get a Vps<T> from stream is.
int getVariables() const
Get number of variables (the same in all components).
int getTruncOrder() const
Get lowest truncation order in any component.
Vps< T > operator+() const
Unary plus.
Vps< T > operator-() const
Unary minus.
Vps< T > truncate(int trunc)
Truncate, may also increase truncation order.
const Tps< T > & getComponent(int index) const
Get component.
int getDimension() const
Get dimension (number of Tps<T> components).
Vps< T > filter(int lowOrder, int highOrder) const
Extract range of orders, set others to zero.
Vps< T > & operator=(const Vps< T > &)
void check() const
Check consistency.
Vps< T > & operator*=(const Tps< T > &y)
Multiply by Tps<T> and assign.
Vps< T > & operator+=(const Vps< T > &y)
Addition.
Vps< T > & operator/=(const Tps< T > &y)
Divide by Tps<T> and assign.