| 1 |
/* |
| 2 |
* (C) Copyright 2024 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 |
template <typename ScalarValue> |
| 20 |
struct SparseMatrixMultiply<backend::hicsparse, Indexing::layout_left, 1, ScalarValue, const ScalarValue, ScalarValue> { |
| 21 |
static void multiply(const SparseMatrixView<ScalarValue>& W, const View<const ScalarValue, 1>& src, View<ScalarValue, 1>& tgt, |
| 22 |
const Configuration&); |
| 23 |
static void multiply_add(const SparseMatrixView<ScalarValue>& W, const View<const ScalarValue, 1>& src, View<ScalarValue, 1>& tgt, |
| 24 |
const Configuration&); |
| 25 |
}; |
| 26 |
|
| 27 |
template <typename ScalarValue> |
| 28 |
struct SparseMatrixMultiply<backend::hicsparse, Indexing::layout_left, 2, ScalarValue, const ScalarValue, ScalarValue> { |
| 29 |
static void multiply(const SparseMatrixView<ScalarValue>& W, const View<const ScalarValue, 2>& src, View<ScalarValue, 2>& tgt, |
| 30 |
const Configuration&); |
| 31 |
static void multiply_add(const SparseMatrixView<ScalarValue>& W, const View<const ScalarValue, 2>& src, View<ScalarValue, 2>& tgt, |
| 32 |
const Configuration&); |
| 33 |
}; |
| 34 |
|
| 35 |
template <typename ScalarValue> |
| 36 |
struct SparseMatrixMultiply<backend::hicsparse, Indexing::layout_right, 1, ScalarValue, const ScalarValue, ScalarValue> { |
| 37 |
static void multiply(const SparseMatrixView<ScalarValue>& W, const View<const ScalarValue, 1>& src, View<ScalarValue, 1>& tgt, |
| 38 |
const Configuration&); |
| 39 |
static void multiply_add(const SparseMatrixView<ScalarValue>& W, const View<const ScalarValue, 1>& src, View<ScalarValue, 1>& tgt, |
| 40 |
const Configuration&); |
| 41 |
}; |
| 42 |
|
| 43 |
template <typename ScalarValue> |
| 44 |
struct SparseMatrixMultiply<backend::hicsparse, Indexing::layout_right, 2, ScalarValue, const ScalarValue, ScalarValue> { |
| 45 |
static void multiply(const SparseMatrixView<ScalarValue>& W, const View<const ScalarValue, 2>& src, View<ScalarValue, 2>& tgt, |
| 46 |
const Configuration&); |
| 47 |
static void multiply_add(const SparseMatrixView<ScalarValue>& W, const View<const ScalarValue, 2>& src, View<ScalarValue, 2>& tgt, |
| 48 |
const Configuration&); |
| 49 |
}; |
| 50 |
|
| 51 |
} // namespace sparse |
| 52 |
} // namespace linalg |
| 53 |
} // namespace atlas |