I am trying to use column major order to a 2d matrix which I am using as 1d.
int N=3,R=2;
for (int i=0;i<N;i++){
for (int j=0;j<R;j++){
//printf("\nX[%d]=%d\t",i+j*N,res[i+j*N]); //column major
// printf("\nX[%d]=%d\t",i*R+j,res[i*R+j]); //row major
}
printf("\n");
}
but the column major doesn not work as it should.
Also,if I want to substract only column elements from a matrix (2d which is used as 1d),how should I approach?
Because ,that's why I am trying to present my matrix as column major order and then use its columns.