Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
xerus
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xerus
xerus
Commits
0fa07860
Commit
0fa07860
authored
Aug 14, 2018
by
Michael Goette
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added unit test related to bug fix
parent
f2536156
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
src/unitTests/tensor.cxx
src/unitTests/tensor.cxx
+16
-0
No files found.
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
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