Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Simox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Leander Singer
Simox
Commits
75f48084
Commit
75f48084
authored
4 years ago
by
Fabian Paus
Browse files
Options
Downloads
Patches
Plain Diff
Suport compact Eigen::Vector JSON representation
parent
449b9519
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SimoxUtility/json/eigen_conversion.h
+21
-7
21 additions, 7 deletions
SimoxUtility/json/eigen_conversion.h
with
21 additions
and
7 deletions
SimoxUtility/json/eigen_conversion.h
+
21
−
7
View file @
75f48084
...
...
@@ -88,12 +88,19 @@ namespace jsonbase
{
for
(
int
row
=
0
;
row
<
matrix
.
rows
();
++
row
)
{
nlohmann
::
json
jrow
=
nlohmann
::
json
::
array
();
for
(
int
col
=
0
;
col
<
matrix
.
cols
();
++
col
)
if
(
matrix
.
cols
()
>
1
)
{
jrow
.
push_back
(
matrix
(
row
,
col
));
nlohmann
::
json
jrow
=
nlohmann
::
json
::
array
();
for
(
int
col
=
0
;
col
<
matrix
.
cols
();
++
col
)
{
jrow
.
push_back
(
matrix
(
row
,
col
));
}
j
.
push_back
(
jrow
);
}
else
{
j
.
push_back
(
matrix
(
row
,
0
));
}
j
.
push_back
(
jrow
);
}
}
...
...
@@ -107,10 +114,17 @@ namespace jsonbase
for
(
std
::
size_t
row
=
0
;
row
<
j
.
size
();
++
row
)
{
const
auto
&
jrow
=
j
.
at
(
row
);
for
(
std
::
size_t
col
=
0
;
col
<
jrow
.
size
();
++
col
)
if
(
jrow
.
is_array
())
{
for
(
std
::
size_t
col
=
0
;
col
<
jrow
.
size
();
++
col
)
{
const
auto
&
value
=
jrow
.
at
(
col
);
matrix
(
static_cast
<
Index
>
(
row
),
static_cast
<
Index
>
(
col
))
=
value
.
get
<
Scalar
>
();
}
}
else
{
const
auto
&
value
=
jrow
.
at
(
col
);
matrix
(
static_cast
<
Index
>
(
row
),
static_cast
<
Index
>
(
col
))
=
value
.
get
<
Scalar
>
();
matrix
(
static_cast
<
Index
>
(
row
),
0
)
=
jrow
.
get
<
Scalar
>
();
}
}
}
...
...
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