Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Timo Koch
dune-common
Commits
421b5b42
Commit
421b5b42
authored
18 years ago
by
Oliver Sander
Browse files
Options
Downloads
Patches
Plain Diff
Making the test more thorough. Inversion still fails
[[Imported from SVN: r4819]]
parent
959bc72c
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
common/test/fmatrixtest.cc
+22
-4
22 additions, 4 deletions
common/test/fmatrixtest.cc
with
22 additions
and
4 deletions
common/test/fmatrixtest.cc
+
22
−
4
View file @
421b5b42
...
...
@@ -14,7 +14,7 @@ int test_invert_solve(T A_data[n*n], T inv_data[n*n],
{
int
ret
=
0
;
std
::
cout
<<
"Checking inver
t
ion of:"
<<
std
::
endl
;
std
::
cout
<<
"Checking inver
s
ion of:"
<<
std
::
endl
;
FieldMatrix
<
T
,
n
,
n
>
A
,
inv
,
calced_inv
;
FieldVector
<
T
,
n
>
x
,
b
,
calced_x
;
...
...
@@ -29,6 +29,19 @@ int test_invert_solve(T A_data[n*n], T inv_data[n*n],
}
std
::
cout
<<
A
<<
std
::
endl
;
// Check whether given inverse is correct
FieldMatrix
<
T
,
n
,
n
>
prod
=
A
;
prod
.
rightmultiply
(
inv
);
for
(
int
i
=
0
;
i
<
n
;
i
++
)
prod
[
i
][
i
]
-=
1
;
bool
equal
=
true
;
if
(
A
.
infinity_norm
()
>
1e-6
)
{
std
::
cerr
<<
"Given inverse wrong"
<<
std
::
endl
;
equal
=
false
;
}
FieldMatrix
<
T
,
n
,
n
>
copy
(
A
);
A
.
invert
();
...
...
@@ -36,7 +49,6 @@ int test_invert_solve(T A_data[n*n], T inv_data[n*n],
A
-=
inv
;
bool
equal
=
true
;
double
singthres
=
FMatrixPrecision
<>::
singular_limit
()
*
10
;
for
(
int
i
=
0
;
i
<
n
;
++
i
)
for
(
int
j
=
0
;
j
<
n
;
++
j
)
...
...
@@ -50,7 +62,7 @@ int test_invert_solve(T A_data[n*n], T inv_data[n*n],
std
::
cerr
<<
"Calculated inverse was:"
<<
std
::
endl
;
std
::
cerr
<<
calced_inv
<<
std
::
endl
;
std
::
cerr
<<
"Should have been"
<<
std
::
endl
;
std
::
cerr
<<
inv
;
std
::
cerr
<<
inv
<<
std
::
endl
;
}
else
std
::
cout
<<
"Result is"
<<
std
::
endl
<<
calced_inv
<<
std
::
endl
;
...
...
@@ -92,9 +104,15 @@ int test_invert_solve()
double
b
[
3
]
=
{
32
,
75
,
201
};
double
x
[
3
]
=
{
1
,
2
,
3
};
ret
+=
test_invert_solve
<
double
,
3
>
(
A_data
,
inv_data
,
x
,
b
);
double
A_data0
[
9
]
=
{
-
0.5
,
0
,
-
0.25
,
0.5
,
0
,
-
0.25
,
0
,
0.5
,
0
};
double
inv_data0
[
9
]
=
{
-
1
,
1
,
0
,
0
,
0
,
2
,
-
2
,
-
2
,
0
};
double
b0
[
3
]
=
{
32
,
75
,
201
};
double
x0
[
3
]
=
{
1
,
2
,
3
};
ret
+=
test_invert_solve
<
double
,
3
>
(
A_data0
,
inv_data0
,
x0
,
b0
);
double
A_data1
[
9
]
=
{
0
,
1
,
0
,
1
,
0
,
0
,
0
,
0
,
1
};
double
b1
[
3
]
=
{
0
,
1
,
2
};
double
x1
[
3
]
=
{
1
,
0
,
2
};
...
...
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