VCTR
Loading...
Searching...
No Matches
PowerSpectrum.h
1/*
2 ==============================================================================
3 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
5 Copyright 2023 - by sonible GmbH.
6
7 This file is part of VCTR - Versatile Container Templates Reconceptualized.
8
9 VCTR is free software: you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License version 3
11 only, as published by the Free Software Foundation.
12
13 VCTR is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU Lesser General Public License version 3 for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 version 3 along with VCTR. If not, see <https://www.gnu.org/licenses/>.
20 ==============================================================================
21*/
22
23namespace vctr::expressions
24{
25
26 template <size_t extent, class SrcType>
27 requires is::complexFloatNumber<ValueType<SrcType>>
29 {
30 public:
31 using value_type = RealType<ValueType<SrcType>>;
32
33 VCTR_COMMON_UNARY_EXPRESSION_MEMBERS (PowerSpectrum, src)
34
35 VCTR_FORCEDINLINE constexpr value_type operator[] (size_t i) const
36 {
37 return std::norm (src[i]);
38 }
39
40 VCTR_FORCEDINLINE const value_type* evalNextVectorOpInExpressionChain (value_type* dst) const
42 {
43 Expression::Accelerate::powerSpectrum (src.data(), dst, sizeToInt (size()));
44 return dst;
45 }
46
47 VCTR_FORCEDINLINE const value_type* evalNextVectorOpInExpressionChain (value_type* dst) const
49 {
50 Expression::IPP::powerSpectrum (src.data(), dst, sizeToInt (size()));
51 return dst;
52 }
53 };
54
55} // namespace vctr::expressions
56
57namespace vctr
58{
73
74} // namespace vctr
Definition: PowerSpectrum.h:29
A combined concept to check if Apple Accelerate is a suitable option for a floating point vector oper...
Definition: ContainerAndExpressionConcepts.h:254
A combined concept to check if Intel IPP is a suitable option for a floating point vector operation t...
Definition: ContainerAndExpressionConcepts.h:282
constexpr ExpressionChainBuilder< expressions::PowerSpectrum > powerSpectrum
Computes the power spectrum of the complex source values.
Definition: PowerSpectrum.h:72
The main namespace of the VCTR project.
Definition: Array.h:24
typename detail::RealType< std::remove_cvref_t< T > >::Type RealType
If T is any instance of std::complex, this will be the real value_type, otherwise this will be T.
Definition: Traits.h:211
int sizeToInt(size_t size)
Casts the size_t argument to an int.
Definition: PlatformVectorOpsHelpers.h:27
An expression chain builder is an object which supplies various operator<< overloads which build chai...
Definition: ExpressionChainBuilder.h:136
The base class to every expression template.
Definition: ExpressionTemplate.h:37