Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
xerus
xerus
Commits
0fa07860
Commit
0fa07860
authored
Aug 14, 2018
by
Michael Goette
Browse files
added unit test related to bug fix
parent
f2536156
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/unitTests/tensor.cxx
View file @
0fa07860
...
...
@@ -287,5 +287,21 @@ static misc::UnitTest tensor_sparse_dense("Tensor", "Sparse_Dense_Conversions",
TEST
(
R
.
representation
==
Tensor
::
Representation
::
Dense
);
});
static
misc
::
UnitTest
tensor_offset_add
(
"Tensor"
,
"Check_Offset_Add"
,
[](){
auto
first
=
xerus
::
Tensor
::
dirac
({
1
,
1
,
1
,
1
},
0
);
auto
second
=
xerus
::
Tensor
::
dirac
({
2
,
2
,
1
,
1
},
0
);
second
[
3
]
=
4
;
second
[
1
]
=
2
;
second
[
2
]
=
3
;
std
::
unique_ptr
<
Tensor
>
comb
(
new
Tensor
({
3
,
3
,
2
,
2
}));
comb
->
offset_add
(
first
,
std
::
vector
<
size_t
>
({
0
,
0
,
0
,
0
}));
comb
->
offset_add
(
second
,
std
::
vector
<
size_t
>
({
1
,
1
,
1
,
1
}));
TEST
(((
*
comb
)[
0
]
-
1
)
*
((
*
comb
)[
0
]
-
1
)
<=
0.01
);
TEST
(((
*
comb
)[
19
]
-
1
)
*
((
*
comb
)[
19
]
-
1
)
<=
0.01
);
TEST
(((
*
comb
)[
23
]
-
2
)
*
((
*
comb
)[
23
]
-
2
)
<=
0.01
);
TEST
(((
*
comb
)[
31
]
-
3
)
*
((
*
comb
)[
31
]
-
3
)
<=
0.01
);
TEST
(((
*
comb
)[
35
]
-
4
)
*
((
*
comb
)[
35
]
-
4
)
<=
0.01
);
TEST
(((
*
comb
)[
1
])
*
((
*
comb
)[
1
])
<=
0.01
);
});
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment