NumericAL
A header-only C++20 lexer built on REAL
Loading...
Searching...
No Matches
Classes | Namespaces | Functions | Variables
matrix.hpp File Reference

A dense, row-major, value-semantic matrix over a scalar type. More...

#include <algorithm>
#include <cmath>
#include <complex>
#include <cstddef>
#include <functional>
#include <initializer_list>
#include <utility>
#include <vector>
#include "gemm.hpp"
#include "parallel.hpp"
#include "vector.hpp"
Include dependency graph for matrix.hpp:

Go to the source code of this file.

Classes

class  numerical::matrix< T >
 A dense, row-major matrix of T with value semantics. More...
 

Namespaces

namespace  numerical
 The NumericAL public API.
 

Functions

template<typename T >
matrix< T > numerical::operator+ (const matrix< T > &a, const matrix< T > &b)
 Element-wise sum.
 
template<typename T >
matrix< T > numerical::operator- (const matrix< T > &a, const matrix< T > &b)
 Element-wise difference.
 
template<typename T >
matrix< T > numerical::operator* (const T &scalar, const matrix< T > &m)
 Scalar times matrix.
 
template<typename T >
matrix< T > numerical::operator* (const matrix< T > &m, const T &scalar)
 Matrix times scalar.
 
template<typename T >
vector< T > numerical::operator* (const matrix< T > &a, const vector< T > &v)
 Matrix–vector product: each element its row's dot product with v (detail::matrix_times_vector).
 
template<typename T >
matrix< T > numerical::operator* (const matrix< T > &a, const matrix< T > &b)
 Matrix–matrix product.
 
template<typename T >
matrix< T > numerical::transpose (const matrix< T > &m)
 The transpose, by blocks of transpose_tile, the result's blocks of rows shared among the threads.
 
template<typename T >
bool numerical::approx_equal (const matrix< T > &a, const matrix< T > &b, double tolerance=1e-9)
 Element-wise closeness within a tolerance (for inexact scalars).
 

Variables

constexpr std::size_t numerical::transpose_tile {32}
 The square blocks transpose copies one at a time: a block's rows of the source and of the result both stay in the L1 cache, where a row of the result walked a column of the source a stride apart.
 

Detailed Description

A dense, row-major, value-semantic matrix over a scalar type.

numerical::matrix is generic over its element type T (the scalar), like numerical::vector. It offers element-wise arithmetic, scalar and matrix/vector products, transpose, and tolerance comparison. Operations with incompatible shapes throw numerical::dimension_error. Factorisations and the linear solve over a matrix live in decomposition.hpp.

Definition in file matrix.hpp.