1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334
|
/*
* Copyright 2008-2009 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*! \file blas.h
* \brief BLAS-like functions
*/
#pragma once
#include <cusp/detail/config.h>
#include <cusp/complex.h>
#include <thrust/iterator/iterator_traits.h>
namespace cusp
{
namespace blas
{
/*! \addtogroup algorithms Algorithms
*/
/*! \addtogroup blas BLAS
* \ingroup algorithms
* \{
*/
template <typename ForwardIterator1,
typename ForwardIterator2,
typename ScalarType>
CUSP_DEPRECATED
void axpy(ForwardIterator1 first1,
ForwardIterator1 last1,
ForwardIterator2 first2,
ScalarType alpha);
/*! \p axpy : scaled vector addition (y = alpha * x + y)
*/
template <typename Array1,
typename Array2,
typename ScalarType>
void axpy(const Array1& x,
Array2& y,
ScalarType alpha);
/*! \p axpy : scaled vector addition (y = alpha * x + y)
*/
template <typename Array1,
typename Array2,
typename ScalarType>
void axpy(const Array1& x,
const Array2& y,
ScalarType alpha);
template <typename InputIterator1,
typename InputIterator2,
typename OutputIterator,
typename ScalarType>
CUSP_DEPRECATED
void axpby(InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
OutputIterator output,
ScalarType alpha,
ScalarType beta);
/*! \p axpby : linear combination of two vectors (output = alpha * x + beta * y)
*/
template <typename Array1,
typename Array2,
typename Array3,
typename ScalarType1,
typename ScalarType2>
void axpby(const Array1& x,
const Array2& y,
Array3& output,
ScalarType1 alpha,
ScalarType2 beta);
/*! \p axpby : linear combination of two vectors (output = alpha * x + beta * y)
*/
template <typename Array1,
typename Array2,
typename Array3,
typename ScalarType1,
typename ScalarType2>
void axpby(const Array1& x,
const Array2& y,
const Array3& output,
ScalarType1 alpha,
ScalarType2 beta);
template <typename InputIterator1,
typename InputIterator2,
typename InputIterator3,
typename OutputIterator,
typename ScalarType>
CUSP_DEPRECATED
void axpbypcz(InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
InputIterator3 first3,
OutputIterator output,
ScalarType alpha,
ScalarType beta,
ScalarType gamma);
/*! \p axpbycz : linear combination of three vectors (output = alpha * x + beta * y + gamma * z)
*/
template <typename Array1,
typename Array2,
typename Array3,
typename Array4,
typename ScalarType1,
typename ScalarType2,
typename ScalarType3>
void axpbypcz(const Array1& x,
const Array2& y,
const Array3& z,
Array4& output,
ScalarType1 alpha,
ScalarType2 beta,
ScalarType3 gamma);
/*! \p axpbycz : linear combination of three vectors (output = alpha * x + beta * y + gamma * z)
*/
template <typename Array1,
typename Array2,
typename Array3,
typename Array4,
typename ScalarType1,
typename ScalarType2,
typename ScalarType3>
void axpbypcz(const Array1& x,
const Array2& y,
const Array3& z,
const Array4& output,
ScalarType1 alpha,
ScalarType2 beta,
ScalarType3 gamma);
template <typename InputIterator1,
typename InputIterator2,
typename OutputIterator,
typename ScalarType>
CUSP_DEPRECATED
void xmy(InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2,
OutputIterator output);
/*! \p xmy : elementwise multiplication of two vectors (output[i] = x[i] * y[i])
*/
template <typename Array1,
typename Array2,
typename Array3>
void xmy(const Array1& x,
const Array2& y,
Array3& output);
/*! \p xmy : elementwise multiplication of two vectors (output[i] = x[i] * y[i])
*/
template <typename Array1,
typename Array2,
typename Array3>
void xmy(const Array1& x,
const Array2& y,
const Array3& output);
template <typename InputIterator,
typename ForwardIterator>
CUSP_DEPRECATED
void copy(InputIterator first1,
InputIterator last1,
ForwardIterator first2);
/*! \p copy : vector copy (y = x)
*/
template <typename Array1,
typename Array2>
void copy(const Array1& array1,
Array2& array2);
/*! \p copy : vector copy (y = x)
*/
template <typename Array1,
typename Array2>
void copy(const Array1& array1,
const Array2& array2);
template <typename InputIterator1,
typename InputIterator2>
CUSP_DEPRECATED
typename thrust::iterator_value<InputIterator1>::type
dot(InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2);
/*! \p dot : dot product (x^T * y)
*/
template <typename Array1,
typename Array2>
typename Array1::value_type
dot(const Array1& x,
const Array2& y);
template <typename InputIterator1,
typename InputIterator2>
CUSP_DEPRECATED
typename thrust::iterator_value<InputIterator1>::type
dotc(InputIterator1 first1,
InputIterator1 last1,
InputIterator2 first2);
/*! \p dotc : conjugate dot product (conjugate(x)^T * y)
*/
template <typename Array1,
typename Array2>
typename Array1::value_type
dotc(const Array1& x,
const Array2& y);
template <typename ForwardIterator,
typename ScalarType>
CUSP_DEPRECATED
void fill(ForwardIterator first,
ForwardIterator last,
ScalarType alpha);
/*! \p fill : vector fill (x[i] = alpha)
*/
template <typename Array,
typename ScalarType>
void fill(Array& array,
ScalarType alpha);
/*! \p fill : vector fill (x[i] = alpha)
*/
template <typename Array,
typename ScalarType>
void fill(const Array& array,
ScalarType alpha);
template <typename InputIterator>
CUSP_DEPRECATED
typename norm_type<typename thrust::iterator_value<InputIterator>::type>::type
nrm1(InputIterator first,
InputIterator last);
/*! \p nrm1 : vector 1-norm (sum abs(x[i]))
*/
template <typename Array>
typename norm_type<typename Array::value_type>::type
nrm1(const Array& array);
template <typename InputIterator>
CUSP_DEPRECATED
typename norm_type<typename thrust::iterator_value<InputIterator>::type>::type
nrm2(InputIterator first,
InputIterator last);
/*! \p nrm2 : vector 2-norm (sqrt(sum x[i] * x[i] )
*/
template <typename Array>
typename norm_type<typename Array::value_type>::type
nrm2(const Array& array);
template <typename InputIterator>
CUSP_DEPRECATED
typename thrust::iterator_value<InputIterator>::type
nrmmax(InputIterator first,
InputIterator last);
/*! \p nrmmax : vector infinity norm
*/
template <typename Array>
typename Array::value_type
nrmmax(const Array& array);
template <typename ForwardIterator,
typename ScalarType>
CUSP_DEPRECATED
void scal(ForwardIterator first,
ForwardIterator last,
ScalarType alpha);
/*! \p nrmmax : scale vector (x[i] = alpha * x[i])
*/
template <typename Array,
typename ScalarType>
void scal(Array& x,
ScalarType alpha);
/*! \p nrmmax : scale vector (x[i] = alpha * x[i])
*/
template <typename Array,
typename ScalarType>
void scal(const Array& x,
ScalarType alpha);
/*! \}
*/
} // end namespace blas
} // end namespace cusp
#include <cusp/detail/blas.inl>
|