36 template <nda::Scalar S>
46 template <nda::Scalar S>
56 FORCEINLINE
auto abs2(
auto x) {
return std::norm(x); }
60 bool isnan(S
const &x) {
62 return std::isnan(x.real()) or std::isnan(x.
imag());
70 auto operator()(
auto const &x)
const {
return conj(x); };
83 template <Scalar S, Scalar P>
97 template <Array A, Scalar S>
98 auto pow(A &&a, S p) {
99 return nda::map([p](
auto const &x) {
return pow(x, p); })(std::forward<A>(a));
111 template <ArrayOrScalar A>
114 return nda::map(detail::conj_f{})(std::forward<A>(a));
116 return std::forward<A>(a);
127 template <ArrayOrScalar A>
129 return nda::map([]<
typename T>(T
const &x) {
132 if constexpr (std::is_floating_point_v<real_t>) {
133 return real_t{1} / x;
140 })(std::forward<A>(a));
152 template <ArrayOrScalar A, ArrayOrScalar B>
155 [[nodiscard]]
auto max(A &&a, B &&b) {
156 return nda::map([](
auto const &x,
auto const &y) {
159 })(std::forward<A>(a), std::forward<B>(b));
171 template <ArrayOrScalar A, ArrayOrScalar B>
174 [[nodiscard]]
auto min(A &&a, B &&b) {
175 return nda::map([](
auto const &x,
auto const &y) {
178 })(std::forward<A>(a), std::forward<B>(b));
195 return nda::map([](
auto const &x) {
return abs(x); })(std::forward<A>(a));
203 template <ArrayOrScalar A>
208 })(std::forward<A>(a));
225 return nda::map([](
auto const &x) {
return floor(x); })(std::forward<A>(a));
233 template <ArrayOrScalar A>
235 return nda::map([](
auto const &x) {
return detail::real(x); })(std::forward<A>(a));
243 template <ArrayOrScalar A>
245 return nda::map([](
auto const &x) {
return detail::abs2(x); })(std::forward<A>(a));
265 template <
typename A>
268 return nda::map([](
auto const &x) {
return detail::isnan(x); })(std::forward<A>(a));
287 return nda::map([](
auto const &x) {
return exp(x); })(std::forward<A>(a));
306 return nda::map([](
auto const &x) {
return cos(x); })(std::forward<A>(a));
325 return nda::map([](
auto const &x) {
return sin(x); })(std::forward<A>(a));
344 return nda::map([](
auto const &x) {
return tan(x); })(std::forward<A>(a));
363 return nda::map([](
auto const &x) {
return cosh(x); })(std::forward<A>(a));
382 return nda::map([](
auto const &x) {
return sinh(x); })(std::forward<A>(a));
401 return nda::map([](
auto const &x) {
return tanh(x); })(std::forward<A>(a));
420 return nda::map([](
auto const &x) {
return acos(x); })(std::forward<A>(a));
439 return nda::map([](
auto const &x) {
return asin(x); })(std::forward<A>(a));
458 return nda::map([](
auto const &x) {
return atan(x); })(std::forward<A>(a));
477 return nda::map([](
auto const &x) {
return log(x); })(std::forward<A>(a));
496 return nda::map([](
auto const &x) {
return sqrt(x); })(std::forward<A>(a));
Check if a given type satisfies the array concept.
Check if a given type is either an arithmetic or complex type.
Provides concepts for the nda library.
auto sinh(S s)
Function sinh for nda::Scalar types (uses std::sinh).
auto asin(S s)
Function asin for nda::Scalar types (uses std::asin).
auto atan(S s)
Function atan for nda::Scalar types (uses std::atan).
auto isnan(S s)
Function isnan for real nda::Scalar types (uses std::isnan).
auto tanh(S s)
Function tanh for nda::Scalar types (uses std::tanh).
auto sin(S s)
Function sin for nda::Scalar types (uses std::sin).
auto real(A &&a)
Function real for nda::ArrayOrScalar types (lazy and coefficient-wise for nda::Array types).
auto abs(S s)
Function abs for nda::Scalar types (uses std::abs).
auto floor(S s)
Function floor for nda::Scalar types (uses std::floor).
auto cosh(S s)
Function cosh for nda::Scalar types (uses std::cosh).
auto tan(S s)
Function tan for nda::Scalar types (uses std::tan).
auto acos(S s)
Function acos for nda::Scalar types (uses std::acos).
auto min(A &&a, B &&b)
Function min for nda::ArrayOrScalar types (lazy and coefficient-wise for nda::Array types).
auto imag(A &&a)
Function imag for nda::ArrayOrScalar types (lazy and coefficient-wise for nda::Array types).
auto abs2(A &&a)
Function abs2 for nda::ArrayOrScalar types (lazy and coefficient-wise for nda::Array types).
auto reciprocal(A &&a)
Reciprocal function for nda::ArrayOrScalar types (lazy and coefficient-wise for nda::Array types).
auto cos(S s)
Function cos for nda::Scalar types (uses std::cos).
auto max(A &&a, B &&b)
Function max for nda::ArrayOrScalar types (lazy and coefficient-wise for nda::Array types).
decltype(auto) conj(A &&a)
Function conj for nda::ArrayOrScalar types (lazy and coefficient-wise for nda::Array types with a com...
auto log(S s)
Function log for nda::Scalar types (uses std::log).
auto exp(S s)
Function exp for nda::Scalar types (uses std::exp).
mapped< F > map(F f)
Create a lazy function call expression on arrays/views.
auto pow(S s, P p)
Function pow for nda::Scalar types (uses std::pow).
auto sqrt(S s)
Function sqrt for nda::Scalar types (uses std::sqrt).
constexpr char get_algebra
Constexpr variable that specifies the algebra of a type.
constexpr int get_rank
Constexpr variable that specifies the rank of an nda::Array or of a contiguous 1-dimensional range.
auto conj(A &&...__a)
Lazy version of std::conj.
constexpr bool is_complex_v
Constexpr variable that is true if type T is a std::complex type.
typename remove_complex< T >::type remove_complex_t
Alias template for the nested type in nda::remove_complex.
Macros used in the nda library.
Provides lazy function calls on arrays/views.
Provides type traits for the nda library.