Source: kalamaris/matrix.h


Annotated List
Files
Globals
Hierarchy
Index
/*  matrix.h - 
    This file is part of Kalamaris
    Copyright (C) 2000  Antonio Larrosa Jimenez
    Kalamaris' homepage : http://perso.wanadoo.es/antlarr/kalamaris.html

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 

    Send comments and bug fixes to Antonio Larrosa <larrosa@kde.org>

 ***************************************************************************/
#ifndef _MATRIX_H
#define _MATRIX_H

#include "map.h"
#include "tmatrix.h"

class QStringList;
class QChar;
class QString;
class Constant;

class Matrix : public Map
{
protected:
  TMatrix *m_matrix;

//  QStringList split(const QChar &sep, const QString &str);

public:

  /**
   * Constructor.
   * Gets the matrix definition as a QString containing the data between
   * square brackets. I.e. If the Matrix is defined as 
   *
   *  [ 1 2 ]
   *  [ 3 4 ]  =  [ 1, 2; 3, 4]  
   *
   * then _m should be " 1, 2; 3, 4"
   */
  Matrix(const QString &m);
  Matrix(TMatrix * m);
  Matrix(const TMatrix &m);
  Matrix(const Matrix & m);

  virtual inline TMatrix *tmatrix(void) const { return m_matrix; };

  virtual Map *copy(void) const;

  virtual Map *eval (const QDict <Map> &vars);

  /**
   * Derivates (symbolically) the current map with respect to the variable var.
   */
  virtual Map *derive(const class Variable &var, const QDict <Map> &vars);

  virtual Map *simplify();

  virtual bool isConstant(void) const;

  virtual QString string(void) const;
  virtual QString htmlString(void) const;
  virtual QString help(void) const;

  static Matrix *add(Matrix *m1, Matrix *m2, 
      bool managem1=false, bool managem2=false);
  static Matrix *sub(Matrix *m1, Matrix *m2, 
      bool managem1=false, bool managem2=false);
  static Matrix *mul(Matrix *m1, Matrix *m2, 
      bool managem1=false, bool managem2=false);
  static Matrix *mul(Constant *c1, Matrix *m2, 
      bool managem1=false, bool managem2=false);
  static Matrix *div(Matrix *m1, Matrix *m2, 
      bool managem1=false, bool managem2=false);
  static Matrix *pow(Matrix * &m1, Constant * &m2, 
      bool managem1=false, bool managem2=false);
};

//Matrix *operator +(const Matrix &m1, const Matrix &m2);
#endif

Generated by: antonio@tazend on Fri May 25 22:16:00 2001, using kdoc 2.0a38.