/[escript]/trunk/cusplibrary/cusp/blas.h
ViewVC logotype

Annotation of /trunk/cusplibrary/cusp/blas.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5148 - (hide annotations)
Mon Sep 15 01:25:23 2014 UTC (5 years, 9 months ago) by caltinay
File MIME type: text/plain
File size: 8526 byte(s)
Merging ripley diagonal storage + CUDA support into trunk.
Options file version has been incremented due to new options
'cuda' and 'nvccflags'.

1 caltinay 4955 /*
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 blas.h
18     * \brief BLAS-like functions
19     */
20    
21    
22     #pragma once
23    
24     #include <cusp/detail/config.h>
25    
26     #include <cusp/complex.h>
27    
28     #include <thrust/iterator/iterator_traits.h>
29    
30     namespace cusp
31     {
32     namespace blas
33     {
34    
35     /*! \addtogroup algorithms Algorithms
36     */
37    
38     /*! \addtogroup blas BLAS
39     * \ingroup algorithms
40     * \{
41     */
42    
43     template <typename ForwardIterator1,
44     typename ForwardIterator2,
45     typename ScalarType>
46     CUSP_DEPRECATED
47     void axpy(ForwardIterator1 first1,
48     ForwardIterator1 last1,
49     ForwardIterator2 first2,
50     ScalarType alpha);
51    
52     /*! \p axpy : scaled vector addition (y = alpha * x + y)
53     */
54     template <typename Array1,
55     typename Array2,
56     typename ScalarType>
57     void axpy(const Array1& x,
58     Array2& y,
59     ScalarType alpha);
60    
61     /*! \p axpy : scaled vector addition (y = alpha * x + y)
62     */
63     template <typename Array1,
64     typename Array2,
65     typename ScalarType>
66     void axpy(const Array1& x,
67     const Array2& y,
68     ScalarType alpha);
69    
70    
71     template <typename InputIterator1,
72     typename InputIterator2,
73     typename OutputIterator,
74     typename ScalarType>
75     CUSP_DEPRECATED
76     void axpby(InputIterator1 first1,
77     InputIterator1 last1,
78     InputIterator2 first2,
79     OutputIterator output,
80     ScalarType alpha,
81     ScalarType beta);
82    
83     /*! \p axpby : linear combination of two vectors (output = alpha * x + beta * y)
84     */
85     template <typename Array1,
86     typename Array2,
87     typename Array3,
88     typename ScalarType1,
89     typename ScalarType2>
90     void axpby(const Array1& x,
91     const Array2& y,
92     Array3& output,
93     ScalarType1 alpha,
94     ScalarType2 beta);
95    
96     /*! \p axpby : linear combination of two vectors (output = alpha * x + beta * y)
97     */
98     template <typename Array1,
99     typename Array2,
100     typename Array3,
101     typename ScalarType1,
102     typename ScalarType2>
103     void axpby(const Array1& x,
104     const Array2& y,
105     const Array3& output,
106     ScalarType1 alpha,
107     ScalarType2 beta);
108    
109    
110     template <typename InputIterator1,
111     typename InputIterator2,
112     typename InputIterator3,
113     typename OutputIterator,
114     typename ScalarType>
115     CUSP_DEPRECATED
116     void axpbypcz(InputIterator1 first1,
117     InputIterator1 last1,
118     InputIterator2 first2,
119     InputIterator3 first3,
120     OutputIterator output,
121     ScalarType alpha,
122     ScalarType beta,
123     ScalarType gamma);
124    
125     /*! \p axpbycz : linear combination of three vectors (output = alpha * x + beta * y + gamma * z)
126     */
127     template <typename Array1,
128     typename Array2,
129     typename Array3,
130     typename Array4,
131     typename ScalarType1,
132     typename ScalarType2,
133     typename ScalarType3>
134     void axpbypcz(const Array1& x,
135     const Array2& y,
136     const Array3& z,
137     Array4& output,
138     ScalarType1 alpha,
139     ScalarType2 beta,
140     ScalarType3 gamma);
141    
142     /*! \p axpbycz : linear combination of three vectors (output = alpha * x + beta * y + gamma * z)
143     */
144     template <typename Array1,
145     typename Array2,
146     typename Array3,
147     typename Array4,
148     typename ScalarType1,
149     typename ScalarType2,
150     typename ScalarType3>
151     void axpbypcz(const Array1& x,
152     const Array2& y,
153     const Array3& z,
154     const Array4& output,
155     ScalarType1 alpha,
156     ScalarType2 beta,
157     ScalarType3 gamma);
158    
159    
160     template <typename InputIterator1,
161     typename InputIterator2,
162     typename OutputIterator,
163     typename ScalarType>
164     CUSP_DEPRECATED
165     void xmy(InputIterator1 first1,
166     InputIterator1 last1,
167     InputIterator2 first2,
168     OutputIterator output);
169    
170     /*! \p xmy : elementwise multiplication of two vectors (output[i] = x[i] * y[i])
171     */
172     template <typename Array1,
173     typename Array2,
174     typename Array3>
175     void xmy(const Array1& x,
176     const Array2& y,
177     Array3& output);
178    
179     /*! \p xmy : elementwise multiplication of two vectors (output[i] = x[i] * y[i])
180     */
181     template <typename Array1,
182     typename Array2,
183     typename Array3>
184     void xmy(const Array1& x,
185     const Array2& y,
186     const Array3& output);
187    
188    
189     template <typename InputIterator,
190     typename ForwardIterator>
191     CUSP_DEPRECATED
192     void copy(InputIterator first1,
193     InputIterator last1,
194     ForwardIterator first2);
195    
196     /*! \p copy : vector copy (y = x)
197     */
198     template <typename Array1,
199     typename Array2>
200     void copy(const Array1& array1,
201     Array2& array2);
202    
203     /*! \p copy : vector copy (y = x)
204     */
205     template <typename Array1,
206     typename Array2>
207     void copy(const Array1& array1,
208     const Array2& array2);
209    
210    
211     template <typename InputIterator1,
212     typename InputIterator2>
213     CUSP_DEPRECATED
214     typename thrust::iterator_value<InputIterator1>::type
215     dot(InputIterator1 first1,
216     InputIterator1 last1,
217     InputIterator2 first2);
218    
219     /*! \p dot : dot product (x^T * y)
220     */
221     template <typename Array1,
222     typename Array2>
223     typename Array1::value_type
224     dot(const Array1& x,
225     const Array2& y);
226    
227    
228     template <typename InputIterator1,
229     typename InputIterator2>
230     CUSP_DEPRECATED
231     typename thrust::iterator_value<InputIterator1>::type
232     dotc(InputIterator1 first1,
233     InputIterator1 last1,
234     InputIterator2 first2);
235    
236     /*! \p dotc : conjugate dot product (conjugate(x)^T * y)
237     */
238     template <typename Array1,
239     typename Array2>
240     typename Array1::value_type
241     dotc(const Array1& x,
242     const Array2& y);
243    
244    
245     template <typename ForwardIterator,
246     typename ScalarType>
247     CUSP_DEPRECATED
248     void fill(ForwardIterator first,
249     ForwardIterator last,
250     ScalarType alpha);
251    
252     /*! \p fill : vector fill (x[i] = alpha)
253     */
254     template <typename Array,
255     typename ScalarType>
256     void fill(Array& array,
257     ScalarType alpha);
258    
259     /*! \p fill : vector fill (x[i] = alpha)
260     */
261     template <typename Array,
262     typename ScalarType>
263     void fill(const Array& array,
264     ScalarType alpha);
265    
266    
267     template <typename InputIterator>
268     CUSP_DEPRECATED
269     typename norm_type<typename thrust::iterator_value<InputIterator>::type>::type
270     nrm1(InputIterator first,
271     InputIterator last);
272    
273     /*! \p nrm1 : vector 1-norm (sum abs(x[i]))
274     */
275     template <typename Array>
276     typename norm_type<typename Array::value_type>::type
277     nrm1(const Array& array);
278    
279    
280     template <typename InputIterator>
281     CUSP_DEPRECATED
282     typename norm_type<typename thrust::iterator_value<InputIterator>::type>::type
283     nrm2(InputIterator first,
284     InputIterator last);
285    
286     /*! \p nrm2 : vector 2-norm (sqrt(sum x[i] * x[i] )
287     */
288     template <typename Array>
289     typename norm_type<typename Array::value_type>::type
290     nrm2(const Array& array);
291    
292    
293     template <typename InputIterator>
294     CUSP_DEPRECATED
295     typename thrust::iterator_value<InputIterator>::type
296     nrmmax(InputIterator first,
297     InputIterator last);
298    
299     /*! \p nrmmax : vector infinity norm
300     */
301     template <typename Array>
302     typename Array::value_type
303     nrmmax(const Array& array);
304    
305    
306     template <typename ForwardIterator,
307     typename ScalarType>
308     CUSP_DEPRECATED
309     void scal(ForwardIterator first,
310     ForwardIterator last,
311     ScalarType alpha);
312    
313     /*! \p nrmmax : scale vector (x[i] = alpha * x[i])
314     */
315     template <typename Array,
316     typename ScalarType>
317     void scal(Array& x,
318     ScalarType alpha);
319    
320     /*! \p nrmmax : scale vector (x[i] = alpha * x[i])
321     */
322     template <typename Array,
323     typename ScalarType>
324     void scal(const Array& x,
325     ScalarType alpha);
326    
327     /*! \}
328     */
329    
330     } // end namespace blas
331     } // end namespace cusp
332    
333     #include <cusp/detail/blas.inl>
334    

  ViewVC Help
Powered by ViewVC 1.1.26