Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pinocchio
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
pinocchio
Commits
7f4a88d8
Commit
7f4a88d8
authored
10 years ago
by
Nicolas Mansard
Committed by
Valenza Florian
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Added Dense UDUt algorithm in the unitest.
parent
5071f19d
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
unittest/udut.cpp
+51
-0
51 additions, 0 deletions
unittest/udut.cpp
with
51 additions
and
0 deletions
unittest/udut.cpp
0 → 100644
+
51
−
0
View file @
7f4a88d8
#include
<iostream>
#include
<Eigen/Core>
#include
<pinocchio/spatial/skew.hpp>
template
<
int
N
>
void
udut
(
Eigen
::
Matrix
<
double
,
N
,
N
>
&
M
)
{
typedef
Eigen
::
Matrix
<
double
,
N
,
N
>
MatrixNd
;
typedef
Eigen
::
Matrix
<
double
,
1
,
N
>
VectorNd
;
typedef
typename
MatrixNd
::
DiagonalReturnType
D_t
;
typedef
typename
MatrixNd
::
template
TriangularViewReturnType
<
Eigen
::
StrictlyUpper
>
::
Type
U_t
;
VectorNd
tmp
;
D_t
D
=
M
.
diagonal
();
U_t
U
=
M
.
template
triangularView
<
Eigen
::
StrictlyUpper
>();
for
(
int
j
=
N
-
1
;
j
>=
0
;
--
j
)
{
typename
VectorNd
::
SegmentReturnType
DUt
=
tmp
.
tail
(
N
-
j
-
1
);
if
(
j
<
N
-
1
)
DUt
=
M
.
row
(
j
).
tail
(
N
-
j
-
1
).
transpose
().
cwiseProduct
(
D
.
tail
(
N
-
j
-
1
)
);
D
[
j
]
-=
M
.
row
(
j
).
tail
(
N
-
j
-
1
).
dot
(
DUt
);
for
(
int
i
=
j
-
1
;
i
>=
0
;
--
i
)
{
U
(
i
,
j
)
-=
M
.
row
(
i
).
tail
(
N
-
j
-
1
).
dot
(
DUt
);
U
(
i
,
j
)
/=
D
[
j
];
}
}
}
#include
<Eigen/Core>
int
main
(
int
argc
,
const
char
**
argv
)
{
using
namespace
Eigen
;
Matrix
<
double
,
6
,
6
>
A
=
Matrix
<
double
,
6
,
6
>::
Random
();
A
=
A
*
A
.
transpose
();
double
m
=
A
(
1
,
1
);
Matrix3d
I
=
A
.
bottomRightCorner
<
3
,
3
>
();
Vector3d
c
=
A
.
block
<
3
,
1
>
(
0
,
3
);
A
.
topLeftCorner
<
3
,
3
>
()
=
Matrix3d
::
Identity
()
*
m
;
A
.
topRightCorner
<
3
,
3
>
()
=
se3
::
skew
(
c
).
transpose
();
A
.
bottomLeftCorner
<
3
,
3
>
()
=
se3
::
skew
(
c
);
A
.
bottomRightCorner
<
3
,
3
>
()
-=
A
.
bottomLeftCorner
<
3
,
3
>
()
*
A
.
bottomLeftCorner
<
3
,
3
>
();
std
::
cout
<<
"A = [
\n
"
<<
A
<<
"];"
<<
std
::
endl
;
udut
(
A
);
std
::
cout
<<
"U = [
\n
"
<<
A
<<
"];"
<<
std
::
endl
;
return
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