Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Yuhao Liu
ogs
Commits
ce910d61
Commit
ce910d61
authored
11 years ago
by
Norihiro Watanabe
Browse files
Options
Downloads
Patches
Plain Diff
rename template parameter names and add documententation
parent
23dcafc6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MathLib/Nonlinear/Picard-impl.h
+3
-3
3 additions, 3 deletions
MathLib/Nonlinear/Picard-impl.h
MathLib/Nonlinear/Picard.h
+11
-3
11 additions, 3 deletions
MathLib/Nonlinear/Picard.h
with
14 additions
and
6 deletions
MathLib/Nonlinear/Picard-impl.h
+
3
−
3
View file @
ce910d61
...
...
@@ -27,8 +27,8 @@ Picard::Picard()
{
}
template
<
class
F_PROBLEM
,
class
T_VALUE
>
bool
Picard
::
solve
(
F_PROBLEM
&
g
,
const
T_VALUE
&
x0
,
T_VALUE
&
x_new
)
template
<
class
T_FUNCTOR
,
class
T_VALUE
>
bool
Picard
::
solve
(
T_FUNCTOR
&
functor
,
const
T_VALUE
&
x0
,
T_VALUE
&
x_new
)
{
T_VALUE
x_old
(
x0
);
T_VALUE
dx
(
x0
);
...
...
@@ -45,7 +45,7 @@ bool Picard::solve(F_PROBLEM &g, const T_VALUE &x0, T_VALUE &x_new)
double
abs_error
=
-
1.
;
double
rel_error
=
-
1.
;
for
(
itr_cnt
=
0
;
itr_cnt
<
_max_itr
;
itr_cnt
++
)
{
g
(
x_old
,
x_new
);
functor
(
x_old
,
x_new
);
dx
=
x_new
;
dx
-=
x_old
;
...
...
This diff is collapsed.
Click to expand it.
MathLib/Nonlinear/Picard.h
+
11
−
3
View file @
ce910d61
...
...
@@ -49,13 +49,21 @@ public:
/**
* solve a nonlinear problem
*
* \param g Fixed point function object (x=g(x))
* \tparam T_FUNCTOR Function object type which supports an
* operator ()(\f$x_k\f$, \f$x_{k+1}\f$). \f$x_k\f$ is a previous iteration
* step value. \f$x_{k+1}\f$ is a new solution.
* \tparam T_VALUE Data type of \f$x_k\f$ and \f$x_{k+1}\f$.
* Both scalar and vector types are available as far as the following conditions
* are satisfied
* - T_VALUE has a copy constructor (for non-primitive data types)
* - MathLib::norm(T_VALUE) exists
* \param functor Fixed point function object (\f$x_{k+1}=g(x_k)\f$)
* \param x0 Initial guess
* \param x_new Solution
* \return true if converged
*/
template
<
class
F_PROBLEM
,
class
T_VALUE
>
bool
solve
(
F_PROBLEM
&
g
,
const
T_VALUE
&
x0
,
T_VALUE
&
x_new
);
template
<
class
T_FUNCTOR
,
class
T_VALUE
>
bool
solve
(
T_FUNCTOR
&
functor
,
const
T_VALUE
&
x0
,
T_VALUE
&
x_new
);
/// return the number of iterations
std
::
size_t
getNIterations
()
const
{
return
_n_iterations
;
}
...
...
This diff is collapsed.
Click to expand it.
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