#include "print.h"
#include "archive.h"
#include "utils.h"
-#include "debugmsg.h"
namespace GiNaC {
/** Default ctor. Initializes to 1 x 1-dimensional zero-matrix. */
matrix::matrix() : inherited(TINFO_matrix), row(1), col(1)
{
- debugmsg("matrix default ctor",LOGLEVEL_CONSTRUCT);
m.push_back(_ex0);
}
matrix::matrix(unsigned r, unsigned c)
: inherited(TINFO_matrix), row(r), col(c)
{
- debugmsg("matrix ctor from unsigned,unsigned",LOGLEVEL_CONSTRUCT);
m.resize(r*c, _ex0);
}
/** Ctor from representation, for internal use only. */
matrix::matrix(unsigned r, unsigned c, const exvector & m2)
- : inherited(TINFO_matrix), row(r), col(c), m(m2)
-{
- debugmsg("matrix ctor from unsigned,unsigned,exvector",LOGLEVEL_CONSTRUCT);
-}
+ : inherited(TINFO_matrix), row(r), col(c), m(m2) {}
/** Construct matrix from (flat) list of elements. If the list has fewer
* elements than the matrix, the remaining matrix elements are set to zero.
matrix::matrix(unsigned r, unsigned c, const lst & l)
: inherited(TINFO_matrix), row(r), col(c)
{
- debugmsg("matrix ctor from unsigned,unsigned,lst",LOGLEVEL_CONSTRUCT);
m.resize(r*c, _ex0);
for (unsigned i=0; i<l.nops(); i++) {
matrix::matrix(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
{
- debugmsg("matrix ctor from archive_node", LOGLEVEL_CONSTRUCT);
if (!(n.find_unsigned("row", row)) || !(n.find_unsigned("col", col)))
throw (std::runtime_error("unknown matrix dimensions in archive"));
m.reserve(row * col);
void matrix::print(const print_context & c, unsigned level) const
{
- debugmsg("matrix print", LOGLEVEL_PRINT);
-
if (is_a<print_tree>(c)) {
inherited::print(c, level);
/** Evaluate matrix entry by entry. */
ex matrix::eval(int level) const
{
- debugmsg("matrix eval",LOGLEVEL_MEMBER_FUNCTION);
-
// check if we have to do anything at all
if ((level==1)&&(flags & status_flags::evaluated))
return *this;