nmatrix-gemv 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +29 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +14 -0
  5. data/Gemfile +7 -0
  6. data/README.md +29 -0
  7. data/Rakefile +225 -0
  8. data/ext/nmatrix_gemv/binary_format.txt +53 -0
  9. data/ext/nmatrix_gemv/data/complex.h +399 -0
  10. data/ext/nmatrix_gemv/data/data.cpp +298 -0
  11. data/ext/nmatrix_gemv/data/data.h +771 -0
  12. data/ext/nmatrix_gemv/data/meta.h +70 -0
  13. data/ext/nmatrix_gemv/data/rational.h +436 -0
  14. data/ext/nmatrix_gemv/data/ruby_object.h +471 -0
  15. data/ext/nmatrix_gemv/extconf.rb +254 -0
  16. data/ext/nmatrix_gemv/math.cpp +1639 -0
  17. data/ext/nmatrix_gemv/math/asum.h +143 -0
  18. data/ext/nmatrix_gemv/math/geev.h +82 -0
  19. data/ext/nmatrix_gemv/math/gemm.h +271 -0
  20. data/ext/nmatrix_gemv/math/gemv.h +212 -0
  21. data/ext/nmatrix_gemv/math/ger.h +96 -0
  22. data/ext/nmatrix_gemv/math/gesdd.h +80 -0
  23. data/ext/nmatrix_gemv/math/gesvd.h +78 -0
  24. data/ext/nmatrix_gemv/math/getf2.h +86 -0
  25. data/ext/nmatrix_gemv/math/getrf.h +240 -0
  26. data/ext/nmatrix_gemv/math/getri.h +108 -0
  27. data/ext/nmatrix_gemv/math/getrs.h +129 -0
  28. data/ext/nmatrix_gemv/math/idamax.h +86 -0
  29. data/ext/nmatrix_gemv/math/inc.h +47 -0
  30. data/ext/nmatrix_gemv/math/laswp.h +165 -0
  31. data/ext/nmatrix_gemv/math/long_dtype.h +52 -0
  32. data/ext/nmatrix_gemv/math/math.h +1069 -0
  33. data/ext/nmatrix_gemv/math/nrm2.h +181 -0
  34. data/ext/nmatrix_gemv/math/potrs.h +129 -0
  35. data/ext/nmatrix_gemv/math/rot.h +141 -0
  36. data/ext/nmatrix_gemv/math/rotg.h +115 -0
  37. data/ext/nmatrix_gemv/math/scal.h +73 -0
  38. data/ext/nmatrix_gemv/math/swap.h +73 -0
  39. data/ext/nmatrix_gemv/math/trsm.h +387 -0
  40. data/ext/nmatrix_gemv/nm_memory.h +60 -0
  41. data/ext/nmatrix_gemv/nmatrix_gemv.cpp +90 -0
  42. data/ext/nmatrix_gemv/nmatrix_gemv.h +374 -0
  43. data/ext/nmatrix_gemv/ruby_constants.cpp +153 -0
  44. data/ext/nmatrix_gemv/ruby_constants.h +107 -0
  45. data/ext/nmatrix_gemv/ruby_nmatrix.c +84 -0
  46. data/ext/nmatrix_gemv/ttable_helper.rb +122 -0
  47. data/ext/nmatrix_gemv/types.h +54 -0
  48. data/ext/nmatrix_gemv/util/util.h +78 -0
  49. data/lib/nmatrix-gemv.rb +43 -0
  50. data/lib/nmatrix_gemv/blas.rb +85 -0
  51. data/lib/nmatrix_gemv/nmatrix_gemv.rb +35 -0
  52. data/lib/nmatrix_gemv/rspec.rb +75 -0
  53. data/nmatrix-gemv.gemspec +31 -0
  54. data/spec/blas_spec.rb +154 -0
  55. data/spec/spec_helper.rb +128 -0
  56. metadata +186 -0
@@ -0,0 +1,181 @@
1
+ /////////////////////////////////////////////////////////////////////
2
+ // = NMatrix
3
+ //
4
+ // A linear algebra library for scientific computation in Ruby.
5
+ // NMatrix is part of SciRuby.
6
+ //
7
+ // NMatrix was originally inspired by and derived from NArray, by
8
+ // Masahiro Tanaka: http://narray.rubyforge.org
9
+ //
10
+ // == Copyright Information
11
+ //
12
+ // SciRuby is Copyright (c) 2010 - 2014, Ruby Science Foundation
13
+ // NMatrix is Copyright (c) 2012 - 2014, John Woods and the Ruby Science Foundation
14
+ //
15
+ // Please see LICENSE.txt for additional copyright notices.
16
+ //
17
+ // == Contributing
18
+ //
19
+ // By contributing source code to SciRuby, you agree to be bound by
20
+ // our Contributor Agreement:
21
+ //
22
+ // * https://github.com/SciRuby/sciruby/wiki/Contributor-Agreement
23
+ //
24
+ // == nrm2.h
25
+ //
26
+ // CBLAS nrm2 function
27
+ //
28
+
29
+ /*
30
+ * Automatically Tuned Linear Algebra Software v3.8.4
31
+ * (C) Copyright 1999 R. Clint Whaley
32
+ *
33
+ * Redistribution and use in source and binary forms, with or without
34
+ * modification, are permitted provided that the following conditions
35
+ * are met:
36
+ * 1. Redistributions of source code must retain the above copyright
37
+ * notice, this list of conditions and the following disclaimer.
38
+ * 2. Redistributions in binary form must reproduce the above copyright
39
+ * notice, this list of conditions, and the following disclaimer in the
40
+ * documentation and/or other materials provided with the distribution.
41
+ * 3. The name of the ATLAS group or the names of its contributers may
42
+ * not be used to endorse or promote products derived from this
43
+ * software without specific written permission.
44
+ *
45
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
46
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
47
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
48
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ATLAS GROUP OR ITS CONTRIBUTORS
49
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
50
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
51
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
52
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
53
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
55
+ * POSSIBILITY OF SUCH DAMAGE.
56
+ *
57
+ */
58
+
59
+ #ifndef NRM2_H
60
+ # define NRM2_H
61
+
62
+
63
+ namespace nm { namespace math {
64
+
65
+ /*
66
+ * Level 1 BLAS routine which returns the 2-norm of an n-vector x.
67
+ #
68
+ * Based on input types, these are the valid return types:
69
+ * int -> int
70
+ * float -> float or double
71
+ * double -> double
72
+ * complex64 -> float or double
73
+ * complex128 -> double
74
+ * rational -> rational
75
+ */
76
+ template <typename ReturnDType, typename DType>
77
+ ReturnDType nrm2(const int N, const DType* X, const int incX) {
78
+ const DType ONE = 1, ZERO = 0;
79
+ typename LongDType<DType>::type scale = 0, ssq = 1, absxi, temp;
80
+
81
+
82
+ if ((N < 1) || (incX < 1)) return ZERO;
83
+ else if (N == 1) return std::abs(X[0]);
84
+
85
+ for (int i = 0; i < N; ++i) {
86
+ absxi = std::abs(X[i*incX]);
87
+ if (scale < absxi) {
88
+ temp = scale / absxi;
89
+ scale = absxi;
90
+ ssq = ONE + ssq * (temp * temp);
91
+ } else {
92
+ temp = absxi / scale;
93
+ ssq += temp * temp;
94
+ }
95
+ }
96
+
97
+ return scale * std::sqrt( ssq );
98
+ }
99
+
100
+
101
+ #if defined HAVE_CBLAS_H || defined HAVE_ATLAS_CBLAS_H
102
+ template <>
103
+ inline float nrm2(const int N, const float* X, const int incX) {
104
+ return cblas_snrm2(N, X, incX);
105
+ }
106
+
107
+ template <>
108
+ inline double nrm2(const int N, const double* X, const int incX) {
109
+ return cblas_dnrm2(N, X, incX);
110
+ }
111
+
112
+ template <>
113
+ inline float nrm2(const int N, const Complex64* X, const int incX) {
114
+ return cblas_scnrm2(N, X, incX);
115
+ }
116
+
117
+ template <>
118
+ inline double nrm2(const int N, const Complex128* X, const int incX) {
119
+ return cblas_dznrm2(N, X, incX);
120
+ }
121
+ #else
122
+ template <typename FloatDType>
123
+ static inline void nrm2_complex_helper(const FloatDType& xr, const FloatDType& xi, double& scale, double& ssq) {
124
+ double absx = std::abs(xr);
125
+ if (scale < absx) {
126
+ double temp = scale / absx;
127
+ scale = absx;
128
+ ssq = 1.0 + ssq * (temp * temp);
129
+ } else {
130
+ double temp = absx / scale;
131
+ ssq += temp * temp;
132
+ }
133
+
134
+ absx = std::abs(xi);
135
+ if (scale < absx) {
136
+ double temp = scale / absx;
137
+ scale = absx;
138
+ ssq = 1.0 + ssq * (temp * temp);
139
+ } else {
140
+ double temp = absx / scale;
141
+ ssq += temp * temp;
142
+ }
143
+ }
144
+
145
+ template <>
146
+ float nrm2(const int N, const Complex64* X, const int incX) {
147
+ double scale = 0, ssq = 1, temp;
148
+
149
+ if ((N < 1) || (incX < 1)) return 0.0;
150
+
151
+ for (int i = 0; i < N; ++i) {
152
+ nrm2_complex_helper<float>(X[i*incX].r, X[i*incX].i, scale, temp);
153
+ }
154
+
155
+ return scale * std::sqrt( ssq );
156
+ }
157
+
158
+ template <>
159
+ double nrm2(const int N, const Complex128* X, const int incX) {
160
+ double scale = 0, ssq = 1, temp;
161
+
162
+ if ((N < 1) || (incX < 1)) return 0.0;
163
+
164
+ for (int i = 0; i < N; ++i) {
165
+ nrm2_complex_helper<double>(X[i*incX].r, X[i*incX].i, scale, temp);
166
+ }
167
+
168
+ return scale * std::sqrt( ssq );
169
+ }
170
+ #endif
171
+
172
+ template <typename ReturnDType, typename DType>
173
+ inline void cblas_nrm2(const int N, const void* X, const int incX, void* result) {
174
+ *reinterpret_cast<ReturnDType*>( result ) = nrm2<ReturnDType, DType>( N, reinterpret_cast<const DType*>(X), incX );
175
+ }
176
+
177
+
178
+
179
+ }} // end of namespace nm::math
180
+
181
+ #endif // NRM2_H
@@ -0,0 +1,129 @@
1
+ /////////////////////////////////////////////////////////////////////
2
+ // = NMatrix
3
+ //
4
+ // A linear algebra library for scientific computation in Ruby.
5
+ // NMatrix is part of SciRuby.
6
+ //
7
+ // NMatrix was originally inspired by and derived from NArray, by
8
+ // Masahiro Tanaka: http://narray.rubyforge.org
9
+ //
10
+ // == Copyright Information
11
+ //
12
+ // SciRuby is Copyright (c) 2010 - 2014, Ruby Science Foundation
13
+ // NMatrix is Copyright (c) 2012 - 2014, John Woods and the Ruby Science Foundation
14
+ //
15
+ // Please see LICENSE.txt for additional copyright notices.
16
+ //
17
+ // == Contributing
18
+ //
19
+ // By contributing source code to SciRuby, you agree to be bound by
20
+ // our Contributor Agreement:
21
+ //
22
+ // * https://github.com/SciRuby/sciruby/wiki/Contributor-Agreement
23
+ //
24
+ // == getrs.h
25
+ //
26
+ // getrs function in native C++.
27
+ //
28
+
29
+ /*
30
+ * Automatically Tuned Linear Algebra Software v3.8.4
31
+ * (C) Copyright 1999 R. Clint Whaley
32
+ *
33
+ * Redistribution and use in source and binary forms, with or without
34
+ * modification, are permitted provided that the following conditions
35
+ * are met:
36
+ * 1. Redistributions of source code must retain the above copyright
37
+ * notice, this list of conditions and the following disclaimer.
38
+ * 2. Redistributions in binary form must reproduce the above copyright
39
+ * notice, this list of conditions, and the following disclaimer in the
40
+ * documentation and/or other materials provided with the distribution.
41
+ * 3. The name of the ATLAS group or the names of its contributers may
42
+ * not be used to endorse or promote products derived from this
43
+ * software without specific written permission.
44
+ *
45
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
46
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
47
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
48
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ATLAS GROUP OR ITS CONTRIBUTORS
49
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
50
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
51
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
52
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
53
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
55
+ * POSSIBILITY OF SUCH DAMAGE.
56
+ *
57
+ */
58
+
59
+ #ifndef POTRS_H
60
+ #define POTRS_H
61
+
62
+ extern "C" {
63
+ #if defined HAVE_CBLAS_H
64
+ #include <cblas.h>
65
+ #elif defined HAVE_ATLAS_CBLAS_H
66
+ #include <atlas/cblas.h>
67
+ #endif
68
+ }
69
+
70
+ namespace nm { namespace math {
71
+
72
+ /*
73
+ * Solves a system of linear equations A*X = B with a symmetric positive definite matrix A using the Cholesky factorization computed by POTRF.
74
+ *
75
+ * From ATLAS 3.8.0.
76
+ */
77
+ template <typename DType, bool is_complex>
78
+ int potrs(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, const int NRHS, const DType* A,
79
+ const int lda, DType* B, const int ldb)
80
+ {
81
+ // enum CBLAS_DIAG Lunit, Uunit; // These aren't used. Not sure why they're declared in ATLAS' src.
82
+
83
+ CBLAS_TRANSPOSE MyTrans = is_complex ? CblasConjTrans : CblasTrans;
84
+
85
+ if (!N || !NRHS) return 0;
86
+
87
+ const DType ONE = 1;
88
+
89
+ if (Order == CblasColMajor) {
90
+ if (Uplo == CblasUpper) {
91
+ nm::math::trsm<DType>(Order, CblasLeft, CblasUpper, MyTrans, CblasNonUnit, N, NRHS, ONE, A, lda, B, ldb);
92
+ nm::math::trsm<DType>(Order, CblasLeft, CblasUpper, CblasNoTrans, CblasNonUnit, N, NRHS, ONE, A, lda, B, ldb);
93
+ } else {
94
+ nm::math::trsm<DType>(Order, CblasLeft, CblasLower, CblasNoTrans, CblasNonUnit, N, NRHS, ONE, A, lda, B, ldb);
95
+ nm::math::trsm<DType>(Order, CblasLeft, CblasLower, MyTrans, CblasNonUnit, N, NRHS, ONE, A, lda, B, ldb);
96
+ }
97
+ } else {
98
+ // There's some kind of scaling operation that normally happens here in ATLAS. Not sure what it does, so we'll only
99
+ // worry if something breaks. It probably has to do with their non-templated code and doesn't apply to us.
100
+
101
+ if (Uplo == CblasUpper) {
102
+ nm::math::trsm<DType>(Order, CblasRight, CblasUpper, CblasNoTrans, CblasNonUnit, NRHS, N, ONE, A, lda, B, ldb);
103
+ nm::math::trsm<DType>(Order, CblasRight, CblasUpper, MyTrans, CblasNonUnit, NRHS, N, ONE, A, lda, B, ldb);
104
+ } else {
105
+ nm::math::trsm<DType>(Order, CblasRight, CblasLower, MyTrans, CblasNonUnit, NRHS, N, ONE, A, lda, B, ldb);
106
+ nm::math::trsm<DType>(Order, CblasRight, CblasLower, CblasNoTrans, CblasNonUnit, NRHS, N, ONE, A, lda, B, ldb);
107
+ }
108
+ }
109
+ return 0;
110
+ }
111
+
112
+
113
+ /*
114
+ * Function signature conversion for calling LAPACK's potrs functions as directly as possible.
115
+ *
116
+ * For documentation: http://www.netlib.org/lapack/double/dpotrs.f
117
+ *
118
+ * This function should normally go in math.cpp, but we need it to be available to nmatrix.cpp.
119
+ */
120
+ template <typename DType, bool is_complex>
121
+ inline int clapack_potrs(const enum CBLAS_ORDER order, const enum CBLAS_UPLO uplo, const int n, const int nrhs,
122
+ const void* a, const int lda, void* b, const int ldb) {
123
+ return potrs<DType,is_complex>(order, uplo, n, nrhs, reinterpret_cast<const DType*>(a), lda, reinterpret_cast<DType*>(b), ldb);
124
+ }
125
+
126
+
127
+ } } // end nm::math
128
+
129
+ #endif // POTRS_H
@@ -0,0 +1,141 @@
1
+ /////////////////////////////////////////////////////////////////////
2
+ // = NMatrix
3
+ //
4
+ // A linear algebra library for scientific computation in Ruby.
5
+ // NMatrix is part of SciRuby.
6
+ //
7
+ // NMatrix was originally inspired by and derived from NArray, by
8
+ // Masahiro Tanaka: http://narray.rubyforge.org
9
+ //
10
+ // == Copyright Information
11
+ //
12
+ // SciRuby is Copyright (c) 2010 - 2014, Ruby Science Foundation
13
+ // NMatrix is Copyright (c) 2012 - 2014, John Woods and the Ruby Science Foundation
14
+ //
15
+ // Please see LICENSE.txt for additional copyright notices.
16
+ //
17
+ // == Contributing
18
+ //
19
+ // By contributing source code to SciRuby, you agree to be bound by
20
+ // our Contributor Agreement:
21
+ //
22
+ // * https://github.com/SciRuby/sciruby/wiki/Contributor-Agreement
23
+ //
24
+ // == rot.h
25
+ //
26
+ // BLAS rot function in native C++.
27
+ //
28
+
29
+ /*
30
+ * Automatically Tuned Linear Algebra Software v3.8.4
31
+ * (C) Copyright 1999 R. Clint Whaley
32
+ *
33
+ * Redistribution and use in source and binary forms, with or without
34
+ * modification, are permitted provided that the following conditions
35
+ * are met:
36
+ * 1. Redistributions of source code must retain the above copyright
37
+ * notice, this list of conditions and the following disclaimer.
38
+ * 2. Redistributions in binary form must reproduce the above copyright
39
+ * notice, this list of conditions, and the following disclaimer in the
40
+ * documentation and/or other materials provided with the distribution.
41
+ * 3. The name of the ATLAS group or the names of its contributers may
42
+ * not be used to endorse or promote products derived from this
43
+ * software without specific written permission.
44
+ *
45
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
46
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
47
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
48
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ATLAS GROUP OR ITS CONTRIBUTORS
49
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
50
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
51
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
52
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
53
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
55
+ * POSSIBILITY OF SUCH DAMAGE.
56
+ *
57
+ */
58
+
59
+ #ifndef ROT_H
60
+ # define ROT_H
61
+
62
+ namespace nm { namespace math {
63
+
64
+ // FIXME: This is not working properly for rational numbers. Do we need some kind of symbolic
65
+ // type to handle square roots?
66
+
67
+
68
+ // TODO: Test this to see if it works properly on complex. ATLAS has a separate algorithm for complex, which looks like
69
+ // TODO: it may actually be the same one.
70
+ //
71
+ // This function is called ATL_rot in ATLAS 3.8.4.
72
+ template <typename DType>
73
+ inline void rot_helper(const int N, DType* X, const int incX, DType* Y, const int incY, const DType c, const DType s) {
74
+ if (c != 1 || s != 0) {
75
+ if (incX == 1 && incY == 1) {
76
+ for (int i = 0; i != N; ++i) {
77
+ DType tmp = X[i] * c + Y[i] * s;
78
+ Y[i] = Y[i] * c - X[i] * s;
79
+ X[i] = tmp;
80
+ }
81
+ } else {
82
+ for (int i = N; i > 0; --i, Y += incY, X += incX) {
83
+ DType tmp = *X * c + *Y * s;
84
+ *Y = *Y * c - *X * s;
85
+ *X = tmp;
86
+ }
87
+ }
88
+ }
89
+ }
90
+
91
+
92
+ /* Applies a plane rotation. From ATLAS 3.8.4. */
93
+ template <typename DType, typename CSDType>
94
+ inline void rot(const int N, DType* X, const int incX, DType* Y, const int incY, const CSDType c, const CSDType s) {
95
+ int incx = incX, incy = incY;
96
+ DType *x = X, *y = Y;
97
+
98
+ if (N > 0) {
99
+ if (incX < 0) {
100
+ if (incY < 0) { incx = -incx; incy = -incy; }
101
+ else x += -incX * (N-1);
102
+ } else if (incY < 0) {
103
+ incy = -incy;
104
+ incx = -incx;
105
+ x += (N-1) * incX;
106
+ }
107
+ rot_helper<DType>(N, x, incx, y, incy, c, s);
108
+ }
109
+ }
110
+
111
+ template <>
112
+ inline void rot(const int N, float* X, const int incX, float* Y, const int incY, const float c, const float s) {
113
+ cblas_srot(N, X, incX, Y, incY, (float)c, (float)s);
114
+ }
115
+
116
+ template <>
117
+ inline void rot(const int N, double* X, const int incX, double* Y, const int incY, const double c, const double s) {
118
+ cblas_drot(N, X, incX, Y, incY, c, s);
119
+ }
120
+
121
+ template <>
122
+ inline void rot(const int N, Complex64* X, const int incX, Complex64* Y, const int incY, const float c, const float s) {
123
+ cblas_csrot(N, X, incX, Y, incY, c, s);
124
+ }
125
+
126
+ template <>
127
+ inline void rot(const int N, Complex128* X, const int incX, Complex128* Y, const int incY, const double c, const double s) {
128
+ cblas_zdrot(N, X, incX, Y, incY, c, s);
129
+ }
130
+
131
+
132
+ template <typename DType, typename CSDType>
133
+ inline void cblas_rot(const int N, void* X, const int incX, void* Y, const int incY, const void* c, const void* s) {
134
+ rot<DType,CSDType>(N, reinterpret_cast<DType*>(X), incX, reinterpret_cast<DType*>(Y), incY,
135
+ *reinterpret_cast<const CSDType*>(c), *reinterpret_cast<const CSDType*>(s));
136
+ }
137
+
138
+
139
+ } } //nm::math
140
+
141
+ #endif // ROT_H