53 template<
typename dtype>
55 -> std::conditional_t<std::is_integral_v<dtype>,
int64,
double>
59 using ReturnType = std::conditional_t<std::is_integral_v<dtype>,
int64,
double>;
63 return static_cast<ReturnType
>(inArray.front());
68 return static_cast<ReturnType
>(inArray(0, 0)) *
static_cast<ReturnType
>(inArray(1, 1)) -
69 static_cast<ReturnType
>(inArray(0, 1)) *
static_cast<ReturnType
>(inArray(1, 0));
74 const auto aei =
static_cast<ReturnType
>(inArray(0, 0)) *
static_cast<ReturnType
>(inArray(1, 1)) *
75 static_cast<ReturnType
>(inArray(2, 2));
76 const auto bfg =
static_cast<ReturnType
>(inArray(0, 1)) *
static_cast<ReturnType
>(inArray(1, 2)) *
77 static_cast<ReturnType
>(inArray(2, 0));
78 const auto cdh =
static_cast<ReturnType
>(inArray(0, 2)) *
static_cast<ReturnType
>(inArray(1, 0)) *
79 static_cast<ReturnType
>(inArray(2, 1));
80 const auto ceg =
static_cast<ReturnType
>(inArray(0, 2)) *
static_cast<ReturnType
>(inArray(1, 1)) *
81 static_cast<ReturnType
>(inArray(2, 0));
82 const auto bdi =
static_cast<ReturnType
>(inArray(0, 1)) *
static_cast<ReturnType
>(inArray(1, 0)) *
83 static_cast<ReturnType
>(inArray(2, 2));
84 const auto afh =
static_cast<ReturnType
>(inArray(0, 0)) *
static_cast<ReturnType
>(inArray(1, 2)) *
85 static_cast<ReturnType
>(inArray(2, 1));
87 return aei + bfg + cdh - ceg - bdi - afh;
90 ReturnType determinant = 0;
97 for (
uint32 i = 1; i < order; ++i)
107 submat(subi, subj++) = inArray(i,
j);
112 determinant += (
sign *
static_cast<ReturnType
>(inArray(0,
c)) *
det(submat, order - 1));
130 template<
typename dtype>
#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
const Shape & shape() const noexcept
Definition: NdArrayCore.hpp:4511
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:41
uint32 rows
Definition: Core/Shape.hpp:44
bool issquare() const noexcept
Definition: Core/Shape.hpp:125
constexpr auto j
Definition: Core/Constants.hpp:42
constexpr double c
speed of light
Definition: Core/Constants.hpp:36
auto det(const NdArray< dtype > &inArray, uint32 order) -> std::conditional_t< std::is_integral_v< dtype >, int64, double >
Definition: det.hpp:54
Definition: cholesky.hpp:41
auto det(const NdArray< dtype > &inArray)
Definition: det.hpp:131
int8 sign(dtype inValue) noexcept
Definition: sign.hpp:52
std::int64_t int64
Definition: Types.hpp:35
std::uint32_t uint32
Definition: Types.hpp:40