52 template<
typename dtype>
62 const auto n =
inA.numRows();
74 for (
auto i = 0u; i <
n; i++)
76 for (
auto j = i + 1; j <
n; j++)
78 const auto val = std::fabs(b(i, j));
93 const auto app = b(
p,
p);
94 const auto aqq = b(
q,
q);
95 const auto apq = b(
p,
q);
97 const auto theta = (
aqq -
app) / (2. *
apq);
100 const auto c = 1.0 / std::sqrt(1. +
utils::sqr(
t));
101 const auto s =
t * c;
103 for (
auto i = 0u; i <
n; ++i)
105 if (i !=
p && i !=
q)
107 const auto bip = b(i,
p);
108 const auto biq = b(i,
q);
116 b(
p,
p) = c * c *
app + s * s *
aqq - 2. * c * s *
apq;
117 b(
q,
q) = s * s *
app + c * c *
aqq + 2. * c * s *
apq;
121 for (
auto i = 0u; i <
n; ++i)
130 for (
auto i = 0u; i <
n; ++i)
135 for (
auto i = 0u; i <
n - 1; ++i)
137 for (
auto j = i + 1; j <
n; ++j)
143 for (
auto k = 0u; k <
n; ++k)
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition StaticAsserts.hpp:39
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
Definition cholesky.hpp:41
std::pair< NdArray< double >, NdArray< double > > eig(const NdArray< dtype > &inA, double inTolerance=1e-12)
Definition eig.hpp:53
constexpr dtype sqr(dtype inValue) noexcept
Definition sqr.hpp:42
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59