Task #2976
Basic math for Multidimensional arrays
Description
To use BasicMatrix3x3 as a drop in for the c-style tensor, we need to support the addition, subtraction, and several multiplication functionality found in math/vec.h. A lot of these functions are used in the main MD code, each of which will need to be supported before the matrices can be replaced.
Functions to replace:copy_matclear_mat
mmul_ur0
mmultranspose
tmmul
mtmuldetm_addm_sub
msmul
mvmul
mvmul_ur0
tmvmul_ur0trace
Associated revisions
Add transpose operation to Matrix3x3
refs #2976
Change-Id: I8f0ce04b18be1e8b119de02cb6b52b3314cd67eb
Add free function to convert matrix type
New free function that allows generation of a Matrix3x3 type from the
legacy matrix type. Prepares for replacing the old matrix types.
Refs #2976
Change-Id: I5f17bef75d666b5221519c38abfa05a2ccd89cb0
Add conversion from legacy to modern matrix type
Refs #2976
Change-Id: Iddf400bbb688a00c9de60e33d9c9a05f7c146f66
History
#1 Updated by Kevin Boyd over 1 year ago
It's not clear to me whether these should be free functions or operator overloads.
#2 Updated by Kevin Boyd over 1 year ago
- Description updated (diff)
#3 Updated by Kevin Boyd over 1 year ago
There are a few composite functions which are used once or twice that I'm not sure are worth reimplementing for matrices.
For example, tmmul(a,b) is tranpose(a) * b, and vice versa for mtmul
#4 Updated by Eric Irrgang over 1 year ago
Kevin Boyd wrote:
It's not clear to me whether these should be free functions or operator overloads.
In general, free functions are clean and clear.
#5 Updated by Kevin Boyd over 1 year ago
- Description updated (diff)
#6 Updated by Mark Abraham over 1 year ago
We would also want to think about the consequences on compilation time. Anecdotally, the density fitting code that Christian has been landing is rather slow to compile, presumably because of the cost of compiling code based on mdspan. Before Kevin gets too committed to the project, we should probably try replacing matrix type with Matrix3x3 in a whole source file and getting a feel for the cost, in release and debug mode.
#7 Updated by Mark Abraham over 1 year ago
Also https://github.com/kokkos/mdspan is of interest if we ever decide something needs improving. They're aware we depend on an earlier mdspan implementation, and would welcome feedback!
#8 Updated by Paul Bauer about 1 year ago
- Target version changed from 2020 to 2021
Can this be considered as resolved?
Add mdspan basic elementwise math
BasicMatrix3x3 provides a replacement for the c-style tensors, but
has yet to replicate the tensor operations in math/vec.h. This provides
a subset of that functionality for msdpan in general, which can be used
for MultiDimArray trivially
Refs #2976
Change-Id: I17b77df032dbbfde0ff87108215edcec07fef6c4