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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4955 - (show annotations)
Tue May 20 04:33:15 2014 UTC (5 years, 1 month ago) by caltinay
File MIME type: text/plain
File size: 2531 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 print.h
18 * \brief Print textual representation of an object
19 */
20
21 #pragma once
22
23 #include <cusp/detail/config.h>
24
25 namespace cusp
26 {
27
28 /*! \addtogroup utilities Utilities
29 * \ingroup utilities
30 * \{
31 */
32
33 /*! \p print : print a textual representation of an object
34 *
35 * \param p matrix, array, or other printable object
36 *
37 * \tparam Printable printable type
38 *
39 * The following code snippet demonstrates how to use \p print.
40 *
41 * \code
42 * #include <cusp/array2d.h>
43 * #include <cusp/print.h>
44 *
45 * int main(void)
46 * {
47 * // initialize a 2x3 matrix
48 * cusp::array2d<float, cusp::host_memory> A(2,3);
49 * A(0,0) = 10; A(0,1) = 20; A(0,2) = 30;
50 * A(1,0) = 40; A(1,1) = 50; A(1,2) = 60;
51 *
52 * // print A
53 * cusp::print(A);
54 *
55 * return 0;
56 * }
57 * \endcode
58 */
59 template <typename Printable>
60 void print(const Printable& p);
61
62 /*! \p print : print a textual representation of an object on a given stream
63 *
64 * \param p matrix, array, or other printable object
65 * \param s stream on which to write the output
66 *
67 * \tparam Printable printable type
68 * \tparam Stream output stream type
69 *
70 * The following code snippet demonstrates how to use \p print.
71 *
72 * \code
73 * #include <cusp/array2d.h>
74 * #include <cusp/print.h>
75 *
76 * #include <sstream>
77 *
78 * int main(void)
79 * {
80 * // initialize a 2x3 matrix
81 * cusp::array2d<float, cusp::host_memory> A(2,3);
82 * A(0,0) = 10; A(0,1) = 20; A(0,2) = 30;
83 * A(1,0) = 40; A(1,1) = 50; A(1,2) = 60;
84 *
85 * std::ostringstream oss;
86 *
87 * // print A to stream
88 * cusp::print(A, oss);
89 *
90 * return 0;
91 * }
92 * \endcode
93 */
94 template <typename Printable, typename Stream>
95 void print(const Printable& p, Stream& s);
96
97 template <typename Matrix>
98 CUSP_DEPRECATED
99 void print_matrix(const Matrix& matrix);
100
101 /*! \}
102 */
103
104 } // end namespace cusp
105
106 #include <cusp/detail/print.inl>
107

  ViewVC Help
Powered by ViewVC 1.1.26