Project

General

Profile

Task #2976

Basic math for Multidimensional arrays

Added by Kevin Boyd 3 months ago. Updated about 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
core library
Target version:
Difficulty:
uncategorized
Close

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_mat
clear_mat
mmul_ur0
mmul
transpose
tmmul
mtmul
det
m_add
m_sub
msmul
mvmul
mvmul_ur0
tmvmul_ur0
trace

Associated revisions

Revision f3c2e710 (diff)
Added by Kevin Boyd 3 months ago

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

Revision 6941eb5a (diff)
Added by Kevin Boyd about 2 months ago

Add transpose operation to Matrix3x3

refs #2976

Change-Id: I8f0ce04b18be1e8b119de02cb6b52b3314cd67eb

Revision 0060f37a (diff)
Added by Paul Bauer about 2 months ago

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

Revision 4625c43c (diff)
Added by Paul Bauer about 1 month ago

Add conversion from legacy to modern matrix type

Refs #2976

Change-Id: Iddf400bbb688a00c9de60e33d9c9a05f7c146f66

History

#1 Updated by Kevin Boyd 3 months ago

It's not clear to me whether these should be free functions or operator overloads.

#2 Updated by Kevin Boyd 2 months ago

  • Description updated (diff)

#3 Updated by Kevin Boyd 2 months 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 about 2 months 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 about 2 months ago

  • Description updated (diff)

#6 Updated by Mark Abraham about 2 months 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 about 2 months 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!

Also available in: Atom PDF