Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
alta
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alta
alta
Commits
c53aa578
Commit
c53aa578
authored
Nov 23, 2013
by
Laurent Belcour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating the norms to avoid undefined behaviour
parent
eeb22779
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
sources/core/function.cpp
sources/core/function.cpp
+5
-4
No files found.
sources/core/function.cpp
View file @
c53aa578
...
...
@@ -144,7 +144,7 @@ double function::L2_distance(const data* d) const
for
(
int
i
=
0
;
i
<
d
->
size
();
++
i
)
{
vec
dat
=
d
->
get
(
i
);
vec
x
(
dimX
()),
y
(
d
->
d
imY
());
vec
x
(
dimX
()),
y
(
dimY
());
if
(
input_parametrization
()
==
params
::
UNKNOWN_INPUT
)
{
...
...
@@ -156,7 +156,7 @@ double function::L2_distance(const data* d) const
}
memcpy
(
&
y
[
0
],
&
dat
[
d
->
dimX
()],
dimY
()
*
sizeof
(
double
));
l2_dist
+=
std
::
pow
(
norm
(
y
-
value
(
x
)),
2
);
l2_dist
+=
std
::
pow
(
norm
(
y
-
value
(
x
)),
2
);
}
l2_dist
=
std
::
sqrt
(
l2_dist
/
d
->
size
());
return
l2_dist
;
...
...
@@ -165,13 +165,14 @@ double function::L2_distance(const data* d) const
//! \brief Linf norm to data.
double
function
::
Linf_distance
(
const
data
*
d
)
const
{
vec
mean
(
dimY
()),
var
(
dimY
());
vec
mean
=
vec
::
Zero
(
dimY
());
vec
var
=
vec
::
Zero
(
dimY
());
double
linf_dist
=
0.0
;
for
(
int
i
=
0
;
i
<
d
->
size
();
++
i
)
{
vec
dat
=
d
->
get
(
i
);
vec
x
(
dimX
()),
y
(
d
->
d
imY
());
vec
x
(
dimX
()),
y
(
dimY
());
if
(
input_parametrization
()
==
params
::
UNKNOWN_INPUT
)
{
...
...
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