2003-08-19 13:00:56 +00:00
|
|
|
/**
|
2007-04-25 03:01:35 +00:00
|
|
|
* \file InsetMathMatrix.cpp
|
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.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2003-08-19 13:00:56 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
#include "InsetMathMatrix.h"
|
2007-04-26 16:05:57 +00:00
|
|
|
#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 {
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
InsetMathMatrix::InsetMathMatrix(InsetMathGrid const & p)
|
|
|
|
: InsetMathGrid(p)
|
2001-11-09 08:35:57 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
|
2007-08-30 18:03:17 +00:00
|
|
|
Inset * InsetMathMatrix::clone() const
|
2001-11-09 08:35:57 +00:00
|
|
|
{
|
2007-08-30 18:03:17 +00:00
|
|
|
return 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
|