Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Alexander Lapshin
common
Commits
e3ee204c
Commit
e3ee204c
authored
Oct 08, 2018
by
Alexander Lapshin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6bb51a74
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
xalgorithm.h
utils/xalgorithm.h
+3
-3
No files found.
utils/xalgorithm.h
View file @
e3ee204c
...
...
@@ -5,8 +5,8 @@
template
<
typename
T
>
double
golden_section_search
(
const
T
&
f
,
double
a
,
double
b
,
double
tol
)
{
double
invphi
=
(
sqrt
(
5
.
0
)
-
1
)
/
2
.
0
;
double
invphi2
=
(
3
-
sqrt
(
5
.
0
))
/
2
.
0
;
double
invphi
=
(
s
td
::
s
qrt
(
5
.
0
)
-
1
)
/
2
.
0
;
double
invphi2
=
(
3
-
s
td
::
s
qrt
(
5
.
0
))
/
2
.
0
;
a
=
std
::
min
(
a
,
b
);
b
=
std
::
max
(
a
,
b
);
...
...
@@ -17,7 +17,7 @@ template<typename T> double golden_section_search(const T& f, double a, double b
return
(
a
+
b
)
/
2
.
0
;
}
int
n
=
ceil
(
log
(
tol
/
h
)
/
log
(
invphi
)
);
int
n
=
ceil
(
std
::
log
(
tol
/
h
)
/
std
::
log
(
invphi
)
);
double
c
=
a
+
invphi2
*
h
;
double
d
=
a
+
invphi
*
h
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment