12#ifndef TLAPACK_LANHE_HH
13#define TLAPACK_LANHE_HH
42template <TLAPACK_NORM norm_t, TLAPACK_UPLO uplo_t, TLAPACK_SMATRIX matrix_t>
51 const idx_t n = nrows(
A);
59 if (n <= 0)
return real_t(0);
65 if (
uplo == Uplo::Upper) {
66 for (idx_t j = 0; j < n; ++j) {
67 for (idx_t i = 0; i < j; ++i) {
88 for (idx_t j = 0; j < n; ++j) {
98 for (idx_t i = j + 1; i < n; ++i) {
111 if (
uplo == Uplo::Upper) {
112 for (idx_t j = 0; j < n; ++j) {
115 for (idx_t i = 0; i < j; ++i)
116 temp += abs(
A(i, j));
120 for (idx_t i = j + 1; i < n; ++i)
121 temp += abs(
A(j, i));
131 for (idx_t j = 0; j < n; ++j) {
134 for (idx_t i = 0; i < j; ++i)
135 temp += abs(
A(j, i));
139 for (idx_t i = j + 1; i < n; ++i)
140 temp += abs(
A(i, j));
155 if (
uplo == Uplo::Upper) {
156 for (idx_t j = 1; j < n; ++j)
160 for (idx_t j = 0; j < n - 1; ++j)
168 [](
const T&
x) {
return abs(
real(
x)); });
constexpr bool isnan(const T &x) noexcept
Extends std::isnan() to complex numbers.
Definition utils.hpp:125
constexpr real_type< T > real(const T &x) noexcept
Extends std::real() to real datatypes.
Definition utils.hpp:71
constexpr auto diag(T &A, int diagIdx=0) noexcept
Get the Diagonal of an Eigen Matrix.
Definition eigen.hpp:576
void lassq(const vector_t &x, real_type< type_t< vector_t > > &scale, real_type< type_t< vector_t > > &sumsq, abs_f absF)
Updates a sum of squares represented in scaled form.
Definition lassq.hpp:49
auto lanhe(norm_t normType, uplo_t uplo, const matrix_t &A)
Calculates the norm of a hermitian matrix.
Definition lanhe.hpp:43
#define tlapack_check_false(cond)
Throw an error if cond is true.
Definition exceptionHandling.hpp:113
typename traits::real_type_traits< Types..., int >::type real_type
The common real type of the list of types.
Definition scalar_type_traits.hpp:113