Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GeoModel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
GeoModelDev
GeoModel
Commits
139db07b
Commit
139db07b
authored
3 years ago
by
Marilena Bandieramonte
Browse files
Options
Downloads
Patches
Plain Diff
Unit test comparing old and new implementation of the GeoXF Pow function
parent
aeb2f8f5
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
GeoModelCore/GeoModelKernel/src/GeoXF.cxx
+65
-0
65 additions, 0 deletions
GeoModelCore/GeoModelKernel/src/GeoXF.cxx
with
65 additions
and
0 deletions
GeoModelCore/GeoModelKernel/src/GeoXF.cxx
+
65
−
0
View file @
139db07b
...
...
@@ -232,6 +232,14 @@ __attribute__ ((flatten))
// Get the translation part and the rotation part:
//
GeoTrf
::
RotationMatrix3D
rotate
=
m_xf
.
rotation
();
//NEW - start
Eigen
::
Matrix3d
linear
=
m_xf
.
linear
();
Eigen
::
EigenSolver
<
GeoTrf
::
RotationMatrix3D
>
solver
(
linear
);
Eigen
::
MatrixXcd
D
=
solver
.
eigenvalues
().
asDiagonal
();
Eigen
::
MatrixXcd
V
=
solver
.
eigenvectors
();
//NEW - end
GeoTrf
::
Vector3D
translate
=
m_xf
.
translation
();
Eigen
::
AngleAxis
<
double
>
aa
(
rotate
);
//
...
...
@@ -244,10 +252,67 @@ __attribute__ ((flatten))
translate
*=
nTimes
;
double
&
delta
=
aa
.
angle
();
delta
*=
nTimes
;
//NEW - start
Eigen
::
Matrix3cd
DPowN
=
Eigen
::
Matrix3cd
::
Zero
();
for
(
unsigned
int
i
=
0
;
i
<
3
;
i
++
)
DPowN
(
i
,
i
)
=
pow
(
D
(
i
,
i
),
nTimes
);
//NEW - end
//
// Now compose these and return a result:
//
//NEW - start
GeoTrf
::
Transform3D
tRPowN
=
GeoTrf
::
Transform3D
::
Identity
();
tRPowN
.
linear
()
=
(
V
*
DPowN
*
V
.
inverse
()).
real
();
//return GeoTrf::Translation3D (translate) * tRPowN;
//NEW - end
GeoTrf
::
Transform3D
newMatrix
=
GeoTrf
::
Translation3D
(
translate
)
*
tRPowN
;
GeoTrf
::
Transform3D
oldMatrix
=
GeoTrf
::
Translation3D
(
translate
)
*
GeoTrf
::
Transform3D
(
aa
);
std
::
cout
.
precision
(
17
);
// if(
// std::abs(newMatrix(0,0)-oldMatrix(0,0))>1.e-15||
// std::abs(newMatrix(0,1)-oldMatrix(0,1))>1.e-15||
// std::abs(newMatrix(0,2)-oldMatrix(0,2))>1.e-15||
// std::abs(newMatrix(1,0)-oldMatrix(1,0))>1.e-15||
// std::abs(newMatrix(1,1)-oldMatrix(1,1))>1.e-15||
// std::abs(newMatrix(1,2)-oldMatrix(1,2))>1.e-15||
// std::abs(newMatrix(2,0)-oldMatrix(2,0))>1.e-15||
// std::abs(newMatrix(2,1)-oldMatrix(2,1))>1.e-15||
// std::abs(newMatrix(2,2)-oldMatrix(2,2))>1.e-15
// )
if
(
std
::
abs
(
newMatrix
(
0
,
0
)
-
oldMatrix
(
0
,
0
))
>
0
||
std
::
abs
(
newMatrix
(
0
,
1
)
-
oldMatrix
(
0
,
1
))
>
0
||
std
::
abs
(
newMatrix
(
0
,
2
)
-
oldMatrix
(
0
,
2
))
>
0
||
std
::
abs
(
newMatrix
(
1
,
0
)
-
oldMatrix
(
1
,
0
))
>
0
||
std
::
abs
(
newMatrix
(
1
,
1
)
-
oldMatrix
(
1
,
1
))
>
0
||
std
::
abs
(
newMatrix
(
1
,
2
)
-
oldMatrix
(
1
,
2
))
>
0
||
std
::
abs
(
newMatrix
(
2
,
0
)
-
oldMatrix
(
2
,
0
))
>
0
||
std
::
abs
(
newMatrix
(
2
,
1
)
-
oldMatrix
(
2
,
1
))
>
0
||
std
::
abs
(
newMatrix
(
2
,
2
)
-
oldMatrix
(
2
,
2
))
>
0
)
{
std
::
cout
<<
"Old matrix:
\n
"
<<
oldMatrix
.
matrix
()
<<
std
::
endl
;
std
::
cout
<<
"New matrix:
\n
"
<<
newMatrix
.
matrix
()
<<
std
::
endl
;
std
::
cout
<<
"Matrices Diff:
\n
"
<<
newMatrix
.
matrix
()
-
oldMatrix
.
matrix
()
<<
std
::
endl
;
std
::
cout
<<
"------
\n
"
<<
std
::
endl
;
//std::cout<<"Old matrix rotation: \n"<<oldMatrix.rotation()<<std::endl;
//std::cout<<"New matrix rotation: \n"<<newMatrix.rotation()<<std::endl;
//std::cout<<"Old matrix translation: \n"<<oldMatrix.translation()<<std::endl;
//std::cout<<"New matrix translation: \n"<<newMatrix.translation()<<std::endl;
exit
(
-
1
);
}
//OLD VALUE
return
GeoTrf
::
Translation3D
(
translate
)
*
GeoTrf
::
Transform3D
(
aa
);
}
GeoTrf
::
Transform3D
Pow
::
operator
()
(
const
GeoGenfun
::
Argument
&
argument
)
const
...
...
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