Fork me on GitHub
 All Classes Files Functions Variables Groups Pages
multiply.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2014 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 
21 #pragma once
22 
23 #include <cusp/detail/config.h>
24 
25 #include <cusp/execution_policy.h>
26 
27 namespace cusp
28 {
29 
37 template <typename DerivedPolicy,
38  typename LinearOperator,
39  typename MatrixOrVector1,
40  typename MatrixOrVector2>
41 void multiply(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
42  const LinearOperator& A,
43  const MatrixOrVector1& B,
44  MatrixOrVector2& C);
99 template <typename LinearOperator,
100  typename MatrixOrVector1,
101  typename MatrixOrVector2>
102 void multiply(const LinearOperator& A,
103  const MatrixOrVector1& B,
104  MatrixOrVector2& C);
105 
107 template <typename DerivedPolicy,
108  typename LinearOperator,
109  typename MatrixOrVector1,
110  typename MatrixOrVector2,
111  typename UnaryFunction,
112  typename BinaryFunction1,
113  typename BinaryFunction2>
114 typename thrust::detail::disable_if_convertible<UnaryFunction,cusp::known_format,void>::type
115 multiply(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
116  const LinearOperator& A,
117  const MatrixOrVector1& B,
118  MatrixOrVector2& C,
119  UnaryFunction initialize,
120  BinaryFunction1 combine,
121  BinaryFunction2 reduce);
186 template <typename LinearOperator,
187  typename MatrixOrVector1,
188  typename MatrixOrVector2,
189  typename UnaryFunction,
190  typename BinaryFunction1,
191  typename BinaryFunction2>
192 void multiply(const LinearOperator& A,
193  const MatrixOrVector1& B,
194  MatrixOrVector2& C,
195  UnaryFunction initialize,
196  BinaryFunction1 combine,
197  BinaryFunction2 reduce);
198 
200 template <typename DerivedPolicy,
201  typename LinearOperator,
202  typename MatrixOrVector1,
203  typename MatrixOrVector2,
204  typename UnaryFunction,
205  typename BinaryFunction1,
206  typename BinaryFunction2>
207 void generalized_spgemm(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
208  const LinearOperator& A,
209  const MatrixOrVector1& B,
210  MatrixOrVector2& C,
211  UnaryFunction initialize,
212  BinaryFunction1 combine,
213  BinaryFunction2 reduce);
282 template <typename LinearOperator,
283  typename MatrixOrVector1,
284  typename MatrixOrVector2,
285  typename UnaryFunction,
286  typename BinaryFunction1,
287  typename BinaryFunction2>
288 void generalized_spgemm(const LinearOperator& A,
289  const MatrixOrVector1& B,
290  MatrixOrVector2& C,
291  UnaryFunction initialize,
292  BinaryFunction1 combine,
293  BinaryFunction2 reduce);
294 
296 template <typename DerivedPolicy,
297  typename LinearOperator,
298  typename Vector1,
299  typename Vector2,
300  typename Vector3,
301  typename BinaryFunction1,
302  typename BinaryFunction2>
303 void generalized_spmv(const thrust::detail::execution_policy_base<DerivedPolicy> &exec,
304  const LinearOperator& A,
305  const Vector1& x,
306  const Vector2& y,
307  Vector3& z,
308  BinaryFunction1 combine,
309  BinaryFunction2 reduce);
373 template <typename LinearOperator,
374  typename Vector1,
375  typename Vector2,
376  typename Vector3,
377  typename BinaryFunction1,
378  typename BinaryFunction2>
379 void generalized_spmv(const LinearOperator& A,
380  const Vector1& x,
381  const Vector2& y,
382  Vector3& z,
383  BinaryFunction1 combine,
384  BinaryFunction2 reduce);
388 } // end namespace cusp
389 
390 #include <cusp/detail/multiply.inl>
391 
void generalized_spgemm(const LinearOperator &A, const MatrixOrVector1 &B, MatrixOrVector2 &C, UnaryFunction initialize, BinaryFunction1 combine, BinaryFunction2 reduce)
Implements generalized matrix-matrix multiplication.
void generalized_spmv(const LinearOperator &A, const Vector1 &x, const Vector2 &y, Vector3 &z, BinaryFunction1 combine, BinaryFunction2 reduce)
Implements generalized matrix-vector multiplication.
void multiply(const LinearOperator &A, const MatrixOrVector1 &B, MatrixOrVector2 &C, UnaryFunction initialize, BinaryFunction1 combine, BinaryFunction2 reduce)
Implements matrix-vector multiplication with custom combine and reduce functionality.