-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
I have tried to use the submatrix method for initializing a 10 x 5 matrix N from the first columns and rows of the 10 x 10 matrix M.
I am probably missing something, since it seems that N is not assigned the expected values of M (all ones). Any suggestions?
#include <iostream>
#include <string>
#include "gurls++/gvec.h"
#include "gurls++/gmat2d.h"
using namespace gurls;
using namespace std;
typedef double T;
int main()
{
gMat2D<T> M(gMat2D<T>::zeros(10,10)+1);
cout << "M initialized: " << endl << M << endl;
gMat2D<T> N(gMat2D<T>::zeros(10,5));
// Initialize N
M.submatrix(N , 10 , 5);
cout << "N initialized: " << endl << N << endl;
}Output:
kammo@kammo-Latitude-E5540:~/Repos/gurlssandbox/build/bin$ ./submatrixTest
M initialized:
[ 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 ]
N initialized:
[ 0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0 ]
Thank you.
Metadata
Metadata
Assignees
Labels
No labels