Changeset 8901 in ntrip for trunk/BNC/newmat/newmat.h
- Timestamp:
- Mar 18, 2020, 11:06:13 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/newmat/newmat.h
r2013 r8901 447 447 class GeneralMatrix : public BaseMatrix // declarable matrix types 448 448 { 449 virtual GeneralMatrix* Image() const; // copy of matrix450 449 protected: 451 450 int tag_val; // shows whether can reuse … … 465 464 void ReverseElements(); // internal reverse of elements 466 465 void ReverseElements(GeneralMatrix*); // reverse order of elements 467 void operator=(Real); // set matrix to constant468 466 Real* GetStore(); // get store or copy 469 467 GeneralMatrix* BorrowStore(GeneralMatrix*, MatrixType); 470 468 // temporarily access store 471 469 void GetMatrix(const GeneralMatrix*); // used by = and initialise 472 void Eq(const BaseMatrix&, MatrixType); // used by =473 void Eq(const GeneralMatrix&); // version with no conversion474 void Eq(const BaseMatrix&, MatrixType, bool);// used by <<475 void Eq2(const BaseMatrix&, MatrixType); // cut down version of Eq476 470 int search(const BaseMatrix*) const; 477 471 virtual GeneralMatrix* Transpose(TransposedMatrix*, MatrixType); … … 484 478 // CleanUp when the data array has already been deleted 485 479 void PlusEqual(const GeneralMatrix& gm); 480 void SP_Equal(const GeneralMatrix& gm); 486 481 void MinusEqual(const GeneralMatrix& gm); 487 482 void PlusEqual(Real f); … … 490 485 public: 491 486 GeneralMatrix* Evaluate(MatrixType mt=MatrixTypeUnSp); 487 void Eq(const BaseMatrix&, MatrixType); // used by = 488 void Eq(const GeneralMatrix&); // version with no conversion 489 void Eq(const BaseMatrix&, MatrixType, bool);// used by << 490 void Eq2(const BaseMatrix&, MatrixType); // cut down version of Eq 492 491 virtual MatrixType type() const = 0; // type of a matrix 493 492 MatrixType Type() const { return type(); } … … 503 502 const Real* data() const { return store; } 504 503 const Real* const_data() const { return store; } 504 void operator=(Real); // set matrix to constant 505 505 virtual ~GeneralMatrix(); // delete store if set 506 506 void tDelete(); // delete if tag_val permits … … 526 526 void Inject(const GeneralMatrix& GM) { inject(GM); } 527 527 void operator+=(const BaseMatrix&); 528 void SP_eq(const BaseMatrix&); 528 529 void operator-=(const BaseMatrix&); 529 530 void operator*=(const BaseMatrix&); … … 579 580 // ReturnMatrix Reverse() const; // reverse order of elements 580 581 void cleanup(); // to clear store 582 virtual GeneralMatrix* Image() const; // copy of matrix 581 583 582 584 friend class Matrix; … … 625 627 class Matrix : public GeneralMatrix 626 628 { 627 GeneralMatrix* Image() const; // copy of matrix628 629 public: 629 630 Matrix() {} … … 668 669 Real minimum2(int& i, int& j) const; 669 670 void operator+=(const Matrix& M) { PlusEqual(M); } 671 void SP_eq(const Matrix& M) { SP_Equal(M); } 670 672 void operator-=(const Matrix& M) { MinusEqual(M); } 673 void operator+=(const BaseMatrix& M) { GeneralMatrix::operator+=(M); } 674 void SP_eq(const BaseMatrix& M) { GeneralMatrix::SP_eq(M); } 675 void operator-=(const BaseMatrix& M) { GeneralMatrix::operator-=(M); } 671 676 void operator+=(Real f) { GeneralMatrix::Add(f); } 672 677 void operator-=(Real f) { GeneralMatrix::Add(-f); } 673 678 void swap(Matrix& gm) { GeneralMatrix::swap((GeneralMatrix&)gm); } 679 GeneralMatrix* Image() const; // copy of matrix 674 680 friend Real dotproduct(const Matrix& A, const Matrix& B); 675 681 NEW_DELETE(Matrix) … … 679 685 class SquareMatrix : public Matrix 680 686 { 681 GeneralMatrix* Image() const; // copy of matrix682 687 public: 683 688 SquareMatrix() {} … … 701 706 void ReSize(const GeneralMatrix& A) { resize(A); } 702 707 void operator+=(const Matrix& M) { PlusEqual(M); } 708 void SP_eq(const Matrix& M) { SP_Equal(M); } 703 709 void operator-=(const Matrix& M) { MinusEqual(M); } 710 void operator+=(const BaseMatrix& M) { GeneralMatrix::operator+=(M); } 711 void SP_eq(const BaseMatrix& M) { GeneralMatrix::SP_eq(M); } 712 void operator-=(const BaseMatrix& M) { GeneralMatrix::operator-=(M); } 704 713 void operator+=(Real f) { GeneralMatrix::Add(f); } 705 714 void operator-=(Real f) { GeneralMatrix::Add(-f); } 706 715 void swap(SquareMatrix& gm) { GeneralMatrix::swap((GeneralMatrix&)gm); } 716 GeneralMatrix* Image() const; // copy of matrix 707 717 NEW_DELETE(SquareMatrix) 708 718 }; … … 711 721 class nricMatrix : public Matrix 712 722 { 713 GeneralMatrix* Image() const; // copy of matrix714 723 Real** row_pointer; // points to rows 715 724 void MakeRowPointer(); // build rowpointer … … 743 752 void MiniCleanUp(); 744 753 void operator+=(const Matrix& M) { PlusEqual(M); } 754 void SP_eq(const Matrix& M) { SP_Equal(M); } 745 755 void operator-=(const Matrix& M) { MinusEqual(M); } 756 void operator+=(const BaseMatrix& M) { GeneralMatrix::operator+=(M); } 757 void SP_eq(const BaseMatrix& M) { GeneralMatrix::SP_eq(M); } 758 void operator-=(const BaseMatrix& M) { GeneralMatrix::operator-=(M); } 746 759 void operator+=(Real f) { GeneralMatrix::Add(f); } 747 760 void operator-=(Real f) { GeneralMatrix::Add(-f); } 748 761 void swap(nricMatrix& gm); 762 GeneralMatrix* Image() const; // copy of matrix 749 763 NEW_DELETE(nricMatrix) 750 764 }; … … 753 767 class SymmetricMatrix : public GeneralMatrix 754 768 { 755 GeneralMatrix* Image() const; // copy of matrix756 769 public: 757 770 SymmetricMatrix() {} … … 789 802 void ReSize(const GeneralMatrix& A) { resize(A); } 790 803 void operator+=(const SymmetricMatrix& M) { PlusEqual(M); } 804 void SP_eq(const SymmetricMatrix& M) { SP_Equal(M); } 791 805 void operator-=(const SymmetricMatrix& M) { MinusEqual(M); } 806 void operator+=(const BaseMatrix& M) { GeneralMatrix::operator+=(M); } 807 void SP_eq(const BaseMatrix& M) { GeneralMatrix::SP_eq(M); } 808 void operator-=(const BaseMatrix& M) { GeneralMatrix::operator-=(M); } 792 809 void operator+=(Real f) { GeneralMatrix::Add(f); } 793 810 void operator-=(Real f) { GeneralMatrix::Add(-f); } 794 811 void swap(SymmetricMatrix& gm) { GeneralMatrix::swap((GeneralMatrix&)gm); } 812 GeneralMatrix* Image() const; // copy of matrix 795 813 NEW_DELETE(SymmetricMatrix) 796 814 }; … … 799 817 class UpperTriangularMatrix : public GeneralMatrix 800 818 { 801 GeneralMatrix* Image() const; // copy of matrix802 819 public: 803 820 UpperTriangularMatrix() {} … … 837 854 MatrixBandWidth bandwidth() const; 838 855 void operator+=(const UpperTriangularMatrix& M) { PlusEqual(M); } 856 void SP_eq(const UpperTriangularMatrix& M) { SP_Equal(M); } 839 857 void operator-=(const UpperTriangularMatrix& M) { MinusEqual(M); } 858 void operator+=(const BaseMatrix& M) { GeneralMatrix::operator+=(M); } 859 void SP_eq(const BaseMatrix& M) { GeneralMatrix::SP_eq(M); } 860 void operator-=(const BaseMatrix& M) { GeneralMatrix::operator-=(M); } 840 861 void operator+=(Real f) { GeneralMatrix::operator+=(f); } 841 862 void operator-=(Real f) { GeneralMatrix::operator-=(f); } 842 863 void swap(UpperTriangularMatrix& gm) 843 864 { GeneralMatrix::swap((GeneralMatrix&)gm); } 865 GeneralMatrix* Image() const; // copy of matrix 844 866 NEW_DELETE(UpperTriangularMatrix) 845 867 }; … … 848 870 class LowerTriangularMatrix : public GeneralMatrix 849 871 { 850 GeneralMatrix* Image() const; // copy of matrix851 872 public: 852 873 LowerTriangularMatrix() {} … … 885 906 MatrixBandWidth bandwidth() const; 886 907 void operator+=(const LowerTriangularMatrix& M) { PlusEqual(M); } 908 void SP_eq(const LowerTriangularMatrix& M) { SP_Equal(M); } 887 909 void operator-=(const LowerTriangularMatrix& M) { MinusEqual(M); } 910 void operator+=(const BaseMatrix& M) { GeneralMatrix::operator+=(M); } 911 void SP_eq(const BaseMatrix& M) { GeneralMatrix::SP_eq(M); } 912 void operator-=(const BaseMatrix& M) { GeneralMatrix::operator-=(M); } 888 913 void operator+=(Real f) { GeneralMatrix::operator+=(f); } 889 914 void operator-=(Real f) { GeneralMatrix::operator-=(f); } 890 915 void swap(LowerTriangularMatrix& gm) 891 916 { GeneralMatrix::swap((GeneralMatrix&)gm); } 917 GeneralMatrix* Image() const; // copy of matrix 892 918 NEW_DELETE(LowerTriangularMatrix) 893 919 }; … … 896 922 class DiagonalMatrix : public GeneralMatrix 897 923 { 898 GeneralMatrix* Image() const; // copy of matrix899 924 public: 900 925 DiagonalMatrix() {} … … 942 967 // ReturnMatrix Reverse() const; // reverse order of elements 943 968 void operator+=(const DiagonalMatrix& M) { PlusEqual(M); } 969 void SP_eq(const DiagonalMatrix& M) { SP_Equal(M); } 944 970 void operator-=(const DiagonalMatrix& M) { MinusEqual(M); } 971 void operator+=(const BaseMatrix& M) { GeneralMatrix::operator+=(M); } 972 void SP_eq(const BaseMatrix& M) { GeneralMatrix::SP_eq(M); } 973 void operator-=(const BaseMatrix& M) { GeneralMatrix::operator-=(M); } 945 974 void operator+=(Real f) { GeneralMatrix::operator+=(f); } 946 975 void operator-=(Real f) { GeneralMatrix::operator-=(f); } 947 976 void swap(DiagonalMatrix& gm) 948 977 { GeneralMatrix::swap((GeneralMatrix&)gm); } 978 GeneralMatrix* Image() const; // copy of matrix 949 979 NEW_DELETE(DiagonalMatrix) 950 980 }; … … 953 983 class RowVector : public Matrix 954 984 { 955 GeneralMatrix* Image() const; // copy of matrix956 985 public: 957 986 RowVector() { nrows_val = 1; } … … 997 1026 // friend ReturnMatrix GetMatrixRow(Matrix& A, int row); 998 1027 void operator+=(const Matrix& M) { PlusEqual(M); } 1028 void SP_eq(const Matrix& M) { SP_Equal(M); } 999 1029 void operator-=(const Matrix& M) { MinusEqual(M); } 1030 void operator+=(const BaseMatrix& M) { GeneralMatrix::operator+=(M); } 1031 void SP_eq(const BaseMatrix& M) { GeneralMatrix::SP_eq(M); } 1032 void operator-=(const BaseMatrix& M) { GeneralMatrix::operator-=(M); } 1000 1033 void operator+=(Real f) { GeneralMatrix::Add(f); } 1001 1034 void operator-=(Real f) { GeneralMatrix::Add(-f); } 1002 1035 void swap(RowVector& gm) 1003 1036 { GeneralMatrix::swap((GeneralMatrix&)gm); } 1037 GeneralMatrix* Image() const; // copy of matrix 1004 1038 NEW_DELETE(RowVector) 1005 1039 }; … … 1008 1042 class ColumnVector : public Matrix 1009 1043 { 1010 GeneralMatrix* Image() const; // copy of matrix1011 1044 public: 1012 1045 ColumnVector() { ncols_val = 1; } … … 1046 1079 // ReturnMatrix Reverse() const; // reverse order of elements 1047 1080 void operator+=(const Matrix& M) { PlusEqual(M); } 1081 void SP_eq(const Matrix& M) { SP_Equal(M); } 1048 1082 void operator-=(const Matrix& M) { MinusEqual(M); } 1083 void operator+=(const BaseMatrix& M) { GeneralMatrix::operator+=(M); } 1084 void SP_eq(const BaseMatrix& M) { GeneralMatrix::SP_eq(M); } 1085 void operator-=(const BaseMatrix& M) { GeneralMatrix::operator-=(M); } 1049 1086 void operator+=(Real f) { GeneralMatrix::Add(f); } 1050 1087 void operator-=(Real f) { GeneralMatrix::Add(-f); } 1051 1088 void swap(ColumnVector& gm) 1052 1089 { GeneralMatrix::swap((GeneralMatrix&)gm); } 1090 GeneralMatrix* Image() const; // copy of matrix 1053 1091 NEW_DELETE(ColumnVector) 1054 1092 }; … … 1064 1102 void ludcmp(); 1065 1103 void get_aux(CroutMatrix&); // for copying indx[] etc 1066 GeneralMatrix* Image() const; // copy of matrix1067 1104 public: 1068 1105 CroutMatrix(const BaseMatrix&); … … 1088 1125 bool even_exchanges() const { return d; } 1089 1126 void swap(CroutMatrix& gm); 1127 GeneralMatrix* Image() const; // copy of matrix 1090 1128 NEW_DELETE(CroutMatrix) 1091 1129 }; … … 1096 1134 class BandMatrix : public GeneralMatrix 1097 1135 { 1098 GeneralMatrix* Image() const; // copy of matrix1099 1136 protected: 1100 1137 void CornerClear() const; // set unused elements to zero … … 1161 1198 void operator<<(const BaseMatrix& X) { GeneralMatrix::operator<<(X); } 1162 1199 void swap(BandMatrix& gm); 1200 GeneralMatrix* Image() const; // copy of matrix 1163 1201 NEW_DELETE(BandMatrix) 1164 1202 }; … … 1167 1205 class UpperBandMatrix : public BandMatrix 1168 1206 { 1169 GeneralMatrix* Image() const; // copy of matrix1170 1207 public: 1171 1208 UpperBandMatrix() {} … … 1200 1237 void swap(UpperBandMatrix& gm) 1201 1238 { BandMatrix::swap((BandMatrix&)gm); } 1239 GeneralMatrix* Image() const; // copy of matrix 1202 1240 NEW_DELETE(UpperBandMatrix) 1203 1241 }; … … 1206 1244 class LowerBandMatrix : public BandMatrix 1207 1245 { 1208 GeneralMatrix* Image() const; // copy of matrix1209 1246 public: 1210 1247 LowerBandMatrix() {} … … 1239 1276 void swap(LowerBandMatrix& gm) 1240 1277 { BandMatrix::swap((BandMatrix&)gm); } 1278 GeneralMatrix* Image() const; // copy of matrix 1241 1279 NEW_DELETE(LowerBandMatrix) 1242 1280 }; … … 1245 1283 class SymmetricBandMatrix : public GeneralMatrix 1246 1284 { 1247 GeneralMatrix* Image() const; // copy of matrix1248 1285 void CornerClear() const; // set unused elements to zero 1249 1286 short SimpleAddOK(const GeneralMatrix* gm); … … 1300 1337 void operator<<(const BaseMatrix& X) { GeneralMatrix::operator<<(X); } 1301 1338 void swap(SymmetricBandMatrix& gm); 1339 GeneralMatrix* Image() const; // copy of matrix 1302 1340 NEW_DELETE(SymmetricBandMatrix) 1303 1341 }; … … 1314 1352 void ludcmp(); 1315 1353 void get_aux(BandLUMatrix&); // for copying indx[] etc 1316 GeneralMatrix* Image() const; // copy of matrix1317 1354 public: 1318 1355 BandLUMatrix(const BaseMatrix&); … … 1342 1379 MatrixBandWidth bandwidth() const; 1343 1380 void swap(BandLUMatrix& gm); 1381 GeneralMatrix* Image() const; // copy of matrix 1344 1382 NEW_DELETE(BandLUMatrix) 1345 1383 }; … … 1350 1388 class IdentityMatrix : public GeneralMatrix 1351 1389 { 1352 GeneralMatrix* Image() const; // copy of matrix1353 1390 public: 1354 1391 IdentityMatrix() {} … … 1386 1423 void swap(IdentityMatrix& gm) 1387 1424 { GeneralMatrix::swap((GeneralMatrix&)gm); } 1425 GeneralMatrix* Image() const; // copy of matrix 1388 1426 NEW_DELETE(IdentityMatrix) 1389 1427 }; … … 1409 1447 void operator=(const BaseMatrix&); 1410 1448 void operator+=(const BaseMatrix&); 1449 void SP_eq(const BaseMatrix&); 1411 1450 void operator-=(const BaseMatrix&); 1412 1451 void operator*=(const BaseMatrix&); … … 1781 1820 void operator=(const BaseMatrix&); 1782 1821 void operator+=(const BaseMatrix&); 1822 void SP_eq(const BaseMatrix&); 1783 1823 void operator-=(const BaseMatrix&); 1784 1824 void operator=(const GetSubMatrix& m) { operator=((const BaseMatrix&)m); }
Note:
See TracChangeset
for help on using the changeset viewer.