madmat88
08-19-2008, 04:15 AM
Hi,
I try to use the Newton Raphson method to resolve a system. I use the method describe in chapter 9.6, and the function mnewt.
I must define my matrix fjac in the usrfun function.
My problem is I don't know how I must write this matrix.
I try with
void usrfun(double *x,int n, double *fvec, double **fjac)
{
int j;
for (j=0;j<(n*n);j++){
fjac[j]=1; /*for example*/
}
}
or I try
for (j=0;j<n;j++){
for (k=0;k<n;k++){
fjac[j][k]=1;
}
}
But the both solutions make problem
Someone knows how to define a matrix in C code for numerical recipes?
Best regard
Mathias
I try to use the Newton Raphson method to resolve a system. I use the method describe in chapter 9.6, and the function mnewt.
I must define my matrix fjac in the usrfun function.
My problem is I don't know how I must write this matrix.
I try with
void usrfun(double *x,int n, double *fvec, double **fjac)
{
int j;
for (j=0;j<(n*n);j++){
fjac[j]=1; /*for example*/
}
}
or I try
for (j=0;j<n;j++){
for (k=0;k<n;k++){
fjac[j][k]=1;
}
}
But the both solutions make problem
Someone knows how to define a matrix in C code for numerical recipes?
Best regard
Mathias