Replies: 1 comment
-
Interface vs. Mixin vs. bothI prefer the second way if this behavior is not undefined behavior in some compiler. Does compiler have specific flag to ignore this warning? Create vs. Modify vs. Write-To vs. all of them?x = A->apply(b) is available for A->apply(b, x) Free-standing functionsIt is a good idea. we can put it without any issue, but I think we still need the member function for those class. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Mike's discussion reminded me that I had written up some thoughts on how our interfaces (Permutable, Transposable, AbsoluteComputable, ...) are implemented:
We have some inconsistencies in Ginkgo, which I would like to collect here:
Interface vs. Mixin vs. both
We have a trade-off between generality and type-safety built into our type hierarchy.
Transposable::transpose()
returns a LinOp, but if we call it on a specificMatrixType
, we know that it will in almost all cases returnMatrixType::transposed_type
. This often leads to additionalas<...>(...)
calls cluttering the user code.On the other hand, we have things like
get_absolute
andget_absolute_linop
where we explicitly provide two different return types for the same interface. I would like to find a uniform solution to address this, either byLinOp operation_linop()
everywhere and implementing this virtual function in terms of the type-safe localConcreteType operation()
from a mixin orConcreteType operation(int = 0)
hidingvirtual LinOp operation()
), which would lead to much nicer user code, but some warnings during compilation.Create vs. Modify vs. Write-To vs. all of them?
We have some functions that
transpose()
,row_permute(...)
orget_absolute()
apply(..., output)
get_absolute_inplace(...)´,
add_scaled(...)`row_gather(...)
,get_real/imag(...)
.The perfect combination of these would look to me as follows:
We could have the best off all worlds by adding a
create_operation_result(...)
function that can be used to build a creating version out of a modifying version:but this means adding a significant amount of additional functions, all of them in
core
though.Possible solution: Free-standing functions
Beta Was this translation helpful? Give feedback.
All reactions