File indexing completed on 2024-05-12 03:41:58

0001 /*************************************************************************************
0002  *  Copyright (C) 2014 by Percy Camilo T. Aucahuasi <percy.camilo.ta@gmail.com>      *
0003  *                                                                                   *
0004  *  This program is free software; you can redistribute it and/or                    *
0005  *  modify it under the terms of the GNU General Public License                      *
0006  *  as published by the Free Software Foundation; either version 2                   *
0007  *  of the License, or (at your option) any later version.                           *
0008  *                                                                                   *
0009  *  This program is distributed in the hope that it will be useful,                  *
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of                   *
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                    *
0012  *  GNU General Public License for more details.                                     *
0013  *                                                                                   *
0014  *  You should have received a copy of the GNU General Public License                *
0015  *  along with this program; if not, write to the Free Software                      *
0016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA   *
0017  *************************************************************************************/
0018 
0019 #ifndef BLOCKMATRIXCOMMANDS_H
0020 #define BLOCKMATRIXCOMMANDS_H
0021 
0022 #include "builtinmethods.h"
0023 
0024 namespace Analitza {
0025 class Expression;
0026 }
0027 
0028 /**
0029  * \class BlockMatrixCommand
0030  * 
0031  * \brief Implements the \"blockmatrix\" command.
0032  * 
0033  * BlockMatrixCommand constructs a block matrix by two ways:
0034  * 
0035  * The first way creates a block matrix based on rows.
0036  * \code blockmatrix(matrixrow{A1,B1,..., Z1}, ..., matrixrow{AN,BN,..., ZN}) \endcode 
0037  * Here A1,B1, ..., ZN are blocks (i.e. matrices) 
0038  * The number of elements in each matrixrow element must be the same.
0039  * 
0040  * The first way creates a block matrix based on vectors (i.e. column vectors)
0041  * \code blockmatrix(matrixrow{A1,B1,..., Z1}, ..., matrixrow{AN,BN,..., ZN}) \endcode 
0042  * Here A1,B1, ..., ZN are blocks (i.e. matrices) 
0043  * The number of elements in each vector must be the same.
0044  * 
0045  * Also, in general, the size of A1 is equals to the size of A2 and 
0046  * equals to the size of A3 and so on (the same it holds for B1,B2,...,BN, 
0047  * ..., Z1, Z2, ZN) 
0048  *
0049  */
0050 
0051 class BlockMatrixCommand: public Analitza::FunctionDefinition
0052 {
0053 public:
0054     virtual Analitza::Expression operator()(const QList< Analitza::Expression >& args) override;
0055     
0056     static const QString id;
0057     static const Analitza::ExpressionType type;
0058 };
0059 
0060 /**
0061  * \class BlockDiagonalMatrixCommand
0062  * 
0063  * \brief Implements the \"blockdiag\" command.
0064  * 
0065  * BlockDiagonalMatrixCommand constructs a block diagonal matrix.
0066  * 
0067  * \code blockdiag(A, B, ..., Z) \endcode 
0068  * A, B, ... and Z are the blocks, so they are matrices.
0069  * 
0070  */
0071 
0072 class BlockDiagonalMatrixCommand: public Analitza::FunctionDefinition
0073 {
0074 public:
0075     virtual Analitza::Expression operator()(const QList< Analitza::Expression >& args) override;
0076 
0077     static const QString id;
0078     static const Analitza::ExpressionType type;
0079 };
0080 
0081 //TODO block tridiagonal matrices
0082 
0083 #endif // BLOCKMATRIXCOMMANDS_H