Skip to content
Snippets Groups Projects
Commit 84128da8 authored by Mark Jenkinson's avatar Mark Jenkinson
Browse files

Added addrow function - adds a row at the bottom of a matrix

parent 9d73903c
No related branches found
No related tags found
No related merge requests found
......@@ -667,6 +667,21 @@ namespace MISCMATHS {
return r;
}
int addrow(Matrix& m, int ncols)
{
if (m.Nrows()==0) {
Matrix mm(1,ncols);
mm=0;
m = mm;
} else {
Matrix mm(m.Nrows()+1,ncols);
mm = 0;
mm.SubMatrix(1,m.Nrows(),1,ncols) = m;
m = mm;
}
return 0;
}
//------------------------------------------------------------------------//
......
......@@ -134,6 +134,7 @@ namespace MISCMATHS {
void reshape(Matrix& r, const Matrix& m, int nrows, int ncols);
ReturnMatrix reshape(const Matrix& m, int nrows, int ncols);
int addrow(Matrix& m, int ncols);
int construct_rotmat_euler(const ColumnVector& params, int n, Matrix& aff);
int construct_rotmat_euler(const ColumnVector& params, int n, Matrix& aff,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment