| 1 |
/* |
| 2 |
* (C) Copyright 2013 ECMWF. |
| 3 |
* |
| 4 |
* This software is licensed under the terms of the Apache Licence Version 2.0 |
| 5 |
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
| 6 |
* In applying this licence, ECMWF does not waive the privileges and immunities |
| 7 |
* granted to it by virtue of its status as an intergovernmental organisation |
| 8 |
* nor does it submit to any jurisdiction. |
| 9 |
*/ |
| 10 |
|
| 11 |
#pragma once |
| 12 |
|
| 13 |
#include "atlas/linalg/sparse/SparseMatrixMultiply.h" |
| 14 |
|
| 15 |
namespace atlas { |
| 16 |
namespace linalg { |
| 17 |
namespace sparse { |
| 18 |
|
| 19 |
|
| 20 |
template <typename MatrixValue, typename SourceValue, typename TargetValue> |
| 21 |
struct SparseMatrixMultiply<backend::openmp, Indexing::layout_left, 1, MatrixValue, SourceValue, TargetValue> { |
| 22 |
static void multiply(const SparseMatrixView<MatrixValue>& W, const View<SourceValue, 1>& src, View<TargetValue, 1>& tgt, |
| 23 |
const Configuration&); |
| 24 |
static void multiply_add(const SparseMatrixView<MatrixValue>& W, const View<SourceValue, 1>& src, View<TargetValue, 1>& tgt, |
| 25 |
const Configuration&); |
| 26 |
}; |
| 27 |
|
| 28 |
template <typename MatrixValue, typename SourceValue, typename TargetValue> |
| 29 |
struct SparseMatrixMultiply<backend::openmp, Indexing::layout_left, 2, MatrixValue, SourceValue, TargetValue> { |
| 30 |
static void multiply(const SparseMatrixView<MatrixValue>& W, const View<SourceValue, 2>& src, View<TargetValue, 2>& tgt, |
| 31 |
const Configuration&); |
| 32 |
static void multiply_add(const SparseMatrixView<MatrixValue>& W, const View<SourceValue, 2>& src, View<TargetValue, 2>& tgt, |
| 33 |
const Configuration&); |
| 34 |
}; |
| 35 |
|
| 36 |
template <typename MatrixValue, typename SourceValue, typename TargetValue> |
| 37 |
struct SparseMatrixMultiply<backend::openmp, Indexing::layout_left, 3, MatrixValue, SourceValue, TargetValue> { |
| 38 |
static void multiply(const SparseMatrixView<MatrixValue>& W, const View<SourceValue, 3>& src, View<TargetValue, 3>& tgt, |
| 39 |
const Configuration&); |
| 40 |
static void multiply_add(const SparseMatrixView<MatrixValue>& W, const View<SourceValue, 3>& src, View<TargetValue, 3>& tgt, |
| 41 |
const Configuration&); |
| 42 |
}; |
| 43 |
|
| 44 |
template <typename MatrixValue, typename SourceValue, typename TargetValue> |
| 45 |
struct SparseMatrixMultiply<backend::openmp, Indexing::layout_right, 1, MatrixValue, SourceValue, TargetValue> { |
| 46 |
static void multiply(const SparseMatrixView<MatrixValue>& W, const View<SourceValue, 1>& src, View<TargetValue, 1>& tgt, |
| 47 |
const Configuration&); |
| 48 |
static void multiply_add(const SparseMatrixView<MatrixValue>& W, const View<SourceValue, 1>& src, View<TargetValue, 1>& tgt, |
| 49 |
const Configuration&); |
| 50 |
}; |
| 51 |
|
| 52 |
template <typename MatrixValue, typename SourceValue, typename TargetValue> |
| 53 |
struct SparseMatrixMultiply<backend::openmp, Indexing::layout_right, 2, MatrixValue, SourceValue, TargetValue> { |
| 54 |
static void multiply(const SparseMatrixView<MatrixValue>& W, const View<SourceValue, 2>& src, View<TargetValue, 2>& tgt, |
| 55 |
const Configuration&); |
| 56 |
static void multiply_add(const SparseMatrixView<MatrixValue>& W, const View<SourceValue, 2>& src, View<TargetValue, 2>& tgt, |
| 57 |
const Configuration&); |
| 58 |
}; |
| 59 |
|
| 60 |
template <typename MatrixValue, typename SourceValue, typename TargetValue> |
| 61 |
struct SparseMatrixMultiply<backend::openmp, Indexing::layout_right, 3, MatrixValue, SourceValue, TargetValue> { |
| 62 |
static void multiply(const SparseMatrixView<MatrixValue>& W, const View<SourceValue, 3>& src, View<TargetValue, 3>& tgt, |
| 63 |
const Configuration&); |
| 64 |
static void multiply_add(const SparseMatrixView<MatrixValue>& W, const View<SourceValue, 3>& src, View<TargetValue, 3>& tgt, |
| 65 |
const Configuration&); |
| 66 |
}; |
| 67 |
|
| 68 |
} // namespace sparse |
| 69 |
} // namespace linalg |
| 70 |
} // namespace atlas |