2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2008-2008 - DIGITEO - Antoine ELIAS
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
13 // This code is separated in matrixpoly.hxx
14 // but will be inlined in arrayof.hxx
16 // If you need additionnal headers, please add it in arrayof.hxx
18 //#ifndef __ARRAYOF_HXX__
19 // #error This file must only be include by arrayof.hxx
22 #ifndef __POLYNOM_HXX__
23 #define __POLYNOM_HXX__
25 #include "arrayof.hxx"
26 #include "singlepoly.hxx"
29 //disable warnings about exports STL items
31 #pragma warning (disable : 4251)
36 class EXTERN_AST Polynom : public ArrayOf<SinglePoly*>
40 Polynom(std::wstring& _szVarName, int _iRows, int _iCols);
41 Polynom(std::wstring& _szVarName, int _iRows, int _iCols, const int *_piRank);
42 Polynom(std::wstring& _szVarName, int _iDims, int* _piDims);
43 Polynom(std::wstring& _szVarName, int _iDims, int* _piDims, const int *_piRank);
47 // FIXME : Should not return NULL
48 InternalType* clone();
50 bool setCoef(int _iRows, int _iCols, Double *_pdblCoef);
51 bool setCoef(int _iIdx, Double *_pdblCoef);
53 virtual void setComplex(bool _bComplex);
55 inline ScilabType getType(void)
60 inline ScilabId getId(void)
62 return isScalar() ? isComplex() ? IdScalarPolynomComplex
64 : isComplex() ? IdPolynomComplex
76 std::wstring& getVariableName();
77 void setVariableName(std::wstring);
78 bool getSizes(int *_piSizes);
79 bool getRank(int *_piRank);
81 Double* evaluate(Double* _pdblValue);
82 void updateRank(void);
83 Double* getCoef(void);
84 void setCoef(Double *_pCoef);
85 Double* extractCoef(int _iRank);
86 bool insertCoef(int _iRank, Double* _pCoef);
88 InternalType* insert(typed_list* _pArgs, InternalType* _pSource);
90 bool set(int _iPos, SinglePoly* _pS);
91 bool set(int _iRows, int _iCols, SinglePoly* _pS);
92 bool set(SinglePoly** _pS);
94 std::wstring getRowString(int* _piDims, int _iDims, bool _bComplex);
95 std::wstring getColString(int* _piDims, int _iDims, bool _bComplex);
96 std::wstring getMatrixString(int* _piDims, int _iDims, bool _bComplex);
99 bool operator==(const InternalType& it);
100 bool operator!=(const InternalType& it);
102 /* return type as string ( double, int, cell, list, ... )*/
103 virtual std::wstring getTypeStr()
105 return L"polynomial";
107 /* return type as short string ( s, i, ce, l, ... )*/
108 virtual std::wstring getShortTypeStr()
118 bool transpose(InternalType *& out);
119 bool adjoint(InternalType *& out);
122 std::wstring m_szVarName;
123 void createPoly(std::wstring& _szVarName, int _iDims, int* _piDims, const int *_piRank);
126 virtual bool subMatrixToString(std::wostringstream& ostr, int* _piDims, int _iDims);
128 virtual SinglePoly* getNullValue();
129 virtual Polynom* createEmpty(int _iDims, int* _piDims, bool _bComplex = false);
130 virtual SinglePoly* copyValue(SinglePoly* _pData);
131 virtual void deleteAll();
132 virtual void deleteImg();
133 virtual SinglePoly** allocData(int _iSize);
134 virtual void deleteData(SinglePoly* data);
139 template class types::ArrayOf<types::SinglePoly*>; //Polynom
141 #endif /* !__POLYNOM_HXX__ */