BLAS++
2024.05.31
BLAS C++ API
Loading...
Searching...
No Matches
scal.hh
1
// Copyright (c) 2017-2023, University of Tennessee. All rights reserved.
2
// SPDX-License-Identifier: BSD-3-Clause
3
// This program is free software: you can redistribute it and/or modify it under
4
// the terms of the BSD 3-Clause license. See the accompanying LICENSE file.
5
6
#ifndef BLAS_SCAL_HH
7
#define BLAS_SCAL_HH
8
9
#include "blas/util.hh"
10
11
#include <limits>
12
13
namespace
blas {
14
15
// =============================================================================
33
34
template
<
typename
T>
35
void
scal
(
36
int64_t n,
37
T alpha,
38
T* x, int64_t incx )
39
{
40
// check arguments
41
blas_error_if( n < 0 );
// standard BLAS returns, doesn't fail
42
blas_error_if( incx <= 0 );
// standard BLAS returns, doesn't fail
43
44
if
(incx == 1) {
45
// unit stride
46
for
(int64_t i = 0; i < n; ++i) {
47
x[i] *= alpha;
48
}
49
}
50
else
{
51
// non-unit stride
52
for
(int64_t i = 0; i < n*incx; i += incx) {
53
x[i] *= alpha;
54
}
55
}
56
}
57
58
}
// namespace blas
59
60
#endif
// #ifndef BLAS_SCAL_HH
blas::scal
void scal(int64_t n, float alpha, float *x, int64_t incx, blas::Queue &queue)
GPU device, float version.
Definition
device_scal.cc:65
include
blas
scal.hh
Generated by
1.9.7