Displaying 5 results from an estimated 5 matches for "rjac".
Did you mean:
jac
2017 Feb 09
3
Ancient C /Fortran code linpack error
...ile nleqslv.c in function fcnjac:
> for (j = 0; j < *n; j++)
> for (i = 0; i < *n; i++) {
> if( !R_FINITE(REAL(sexp_fjac)[(*n)*j + i]) )
> error("non-finite value(s) returned by jacobian (row=%d,col=%d)",i+1,j+1);
> rjac[(*ldr)*j + i] = REAL(sexp_fjac)[(*n)*j + i];
> }
A minor hint on that: While REAL(.) (or INTEGER(.) ...) is really cheap in
the R sources themselves, that is not the case in package code.
Hence, not only nicer to read but even faster is
double *fj = REAL(sexp_fjac);
for (j = 0...
2017 Feb 10
1
Ancient C /Fortran code linpack error
...>>> for (j = 0; j < *n; j++)
>>> for (i = 0; i < *n; i++) {
>>> if( !R_FINITE(REAL(sexp_fjac)[(*n)*j + i]) )
>>> error("non-finite value(s) returned by jacobian (row=%d,col=%d)",i+1,j+1);
>>> rjac[(*ldr)*j + i] = REAL(sexp_fjac)[(*n)*j + i];
>>> }
>>
>> A minor hint on that: While REAL(.) (or INTEGER(.) ...) is really cheap in
>> the R sources themselves, that is not the case in package code.
>>
>> Hence, not only nicer to read but even fas...
2017 Feb 09
3
Ancient C /Fortran code linpack error
In my package 'glmmML' I'm using old C code and linpack in the
optimizing procedure. Specifically, one part of the code looks like this:
F77_CALL(dpoco)(*hessian, &bdim, &bdim, &rcond, work, info);
if (*info == 0){
F77_CALL(dpodi)(*hessian, &bdim, &bdim, det, &job);
........
This usually works OK, but with an ill-conditioned data
2017 Feb 10
0
Ancient C /Fortran code linpack error
...n fcnjac:
>
>> for (j = 0; j < *n; j++)
>> for (i = 0; i < *n; i++) {
>> if( !R_FINITE(REAL(sexp_fjac)[(*n)*j + i]) )
>> error("non-finite value(s) returned by jacobian (row=%d,col=%d)",i+1,j+1);
>> rjac[(*ldr)*j + i] = REAL(sexp_fjac)[(*n)*j + i];
>> }
>
> A minor hint on that: While REAL(.) (or INTEGER(.) ...) is really cheap in
> the R sources themselves, that is not the case in package code.
>
> Hence, not only nicer to read but even faster is
>
> double...
2017 Feb 09
0
Ancient C /Fortran code linpack error
...; jacobian like this in file nleqslv.c in function fcnjac:
for (j = 0; j < *n; j++)
for (i = 0; i < *n; i++) {
if( !R_FINITE(REAL(sexp_fjac)[(*n)*j + i]) )
error("non-finite value(s) returned by jacobian (row=%d,col=%d)",i+1,j+1);
rjac[(*ldr)*j + i] = REAL(sexp_fjac)[(*n)*j + i];
}
There may be a more compact way with a macro in the R headers.
I feel that If other code can't handle non-finite values: then test.
Berend Hasselman