Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
dynare
Commits
380fd84c
Verified
Commit
380fd84c
authored
3 years ago
by
Stéphane Adjemian
Browse files
Options
Downloads
Patches
Plain Diff
Fix NLS estimation routine.
Closes
#1798
parent
7c0af1ce
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#5866
passed
3 years ago
Stage: build
Stage: test
Stage: pkg
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/+estimate/nls.m
+19
-2
19 additions, 2 deletions
matlab/+estimate/nls.m
with
19 additions
and
2 deletions
matlab/+estimate/nls.m
+
19
−
2
View file @
380fd84c
...
@@ -136,10 +136,27 @@ else
...
@@ -136,10 +136,27 @@ else
end
end
end
end
% Remove residuals from the equation. Note that a plus or minus will
% Remove residuals from the equation. Note that a plus or minus will remain in the equation
% remain in the equation, but this seems to be without consequence.
rhs
=
regexprep
(
rhs
,
rname
,
''
);
rhs
=
regexprep
(
rhs
,
rname
,
''
);
% FIXME The JSON output for rhs (with aux variables substitutions) is not always
% the same regarding to the position of the residual. If the residual appears at
% the end of the equation, after the removal of rname the rhs will end with a +
% symbol which will result in a crash later when evaluating the sum of square
% residuals. If the residual appears at the begining of the equation, after the
% removal of rname the rhs will begin with a + symbol which is just awful (but
% will not cause any trouble).
% Remove trailing + (if any, introduced when removing residual)
if
isequal
(
rhs
(
end
),
'+'
)
rhs
=
rhs
(
1
:
end
-
1
);
end
% Remove leading + (if any, introduced when removing residual)
if
isequal
(
rhs
(
1
),
'+'
)
rhs
=
rhs
(
2
:
end
);
end
%
%
% Rewrite and print the equation.
% Rewrite and print the equation.
%
%
...
...
This diff is collapsed.
Click to expand it.
Stéphane Adjemian
@stepan-a
mentioned in commit
fdebbd89
·
3 years ago
mentioned in commit
fdebbd89
mentioned in commit fdebbd898d67fecba3e3994ba7a8755f7ce91805
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment