I would like to copy the 2 matrices. With a copy element by element through 2 for loops (row and column), after several mathematical operations and copies the final result is correct while using "memcpy" the final result is wrong in the decimal places. The code is as follows.
double **L_original;
double **L;
int nF,nU;
L = new double*[nU]();
L_original = new double*[nU]();
for(int i=0; i<nU; i++){
L_original[i] = new double[nF]();
L[i] = new double[nF]();
}
// copy element to element
/*for(int i=0; i<nU; i++)
for(int j=0; j<nF; j++)
L[i][j] = L_original[i][j];*/
memcpy(L, L_original, sizeof(L_original));
This is the correct result:Matrix Correct This is the output: output when using memcpy