Basix 0.4.1

Home     Installation     Demos     C++ docs     Python docs

Functions
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.

Function Documentation

◆ cross()

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

Compute the cross product u x v

Parameters
uThe first vector. It must has size 3.
vThe 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]AInput matrix
[in]BInput 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]AInput matrix
[in]BInput matrix
[in,out]CThe 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]AInput 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]AThe matrix
Returns
A bool indicating if the matrix is singular

◆ outer()

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

Compute the outer product of vectors u and v

Parameters
uThe first vector. It must has size 3.
vThe 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]AThe matrix
[in]BRight-hand side matrix/vector
Returns
A^{-1} B