1 C~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 SUBROUTINE mexFunction
( nlhs
, plhs
, nrhs
, prhs
)
3 C~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 C Matlab Gateway for the Sparse Hessian
5 C~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 INTEGER plhs
(*), prhs
(*)
9 INTEGER mxGetPr
, mxCreateFull
, mxGetM
, mxgetN
10 INTEGER VPtr
, FPtr
, RPtr
, HESSPtr
11 KPP_REAL V
(KPP_NVAR
), F
(KPP_NFIX
), RCT
(KPP_NREACT
)
12 KPP_REAL HESS
(KPP_NHESS
)
14 C Check for the right number of input arguments
15 IF ( nrhs
.ne
. 3 ) THEN
16 CALL mexErrMsgTxt
('Hessian requires 3 input vectors:
17 &V(KPP_NVAR), F(KPP_NFIX), RCT(KPP_NREACT)')
19 C Check for the right number of output arguments
20 IF ( nlhs
.ne
. 1 ) THEN
21 CALL mexErrMsgTxt
('Hessian requires 1 output vector:
25 plhs
(1) = mxCreateDoubleMatrix
(KPP_NHESS
,1,0)
27 VPtr
= mxGetPr
(prhs
(1))
28 CALL mxCopyPtrToReal8
(VPtr
,V
,KPP_NVAR
)
30 FPtr
= mxGetPr
(prhs
(2))
31 CALL mxCopyPtrToReal8
(FPtr
,F
,KPP_NFIX
)
33 RPtr
= mxGetPr
(prhs
(3))
34 CALL mxCopyPtrToReal8
(RPtr
,RCT
,KPP_NREACT
)
36 HESSPtr
= mxGetPr
(plhs
(1))
38 CALL Hessian
( V
, F
, RCT
, HESS
)
40 CALL mxCopyReal8ToPtr
(HESS
, HESSPtr
, KPP_NHESS
)