isyegatech
Technical User
Hi everyone, I am trying to finding the root of a nonlinear system using the fortran 90 subroutine "newt" provided in the book, Numerical Recipes.
I try to substitute the statement [highlight #D3D7CF]GEMM[/highlight], provided in Math Kernel Library, for the fortran built-in statement [highlight #D3D7CF]MATMUL[/highlight]: that is,
replacing [highlight #FCE94F]g)=matmul(fvec),fjac,)[/highlight]
with [highlight #FCE94F]call gemm(fvec),fjac,,g))[/highlight].
However, this change leads to a compiling error that says "Could not resolve generic procedure gemm." I am sure the linking setup in my visual studio's properties page is correct, because in the meantime the use of other MKL functions works normally.
The [highlight #D3D7CF]fjac[/highlight] is a generic real type array used for the Jacobian matrix. The [highlight #D3D7CF]fvec[/highlight] is a target to which a pointer [highlight #D3D7CF]fmin_fvecp[/highlight] points. The pointer is declared in a module's internal function [highlight #D3D7CF]fmin[/highlight]. The module and the associated external function [highlight #D3D7CF]funcv[/highlight] that defines the nonlinear system are shown as follows:
MODULE model
(...)
REAL(WP), DIMENSION), POINTER :: fmin_fvecp
CONTAINS
FUNCTION fmin(x)
IMPLICIT NONE
REAL(WP), DIMENSION), INTENT(IN) :: x
REAL(WP) :: fmin
INTERFACE
FUNCTION funcv(x)
USE mkl95_precision, ONLY: WP => DP
IMPLICIT NONE
REAL(WP), DIMENSION), INTENT(IN) :: x
REAL(WP), DIMENSION(size(x)) :: funcv
END FUNCTION funcv
END INTERFACE
if (.not. associated(fmin_fvecp)) call &
nrerror('fmin: problem with pointer for returned values')
fmin_fvecp=funcv(x)
fmin=0.5_wp*dot(fmin_fvecp,fmin_fvecp)
END FUNCTION fmin
(...)
END MODULE model
FUNCTION funcv(x)
USE mkl95_precision, ONLY: WP => DP
IMPLICIT NONE
REAL(WP), DIMENSION), INTENT(IN) :: x
REAL(WP), DIMENSION(size(x)) :: funcv
funcv(1)=x(1)**2+x(2)**2-2.0_sp
funcv(2)=exp(x(1)-1.0_wp)+x(2)**3-2.0_wp
END FUNCTION funcv
Please let me know what's wrong with the statement call gemm(fvec),fjac,,g)). Thank you for the help.
Lee
I try to substitute the statement [highlight #D3D7CF]GEMM[/highlight], provided in Math Kernel Library, for the fortran built-in statement [highlight #D3D7CF]MATMUL[/highlight]: that is,
replacing [highlight #FCE94F]g)=matmul(fvec),fjac,)[/highlight]
with [highlight #FCE94F]call gemm(fvec),fjac,,g))[/highlight].
However, this change leads to a compiling error that says "Could not resolve generic procedure gemm." I am sure the linking setup in my visual studio's properties page is correct, because in the meantime the use of other MKL functions works normally.
The [highlight #D3D7CF]fjac[/highlight] is a generic real type array used for the Jacobian matrix. The [highlight #D3D7CF]fvec[/highlight] is a target to which a pointer [highlight #D3D7CF]fmin_fvecp[/highlight] points. The pointer is declared in a module's internal function [highlight #D3D7CF]fmin[/highlight]. The module and the associated external function [highlight #D3D7CF]funcv[/highlight] that defines the nonlinear system are shown as follows:
MODULE model
(...)
REAL(WP), DIMENSION), POINTER :: fmin_fvecp
CONTAINS
FUNCTION fmin(x)
IMPLICIT NONE
REAL(WP), DIMENSION), INTENT(IN) :: x
REAL(WP) :: fmin
INTERFACE
FUNCTION funcv(x)
USE mkl95_precision, ONLY: WP => DP
IMPLICIT NONE
REAL(WP), DIMENSION), INTENT(IN) :: x
REAL(WP), DIMENSION(size(x)) :: funcv
END FUNCTION funcv
END INTERFACE
if (.not. associated(fmin_fvecp)) call &
nrerror('fmin: problem with pointer for returned values')
fmin_fvecp=funcv(x)
fmin=0.5_wp*dot(fmin_fvecp,fmin_fvecp)
END FUNCTION fmin
(...)
END MODULE model
FUNCTION funcv(x)
USE mkl95_precision, ONLY: WP => DP
IMPLICIT NONE
REAL(WP), DIMENSION), INTENT(IN) :: x
REAL(WP), DIMENSION(size(x)) :: funcv
funcv(1)=x(1)**2+x(2)**2-2.0_sp
funcv(2)=exp(x(1)-1.0_wp)+x(2)**3-2.0_wp
END FUNCTION funcv
Please let me know what's wrong with the statement call gemm(fvec),fjac,,g)). Thank you for the help.
Lee