2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file math_matrixinset.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
|
#include "math_matrixinset.h"
|
2003-09-07 21:25:37 +00:00
|
|
|
|
#include "math_data.h"
|
2001-11-09 08:35:57 +00:00
|
|
|
|
#include "math_mathmlstream.h"
|
|
|
|
|
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
|
|
2002-04-24 17:07:42 +00:00
|
|
|
|
MathMatrixInset::MathMatrixInset(MathGridInset const & p)
|
|
|
|
|
: MathGridInset(p)
|
2001-11-09 08:35:57 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2004-11-23 23:04:52 +00:00
|
|
|
|
auto_ptr<InsetBase> MathMatrixInset::doClone() const
|
2001-11-09 08:35:57 +00:00
|
|
|
|
{
|
2003-07-25 17:11:25 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new MathMatrixInset(*this));
|
2001-11-09 08:35:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MathMatrixInset::write(WriteStream & os) const
|
|
|
|
|
{
|
2002-04-24 17:07:42 +00:00
|
|
|
|
MathGridInset::write(os);
|
2001-11-09 08:35:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MathMatrixInset::normalize(NormalStream & os) const
|
|
|
|
|
{
|
2002-04-24 17:07:42 +00:00
|
|
|
|
MathGridInset::normalize(os);
|
2001-11-09 08:35:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-02-14 14:30:09 +00:00
|
|
|
|
void MathMatrixInset::maple(MapleStream & os) const
|
2001-11-09 08:35:57 +00:00
|
|
|
|
{
|
|
|
|
|
os << "matrix(" << int(nrows()) << ',' << int(ncols()) << ",[";
|
|
|
|
|
for (idx_type idx = 0; idx < nargs(); ++idx) {
|
|
|
|
|
if (idx)
|
|
|
|
|
os << ',';
|
|
|
|
|
os << cell(idx);
|
|
|
|
|
}
|
|
|
|
|
os << "])";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-02-14 14:30:09 +00:00
|
|
|
|
void MathMatrixInset::maxima(MaximaStream & os) const
|
2002-10-28 17:15:19 +00:00
|
|
|
|
{
|
|
|
|
|
os << "matrix(";
|
|
|
|
|
for (row_type row = 0; row < nrows(); ++row) {
|
|
|
|
|
if (row)
|
|
|
|
|
os << ',';
|
|
|
|
|
os << '[';
|
|
|
|
|
for (col_type col = 0; col < ncols(); ++col) {
|
|
|
|
|
if (col)
|
|
|
|
|
os << ',';
|
|
|
|
|
os << cell(index(row, col));
|
|
|
|
|
}
|
|
|
|
|
os << ']';
|
|
|
|
|
}
|
|
|
|
|
os << ')';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
|
void MathMatrixInset::mathmlize(MathMLStream & os) const
|
|
|
|
|
{
|
2001-11-09 18:02:20 +00:00
|
|
|
|
MathGridInset::mathmlize(os);
|
2001-11-09 08:35:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-02-14 14:30:09 +00:00
|
|
|
|
void MathMatrixInset::octave(OctaveStream & os) const
|
2001-11-09 08:35:57 +00:00
|
|
|
|
{
|
|
|
|
|
os << '[';
|
|
|
|
|
for (row_type row = 0; row < nrows(); ++row) {
|
|
|
|
|
if (row)
|
|
|
|
|
os << ';';
|
|
|
|
|
os << '[';
|
2002-03-21 17:42:56 +00:00
|
|
|
|
for (col_type col = 0; col < ncols(); ++col)
|
2001-11-09 08:35:57 +00:00
|
|
|
|
os << cell(index(row, col)) << ' ';
|
|
|
|
|
os << ']';
|
|
|
|
|
}
|
|
|
|
|
os << ']';
|
|
|
|
|
}
|