Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic-graph
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
Container Registry
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
Stack Of Tasks
dynamic-graph
Commits
844d1d49
Commit
844d1d49
authored
8 years ago
by
Rohan Budhiraja
Committed by
Olivier Stasse
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[c++] fix bug in matrix istream input operator
parent
8cff599b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/dynamic-graph/eigen-io.h
+9
-6
9 additions, 6 deletions
include/dynamic-graph/eigen-io.h
with
9 additions
and
6 deletions
include/dynamic-graph/eigen-io.h
+
9
−
6
View file @
844d1d49
...
...
@@ -39,6 +39,7 @@ using dynamicgraph::ExceptionSignal;
*/
namespace
Eigen
{
typedef
EIGEN_DEFAULT_DENSE_INDEX_TYPE
eigen_index
;
inline
std
::
istringstream
&
operator
>>
(
std
::
istringstream
&
iss
,
dynamicgraph
::
Vector
&
inst
)
{
unsigned
int
_size
;
...
...
@@ -88,7 +89,8 @@ namespace Eigen {
unsigned
int
_rowsize
;
double
_dbl_val
;
char
_ch
;
boost
::
format
fmt
(
"Failed to enter %s as vector. Reenter as [N](val1,val2,val3,...,valN)"
);
boost
::
format
fmt
(
"Failed to enter %s as matrix. Reenter as ((val11,val12,val13,...,val1N),...,(valM1,valM2,...,valMN))"
);
MatrixXd
_tmp_matrix
;
fmt
%
iss
.
str
();
if
(
iss
>>
_ch
&&
_ch
!=
'['
){
throw
ExceptionSignal
(
ExceptionSignal
::
GENERIC
,
fmt
.
str
());
...
...
@@ -101,7 +103,7 @@ namespace Eigen {
if
(
iss
.
fail
())
throw
ExceptionSignal
(
ExceptionSignal
::
GENERIC
,
fmt
.
str
());
else
{
inst
.
resize
(
_rowsize
,
_colsize
);
_tmp_matrix
.
resize
(
_rowsize
,
_colsize
);
if
(
iss
>>
_ch
&&
_ch
!=
']'
)
throw
ExceptionSignal
(
ExceptionSignal
::
GENERIC
,
fmt
.
str
());
else
{
...
...
@@ -115,7 +117,7 @@ namespace Eigen {
iss
>>
_dbl_val
;
if
(
iss
.
peek
()
==
','
||
iss
.
peek
()
==
' '
)
iss
.
ignore
();
inst
(
j
,
i
)
=
_dbl_val
;
_tmp_matrix
(
j
,
i
)
=
_dbl_val
;
}
if
(
iss
>>
_ch
&&
_ch
!=
')'
)
throw
ExceptionSignal
(
ExceptionSignal
::
GENERIC
,
fmt
.
str
());
...
...
@@ -128,13 +130,14 @@ namespace Eigen {
}
}
}
inst
=
_tmp_matrix
;
return
iss
;
}
inline
std
::
istringstream
&
operator
>>
(
std
::
istringstream
&
iss
,
Transform
<
double
,
3
,
Affine
>
&
inst
)
{
Matrix
4
d
M
;
iss
>>
M
;
inst
=
M
;
return
iss
;
}
Matrix
X
d
M
;
iss
>>
M
;
inst
.
matrix
()
=
M
;
return
iss
;
}
...
...
@@ -157,12 +160,12 @@ namespace Eigen {
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
AngleAxisd
quat
)
{
Vector
4
d
v
;
v
(
0
)
=
quat
.
angle
();
v
.
tail
<
3
>
()
=
quat
.
axis
();
Vector
X
d
v
(
4
)
;
v
(
0
)
=
quat
.
angle
();
v
.
tail
<
3
>
()
=
quat
.
axis
();
os
<<
v
;
return
os
;
}
inline
std
::
istringstream
&
operator
>>
(
std
::
istringstream
&
iss
,
AngleAxisd
&
inst
)
{
Vector
4
d
v
;
iss
>>
v
;
Vector
X
d
v
(
4
)
;
iss
>>
v
;
inst
.
angle
()
=
v
(
0
);
inst
.
axis
()
=
v
.
tail
<
3
>
();
return
iss
;
}
...
...
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