📄 lsqnonlin.c
字号:
* nlsq(funfcn,x,verbosity,options,f,JAC,YDATA,caller,varargin{:});
*/
mlfAssign(
&x,
mlfOptim_private_nlsq(
FVAL,
JACOB,
EXITFLAG,
OUTPUT,
funfcn,
x,
verbosity,
options,
f,
JAC,
YDATA,
caller,
mlfIndexRef(varargin, "{?}", mlfCreateColonIndex()),
NULL));
/*
* LAMBDA.upper=[]; LAMBDA.lower=[];
*/
mlfIndexAssign(LAMBDA, ".upper", mclCreateEmptyArray());
mlfIndexAssign(LAMBDA, ".lower", mclCreateEmptyArray());
/*
* end
*/
}
/*
* Resnorm = FVAL'*FVAL;
*/
mlfAssign(Resnorm, mlfMtimes(mlfCtranspose(*FVAL), *FVAL));
/*
*
* % Reset FVAL to shape of the user-function, fuser
* FVAL = reshape(FVAL,size(fuser));
*/
mlfAssign(
FVAL, mlfReshape(*FVAL, mlfSize(mclValueVarargout(), fuser, NULL), NULL));
/*
*
* %--end of LSQNONLIN--
*
* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
return_:
mclValidateOutputs(
"lsqnonlin",
7,
nargout_,
&x,
Resnorm,
FVAL,
EXITFLAG,
OUTPUT,
LAMBDA,
JACOB);
mxDestroyArray(HESS);
mxDestroyArray(JAC);
mxDestroyArray(Jcols);
mxDestroyArray(Jrows);
mxDestroyArray(Jstr);
mxDestroyArray(LB);
mxDestroyArray(UB);
mxDestroyArray(YDATA);
mxDestroyArray(ans);
mxDestroyArray(c);
mxDestroyArray(cGRAD);
mxDestroyArray(caller);
mxDestroyArray(ceq);
mxDestroyArray(ceqGRAD);
mxDestroyArray(computeLambda);
mxDestroyArray(confcn);
mxDestroyArray(constflag);
mxDestroyArray(defaultopt);
mxDestroyArray(diagnostics);
mxDestroyArray(errmsg);
mxDestroyArray(errstr);
mxDestroyArray(f);
mxDestroyArray(funfcn);
mxDestroyArray(fuser);
mxDestroyArray(gradconstflag);
mxDestroyArray(gradflag);
mxDestroyArray(hessflag);
mxDestroyArray(l);
mxDestroyArray(lFinite);
mxDestroyArray(large);
mxDestroyArray(lin_eq);
mxDestroyArray(lin_ineq);
mxDestroyArray(line_search);
mxDestroyArray(medium);
mxDestroyArray(msg);
mxDestroyArray(nargin_);
mxDestroyArray(nargout);
mxDestroyArray(nfun);
mxDestroyArray(non_eq);
mxDestroyArray(non_ineq);
mxDestroyArray(numberOfVariables);
mxDestroyArray(options);
mxDestroyArray(u);
mxDestroyArray(uFinite);
mxDestroyArray(verbosity);
mxDestroyArray(warnstr);
mxDestroyArray(xstart);
return x;
}
/*
* The function "mlfNLsqnonlin" contains the nargout interface for the
* "lsqnonlin" M-function from file "C:\MATLABR11\toolbox\optim\lsqnonlin.m"
* (lines 1-254). This interface is only produced if the M-function uses the
* special variable "nargout". The nargout interface allows the number of
* requested outputs to be specified via the nargout argument, as opposed to
* the normal interface which dynamically calculates the number of outputs
* based on the number of non-NULL inputs it receives. This function processes
* any input arguments and passes them to the implementation version of the
* function, appearing above.
*/
mxArray * mlfNLsqnonlin(int nargout,
mxArray * * Resnorm,
mxArray * * FVAL,
mxArray * * EXITFLAG,
mxArray * * OUTPUT,
mxArray * * LAMBDA,
mxArray * * JACOB,
mxArray * FUN,
mxArray * x_,
mxArray * LB,
mxArray * UB,
mxArray * options,
...) {
mxArray * varargin = mclUnassigned();
mxArray * x = mclGetUninitializedArray();
mxArray * Resnorm__ = mclGetUninitializedArray();
mxArray * FVAL__ = mclGetUninitializedArray();
mxArray * EXITFLAG__ = mclGetUninitializedArray();
mxArray * OUTPUT__ = mclGetUninitializedArray();
mxArray * LAMBDA__ = mclGetUninitializedArray();
mxArray * JACOB__ = mclGetUninitializedArray();
mlfVarargin(&varargin, options, 0);
mlfEnterNewContext(
6,
-6,
Resnorm,
FVAL,
EXITFLAG,
OUTPUT,
LAMBDA,
JACOB,
FUN,
x_,
LB,
UB,
options,
varargin);
x
= Mlsqnonlin(
&Resnorm__,
&FVAL__,
&EXITFLAG__,
&OUTPUT__,
&LAMBDA__,
&JACOB__,
nargout,
FUN,
x_,
LB,
UB,
options,
varargin);
mlfRestorePreviousContext(
6,
5,
Resnorm,
FVAL,
EXITFLAG,
OUTPUT,
LAMBDA,
JACOB,
FUN,
x_,
LB,
UB,
options);
mxDestroyArray(varargin);
if (Resnorm != NULL) {
mclCopyOutputArg(Resnorm, Resnorm__);
} else {
mxDestroyArray(Resnorm__);
}
if (FVAL != NULL) {
mclCopyOutputArg(FVAL, FVAL__);
} else {
mxDestroyArray(FVAL__);
}
if (EXITFLAG != NULL) {
mclCopyOutputArg(EXITFLAG, EXITFLAG__);
} else {
mxDestroyArray(EXITFLAG__);
}
if (OUTPUT != NULL) {
mclCopyOutputArg(OUTPUT, OUTPUT__);
} else {
mxDestroyArray(OUTPUT__);
}
if (LAMBDA != NULL) {
mclCopyOutputArg(LAMBDA, LAMBDA__);
} else {
mxDestroyArray(LAMBDA__);
}
if (JACOB != NULL) {
mclCopyOutputArg(JACOB, JACOB__);
} else {
mxDestroyArray(JACOB__);
}
return mlfReturnValue(x);
}
/*
* The function "mlfLsqnonlin" contains the normal interface for the
* "lsqnonlin" M-function from file "C:\MATLABR11\toolbox\optim\lsqnonlin.m"
* (lines 1-254). This function processes any input arguments and passes them
* to the implementation version of the function, appearing above.
*/
mxArray * mlfLsqnonlin(mxArray * * Resnorm,
mxArray * * FVAL,
mxArray * * EXITFLAG,
mxArray * * OUTPUT,
mxArray * * LAMBDA,
mxArray * * JACOB,
mxArray * FUN,
mxArray * x_,
mxArray * LB,
mxArray * UB,
mxArray * options,
...) {
mxArray * varargin = mclUnassigned();
int nargout = 1;
mxArray * x = mclGetUninitializedArray();
mxArray * Resnorm__ = mclGetUninitializedArray();
mxArray * FVAL__ = mclGetUninitializedArray();
mxArray * EXITFLAG__ = mclGetUninitializedArray();
mxArray * OUTPUT__ = mclGetUninitializedArray();
mxArray * LAMBDA__ = mclGetUninitializedArray();
mxArray * JACOB__ = mclGetUninitializedArray();
mlfVarargin(&varargin, options, 0);
mlfEnterNewContext(
6,
-6,
Resnorm,
FVAL,
EXITFLAG,
OUTPUT,
LAMBDA,
JACOB,
FUN,
x_,
LB,
UB,
options,
varargin);
if (Resnorm != NULL) {
++nargout;
}
if (FVAL != NULL) {
++nargout;
}
if (EXITFLAG != NULL) {
++nargout;
}
if (OUTPUT != NULL) {
++nargout;
}
if (LAMBDA != NULL) {
++nargout;
}
if (JACOB != NULL) {
++nargout;
}
x
= Mlsqnonlin(
&Resnorm__,
&FVAL__,
&EXITFLAG__,
&OUTPUT__,
&LAMBDA__,
&JACOB__,
nargout,
FUN,
x_,
LB,
UB,
options,
varargin);
mlfRestorePreviousContext(
6,
5,
Resnorm,
FVAL,
EXITFLAG,
OUTPUT,
LAMBDA,
JACOB,
FUN,
x_,
LB,
UB,
options);
mxDestroyArray(varargin);
if (Resnorm != NULL) {
mclCopyOutputArg(Resnorm, Resnorm__);
} else {
mxDestroyArray(Resnorm__);
}
if (FVAL != NULL) {
mclCopyOutputArg(FVAL, FVAL__);
} else {
mxDestroyArray(FVAL__);
}
if (EXITFLAG != NULL) {
mclCopyOutputArg(EXITFLAG, EXITFLAG__);
} else {
mxDestroyArray(EXITFLAG__);
}
if (OUTPUT != NULL) {
mclCopyOutputArg(OUTPUT, OUTPUT__);
} else {
mxDestroyArray(OUTPUT__);
}
if (LAMBDA != NULL) {
mclCopyOutputArg(LAMBDA, LAMBDA__);
} else {
mxDestroyArray(LAMBDA__);
}
if (JACOB != NULL) {
mclCopyOutputArg(JACOB, JACOB__);
} else {
mxDestroyArray(JACOB__);
}
return mlfReturnValue(x);
}
/*
* The function "mlfVLsqnonlin" contains the void interface for the "lsqnonlin"
* M-function from file "C:\MATLABR11\toolbox\optim\lsqnonlin.m" (lines 1-254).
* The void interface is only produced if the M-function uses the special
* variable "nargout", and has at least one output. The void interface function
* specifies zero output arguments to the implementation version of the
* function, and in the event that the implementation version still returns an
* output (which, in MATLAB, would be assigned to the "ans" variable), it
* deallocates the output. This function processes any input arguments and
* passes them to the implementation version of the function, appearing above.
*/
void mlfVLsqnonlin(mxArray * FUN,
mxArray * x_,
mxArray * LB,
mxArray * UB,
mxArray * options,
...) {
mxArray * varargin = mclUnassigned();
mxArray * x = mclUnassigned();
mxArray * Resnorm = mclUnassigned();
mxArray * FVAL = mclUnassigned();
mxArray * EXITFLAG = mclUnassigned();
mxArray * OUTPUT = mclUnassigned();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -