00001
00015 #ifndef OSMATRIX_H
00016 #define OSMATRIX_H
00017
00018 #include "OSConfig.h"
00019 #include "OSParameters.h"
00020 #include "OSnLNode.h"
00021 #include "OSExpressionTree.h"
00022
00023 #include <string>
00024 #include <vector>
00025
00026
00027
00028
00029
00030
00031
00032
00033
00040 class OSnLNode;
00041 class OSnLMNode;
00042 class ScalarExpressionTree;
00043
00044
00050 class MatrixNode
00051 {
00052 public:
00058 ENUM_MATRIX_TYPE matrixType;
00059
00064 ENUM_MATRIX_CONSTRUCTOR_TYPE nType;
00065
00070 unsigned int inumberOfChildren;
00071
00076 MatrixNode **m_mChildren;
00077
00079 MatrixNode();
00080
00082 virtual ~MatrixNode();
00083
00087 virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType();
00088
00092 virtual ENUM_MATRIX_TYPE getMatrixType() = 0;
00093
00097 virtual std::string getNodeName() = 0;
00098
00107 virtual std::string getMatrixNodeInXML() = 0;
00108
00117 std::vector<MatrixNode*> getPrefixFromNodeTree();
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128 std::vector<MatrixNode*> preOrderMatrixNodeTraversal( std::vector<MatrixNode*> *prefixVector);
00129
00138 std::vector<MatrixNode*> getPostfixFromNodeTree();
00139
00149 std::vector<MatrixNode*> postOrderMatrixNodeTraversal( std::vector<MatrixNode*> *postfixVector);
00150
00158 virtual MatrixNode *cloneMatrixNode() = 0;
00159
00171 virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols) = 0;
00172
00176 virtual bool IsEqual(MatrixNode *that);
00177
00186 bool setRandom(double density, bool conformant, int iMin, int iMax);
00187
00193 bool deepCopyFrom(MatrixNode *that);
00194 };
00195
00196
00209 class MatrixConstructor : public MatrixNode
00210 {
00211 public:
00213 MatrixConstructor();
00214
00216 virtual ~MatrixConstructor();
00217
00222
00223
00232
00233
00239
00240 };
00241
00242
00248 class MatrixElements: public MatrixConstructor
00249 {
00250 public:
00255 bool rowMajor;
00256
00261 int numberOfValues;
00262
00266 IntVector *start;
00267
00269 IntVector *index;
00270
00271
00272 MatrixElements();
00273 virtual ~MatrixElements();
00274
00278 bool getRowMajor();
00279
00288
00289
00293 bool IsEqual(MatrixElements *that);
00294
00295 #if 0
00296
00304 bool setRandom(double density, bool conformant, int iMin, int iMax);
00305
00311 bool deepCopyFrom(MatrixElements *that);
00312 #endif
00313 };
00314
00315
00321 class MatrixElementValues
00322 {
00323 public:
00327 int numberOfEl;
00328
00329 MatrixElementValues();
00330 virtual ~MatrixElementValues();
00331
00340
00341
00346
00347
00356
00357
00363 virtual bool deepCopyFrom(MatrixElementValues *that);
00364 };
00365
00366
00367
00373 class LinearMatrixElementTerm
00374 {
00375 public:
00376 int idx;
00377 double coef;
00378
00379 LinearMatrixElementTerm();
00380 ~LinearMatrixElementTerm();
00381
00385 bool IsEqual(LinearMatrixElementTerm *that);
00386
00395 bool setRandom(double density, bool conformant, int iMin, int iMax);
00396
00402 bool deepCopyFrom(LinearMatrixElementTerm *that);
00403 };
00404
00411 class LinearMatrixElement
00412 {
00413 public:
00414 int numberOfVarIdx;
00415 double constant;
00416
00417 LinearMatrixElementTerm** varIdx;
00418
00419 LinearMatrixElement();
00420 ~LinearMatrixElement();
00421
00425 bool IsEqual(LinearMatrixElement *that);
00426
00435 bool setRandom(double density, bool conformant, int iMin, int iMax);
00436
00442 bool deepCopyFrom(LinearMatrixElement *that);
00443 };
00444
00445
00453 class ConReferenceMatrixElement
00454 {
00455 public:
00460 int conReference;
00461
00466 ENUM_CONREFERENCE_VALUETYPE valueType;
00467
00469 double value;
00470
00471 ConReferenceMatrixElement();
00472 ~ConReferenceMatrixElement();
00473
00477 bool IsEqual(ConReferenceMatrixElement *that);
00478
00487 bool setRandom(double density, bool conformant, int iMin, int iMax);
00488
00494 bool deepCopyFrom(ConReferenceMatrixElement *that);
00495 };
00496
00497
00501 class ConstantMatrixValues : public MatrixElementValues
00502 {
00503 public:
00504 double *el;
00505
00506 ConstantMatrixValues();
00507 ~ConstantMatrixValues();
00508
00512
00513
00517
00518
00522
00523
00532
00533
00538 bool IsEqual(ConstantMatrixValues *that);
00539
00548 bool setRandom(double density, bool conformant, int iMin, int iMax);
00549
00555 bool deepCopyFrom(ConstantMatrixValues *that);
00556 };
00557
00558
00563 class VarReferenceMatrixValues : public MatrixElementValues
00564 {
00565 public:
00569 int *el;
00570
00571 VarReferenceMatrixValues();
00572 ~VarReferenceMatrixValues();
00573
00578 bool IsEqual(VarReferenceMatrixValues *that);
00579
00588 bool setRandom(double density, bool conformant, int iMin, int iMax);
00589
00595 virtual bool deepCopyFrom(VarReferenceMatrixValues *that);
00596 };
00597
00598
00602 class LinearMatrixValues : public MatrixElementValues
00603 {
00604 public:
00605 LinearMatrixElement **el;
00606
00607 LinearMatrixValues();
00608 ~LinearMatrixValues();
00609
00614 bool IsEqual(LinearMatrixValues *that);
00615
00625 bool setRandom(double density, bool conformant, int iMin, int iMax);
00626
00632 virtual bool deepCopyFrom(LinearMatrixValues *that);
00633 };
00634
00635
00639 class GeneralMatrixValues : public MatrixElementValues
00640 {
00641 public:
00642 ScalarExpressionTree **el;
00643
00644 GeneralMatrixValues();
00645 ~GeneralMatrixValues();
00646
00651 bool IsEqual(GeneralMatrixValues *that);
00652
00661 bool setRandom(double density, bool conformant, int iMin, int iMax);
00662
00668 virtual bool deepCopyFrom(GeneralMatrixValues *that);
00669 };
00670
00671
00675 class ObjReferenceMatrixValues : public MatrixElementValues
00676 {
00677 public:
00678 int *el;
00679
00680 ObjReferenceMatrixValues();
00681 ~ObjReferenceMatrixValues();
00682
00687 bool IsEqual(ObjReferenceMatrixValues *that);
00688
00697 bool setRandom(double density, bool conformant, int iMin, int iMax);
00698
00704 virtual bool deepCopyFrom(ObjReferenceMatrixValues *that);
00705 };
00706
00707
00711 class ConReferenceMatrixValues : public MatrixElementValues
00712 {
00713 public:
00717 ConReferenceMatrixElement **el;
00718
00719 ConReferenceMatrixValues();
00720 ~ConReferenceMatrixValues();
00721
00725 bool IsEqual(ConReferenceMatrixValues *that);
00726
00735 bool setRandom(double density, bool conformant, int iMin, int iMax);
00736
00742 virtual bool deepCopyFrom(ConReferenceMatrixValues *that);
00743 };
00744
00745
00749 class ConstantMatrixElements: public MatrixElements
00750 {
00751 public:
00753 ConstantMatrixValues *value;
00754
00755 ConstantMatrixElements();
00756 ~ConstantMatrixElements();
00757
00758
00762 virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType();
00763
00767 virtual std::string getNodeName();
00768
00772 virtual ENUM_MATRIX_TYPE getMatrixType();
00773
00782 virtual std::string getMatrixNodeInXML();
00783
00795 virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols);
00796
00804 virtual ConstantMatrixElements *cloneMatrixNode();
00805
00810 bool IsEqual(ConstantMatrixElements *that);
00811
00820 bool setRandom(double density, bool conformant, int iMin, int iMax);
00821
00827 bool deepCopyFrom(ConstantMatrixElements *that);
00828 };
00829
00830
00835 class VarReferenceMatrixElements: public MatrixElements
00836 {
00837 public:
00839 VarReferenceMatrixValues *value;
00840
00841 VarReferenceMatrixElements();
00842 ~VarReferenceMatrixElements();
00843
00847 virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType();
00848
00852 virtual ENUM_MATRIX_TYPE getMatrixType();
00853
00857 virtual std::string getNodeName();
00866 virtual std::string getMatrixNodeInXML();
00867
00879 virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols);
00880
00888 virtual VarReferenceMatrixElements *cloneMatrixNode();
00889
00893 bool IsEqual(VarReferenceMatrixElements *that);
00894
00903 bool setRandom(double density, bool conformant, int iMin, int iMax);
00904
00910 bool deepCopyFrom(VarReferenceMatrixElements *that);
00911 };
00912
00913
00917 class LinearMatrixElements: public MatrixElements
00918 {
00919 public:
00925 LinearMatrixValues *value;
00926
00927 LinearMatrixElements();
00928 ~LinearMatrixElements();
00929
00930
00934 virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType();
00935
00939 virtual ENUM_MATRIX_TYPE getMatrixType();
00940
00944 virtual std::string getNodeName();
00953 virtual std::string getMatrixNodeInXML();
00954
00966 virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols);
00967
00975 virtual LinearMatrixElements *cloneMatrixNode();
00976
00981 bool IsEqual(LinearMatrixElements *that);
00982
00991 bool setRandom(double density, bool conformant, int iMin, int iMax);
00992
00998 bool deepCopyFrom(LinearMatrixElements *that);
00999 };
01000
01001
01005 class GeneralMatrixElements: public MatrixElements
01006 {
01007 public:
01011 GeneralMatrixValues *value;
01012
01013 GeneralMatrixElements();
01014 ~GeneralMatrixElements();
01015
01016
01020 virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType();
01021
01025 virtual ENUM_MATRIX_TYPE getMatrixType();
01026
01030 virtual std::string getNodeName();
01039 virtual std::string getMatrixNodeInXML();
01040
01052 virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols);
01053
01061 virtual GeneralMatrixElements *cloneMatrixNode();
01062
01066 bool IsEqual(GeneralMatrixElements *that);
01067
01076 bool setRandom(double density, bool conformant, int iMin, int iMax);
01077
01083 bool deepCopyFrom(GeneralMatrixElements *that);
01084 };
01085
01086
01091 class ObjReferenceMatrixElements: public MatrixElements
01092 {
01093 public:
01095 ObjReferenceMatrixValues *value;
01096
01097 ObjReferenceMatrixElements();
01098 ~ObjReferenceMatrixElements();
01099
01100
01104 virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType();
01105
01109 virtual ENUM_MATRIX_TYPE getMatrixType();
01110
01114 virtual std::string getNodeName();
01115
01124 virtual std::string getMatrixNodeInXML();
01125
01137 virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols);
01138
01146 virtual ObjReferenceMatrixElements *cloneMatrixNode();
01147
01152 bool IsEqual(ObjReferenceMatrixElements *that);
01153
01162 bool setRandom(double density, bool conformant, int iMin, int iMax);
01163
01169 bool deepCopyFrom(ObjReferenceMatrixElements *that);
01170 };
01171
01172
01177 class ConReferenceMatrixElements: public MatrixElements
01178 {
01179 public:
01181 ConReferenceMatrixValues *value;
01182
01183 ConReferenceMatrixElements();
01184 ~ConReferenceMatrixElements();
01185
01186
01190 virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType();
01191
01195 virtual ENUM_MATRIX_TYPE getMatrixType();
01196
01200 virtual std::string getNodeName();
01201
01210 virtual std::string getMatrixNodeInXML();
01211
01223 virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols);
01224
01232 virtual ConReferenceMatrixElements *cloneMatrixNode();
01233
01238 bool IsEqual(ConReferenceMatrixElements *that);
01239
01248 bool setRandom(double density, bool conformant, int iMin, int iMax);
01249
01255 bool deepCopyFrom(ConReferenceMatrixElements *that);
01256 };
01257
01258
01264 class MixedRowReferenceMatrixElements: public MatrixElements
01265 {
01266 public:
01275 ConReferenceMatrixValues *value;
01276
01277 MixedRowReferenceMatrixElements();
01278 ~MixedRowReferenceMatrixElements();
01279
01280
01284 virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType();
01285
01289 virtual ENUM_MATRIX_TYPE getMatrixType();
01290
01294 virtual std::string getNodeName();
01295
01306 virtual std::string getMatrixNodeInXML();
01307
01319 virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols);
01320
01328 virtual MixedRowReferenceMatrixElements *cloneMatrixNode();
01329
01333 bool IsEqual(MixedRowReferenceMatrixElements *that);
01334
01343 bool setRandom(double density, bool conformant, int iMin, int iMax);
01344
01350 bool deepCopyFrom(MixedRowReferenceMatrixElements *that);
01351 };
01352
01353
01358 class MatrixTransformation : public MatrixConstructor
01359 {
01360 public:
01364 OSnLMNode *transformation;
01365
01370 ENUM_NL_EXPR_SHAPE shape;
01371
01372 MatrixTransformation();
01373 ~MatrixTransformation();
01374
01378 virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType();
01379
01383 virtual std::string getNodeName();
01384
01385
01389 virtual ENUM_MATRIX_TYPE getMatrixType();
01390
01399 virtual std::string getMatrixNodeInXML();
01400
01410 virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols);
01411
01416 virtual MatrixTransformation *cloneMatrixNode();
01417
01422 bool IsEqual(MatrixTransformation *that);
01423
01432 bool setRandom(double density, bool conformant, int iMin, int iMax);
01433
01439 bool deepCopyFrom(MatrixTransformation *that);
01440 };
01441
01442
01443
01449 class MatrixBlocks : public MatrixConstructor
01450 {
01451 public:
01456 IntVector *colOffset;
01457
01461 IntVector *rowOffset;
01462
01463 MatrixBlocks();
01464 ~MatrixBlocks();
01465
01469 virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType();
01470
01474 virtual std::string getNodeName();
01475
01479 virtual ENUM_MATRIX_TYPE getMatrixType();
01480
01489 virtual std::string getMatrixNodeInXML();
01490
01500 virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols) ;
01501
01506 virtual MatrixBlocks *cloneMatrixNode();
01507
01511 bool IsEqual(MatrixBlocks *that);
01512
01521 bool setRandom(double density, bool conformant, int iMin, int iMax);
01522
01528 bool deepCopyFrom(MatrixBlocks *that);
01529 };
01530
01531
01536 class BaseMatrix : public MatrixConstructor
01537 {
01538 public:
01542 int baseMatrixIdx;
01543
01547 OSMatrix* baseMatrix;
01548
01552 int targetMatrixFirstRow;
01553 int targetMatrixFirstCol;
01554
01559 int baseMatrixStartRow;
01560 int baseMatrixStartCol;
01561
01566 int baseMatrixEndRow;
01567 int baseMatrixEndCol;
01568
01572 bool baseTranspose;
01573
01577 double scalarMultiplier;
01578
01580 BaseMatrix();
01581 ~BaseMatrix();
01582
01586 virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType();
01587
01591 virtual std::string getNodeName();
01592
01596 virtual ENUM_MATRIX_TYPE getMatrixType();
01597
01606 virtual std::string getMatrixNodeInXML();
01607
01617 virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols) ;
01618
01623 virtual BaseMatrix *cloneMatrixNode();
01624
01628 bool IsEqual(BaseMatrix *that);
01629
01630 #if 0
01631
01639 bool setRandom(double density, bool conformant, int iMin, int iMax);
01640
01646 bool deepCopyFrom(BaseMatrix *that);
01647 #endif
01648 };
01649
01650
01654 class GeneralSparseMatrix
01655 {
01656 public:
01657
01662 bool b_deleteStartArray;
01663
01668 bool b_deleteIndexArray;
01669
01674 bool b_deleteValueArray;
01675
01680 bool isRowMajor;
01681
01686 ENUM_MATRIX_SYMMETRY symmetry;
01687
01691 int startSize;
01692
01696 int valueSize;
01697
01702 int* start;
01703
01708 int* index;
01709
01714 ENUM_MATRIX_TYPE vType;
01715
01723 MatrixElementValues* value;
01724
01728 GeneralSparseMatrix();
01729
01739 GeneralSparseMatrix(bool isColumnMajor, int startSize, int valueSize, ENUM_MATRIX_TYPE type);
01740
01745 ~GeneralSparseMatrix();
01746
01752 bool display(int secondaryDim);
01753
01758 bool isDiagonal();
01759 };
01760
01761
01768 class ExpandedMatrixBlocks
01769 {
01770 public:
01775 bool bDeleteArrays;
01776
01781 ENUM_MATRIX_TYPE vType;
01782
01787 bool isRowMajor;
01788
01793 int blockNumber;
01794
01801 int* rowOffset;
01802
01809 int* colOffset;
01810
01814 int rowOffsetSize;
01815 int colOffsetSize;
01816
01823 int* blockRows;
01824
01831 int* blockColumns;
01832
01838 GeneralSparseMatrix** blocks;
01839
01844 ExpandedMatrixBlocks();
01845
01854 ExpandedMatrixBlocks(bool isColumnMajor_, int startSize, int valueSize);
01855
01860 ~ExpandedMatrixBlocks();
01861
01867 bool display(int secondaryDim);
01868
01875 GeneralSparseMatrix* getBlock(int rowIdx, int colIdx);
01876
01881 bool isBlockDiagonal();
01882 };
01883
01884
01889 class MatrixType : public MatrixNode
01890 {
01891 public:
01896 ENUM_MATRIX_SYMMETRY symmetry;
01897
01902 ENUM_MATRIX_TYPE type;
01903
01904 int numberOfRows;
01905 int numberOfColumns;
01906
01911 GeneralSparseMatrix* ExpandedMatrixInRowMajorForm;
01912 GeneralSparseMatrix* ExpandedMatrixInColumnMajorForm;
01913 std::vector<ExpandedMatrixBlocks*> ExpandedMatrixByBlocks;
01914
01915 private:
01919 int* m_miRowPartition;
01920
01924 int m_iRowPartitionSize;
01925
01929 int* m_miColumnPartition;
01930
01934 int m_iColumnPartitionSize;
01935
01939 bool m_bHaveRowPartition;
01940
01944 bool m_bHaveColumnPartition;
01945
01946 public:
01947 MatrixType();
01948 virtual ~MatrixType();
01949
01950
01954
01955
01965 virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols) ;
01966
01970 bool matrixHasBase();
01971 bool matrixHasElements();
01972 bool matrixHasTransformations();
01973 bool matrixHasBlocks();
01974 int getNumberOfElementConstructors();
01975 int getNumberOfTransformationConstructors();
01976 int getNumberOfBlocksConstructors();
01977
01978 GeneralSparseMatrix* getMatrixCoefficientsInColumnMajor();
01979 GeneralSparseMatrix* getMatrixCoefficientsInRowMajor();
01980 GeneralSparseMatrix* getMatrixBlockInColumnMajorForm(int columnIdx, int rowIdx);
01981
01988 bool printExpandedMatrix(bool rowMajor);
01989
01997 int getRowPartitionSize();
01998
02005 int* getRowPartition();
02006
02014 int getColumnPartitionSize();
02015
02022 int* getColumnPartition();
02023
02024
02034 virtual bool expandElements(bool rowMajor);
02035
02043 GeneralSparseMatrix* convertToOtherMajor(bool isColumnMajor);
02044
02057 bool processBlockPartition();
02058
02073 virtual bool processBlocks(bool rowMajor, ENUM_MATRIX_SYMMETRY symmetry);
02074
02091 virtual bool processBlocks(int* rowOffset, int rowOffsetSize, int* colOffset,
02092 int colOffsetSize, bool rowMajor, ENUM_MATRIX_SYMMETRY symmetry);
02093
02112 GeneralSparseMatrix* extractBlock(int firstrow, int firstcol, int lastrow, int lastcol,
02113 bool rowMajor, ENUM_MATRIX_SYMMETRY symmetry);
02114
02136 ExpandedMatrixBlocks* getBlocks(int* rowPartition, int rowPartitionSize,
02137 int* colPartition, int colPartitionSize,
02138 bool rowMajor, bool appendToBlockArray);
02139
02152 ExpandedMatrixBlocks* disassembleMatrix(int* rowPartition, int rowPartitionSize,
02153 int* colPartition, int colPartitionSize,
02154 bool rowMajor, ENUM_MATRIX_SYMMETRY symmetry);
02155
02159 bool IsEqual(MatrixType *that);
02160
02169 bool setRandom(double density, bool conformant, int iMin, int iMax);
02170
02177 bool deepCopyFrom(MatrixType *that);
02178 };
02179
02180
02185 class OSMatrix : public MatrixType
02186 {
02187 public:
02188 int idx;
02189 std::string name;
02190
02191 public:
02192 OSMatrix();
02193 ~OSMatrix();
02194
02205 OSMatrix* createConstructorTreeFromPrefix(std::vector<MatrixNode*> mtxConstructorVec);
02206
02210 virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType();
02211
02215 virtual std::string getNodeName();
02216
02220 virtual ENUM_MATRIX_TYPE getMatrixType();
02221
02236
02237
02238
02248 virtual bool expandElements(bool rowMajor);
02249
02259 virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols) ;
02260
02264 bool isBlockDiagonal();
02265
02285 bool setMatrix(std::string name, int numberOfRows, int numberOfColumns,
02286 ENUM_MATRIX_SYMMETRY symmetry, ENUM_MATRIX_TYPE matrixType,
02287 unsigned int inumberOfChildren, MatrixNode **m_mChildren);
02288
02289
02298 virtual std::string getMatrixNodeInXML();
02299
02304 virtual OSMatrix *cloneMatrixNode();
02305
02310 bool IsEqual(OSMatrix *that);
02311
02321 bool setRandom(double density, bool conformant, int iMin, int iMax);
02322
02328 bool deepCopyFrom(OSMatrix *that);
02329 };
02330
02331
02336 class OSMatrixWithMatrixVarIdx : public OSMatrix
02337 {
02338 public:
02339 int matrixVarIdx;
02340
02341 public:
02342 OSMatrixWithMatrixVarIdx();
02343 ~OSMatrixWithMatrixVarIdx();
02344
02353 virtual std::string getMatrixNodeInXML();
02354
02359 virtual OSMatrixWithMatrixVarIdx *cloneMatrixNode();
02360
02365 bool IsEqual(OSMatrixWithMatrixVarIdx *that);
02366
02376 bool setRandom(double density, bool conformant, int iMin, int iMax);
02377
02383 bool deepCopyFrom(OSMatrixWithMatrixVarIdx *that);
02384 };
02385
02386
02391 class OSMatrixWithMatrixObjIdx : public OSMatrix
02392 {
02393 public:
02394 int matrixObjIdx;
02395
02396 public:
02397 OSMatrixWithMatrixObjIdx();
02398 ~OSMatrixWithMatrixObjIdx();
02399
02408 virtual std::string getMatrixNodeInXML();
02409
02414 virtual OSMatrixWithMatrixObjIdx *cloneMatrixNode();
02415
02420 bool IsEqual(OSMatrixWithMatrixObjIdx *that);
02421
02431 bool setRandom(double density, bool conformant, int iMin, int iMax);
02432
02438 bool deepCopyFrom(OSMatrixWithMatrixObjIdx *that);
02439 };
02440
02445 class OSMatrixWithMatrixConIdx : public OSMatrix
02446 {
02447 public:
02448 int matrixConIdx;
02449
02450 public:
02451 OSMatrixWithMatrixConIdx();
02452 ~OSMatrixWithMatrixConIdx();
02453
02462 virtual std::string getMatrixNodeInXML();
02463
02468 virtual OSMatrixWithMatrixConIdx *cloneMatrixNode();
02469
02474 bool IsEqual(OSMatrixWithMatrixConIdx *that);
02475
02485 bool setRandom(double density, bool conformant, int iMin, int iMax);
02486
02492 bool deepCopyFrom(OSMatrixWithMatrixConIdx *that);
02493 };
02494
02495
02500 class MatrixBlock : public MatrixType
02501 {
02502 public:
02503 int blockRowIdx;
02504 int blockColIdx;
02505
02506 MatrixBlock();
02507 ~MatrixBlock();
02508
02512 virtual ENUM_MATRIX_CONSTRUCTOR_TYPE getNodeType();
02513
02517 virtual std::string getNodeName();
02518
02519
02523 virtual ENUM_MATRIX_TYPE getMatrixType();
02524
02533 virtual std::string getMatrixNodeInXML();
02534
02544 virtual bool alignsOnBlockBoundary(int firstRow, int firstColumn, int nRows, int nCols);
02545
02555 virtual bool expandElements(bool rowMajor);
02556
02561 virtual MatrixBlock *cloneMatrixNode();
02562
02567 bool IsEqual(MatrixBlock *that);
02568
02578 bool setRandom(double density, bool conformant, int iMin, int iMax);
02579
02585 bool deepCopyFrom(MatrixBlock *that);
02586 };
02587
02588
02592 LinearMatrixElement* convertToLinearMatrixElement(double val);
02593 LinearMatrixElement* convertToLinearMatrixElement(int varref);
02594 ScalarExpressionTree* convertToGeneralMatrixElement(double val);
02595 ScalarExpressionTree* convertToGeneralMatrixElement(int refIdx, bool varRef);
02596 ScalarExpressionTree* convertToGeneralMatrixElement(LinearMatrixElement* val);
02597 ScalarExpressionTree* convertToGeneralMatrixElement(ConReferenceMatrixElement* val);
02598 ConReferenceMatrixElement* convertToConReferenceMatrixElement(int objref);
02599 #endif