35 #include <itpp/itexports.h>
46 inline void copy_vector(
int n,
const int *x,
int *y)
48 memcpy(y, x, n *
sizeof(
int));
50 inline void copy_vector(
int n,
const short *x,
short *y)
52 memcpy(y, x, n *
sizeof(
short));
54 inline void copy_vector(
int n,
const bin *x, bin *y)
56 memcpy(y, x, n *
sizeof(bin));
59 ITPP_EXPORT
void copy_vector(
int n,
const double *x,
double *y);
60 ITPP_EXPORT
void copy_vector(
int n,
const std::complex<double> *x,
61 std::complex<double> *y);
63 template<
class T>
inline
64 void copy_vector(
int n,
const T *x, T *y)
66 for (
int i = 0; i < n; i++)
76 ITPP_EXPORT
void copy_vector(
int n,
const double *x,
int incx,
double *y,
int incy);
77 ITPP_EXPORT
void copy_vector(
int n,
const std::complex<double> *x,
int incx,
78 std::complex<double> *y,
int incy);
80 template<
class T>
inline
81 void copy_vector(
int n,
const T *x,
int incx, T *y,
int incy)
83 for (
int i = 0; i < n; i++)
84 y[i*incy] = x[i*incx];
91 inline void swap_vector(
int n,
int *x,
int *y)
93 for (
int i = 0; i < n; i++)
94 std::swap(x[i], y[i]);
96 inline void swap_vector(
int n,
short *x,
short *y)
98 for (
int i = 0; i < n; i++)
99 std::swap(x[i], y[i]);
101 inline void swap_vector(
int n, bin *x, bin *y)
103 for (
int i = 0; i < n; i++)
104 std::swap(x[i], y[i]);
107 ITPP_EXPORT
void swap_vector(
int n,
double *x,
double *y);
108 ITPP_EXPORT
void swap_vector(
int n, std::complex<double> *x, std::complex<double> *y);
110 template<
class T>
inline
111 void swap_vector(
int n, T *x, T *y)
114 for (
int i = 0; i < n; i++) {
127 inline void swap_vector(
int n,
int *x,
int incx,
int *y,
int incy)
129 for (
int i = 0; i < n; i++)
130 std::swap(x[i*incx], y[i*incy]);
132 inline void swap_vector(
int n,
short *x,
int incx,
short *y,
int incy)
134 for (
int i = 0; i < n; i++)
135 std::swap(x[i*incx], y[i*incy]);
137 inline void swap_vector(
int n, bin *x,
int incx, bin *y,
int incy)
139 for (
int i = 0; i < n; i++)
140 std::swap(x[i*incx], y[i*incy]);
143 ITPP_EXPORT
void swap_vector(
int n,
double *x,
int incx,
double *y,
int incy);
144 ITPP_EXPORT
void swap_vector(
int n, std::complex<double> *x,
int incx,
145 std::complex<double> *y,
int incy);
147 template<
class T>
inline
148 void swap_vector(
int n, T *x,
int incx, T *y,
int incy)
151 for (
int i = 0; i < n; i++) {
153 y[i*incy] = x[i*incx];
162 ITPP_EXPORT
void scal_vector(
int n,
double alpha,
double *x);
163 ITPP_EXPORT
void scal_vector(
int n, std::complex<double> alpha, std::complex<double> *x);
165 template<
typename T>
inline
166 void scal_vector(
int n, T alpha, T *x)
169 for (
int i = 0; i < n; ++i) {
180 ITPP_EXPORT
void scal_vector(
int n,
double alpha,
double *x,
int incx);
181 ITPP_EXPORT
void scal_vector(
int n, std::complex<double> alpha, std::complex<double> *x,
184 template<
typename T>
inline
185 void scal_vector(
int n, T alpha, T *x,
int incx)
188 for (
int i = 0; i < n; ++i) {
198 ITPP_EXPORT
void axpy_vector(
int n,
double alpha,
const double *x,
double *y);
200 ITPP_EXPORT
void axpy_vector(
int n, std::complex<double> alpha,
201 const std::complex<double> *x, std::complex<double> *y);
203 template<
typename T>
inline
204 void axpy_vector(
int n, T alpha,
const T *x, T *y)
207 for (
int i = 0; i < n; ++i) {
208 y[i] += alpha * x[i];
212 for (
int i = 0; i < n; ++i) {
224 ITPP_EXPORT
void axpy_vector(
int n,
double alpha,
const double *x,
int incx,
double *y,
226 ITPP_EXPORT
void axpy_vector(
int n, std::complex<double> alpha,
227 const std::complex<double> *x,
int incx,
228 std::complex<double> *y,
int incy);
230 template<
typename T>
inline
231 void axpy_vector(
int n, T alpha,
const T *x,
int incx, T *y,
int incy)
234 for (
int i = 0; i < n; ++i) {
235 y[i*incy] += alpha * x[i*incx];
239 for (
int i = 0; i < n; ++i) {
240 y[i*incy] += x[i*incx];
250 #endif // #ifndef COPY_VECTOR_H