Skip to content

Commit b6af411

Browse files
authored
Add files via upload
1 parent 3dcf587 commit b6af411

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

numerical.h

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff 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+
}
352369
template <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-
}
708717
template <class DB> void Resize(Matrix<DB> &A,int r,int c)
709718
{
710719
if(r<A.row_num)

0 commit comments

Comments
 (0)