Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Chaofan Chen
ogs
Commits
259dffca
Commit
259dffca
authored
4 months ago
by
wenqing
Committed by
Dmitri Naumov
4 months ago
Browse files
Options
Downloads
Patches
Plain Diff
[UnitTest] Fixed the test for PETScMatrix
parent
e5c02f32
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/MathLib/TestGlobalMatrixInterface.cpp
+5
-4
5 additions, 4 deletions
Tests/MathLib/TestGlobalMatrixInterface.cpp
with
5 additions
and
4 deletions
Tests/MathLib/TestGlobalMatrixInterface.cpp
+
5
−
4
View file @
259dffca
...
...
@@ -79,7 +79,7 @@ void checkGlobalMatrixInterfaceMPI(T_MATRIX& m, T_VECTOR& v)
ASSERT_EQ
(
m
.
getNumberOfColumns
(),
gathered_cols
);
// Add entries
Eigen
::
Matrix
2d
loc_m
(
2
,
2
)
;
Eigen
::
Matrix
<
double
,
2
,
2
,
Eigen
::
RowMajor
>
loc_m
;
loc_m
(
0
,
0
)
=
1.
;
loc_m
(
0
,
1
)
=
2.
;
loc_m
(
1
,
0
)
=
3.
;
...
...
@@ -104,6 +104,7 @@ void checkGlobalMatrixInterfaceMPI(T_MATRIX& m, T_VECTOR& v)
// Multiply by a vector
// v = 1.;
set
(
v
,
1.
);
const
bool
deep_copy
=
false
;
T_VECTOR
y
(
v
,
deep_copy
);
matMult
(
m_c
,
v
,
y
);
...
...
@@ -112,14 +113,14 @@ void checkGlobalMatrixInterfaceMPI(T_MATRIX& m, T_VECTOR& v)
// set a value
m_c
.
set
(
2
*
mrank
,
2
*
mrank
,
5.0
);
MathLib
::
finalizeMatrixAssembly
(
m
);
MathLib
::
finalizeMatrixAssembly
(
m
_c
);
// add a value
m_c
.
add
(
2
*
mrank
+
1
,
2
*
mrank
+
1
,
5.0
);
MathLib
::
finalizeMatrixAssembly
(
m_c
);
matMult
(
m_c
,
v
,
y
);
ASSERT_
EQ
(
sqrt
((
3
*
7
*
7
+
3
*
12
*
12
)),
norm2
(
y
));
ASSERT_
NEAR
(
sqrt
((
3
*
7
*
7
+
3
*
12
*
12
)),
norm2
(
y
)
,
1e-12
);
}
// Rectanglular matrix
...
...
@@ -144,7 +145,7 @@ void checkGlobalRectangularMatrixInterfaceMPI(T_MATRIX& m, T_VECTOR& v)
ASSERT_EQ
(
m
.
getNumberOfColumns
(),
gathered_cols
);
// Add entries
Eigen
::
Matrix
<
double
,
2
,
3
>
loc_m
;
Eigen
::
Matrix
<
double
,
2
,
3
,
Eigen
::
RowMajor
>
loc_m
;
loc_m
(
0
,
0
)
=
1.
;
loc_m
(
0
,
1
)
=
2.
;
loc_m
(
0
,
2
)
=
3.
;
...
...
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