Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
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
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
code
pugs
Commits
acb0259f
Commit
acb0259f
authored
3 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Add output to Array. Now Vector uses Array output to print data.
parent
5f780832
No related branches found
No related tags found
1 merge request
!105
Add NaNHelper utility
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/algebra/Vector.hpp
+1
-8
1 addition, 8 deletions
src/algebra/Vector.hpp
src/utils/Array.hpp
+12
-0
12 additions, 0 deletions
src/utils/Array.hpp
with
13 additions
and
8 deletions
src/algebra/Vector.hpp
+
1
−
8
View file @
acb0259f
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
#define VECTOR_HPP
#define VECTOR_HPP
#include
<utils/Array.hpp>
#include
<utils/Array.hpp>
#include
<utils/NaNHelper.hpp>
#include
<utils/PugsAssert.hpp>
#include
<utils/PugsAssert.hpp>
#include
<utils/PugsMacros.hpp>
#include
<utils/PugsMacros.hpp>
#include
<utils/PugsUtils.hpp>
#include
<utils/PugsUtils.hpp>
...
@@ -29,13 +28,7 @@ class Vector // LCOV_EXCL_LINE
...
@@ -29,13 +28,7 @@ class Vector // LCOV_EXCL_LINE
friend
std
::
ostream
&
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
Vector
&
x
)
operator
<<
(
std
::
ostream
&
os
,
const
Vector
&
x
)
{
{
if
(
x
.
size
()
>
0
)
{
return
os
<<
x
.
m_values
;
os
<<
0
<<
':'
<<
NaNHelper
(
x
[
0
]);
}
for
(
size_t
i
=
1
;
i
<
x
.
size
();
++
i
)
{
os
<<
' '
<<
i
<<
':'
<<
NaNHelper
(
x
[
i
]);
}
return
os
;
}
}
friend
Vector
<
std
::
remove_const_t
<
DataType
>>
friend
Vector
<
std
::
remove_const_t
<
DataType
>>
...
...
This diff is collapsed.
Click to expand it.
src/utils/Array.hpp
+
12
−
0
View file @
acb0259f
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#define ARRAY_HPP
#define ARRAY_HPP
#include
<utils/InvalidData.hpp>
#include
<utils/InvalidData.hpp>
#include
<utils/NaNHelper.hpp>
#include
<utils/PugsAssert.hpp>
#include
<utils/PugsAssert.hpp>
#include
<utils/PugsMacros.hpp>
#include
<utils/PugsMacros.hpp>
#include
<utils/PugsUtils.hpp>
#include
<utils/PugsUtils.hpp>
...
@@ -23,6 +24,17 @@ class [[nodiscard]] Array
...
@@ -23,6 +24,17 @@ class [[nodiscard]] Array
friend
Array
<
std
::
add_const_t
<
DataType
>>
;
friend
Array
<
std
::
add_const_t
<
DataType
>>
;
public:
public:
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
Array
&
x
)
{
if
(
x
.
size
()
>
0
)
{
os
<<
0
<<
':'
<<
NaNHelper
(
x
[
0
]);
}
for
(
size_t
i
=
1
;
i
<
x
.
size
();
++
i
)
{
os
<<
' '
<<
i
<<
':'
<<
NaNHelper
(
x
[
i
]);
}
return
os
;
}
PUGS_INLINE
size_t
size
()
const
noexcept
PUGS_INLINE
size_t
size
()
const
noexcept
{
{
return
m_values
.
extent
(
0
);
return
m_values
.
extent
(
0
);
...
...
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