Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
IP
elsa
Commits
4229e118
Commit
4229e118
authored
Apr 11, 2022
by
Andi Braimllari
Committed by
Tobias Lasser
Apr 11, 2022
Browse files
fix and test cloning of scalar * linearOperator
parent
baf04e2e
Pipeline
#873473
passed with stages
in 56 minutes and 26 seconds
Changes
2
Pipelines
8
Hide whitespace changes
Inline
Side-by-side
elsa/core/LinearOperator.cpp
View file @
4229e118
...
@@ -270,7 +270,7 @@ namespace elsa
...
@@ -270,7 +270,7 @@ namespace elsa
}
}
if
(
_mode
==
CompositeMode
::
SCALAR_MULT
)
{
if
(
_mode
==
CompositeMode
::
SCALAR_MULT
)
{
return
new
LinearOperator
<
data_t
>
(
*
_rhs
,
_isAdjoint
);
return
new
LinearOperator
<
data_t
>
(
*
this
);
}
}
}
}
...
...
elsa/core/tests/test_LinearOperator.cpp
View file @
4229e118
...
@@ -118,6 +118,37 @@ TEST_CASE_TEMPLATE("LinearOperator: Testing clone()", TestType, float, double, c
...
@@ -118,6 +118,37 @@ TEST_CASE_TEMPLATE("LinearOperator: Testing clone()", TestType, float, double, c
}
}
}
}
}
}
GIVEN
(
"a scalar multiplicative composite LinearOperator"
)
{
IndexVector_t
numCoeff
(
3
);
numCoeff
<<
50
,
41
,
22
;
IndexVector_t
numCoeff2
(
2
);
numCoeff2
<<
4
,
88
;
VolumeDescriptor
ddDomain
(
numCoeff
);
VolumeDescriptor
ddRange
(
numCoeff2
);
LinearOperator
<
TestType
>
linOp
(
ddDomain
,
ddRange
);
TestType
scalar
=
42
;
LinearOperator
<
TestType
>
scalarMultLinOp
=
scalar
*
linOp
;
WHEN
(
"cloning the LinearOperator"
)
{
auto
linOpClone
=
scalarMultLinOp
.
clone
();
THEN
(
"everything matches"
)
{
REQUIRE_NE
(
linOpClone
.
get
(),
&
scalarMultLinOp
);
REQUIRE_EQ
(
*
linOpClone
,
scalarMultLinOp
);
}
THEN
(
"copies are also identical"
)
{
auto
newOp
=
*
linOpClone
;
REQUIRE_EQ
(
newOp
,
scalarMultLinOp
);
}
}
}
}
}
TEST_CASE_TEMPLATE
(
"LinearOperator: Testing a leaf LinearOperator"
,
TestType
,
float
,
double
,
TEST_CASE_TEMPLATE
(
"LinearOperator: Testing a leaf LinearOperator"
,
TestType
,
float
,
double
,
...
...
Write
Preview
Supports
Markdown
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