Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/basix/v0.8.0/cpp/namespacebasix_1_1math.html

# Basix 0.4.1

## HomeInstallationDemosC++ docsPython docs

basix::math Namespace Reference

Mathematical functions. More...

## Functions

template<typename U , typename V >
xt::xtensor< typename U::value_type, 2 > outer (const U &u, const V &v)

template<typename U , typename V >
xt::xtensor_fixed< typename U::value_type, xt::xshape< 3 > > cross (const U &u, const V &v)

std::pair< xt::xtensor< double, 1 >, xt::xtensor< double, 2, xt::layout_type::column_major > > eigh (const xt::xtensor< double, 2 > &A)

xt::xarray< double, xt::layout_type::column_major > solve (const xt::xtensor< double, 2 > &A, const xt::xarray< double > &B)

bool is_singular (const xt::xtensor< double, 2 > &A)

void dot (const xt::xtensor< double, 2 > &A, const xt::xtensor< double, 2 > &B, xt::xtensor< double, 2 > &C)

xt::xtensor< double, 2 > dot (const xt::xtensor< double, 2 > &A, const xt::xtensor< double, 2 > &B)

## Detailed Description

Mathematical functions.

Note
The functions in this namespace are designed to be called multiple times at runtime, so their performance is critical.

## ◆ cross()

template<typename U , typename V >
 xt::xtensor_fixed > basix::math::cross ( const U & u, const V & v )

Compute the cross product u x v

Parameters
 u The first vector. It must has size 3. v The second vector. It must has size 3.
Returns
The cross product u x v. The type will be the same as u.

## ◆ dot() [1/2]

 xt::xtensor< double, 2 > basix::math::dot ( const xt::xtensor< double, 2 > & A, const xt::xtensor< double, 2 > & B )

Compute C = A * B

Parameters
 [in] A Input matrix [in] B Input matrix return A * B

## ◆ dot() [2/2]

 void basix::math::dot ( const xt::xtensor< double, 2 > & A, const xt::xtensor< double, 2 > & B, xt::xtensor< double, 2 > & C )

Compute C = A * B

Parameters
 [in] A Input matrix [in] B Input matrix [in,out] C The output matrix

## ◆ eigh()

 std::pair< xt::xtensor< double, 1 >, xt::xtensor< double, 2, xt::layout_type::column_major > > basix::math::eigh ( const xt::xtensor< double, 2 > & A )

Compute the eigenvalues and eigenvectors of a square Hermitian matrix A

Parameters
 [in] A Input matrix
Returns
Eigenvalues and eigenvectors

## ◆ is_singular()

 bool basix::math::is_singular ( const xt::xtensor< double, 2 > & A )

Check if A is a singular matrix

Parameters
 [in] A The matrix
Returns
A bool indicating if the matrix is singular

## ◆ outer()

template<typename U , typename V >
 xt::xtensor basix::math::outer ( const U & u, const V & v )

Compute the outer product of vectors u and v

Parameters
 u The first vector. It must has size 3. v The second vector. It must has size 3.
Returns
The outer product. The type will be the same as u.

## ◆ solve()

 xt::xarray< double, xt::layout_type::column_major > basix::math::solve ( const xt::xtensor< double, 2 > & A, const xt::xarray< double > & B )

Solve A X = B

Parameters
 [in] A The matrix [in] B Right-hand side matrix/vector
Returns
A^{-1} B