Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
GRASLAND Hadrien
Fast5x5
Commits
28925231
Commit
28925231
authored
May 24, 2017
by
Lucas Serrano
Browse files
Add inversion test
parent
b843b601
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
tests.cpp
tests.cpp
+25
-1
No files found.
tests.cpp
View file @
28925231
...
...
@@ -196,11 +196,34 @@ void test_column_scalar_product() {
}
void
test_identity
()
{
IdentityMatrix
<
float
,
5
,
8
>
A
;
//IdentityMatrix<float, 5, 8> A;
BaseMatrix
<
float
,
5
,
8
>
A
(
1
);
std
::
cout
<<
"Testing identity matrix"
<<
std
::
endl
;
std
::
cout
<<
A
;
}
void
test_matrix_inv
()
{
alignas
(
32
)
float
input
[
3
*
3
]
=
{
1
,
0
,
0
,
0
,
2
,
0
,
0
,
0
,
4
,
};
alignas
(
32
)
float
truth
[
3
*
3
]
=
{
1
,
0
,
0
,
0
,
0.5
,
0
,
0
,
0
,
0.25
,
};
BaseMatrix
<
float
,
3
,
4
>
A
(
input
),
I
;
matrix_inv
<
BaseMatrix
<
float
,
3
,
4
>
,
20
>
(
A
,
I
);
std
::
cout
<<
"Testing Matrix inversion"
<<
std
::
endl
;
std
::
cout
<<
"
\t
Output: "
<<
std
::
endl
;
print_matrix
<
float
>
(
I
.
dump_array
(),
3
,
3
);
std
::
cout
<<
"
\t
Truth: "
<<
std
::
endl
;
print_matrix
<
float
>
(
truth
,
3
,
3
);
std
::
cout
<<
std
::
endl
;
}
int
main
(
int
argc
,
char
**
argv
)
{
test_protect_for_division
();
test_matrix_add
();
...
...
@@ -209,5 +232,6 @@ int main(int argc, char **argv) {
test_column_dot_product
();
test_column_scalar_product
();
test_identity
();
test_matrix_inv
();
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment