Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
lib4neuro
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
MolDyn
lib4neuro
Commits
88b53c6c
Commit
88b53c6c
authored
6 years ago
by
Martin Beseda
Browse files
Options
Downloads
Patches
Plain Diff
FIX: Fixed bug with division by 0.
parent
66ed16af
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
src/DataSet/DataSet.cpp
+18
-2
18 additions, 2 deletions
src/DataSet/DataSet.cpp
src/DataSet/DataSet.h
+1
-1
1 addition, 1 deletion
src/DataSet/DataSet.h
with
19 additions
and
3 deletions
src/DataSet/DataSet.cpp
+
18
−
2
View file @
88b53c6c
...
...
@@ -108,7 +108,15 @@ namespace lib4neuro {
"is of different dimensionality!"
);
}
double
frac
=
(
upper_bound
-
lower_bound
)
/
(
size
-
1
);
double
frac
;
if
(
size
<
1
)
{
THROW_INVALID_ARGUMENT_ERROR
(
"Size of added data has to be >=1 !"
);
}
else
if
(
size
==
1
)
{
frac
=
1
;
}
else
{
frac
=
(
upper_bound
-
lower_bound
)
/
(
size
-
1
);
}
std
::
vector
<
double
>
inp
,
out
;
out
=
{
output
};
...
...
@@ -128,9 +136,17 @@ namespace lib4neuro {
std
::
vector
<
std
::
vector
<
double
>>
grid
;
std
::
vector
<
double
>
tmp
;
double
frac
;
if
(
no_elems_in_one_dim
<
1
)
{
THROW_INVALID_ARGUMENT_ERROR
(
"Number of elements in one dimension has to be >=1 !"
);
}
for
(
unsigned
int
i
=
0
;
i
<
bounds
.
size
();
i
+=
2
)
{
frac
=
(
bounds
[
i
]
+
bounds
[
i
+
1
])
/
(
no_elems_in_one_dim
-
1
);
if
(
no_elems_in_one_dim
==
1
)
{
frac
=
1
;
}
else
{
frac
=
(
bounds
[
i
]
-
bounds
[
i
+
1
])
/
(
no_elems_in_one_dim
-
1
);
}
tmp
.
clear
();
for
(
double
j
=
bounds
[
i
];
j
<=
bounds
[
i
+
1
];
j
+=
frac
)
{
tmp
.
emplace_back
(
j
);
...
...
This diff is collapsed.
Click to expand it.
src/DataSet/DataSet.h
+
1
−
1
View file @
88b53c6c
...
...
@@ -94,7 +94,7 @@ namespace lib4neuro {
* Constructor for an empty DataSet
*/
LIB4NEURO_API
DataSet
();
/**
* Constructor reading data from the file
* @param file_path Path to the file with stored data set
...
...
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