#include "matrix.h"
#include "debugmsg.h"
+#include "utils.h"
#ifndef NO_GINAC_NAMESPACE
namespace GiNaC {
: basic(TINFO_matrix), row(1), col(1)
{
debugmsg("matrix default constructor",LOGLEVEL_CONSTRUCT);
- m.push_back(exZERO());
+ m.push_back(_ex0());
}
matrix::~matrix()
: basic(TINFO_matrix), row(r), col(c)
{
debugmsg("matrix constructor from int,int",LOGLEVEL_CONSTRUCT);
- m.resize(r*c, exZERO());
+ m.resize(r*c, _ex0());
}
// protected
{
GINAC_ASSERT(M.rows()==M.cols()); // cannot happen, just in case...
matrix tmp(M);
- ex det=exONE();
+ ex det=_ex1();
ex piv;
for (int r1=0; r1<M.rows(); ++r1) {
int indx = tmp.pivot(r1);
if (indx == -1) {
- return exZERO();
+ return _ex0();
}
if (indx != 0) {
- det *= exMINUSONE();
+ det *= _ex_1();
}
det = det * tmp.m[r1*M.cols()+r1];
for (int r2=r1+1; r2<M.rows(); ++r2) {
matrix tmp(row,col);
// set tmp to the unit matrix
for (int i=0; i<col; ++i) {
- tmp.m[i*col+i] = exONE();
+ tmp.m[i*col+i] = _ex1();
}
// create a copy of this matrix
matrix cpy(*this);
for (int k=1; (k<=n)&&(r<=m); ++k) {
// find a nonzero pivot
int p;
- for (p=r; (p<=m)&&(a.ffe_get(p,k).is_equal(exZERO())); ++p) {}
+ for (p=r; (p<=m)&&(a.ffe_get(p,k).is_equal(_ex0())); ++p) {}
// pivot is in row p
if (p<=m) {
if (p!=r) {
for (int r=1; r<=m; ++r) {
int zero_in_this_row=0;
for (int c=1; c<=n; ++c) {
- if (a.ffe_get(r,c).is_equal(exZERO())) {
+ if (a.ffe_get(r,c).is_equal(_ex0())) {
zero_in_this_row++;
} else {
break;