2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
2006-09-17 09:14:18 +00:00
|
|
|
|
* \file InsetMathMatrix.C
|
2003-08-19 13:00:56 +00:00
|
|
|
|
* 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>
|
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "InsetMathMatrix.h"
|
|
|
|
|
#include "MathData.h"
|
2006-10-22 10:15:23 +00:00
|
|
|
|
#include "MathStream.h"
|
2001-11-09 08:35:57 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathMatrix::InsetMathMatrix(InsetMathGrid const & p)
|
|
|
|
|
: InsetMathGrid(p)
|
2001-11-09 08:35:57 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
auto_ptr<InsetBase> InsetMathMatrix::doClone() const
|
2001-11-09 08:35:57 +00:00
|
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new InsetMathMatrix(*this));
|
2001-11-09 08:35:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathMatrix::write(WriteStream & os) const
|
2001-11-09 08:35:57 +00:00
|
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathGrid::write(os);
|
2001-11-09 08:35:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathMatrix::normalize(NormalStream & os) const
|
2001-11-09 08:35:57 +00:00
|
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathGrid::normalize(os);
|
2001-11-09 08:35:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathMatrix::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 << "])";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathMatrix::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 << ')';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathMatrix::mathematica(MathematicaStream & os) const
|
2006-09-02 01:57:36 +00:00
|
|
|
|
{
|
|
|
|
|
os << '{';
|
|
|
|
|
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 << '}';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void InsetMathMatrix::mathmlize(MathStream & os) const
|
2001-11-09 08:35:57 +00:00
|
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathGrid::mathmlize(os);
|
2001-11-09 08:35:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathMatrix::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 << ']';
|
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|