File AlgebraHelpers.hpp

namespace Acts


This file is foreseen for the Geometry module to replace Extent


template<typename MatrixType>
MatrixType bitsetToMatrix(const std::bitset<MatrixType::RowsAtCompileTime * MatrixType::ColsAtCompileTime> bs)

Convert a bitset to a matrix of integers, with each element set to the bit value.


How the bits are assigned to matrix elements depends on the storage type of the matrix being converted (row-major or col-major)

Template Parameters

MatrixType – Matrix type that is produced


bs – The bitset to convert


A matrix with the integer values of the bits from bs

template<typename A, typename B>
inline ActsMatrix<A::RowsAtCompileTime, B::ColsAtCompileTime> blockedMult(const A &a, const B &b)

Perform a blocked matrix multiplication, avoiding Eigen GEMM methods.

Template Parameters
  • A – The type of the first matrix, which should be MxN

  • B – The type of the second matrix, which should be NxP

  • a[in] An MxN matrix of type A

  • b[in] An NxP matrix of type P


The product ab

template<typename Derived>
auto matrixToBitset(const Eigen::PlainObjectBase<Derived> &m)

Convert an integer matrix to a bitset.


How the bits are ordered depends on the storage type of the matrix being converted (row-major or col-major)

Template Parameters

Derived – Eigen base concrete type


m – Matrix that is converted


The converted bitset.

template<typename MatrixType, typename ResultType = MatrixType>
std::optional<ResultType> safeInverse(const MatrixType &m) noexcept

Calculate the inverse of an Eigen matrix after checking if it can be numerically inverted.

This allows to catch potential FPEs before they occur.

Our main motivation for this is that users might have a strict FPE policy which would flag every single occurrence as a failure and then sombody has to investigate. Since we are processing a high number of events and floating point numbers sometimes work in mysterious ways the caller of this function might want to hide FPEs and handle them in a more controlled way.

Template Parameters
  • Derived – Eigen derived concrete type

  • Result – Eigen result type defaulted to input type


m – Eigen matrix to invert


The theta value