VCTR
Loading...
Searching...
No Matches
Asin.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
26template <size_t extent, class SrcType>
27requires is::realOrComplexFloatNumber<ValueType<SrcType>>
29{
30public:
31 using value_type = ValueType<SrcType>;
32
33 VCTR_COMMON_UNARY_EXPRESSION_MEMBERS (Asin, src)
34
35 VCTR_FORCEDINLINE constexpr value_type operator[] (size_t i) const
36 {
37#if VCTR_USE_GCEM
39 {
40 if (std::is_constant_evaluated())
41 return gcem::asin (src[i]);
42 }
43#endif
44
45 return std::asin (src[i]);
46 }
47
48 //==============================================================================
49 // Platform Vector Operation Implementation
50 VCTR_FORCEDINLINE const value_type* evalNextVectorOpInExpressionChain (value_type* dst) const
52 {
53 Expression::Accelerate::asin (src.evalNextVectorOpInExpressionChain (dst), dst, sizeToInt (size()));
54 return dst;
55 }
56
57 VCTR_FORCEDINLINE const value_type* evalNextVectorOpInExpressionChain (value_type* dst) const
59 {
60 Expression::IPP::asin (src.evalNextVectorOpInExpressionChain (dst), dst, sizeToInt (size()));
61 return dst;
62 }
63
64 //==============================================================================
65 // Apple specific SIMD Implementation
66 VCTR_FORCEDINLINE VCTR_TARGET ("sse4.1") SSERegister<value_type> getSSE (size_t i) const
68 {
69 return { vasinf (src.getSSE (i).value) };
70 }
71
72 NeonRegister<value_type> getNeon (size_t i) const
74 {
75 return { vasinf (src.getNeon (i).value) };
76 }
77};
78
79} // namespace vctr::expressions
80
81namespace vctr
82{
83
89
90} // namespace vctr
Definition: Asin.h:29
Constrains a type to represent a real valued floating point number.
Definition: NumericTypeConcepts.h:79
A combined concept to check if Apple Accelerate vpf functions are suitable to work on Neon registers.
Definition: ContainerAndExpressionConcepts.h:238
A combined concept to check if Apple Accelerate is a suitable option for a real valued floating point...
Definition: ContainerAndExpressionConcepts.h:242
A combined concept to check if Apple Accelerate vpf functions are suitable to work on SSE registers.
Definition: ContainerAndExpressionConcepts.h:234
A combined concept to check if Intel IPP is a suitable option for a real or complex valued floating p...
Definition: ContainerAndExpressionConcepts.h:278
constexpr ExpressionChainBuilder< expressions::Asin > asin
Computes the inverse sine of each source element.
Definition: Asin.h:88
The main namespace of the VCTR project.
Definition: Array.h:24
typename detail::ValueType< std::remove_cvref_t< T > >::Type ValueType
If T is an expression template, it equals its return type, if it's a type that defines value_type as ...
Definition: Traits.h:201
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
Definition: NeonRegister.h:28
Definition: SSERegister.h:28