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