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

Contents of /trunk/cusplibrary/cusp/transpose.h

Parent Directory Parent Directory | Revision Log Revision Log


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

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 transpose.h
18 * \brief Matrix transpose
19 */
20
21 #pragma once
22
23 #include <cusp/detail/config.h>
24
25 namespace cusp
26 {
27
28 /*! \addtogroup algorithms Algorithms
29 * \ingroup algorithms
30 * \{
31 */
32
33 /*! \p transpose : transpose a matrix
34 *
35 * \param A input matrix
36 * \param At output matrix (transpose of A)
37 *
38 * \tparam MatrixType1 matrix
39 * \tparam MatrixType2 matrix
40 *
41 * The following code snippet demonstrates how to use \p transpose.
42 *
43 * \code
44 * #include <cusp/transpose.h>
45 * #include <cusp/array2d.h>
46 * #include <cusp/print.h>
47 *
48 * int main(void)
49 * {
50 * // initialize a 2x3 matrix
51 * cusp::array2d<float, cusp::host_memory> A(2,3);
52 * A(0,0) = 10; A(0,1) = 20; A(0,2) = 30;
53 * A(1,0) = 40; A(1,1) = 50; A(1,2) = 60;
54 *
55 * // print A
56 * cusp::print(A);
57 *
58 * // compute the transpose
59 * cusp::array2d<float, cusp::host_memory> At;
60 * cusp::transpose(A, At);
61 *
62 * // print A^T
63 * cusp::print(At);
64 *
65 * return 0;
66 * }
67 * \endcode
68 */
69 template <typename MatrixType1, typename MatrixType2>
70 void transpose(const MatrixType1& A, MatrixType2& At);
71
72 /*! \}
73 */
74
75 } // end namespace cusp
76
77 #include <cusp/detail/transpose.inl>
78

  ViewVC Help
Powered by ViewVC 1.1.26