/[escript]/branches/diaplayground/cusplibrary/cusp/cmath.h
ViewVC logotype

Contents of /branches/diaplayground/cusplibrary/cusp/cmath.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4955 - (show annotations)
Tue May 20 04:33:15 2014 UTC (5 years ago) by caltinay
File MIME type: text/plain
File size: 3097 byte(s)
added pristine copy of cusplibrary (apache license) to be used by ripley.

1 /*
2 * Copyright 2008-2009 NVIDIA Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /*! \file cmath.h
18 * \brief Complex math functions
19 */
20
21 #pragma once
22
23 #include <cusp/detail/config.h>
24
25 #include <cmath>
26
27 // We need this to make sure code inside cusp:: that calls sqrt() using real numbers
28 // doesn't try to call the complex sqrt, but the standard sqrt
29 namespace cusp
30 {
31 template <typename ValueType>
32 __host__ __device__
33 inline ValueType cos(ValueType x){
34 return std::cos(x);
35 }
36 template <typename ValueType>
37 __host__ __device__
38 inline ValueType sin(ValueType x){
39 return std::sin(x);
40 }
41 template <typename ValueType>
42 __host__ __device__
43 inline ValueType tan(ValueType x){
44 return std::tan(x);
45 }
46 template <typename ValueType>
47 __host__ __device__
48 inline ValueType acos(ValueType x){
49 return std::acos(x);
50 }
51 template <typename ValueType>
52 __host__ __device__
53 inline ValueType asin(ValueType x){
54 return std::asin(x);
55 }
56 template <typename ValueType>
57 __host__ __device__
58 inline ValueType atan(ValueType x){
59 return std::atan(x);
60 }
61 template <typename ValueType>
62 __host__ __device__
63 inline ValueType atan2(ValueType x,ValueType y){
64 return std::atan2(x,y);
65 }
66 template <typename ValueType>
67 __host__ __device__
68 inline ValueType cosh(ValueType x){
69 return std::cosh(x);
70 }
71 template <typename ValueType>
72 __host__ __device__
73 inline ValueType sinh(ValueType x){
74 return std::sinh(x);
75 }
76 template <typename ValueType>
77 __host__ __device__
78 inline ValueType tanh(ValueType x){
79 return std::tanh(x);
80 }
81 template <typename ValueType>
82 __host__ __device__
83 inline ValueType exp(ValueType x){
84 return std::exp(x);
85 }
86 template <typename ValueType>
87 __host__ __device__
88 inline ValueType log(ValueType x){
89 return std::log(x);
90 }
91 template <typename ValueType>
92 __host__ __device__
93 inline ValueType log10(ValueType x){
94 return std::log10(x);
95 }
96 template <typename ValueType, typename ExponentType>
97 __host__ __device__
98 inline ValueType pow(ValueType x, ExponentType e){
99 return std::pow(x,e);
100 }
101 template <typename ValueType>
102 __host__ __device__
103 inline ValueType sqrt(ValueType x){
104 return std::sqrt(x);
105 }
106 template <typename ValueType>
107 __host__ __device__
108 inline ValueType abs(ValueType x){
109 return std::abs(x);
110 }
111 template <typename ValueType>
112 __host__ __device__
113 inline ValueType conj(ValueType x){
114 return x;
115 }
116 }

  ViewVC Help
Powered by ViewVC 1.1.26