ViennaCL - The Vienna Computing Library: tests/src/global_variables.cpp Source File

ViennaCL - The Vienna Computing Library 1.7.1 Free open-source GPU-accelerated linear algebra and solver library. |

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
global_variables.cpp
Go to the documentation of this file.
1 /* =========================================================================
2 Copyright (c) 2010-2016, Institute for Microelectronics,
3 Institute for Analysis and Scientific Computing,
4 TU Wien.
5 Portions of this software are copyright by UChicago Argonne, LLC.
6
7 -----------------
8 ViennaCL - The Vienna Computing Library
9 -----------------
10
11 Project Head: Karl Rupp rupp@iue.tuwien.ac.at
12
13 (A list of authors and contributors can be found in the PDF manual)
14
15 License: MIT (X11), see file LICENSE in the base directory
16 ============================================================================= */
17
22 //
23 // *** System
24 //
25 #include <iostream>
26 #include <algorithm>
27 #include <cmath>
28
29 //
30 // *** ViennaCL
31 //
32 #include "viennacl/scalar.hpp"
33 #include "viennacl/vector.hpp"
34 #include "viennacl/matrix.hpp"
35 #include "viennacl/compressed_matrix.hpp"
36 #include "viennacl/coordinate_matrix.hpp"
37 #include "viennacl/ell_matrix.hpp"
38 #include "viennacl/hyb_matrix.hpp"
39 #ifdef VIENNACL_WITH_OPENCL
40 #include "viennacl/circulant_matrix.hpp"
41 #include "viennacl/hankel_matrix.hpp"
42 #include "viennacl/toeplitz_matrix.hpp"
43 #include "viennacl/vandermonde_matrix.hpp"
44 #endif
45
46
47 // forward declarations of global variables:
48 extern viennacl::scalar<float> s1;
49 extern viennacl::scalar<int> s2;
50
51 extern viennacl::vector<float> v1;
52 extern viennacl::vector<int> v2;
53
54 extern viennacl::matrix<float> m1;
55
56 // instantiation of global variables:
57 viennacl::scalar<float> s1;
58 viennacl::scalar<int> s2;
59
60 viennacl::vector<float> v1;
61 viennacl::vector<int> v2;
62
63 viennacl::matrix<float> m1;
64 //viennacl::matrix<int> m2;
65
66 // TODO: Add checks for other types
67
68 //
69 // -------------------------------------------------------------
70 //
71 int main()
72 {
73 std::cout << std::endl;
74 std::cout << "----------------------------------------------" << std::endl;
75 std::cout << "----------------------------------------------" << std::endl;
76 std::cout << "## Test :: Instantiation of global variables" << std::endl;
77 std::cout << "----------------------------------------------" << std::endl;
78 std::cout << "----------------------------------------------" << std::endl;
79 std::cout << std::endl;
80
81 s1 = viennacl::scalar<float>(1.0f);
82 s2 = viennacl::scalar<int>(1);
83
84 v1 = viennacl::vector<float>(5);
85 v2 = viennacl::vector<int>(5);
86
87 m1 = viennacl::matrix<float>(5, 4);
88 //m2 = viennacl::matrix<int>(5, 4);
89
90 std::cout << std::endl;
91 std::cout << "------- Test completed --------" << std::endl;
92 std::cout << std::endl;
93
94
95 return EXIT_SUCCESS;
96 }
97 //
98 // -------------------------------------------------------------
99 //
100
viennacl::scalar< float >
matrix.hpp
Implementation of the dense matrix class.
viennacl::matrix
A dense matrix class.
Definition: forwards.h:375
s2
viennacl::scalar< int > s2
Definition: global_variables.cpp:58
main
int main()
Definition: global_variables.cpp:71
s1
viennacl::scalar< float > s1
Definition: global_variables.cpp:57
coordinate_matrix.hpp
Implementation of the coordinate_matrix class.
v1
viennacl::vector< float > v1
Definition: global_variables.cpp:60
hyb_matrix.hpp
Implementation of the hyb_matrix class.
hankel_matrix.hpp
Implementation of the hankel_matrix class for efficient manipulation of Hankel matrices. Experimental.
circulant_matrix.hpp
Implementation of the circulant_matrix class for efficient manipulation of circulant matrices...
compressed_matrix.hpp
Implementation of the compressed_matrix class.
ell_matrix.hpp
Implementation of the ell_matrix class.
viennacl::vector
Definition: forwards.h:266
vandermonde_matrix.hpp
Implementation of the vandermonde_matrix class for efficient manipulation of Vandermonde matrices...
v2
viennacl::vector< int > v2
Definition: global_variables.cpp:61
vector.hpp
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
m1
viennacl::matrix< float > m1
Definition: global_variables.cpp:63
scalar.hpp
Implementation of the ViennaCL scalar class.
toeplitz_matrix.hpp
Implementation of the toeplitz_matrix class for efficient manipulation of Toeplitz matrices...