9template <
typename Group,
typename T,
typename Op,
typename... Inputs>
10inline constexpr void hadamard(
const Group& group,
13 const Inputs&... inputs) {
17 for (
int index = local_id; index < z.
size(); index += local_size) {
18 z(index) = op(inputs(index)...);
33template <
typename Group,
typename T>
34inline constexpr void copy(
const Group& group,
41 for (
int index = local_id; index < x.
size(); index += local_size) {
51template <
typename Group,
typename T>
52inline constexpr void copyc(
const Group& group,
59 for (
int index = local_id; index < x.
size(); index += local_size) {
68template <
typename Group,
typename T>
69inline constexpr void scal(
const Group& group,
76 for (
int index = local_id; index < x.
size(); index += local_size) {
87template <
typename Group,
typename T>
88inline constexpr void axpy(
const Group& group,
96 for (
int index = local_id; index < x.
size(); index += local_size) {
97 y(index) += alpha * x(index);
107template <
typename Group,
typename T>
112 hadamard(group, z, [](
const T& lhs,
const T& rhs) {
return lhs * rhs; }, x, y);
122template <
typename Group,
typename T,
typename Op,
typename... Inputs>
123 requires(
sizeof...(Inputs) > 0 && (detail::VectorOperandFor<T, Inputs> && ...))
127 const Inputs&... inputs) {
138template <
typename Group,
typename T>
139inline constexpr T
dotu(
const Group& group,
147 for (
int index = local_id; index < x.
size(); index += local_size) {
148 partial += x(index) * y(index);
160template <
typename Group,
typename T>
161inline constexpr T
dotc(
const Group& group,
169 for (
int index = local_id; index < x.
size(); index += local_size) {
Non-owning view of a batch of strided vectors: the vector argument type of the entry points.
int size() const
Entries per item.
constexpr void copy(const Group &group, const VectorView< T > &x, const VectorView< T > &y)
, cooperatively across group.
constexpr void copyc(const Group &group, const VectorView< T > &x, const VectorView< T > &y)
(a plain copy for real T).
constexpr T dotc(const Group &group, const VectorView< T > &x, const VectorView< T > &y)
Conjugated dot product (dotu for real T).
constexpr T dotu(const Group &group, const VectorView< T > &x, const VectorView< T > &y)
Unconjugated dot product .
constexpr void axpy(const Group &group, const VectorView< T > &x, const VectorView< T > &y, T alpha=T(1))
.
constexpr void scal(const Group &group, const VectorView< T > &x, T alpha)
.
constexpr void hadamard(const Group &group, const VectorView< T > &x, const VectorView< T > &y, const VectorView< T > &z)
Element-wise product .
@ Group
the call receives a sycl::group (or sycl::sub_group)
constexpr void hadamard(const Group &group, const VectorView< T > &z, Op op, const Inputs &... inputs)
constexpr int group_local_linear_id(const Group &group)
constexpr void validate_vector_operands(const VectorView< T > &x, const VectorView< T > &y, const char *op_name)
constexpr int group_local_linear_range(const Group &group)
constexpr T reduce_sum_group(const Group &group, const T &value)
constexpr T conj(const T &value)
constexpr void validate_vector_operand(const VectorView< T > &x, const char *op_name)
constexpr void validate_hadamard_operands(const VectorView< T > &z, const char *op_name, const Views &... inputs)