2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2008-2008 - DIGITEO - Antoine ELIAS
5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
7 * This file is hereby licensed under the terms of the GNU GPL v2.0,
8 * pursuant to article 5.3.4 of the CeCILL v.2.1.
9 * This file was originally licensed under the terms of the CeCILL v2.1,
10 * and continues to be available under such terms.
11 * For more information, see the COPYING file which you should have received
12 * along with this program.
16 // This code is separated in matrixpoly.hxx
17 // but will be inlined in arrayof.hxx
19 // If you need additionnal headers, please add it in arrayof.hxx
21 //#ifndef __ARRAYOF_HXX__
22 // #error This file must only be include by arrayof.hxx
25 #ifndef __POLYNOM_HXX__
26 #define __POLYNOM_HXX__
28 #include "arrayof.hxx"
29 #include "singlepoly.hxx"
32 //disable warnings about exports STL items
34 #pragma warning (disable : 4251)
39 class EXTERN_AST Polynom : public ArrayOf<SinglePoly*>
43 Polynom(const std::wstring& _szVarName, int _iRows, int _iCols);
44 Polynom(const std::wstring& _szVarName, int _iRows, int _iCols, const int *_piRank);
45 Polynom(const std::wstring& _szVarName, int _iDims, const int* _piDims);
46 Polynom(const std::wstring& _szVarName, int _iDims, const int* _piDims, const int *_piRank);
50 // FIXME : Should not return NULL
51 Polynom* clone() override;
53 Polynom* setCoef(int _iRows, int _iCols, Double *_pdblCoef);
54 Polynom* setCoef(int _iIdx, Double *_pdblCoef);
56 virtual Polynom* setComplex(bool _bComplex) override;
58 inline ScilabType getType(void) override
63 inline ScilabId getId(void) override
65 return isScalar() ? isComplex() ? IdScalarPolynomComplex
67 : isComplex() ? IdPolynomComplex
71 bool isComplex(void) override;
73 bool isDollar() override;
74 inline bool isPoly() override
79 void whoAmI(void) override;
80 std::wstring& getVariableName();
81 void setVariableName(const std::wstring&);
82 bool getSizes(int *_piSizes);
83 bool getRank(int *_piRank);
85 Double* evaluate(Double* _pdblValue);
86 void updateRank(void);
87 Double* getCoef(void);
88 Polynom* setCoef(Double *_pCoef);
89 Double* extractCoef(int _iRank);
90 bool insertCoef(int _iRank, Double* _pCoef);
92 Polynom* insert(typed_list* _pArgs, InternalType* _pSource) override;
94 Polynom* set(int _iPos, SinglePoly* _pS) override;
95 Polynom* set(int _iRows, int _iCols, SinglePoly* _pS) override;
96 Polynom* set(SinglePoly** _pS) override;
98 std::wstring getRowString(int* _piDims, int _iDims, bool _bComplex);
99 std::wstring getColString(int* _piDims, int _iDims, bool _bComplex);
100 std::wstring getMatrixString(int* _piDims, int _iDims, bool _bComplex);
103 bool operator==(const InternalType& it) override;
104 bool operator!=(const InternalType& it) override;
106 /* return type as string ( double, int, cell, list, ... )*/
107 virtual std::wstring getTypeStr() const override
109 return L"polynomial";
111 /* return type as short string ( s, i, ce, l, ... )*/
112 virtual std::wstring getShortTypeStr() const override
117 bool isTrue() override
122 bool getMemory(long long* _piSize, long long* _piSizePlusType) override;
124 bool transpose(InternalType *& out) override;
125 bool adjoint(InternalType *& out) override;
127 static Polynom* Dollar();
130 std::wstring m_szVarName;
131 void createPoly(const std::wstring& _szVarName, int _iDims, const int* _piDims, const int *_piRank);
134 virtual bool subMatrixToString(std::wostringstream& ostr, int* _piDims, int _iDims) override;
136 virtual SinglePoly* getNullValue() override;
137 virtual Polynom* createEmpty(int _iDims, int* _piDims, bool _bComplex = false) override;
138 virtual SinglePoly* copyValue(SinglePoly* _pData) override;
139 virtual void deleteAll() override;
140 virtual void deleteImg() override;
141 virtual SinglePoly** allocData(int _iSize) override;
142 virtual void deleteData(SinglePoly* data) override;
147 template class types::ArrayOf<types::SinglePoly*>; //Polynom
149 #endif /* !__POLYNOM_HXX__ */