ViennaCL - The Vienna Computing Library
1.2.0
Main Page
Namespaces
Data Structures
Files
File List
Globals
viennacl
forwards.h
Go to the documentation of this file.
1
#ifndef VIENNACL_FORWARDS_H
2
#define VIENNACL_FORWARDS_H
3
4
/* =========================================================================
5
Copyright (c) 2010-2011, Institute for Microelectronics,
6
Institute for Analysis and Scientific Computing,
7
TU Wien.
8
9
-----------------
10
ViennaCL - The Vienna Computing Library
11
-----------------
12
13
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
14
15
(A list of authors and contributors can be found in the PDF manual)
16
17
License: MIT (X11), see file LICENSE in the base directory
18
============================================================================= */
19
20
34
#include <cstddef>
35
#include "
viennacl/ocl/forwards.h
"
36
#include "
viennacl/meta/enable_if.hpp
"
37
38
namespace
viennacl
39
{
40
typedef
std::size_t
vcl_size_t
;
41
typedef
std::ptrdiff_t
vcl_ptrdiff_t
;
42
43
45
struct
op_add;
47
struct
op_sub;
49
struct
op_div;
50
52
struct
op_inner_prod;
53
55
struct
op_norm_1;
56
58
struct
op_norm_2;
59
61
struct
op_norm_inf;
62
64
struct
op_prod;
65
67
struct
op_trans;
68
69
70
//forward declaration of basic types:
71
template
<
class
TYPE>
72
class
scalar
;
73
74
template
<
typename
LHS,
typename
RHS,
typename
OP>
75
class
scalar_expression
;
76
77
template
<
typename
SCALARTYPE>
78
class
entry_proxy
;
79
80
template
<
typename
LHS,
typename
RHS,
typename
OP>
81
class
vector_expression
;
82
83
template
<
class
SCALARTYPE,
unsigned
int
ALIGNMENT>
84
class
vector_iterator
;
85
86
template
<
class
SCALARTYPE,
unsigned
int
ALIGNMENT>
87
class
const_vector_iterator
;
88
89
template
<
class
SCALARTYPE,
unsigned
int
ALIGNMENT = 1>
90
class
vector
;
91
92
//the following forwards are needed for GMRES
93
template
<
typename
SCALARTYPE,
unsigned
int
ALIGNMENT,
typename
CPU_ITERATOR>
94
void
copy
(CPU_ITERATOR
const
& cpu_begin,
95
CPU_ITERATOR
const
& cpu_end,
96
vector_iterator<SCALARTYPE, ALIGNMENT>
gpu_begin);
97
98
template
<
typename
SCALARTYPE,
unsigned
int
ALIGNMENT_SRC,
unsigned
int
ALIGNMENT_DEST>
99
void
copy
(
const_vector_iterator<SCALARTYPE, ALIGNMENT_SRC>
const
& gpu_src_begin,
100
const_vector_iterator<SCALARTYPE, ALIGNMENT_SRC>
const
& gpu_src_end,
101
vector_iterator<SCALARTYPE, ALIGNMENT_DEST>
gpu_dest_begin);
102
103
template
<
typename
SCALARTYPE,
unsigned
int
ALIGNMENT_SRC,
unsigned
int
ALIGNMENT_DEST>
104
void
copy
(
const_vector_iterator<SCALARTYPE, ALIGNMENT_SRC>
const
& gpu_src_begin,
105
const_vector_iterator<SCALARTYPE, ALIGNMENT_SRC>
const
& gpu_src_end,
106
const_vector_iterator<SCALARTYPE, ALIGNMENT_DEST>
gpu_dest_begin);
107
108
109
struct
row_major
;
110
struct
column_major
;
111
112
struct
row_iteration
;
113
struct
col_iteration
;
114
115
template
<
typename
LHS,
typename
RHS,
typename
OP>
116
class
matrix_expression
;
117
118
//
119
// Matrix types:
120
//
121
template
<
class
SCALARTYPE,
typename
F = row_major,
unsigned
int
ALIGNMENT = 1>
122
class
matrix
;
123
124
template
<
class
SCALARTYPE,
unsigned
int
ALIGNMENT = 1>
125
class
compressed_matrix
;
126
127
template
<
class
SCALARTYPE,
unsigned
int
ALIGNMENT = 128>
128
class
coordinate_matrix
;
129
130
template
<
class
SCALARTYPE,
unsigned
int
ALIGNMENT = 1>
131
class
circulant_matrix
;
132
133
template
<
class
SCALARTYPE,
unsigned
int
ALIGNMENT = 1>
134
class
hankel_matrix
;
135
136
template
<
class
SCALARTYPE,
unsigned
int
ALIGNMENT = 1>
137
class
toeplitz_matrix
;
138
139
template
<
class
SCALARTYPE,
unsigned
int
ALIGNMENT = 1>
140
class
vandermonde_matrix
;
141
142
//
143
// Proxies:
144
//
145
template
<
typename
SizeType = std::
size_t
,
typename
DistanceType = std::ptrdiff_t>
146
class
basic_range
;
147
148
typedef
basic_range<>
range
;
149
150
template
<
typename
MatrixType>
151
class
matrix_range
;
152
153
template
<
typename
VectorType>
154
class
vector_range
;
155
156
template
<
typename
T>
157
struct
is_scalar
;
158
159
template
<
typename
T>
160
struct
is_vector
;
161
162
template
<
typename
T>
163
struct
is_matrix
;
164
165
namespace
tools
166
{
167
//helper for matrix row/col iterators
168
//must be specialized for every viennacl matrix type
169
template
<
typename
ROWCOL,
typename
MATRIXTYPE>
170
struct
MATRIX_ITERATOR_INCREMENTER
171
{
172
static
void
apply
(
const
MATRIXTYPE & mat,
unsigned
int
& row,
unsigned
int
& col)
173
{
174
typedef
typename
MATRIXTYPE::ERROR_SPECIALIZATION_FOR_THIS_MATRIX_TYPE_MISSING ErrorIndicator;
175
}
176
};
177
}
178
179
namespace
linalg
180
{
181
template
<
class
SCALARTYPE,
unsigned
int
ALIGNMENT>
182
void
convolve_i
(
viennacl::vector<SCALARTYPE, ALIGNMENT>
& input1,
183
viennacl::vector<SCALARTYPE, ALIGNMENT>
& input2,
184
viennacl::vector<SCALARTYPE, ALIGNMENT>
& output);
185
186
#ifndef _MSC_VER
187
//forward definition of norm_1_impl function
188
template
<
typename
V1,
typename
S2>
189
void
norm_1_impl
(V1
const
& vec,
190
S2 & result,
191
typename
viennacl::enable_if
<
viennacl::is_vector<V1>::value
192
&&
viennacl::is_scalar<S2>::value
193
>::type * dummy = 0);
194
195
//forward definition of norm_2_impl function
196
template
<
typename
V1,
typename
S2>
197
void
norm_2_impl
(V1
const
& vec,
198
S2 & result,
199
typename
viennacl::enable_if
<
viennacl::is_vector<V1>::value
200
&&
viennacl::is_scalar<S2>::value
201
>::type * dummy = 0);
202
203
//forward definition of norm_inf_impl function
204
template
<
typename
V1,
typename
S2>
205
void
norm_inf_impl
(V1
const
& vec,
206
S2 & result,
207
typename
viennacl::enable_if
<
viennacl::is_vector<V1>::value
208
&&
viennacl::is_scalar<S2>::value
209
>::type * dummy = 0);
210
#endif
211
212
//forward definition of prod_impl functions
213
template
<
class
SCALARTYPE,
typename
F,
unsigned
int
ALIGNMENT,
unsigned
int
VECTOR_ALIGNMENT>
214
viennacl::vector_expression<const viennacl::matrix<SCALARTYPE, F, ALIGNMENT>
,
215
const
viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT>
,
216
op_prod >
prod_impl
(
const
viennacl::matrix<SCALARTYPE, F, ALIGNMENT>
&,
217
const
viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT>
&);
218
219
template
<
class
SCALARTYPE,
unsigned
int
ALIGNMENT,
unsigned
int
VECTOR_ALIGNMENT>
220
viennacl::vector_expression<const viennacl::compressed_matrix<SCALARTYPE, ALIGNMENT>
,
221
const
viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT>
,
222
op_prod >
prod_impl
(
const
viennacl::compressed_matrix<SCALARTYPE, ALIGNMENT>
& ,
223
const
viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT>
&);
224
225
template
<
class
SCALARTYPE,
unsigned
int
ALIGNMENT,
unsigned
int
VECTOR_ALIGNMENT>
226
viennacl::vector_expression<const viennacl::coordinate_matrix<SCALARTYPE, ALIGNMENT>
,
227
const
viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT>
,
228
op_prod >
prod_impl
(
const
viennacl::coordinate_matrix<SCALARTYPE, ALIGNMENT>
& ,
229
const
viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT>
&);
230
231
232
//forward definition of inner_prod_impl function
233
/*template <typename V1, typename V2>
234
typename viennacl::enable_if< viennacl::is_vector<V1>::value
235
&& viennacl::is_vector<V2>::value,
236
viennacl::scalar_expression< const V1,
237
const V2,
238
viennacl::op_inner_prod >
239
>::type
240
inner_prod_impl(V1 const & vec1,
241
V2 const & vec2);*/
242
243
#ifndef _MSC_VER
244
template
<
typename
V1,
typename
V2,
typename
S3>
245
void
inner_prod_impl
(V1
const
& vec1,
246
V2
const
& vec2,
247
S3 & result,
248
typename
viennacl::enable_if
<
viennacl::is_vector<V1>::value
249
&&
viennacl::is_vector<V2>::value
250
&&
viennacl::is_scalar<S3>::value
251
>::type * dummy = 0);
252
#endif
253
254
256
struct
lower_tag
257
{
258
static
const
char
*
const
name
() {
return
"lower"
; }
259
};
//lower triangular matrix
261
struct
upper_tag
262
{
263
static
const
char
*
const
name
() {
return
"upper"
; }
264
};
//upper triangular matrix
266
struct
unit_lower_tag
267
{
268
static
const
char
*
const
name
() {
return
"unit_lower"
; }
269
};
//unit lower triangular matrix
271
struct
unit_upper_tag
272
{
273
static
const
char
*
const
name
() {
return
"unit_upper"
; }
274
};
//unit upper triangular matrix
275
276
//preconditioner tags
277
class
ilut_tag;
278
280
class
no_precond
281
{
282
public
:
283
template
<
typename
VectorType>
284
void
apply
(VectorType & vec)
const
{}
285
};
286
287
288
}
//namespace linalg
289
}
//namespace viennacl
290
291
#endif
292
Generated on Fri Jul 27 2012 22:02:47 for ViennaCL - The Vienna Computing Library by
1.8.1.2