Skip to content

Matrix multiplication + dot product in meta prog

One can now multiply and compute dot product with matrices and / or vectors, both loop-free, on an arbitrary number of dimensions. Those methods are templated on the matrices dimension, and with a template giving the possibility to compute the product by indexing the matrix to its transposed counter-part, or by considering the input vector as the diagonal of a diagonal matrix.

Matrices must be 1D array with an operator[] pointing to the corresponding component in the matrix with a row-wise ordering. If one wants to feed in a column-wise ordered array, one can turn on the transpose flag vtkMath::MatrixLayout::Transpose for the corresponding matrice. One can also transform a vector into a diagonal matrix, rectangular or not, with the flag vtkMath::MatrixLayout::Diag.

New methods are vtkMath::MultiplyMatrix, vtkMath::MultiplyMatrixWithVector, and vtkMath::Dot.

Edited by Yohann Bearzi (Kitware)

Merge request reports