MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
diagonal.hpp File Reference
#include <algorithm>
#include <mtl/concepts/matrix.hpp>
#include <mtl/vec/dense_vector.hpp>
#include <mtl/mat/compressed2D.hpp>
#include <mtl/mat/inserter.hpp>

Namespaces

namespace  mtl

Functions

template<Matrix M>
auto mtl::diagonal (const M &A)
 Returns a dense_vector containing the diagonal entries A(i,i).
template<typename T>
auto mtl::diag (const vec::dense_vector< T > &v)
 Construct an n x n diagonal sparse matrix from a vector (inverse of diagonal).