* symbolic equations. */
/*
- * GiNaC Copyright (C) 1999-2000 Johannes Gutenberg University Mainz, Germany
+ * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "checks.h"
+#if defined(HAVE_SSTREAM)
+# include <sstream>
+#else
+# include <strstream>
+#endif
+
static unsigned check_matrix_solve(unsigned m, unsigned n, unsigned p,
unsigned degree)
{
matrix X(n,p);
for (unsigned i=0; i<n; ++i) {
for (unsigned j=0; j<p; ++j) {
+#if defined(HAVE_SSTREAM)
+ ostringstream buf;
+ buf << "x" << i << j << ends;
+ x.push_back(symbol(buf.str()));
+#else
char buf[4];
ostrstream(buf,sizeof(buf)) << i << j << ends;
x.push_back(symbol(string("x")+buf));
+#endif
X.set(i,j,x[p*i+j]);
}
}
}
if (errorflag) {
clog << "Our solve method claims that A*X==B, with matrices" << endl
- << "A == " << A << endl
- << "X == " << sol << endl
- << "B == " << B << endl;
+ << "A == " << A << endl
+ << "X == " << sol << endl
+ << "B == " << B << endl;
return 1;
}
vector<symbol> a;
vector<symbol> x;
for (unsigned i=0; i<n; ++i) {
+#if defined(HAVE_SSTREAM)
+ ostringstream buf;
+ buf << i << ends;
+ a.push_back(symbol(string("a")+buf.str()));
+ x.push_back(symbol(string("x")+buf.str()));
+#else
char buf[3];
ostrstream(buf,sizeof(buf)) << i << ends;
a.push_back(symbol(string("a")+buf));
x.push_back(symbol(string("x")+buf));
+#endif
}
lst eqns; // equation list
lst vars; // variable list
if (errorflag) {
++result;
clog << "solution of the system " << eqns << " for " << vars
- << " erroneously returned " << sol << endl;
+ << " erroneously returned " << sol << endl;
}
}
}