File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -349,6 +349,23 @@ template<class DB> DB Matrix<DB>::operator()(int r) const
349349{
350350 return (*this )(r,0 );
351351}
352+ template <class DB > const vector<DB>& Matrix<DB>::operator [](int r)
353+ {
354+ if (r>=row_num)
355+ {
356+ cerr << " 错误:矩阵下标越界" << ' \n ' ;
357+ return value[0 ];
358+ }
359+ return value[r];
360+ }
361+ template <class DB > int RowSize (const Matrix<DB> &a)
362+ {
363+ return a.row_num ;
364+ }
365+ template <class DB > int ColumnSize (const Matrix<DB> &a)
366+ {
367+ return a.column_num ;
368+ }
352369template <class DB > bool operator ==(const Matrix<DB> &A, const Matrix<DB> &B)
353370{
354371 int r=A.row_num ;
@@ -697,14 +714,6 @@ template<class DB> Matrix<DB> Eye(int n)
697714 }
698715 return e;
699716}
700- template <class DB > int RowSize (const Matrix<DB> &a)
701- {
702- return a.row_num ;
703- }
704- template <class DB > int ColumnSize (const Matrix<DB> &a)
705- {
706- return a.column_num ;
707- }
708717template <class DB > void Resize (Matrix<DB> &A,int r,int c)
709718{
710719 if (r<A.row_num )
You can’t perform that action at this time.
0 commit comments