<T>LAPACK 0.1.1
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
utils.hpp
Go to the documentation of this file.
1
3//
4// Copyright (c) 2021-2023, University of Colorado Denver. All rights reserved.
5//
6// This file is part of <T>LAPACK.
7// <T>LAPACK is free software: you can redistribute it and/or modify it under
8// the terms of the BSD 3-Clause license. See the accompanying LICENSE file.
9
10#ifndef TLAPACK_LEGACY_UTILS_HH
11#define TLAPACK_LEGACY_UTILS_HH
12
14
33#define tlapack_expr_with_2vectors(x, TX, n, X, incx, y, TY, m, Y, incy, expr) \
34 do { \
35 using tlapack::legacy::internal::create_vector; \
36 using tlapack::legacy::internal::create_backward_vector; \
37 if (incx == 1) { \
38 auto x = create_vector((TX*)X, n); \
39 tlapack_expr_with_vector(y, TY, m, Y, incy, expr); \
40 } \
41 else if (incx == -1) { \
42 auto x = create_backward_vector((TX*)X, n); \
43 tlapack_expr_with_vector(y, TY, m, Y, incy, expr); \
44 } \
45 else if (incx > 1) { \
46 auto x = create_vector((TX*)X, n, incx); \
47 tlapack_expr_with_vector(y, TY, m, Y, incy, expr); \
48 } \
49 else { \
50 auto x = create_backward_vector((TX*)X, n, -incx); \
51 tlapack_expr_with_vector(y, TY, m, Y, incy, expr); \
52 } \
53 } while (false)
54
68#define tlapack_expr_with_vector(x, TX, n, X, incx, expr) \
69 do { \
70 using tlapack::legacy::internal::create_vector; \
71 using tlapack::legacy::internal::create_backward_vector; \
72 if (incx == 1) { \
73 auto x = create_vector((TX*)X, n); \
74 expr; \
75 } \
76 else if (incx == -1) { \
77 auto x = create_backward_vector((TX*)X, n); \
78 expr; \
79 } \
80 else if (incx > 1) { \
81 auto x = create_vector((TX*)X, n, incx); \
82 expr; \
83 } \
84 else { \
85 auto x = create_backward_vector((TX*)X, n, -incx); \
86 expr; \
87 } \
88 } while (false)
89
106#define tlapack_expr_with_vector_positiveInc(x, TX, n, X, incx, expr) \
107 do { \
108 using tlapack::legacy::internal::create_vector; \
109 if (incx == 1) { \
110 auto x = create_vector((TX*)X, n); \
111 expr; \
112 } \
113 else { \
114 auto x = create_vector((TX*)X, n, incx); \
115 expr; \
116 } \
117 } while (false)
118
119#endif // TLAPACK_LEGACY_UTILS_HH