nmatrix-lapacke 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/ext/nmatrix/data/data.h +7 -8
  3. data/ext/nmatrix/data/ruby_object.h +1 -4
  4. data/ext/nmatrix/math/asum.h +10 -31
  5. data/ext/nmatrix/math/cblas_templates_core.h +10 -10
  6. data/ext/nmatrix/math/getrf.h +2 -2
  7. data/ext/nmatrix/math/imax.h +12 -9
  8. data/ext/nmatrix/math/laswp.h +3 -3
  9. data/ext/nmatrix/math/long_dtype.h +16 -3
  10. data/ext/nmatrix/math/magnitude.h +54 -0
  11. data/ext/nmatrix/math/nrm2.h +19 -14
  12. data/ext/nmatrix/math/trsm.h +40 -36
  13. data/ext/nmatrix/math/util.h +14 -0
  14. data/ext/nmatrix/nmatrix.h +39 -1
  15. data/ext/nmatrix/storage/common.h +9 -3
  16. data/ext/nmatrix/storage/yale/class.h +1 -1
  17. data/ext/nmatrix_lapacke/extconf.rb +3 -136
  18. data/ext/nmatrix_lapacke/lapacke.cpp +104 -84
  19. data/ext/nmatrix_lapacke/lapacke/src/lapacke_cgeqrf.c +77 -0
  20. data/ext/nmatrix_lapacke/lapacke/src/lapacke_cgeqrf_work.c +89 -0
  21. data/ext/nmatrix_lapacke/lapacke/src/lapacke_cunmqr.c +88 -0
  22. data/ext/nmatrix_lapacke/lapacke/src/lapacke_cunmqr_work.c +111 -0
  23. data/ext/nmatrix_lapacke/lapacke/src/lapacke_dgeqrf.c +75 -0
  24. data/ext/nmatrix_lapacke/lapacke/src/lapacke_dgeqrf_work.c +87 -0
  25. data/ext/nmatrix_lapacke/lapacke/src/lapacke_dormqr.c +86 -0
  26. data/ext/nmatrix_lapacke/lapacke/src/lapacke_dormqr_work.c +109 -0
  27. data/ext/nmatrix_lapacke/lapacke/src/lapacke_sgeqrf.c +75 -0
  28. data/ext/nmatrix_lapacke/lapacke/src/lapacke_sgeqrf_work.c +87 -0
  29. data/ext/nmatrix_lapacke/lapacke/src/lapacke_sormqr.c +86 -0
  30. data/ext/nmatrix_lapacke/lapacke/src/lapacke_sormqr_work.c +109 -0
  31. data/ext/nmatrix_lapacke/lapacke/src/lapacke_zgeqrf.c +77 -0
  32. data/ext/nmatrix_lapacke/lapacke/src/lapacke_zgeqrf_work.c +89 -0
  33. data/ext/nmatrix_lapacke/lapacke/src/lapacke_zunmqr.c +88 -0
  34. data/ext/nmatrix_lapacke/lapacke/src/lapacke_zunmqr_work.c +111 -0
  35. data/ext/nmatrix_lapacke/lapacke/utils/lapacke_c_nancheck.c +51 -0
  36. data/ext/nmatrix_lapacke/lapacke/utils/lapacke_d_nancheck.c +51 -0
  37. data/ext/nmatrix_lapacke/lapacke/utils/lapacke_s_nancheck.c +51 -0
  38. data/ext/nmatrix_lapacke/lapacke/utils/lapacke_z_nancheck.c +51 -0
  39. data/ext/nmatrix_lapacke/math_lapacke.cpp +149 -17
  40. data/ext/nmatrix_lapacke/math_lapacke/lapacke_templates.h +76 -0
  41. data/lib/nmatrix/lapacke.rb +118 -0
  42. data/spec/00_nmatrix_spec.rb +50 -1
  43. data/spec/02_slice_spec.rb +21 -21
  44. data/spec/blas_spec.rb +25 -3
  45. data/spec/math_spec.rb +233 -5
  46. data/spec/plugins/lapacke/lapacke_spec.rb +187 -0
  47. data/spec/shortcuts_spec.rb +145 -5
  48. data/spec/spec_helper.rb +24 -1
  49. metadata +38 -8
@@ -1,100 +1,120 @@
1
1
  //This file is auto-generated by make_lapacke_cpp.rb
2
2
  //It includes all source files in the lapacke/ subdirectory
3
- #include "lapacke/utils/lapacke_dtr_nancheck.c"
4
- #include "lapacke/utils/lapacke_dpo_nancheck.c"
5
- #include "lapacke/utils/lapacke_ztr_nancheck.c"
6
- #include "lapacke/utils/lapacke_str_trans.c"
7
- #include "lapacke/utils/lapacke_cge_nancheck.c"
8
- #include "lapacke/utils/lapacke_dtr_trans.c"
9
- #include "lapacke/utils/lapacke_zge_nancheck.c"
10
- #include "lapacke/utils/lapacke_cpo_trans.c"
11
- #include "lapacke/utils/lapacke_zpo_nancheck.c"
12
- #include "lapacke/utils/lapacke_dge_nancheck.c"
13
- #include "lapacke/utils/lapacke_ctr_trans.c"
14
- #include "lapacke/utils/lapacke_ztr_trans.c"
15
- #include "lapacke/utils/lapacke_cge_trans.c"
16
- #include "lapacke/utils/lapacke_dpo_trans.c"
17
- #include "lapacke/utils/lapacke_spo_trans.c"
18
- #include "lapacke/utils/lapacke_ctr_nancheck.c"
19
- #include "lapacke/utils/lapacke_cpo_nancheck.c"
20
- #include "lapacke/utils/lapacke_str_nancheck.c"
21
- #include "lapacke/utils/lapacke_xerbla.c"
22
- #include "lapacke/utils/lapacke_dge_trans.c"
23
- #include "lapacke/utils/lapacke_sge_nancheck.c"
24
- #include "lapacke/utils/lapacke_zge_trans.c"
25
- #include "lapacke/utils/lapacke_sge_trans.c"
26
- #include "lapacke/utils/lapacke_lsame.c"
27
- #include "lapacke/utils/lapacke_spo_nancheck.c"
28
- #include "lapacke/utils/lapacke_zpo_trans.c"
29
- #include "lapacke/src/lapacke_zgesvd_work.c"
30
- #include "lapacke/src/lapacke_cgetri_work.c"
3
+ #include "lapacke/src/lapacke_dgeev_work.c"
4
+ #include "lapacke/src/lapacke_zgeqrf_work.c"
5
+ #include "lapacke/src/lapacke_cgesdd.c"
6
+ #include "lapacke/src/lapacke_cunmqr.c"
31
7
  #include "lapacke/src/lapacke_zgesdd_work.c"
32
- #include "lapacke/src/lapacke_zpotrf_work.c"
33
- #include "lapacke/src/lapacke_dgetri_work.c"
34
- #include "lapacke/src/lapacke_dpotri_work.c"
35
- #include "lapacke/src/lapacke_sgesvd_work.c"
8
+ #include "lapacke/src/lapacke_dgeqrf.c"
9
+ #include "lapacke/src/lapacke_dgesdd_work.c"
10
+ #include "lapacke/src/lapacke_zgeev_work.c"
36
11
  #include "lapacke/src/lapacke_cpotri_work.c"
12
+ #include "lapacke/src/lapacke_dormqr_work.c"
13
+ #include "lapacke/src/lapacke_cpotri.c"
14
+ #include "lapacke/src/lapacke_cgesvd.c"
15
+ #include "lapacke/src/lapacke_cgetrf.c"
16
+ #include "lapacke/src/lapacke_dgetrf.c"
17
+ #include "lapacke/src/lapacke_sgetri_work.c"
18
+ #include "lapacke/src/lapacke_zgetrs.c"
19
+ #include "lapacke/src/lapacke_cgetrf_work.c"
20
+ #include "lapacke/src/lapacke_sgesvd.c"
21
+ #include "lapacke/src/lapacke_cpotrf.c"
37
22
  #include "lapacke/src/lapacke_dgetrf_work.c"
38
- #include "lapacke/src/lapacke_cpotrf_work.c"
39
- #include "lapacke/src/lapacke_sgetrs_work.c"
23
+ #include "lapacke/src/lapacke_dgeev.c"
24
+ #include "lapacke/src/lapacke_zgeev.c"
25
+ #include "lapacke/src/lapacke_cgetri.c"
40
26
  #include "lapacke/src/lapacke_zgetri_work.c"
41
- #include "lapacke/src/lapacke_zgetri.c"
42
- #include "lapacke/src/lapacke_spotrs_work.c"
43
- #include "lapacke/src/lapacke_zpotrs.c"
44
- #include "lapacke/src/lapacke_cpotrs_work.c"
45
- #include "lapacke/src/lapacke_dgesdd_work.c"
46
- #include "lapacke/src/lapacke_sgetrf_work.c"
47
- #include "lapacke/src/lapacke_cgeev.c"
27
+ #include "lapacke/src/lapacke_zpotrs_work.c"
28
+ #include "lapacke/src/lapacke_sormqr.c"
48
29
  #include "lapacke/src/lapacke_sgeev_work.c"
49
- #include "lapacke/src/lapacke_spotri_work.c"
50
- #include "lapacke/src/lapacke_dgesvd_work.c"
51
- #include "lapacke/src/lapacke_dgetrs.c"
52
- #include "lapacke/src/lapacke_dgesdd.c"
53
- #include "lapacke/src/lapacke_cpotrf.c"
54
- #include "lapacke/src/lapacke_dgeev.c"
55
- #include "lapacke/src/lapacke_sgetrf.c"
56
- #include "lapacke/src/lapacke_cgeev_work.c"
57
- #include "lapacke/src/lapacke_dpotrs_work.c"
58
- #include "lapacke/src/lapacke_dpotrs.c"
59
- #include "lapacke/src/lapacke_zpotri_work.c"
60
- #include "lapacke/src/lapacke_dgetri.c"
61
- #include "lapacke/src/lapacke_sgesdd_work.c"
62
- #include "lapacke/src/lapacke_dgesvd.c"
63
- #include "lapacke/src/lapacke_sgetri_work.c"
64
- #include "lapacke/src/lapacke_zgetrs.c"
65
- #include "lapacke/src/lapacke_dpotrf_work.c"
30
+ #include "lapacke/src/lapacke_spotrf_work.c"
31
+ #include "lapacke/src/lapacke_zgetri.c"
32
+ #include "lapacke/src/lapacke_cgeqrf.c"
33
+ #include "lapacke/src/lapacke_zunmqr.c"
34
+ #include "lapacke/src/lapacke_zgesvd.c"
35
+ #include "lapacke/src/lapacke_dgetri_work.c"
36
+ #include "lapacke/src/lapacke_dgeqrf_work.c"
37
+ #include "lapacke/src/lapacke_dpotri.c"
38
+ #include "lapacke/src/lapacke_dpotri_work.c"
39
+ #include "lapacke/src/lapacke_spotrs.c"
66
40
  #include "lapacke/src/lapacke_cgesvd_work.c"
67
41
  #include "lapacke/src/lapacke_cpotrs.c"
68
- #include "lapacke/src/lapacke_sgesdd.c"
69
- #include "lapacke/src/lapacke_spotrs.c"
70
- #include "lapacke/src/lapacke_cgetrs.c"
42
+ #include "lapacke/src/lapacke_sormqr_work.c"
43
+ #include "lapacke/src/lapacke_zunmqr_work.c"
44
+ #include "lapacke/src/lapacke_sgetrs_work.c"
45
+ #include "lapacke/src/lapacke_cgeev_work.c"
46
+ #include "lapacke/src/lapacke_zpotrf_work.c"
47
+ #include "lapacke/src/lapacke_zgeqrf.c"
48
+ #include "lapacke/src/lapacke_sgesvd_work.c"
49
+ #include "lapacke/src/lapacke_spotrf.c"
50
+ #include "lapacke/src/lapacke_cunmqr_work.c"
51
+ #include "lapacke/src/lapacke_cpotrf_work.c"
52
+ #include "lapacke/src/lapacke_dgetri.c"
53
+ #include "lapacke/src/lapacke_cgeqrf_work.c"
54
+ #include "lapacke/src/lapacke_sgeqrf_work.c"
71
55
  #include "lapacke/src/lapacke_zpotri.c"
72
- #include "lapacke/src/lapacke_zgetrf.c"
56
+ #include "lapacke/src/lapacke_dgetrs.c"
73
57
  #include "lapacke/src/lapacke_zgesdd.c"
74
- #include "lapacke/src/lapacke_spotrf_work.c"
75
- #include "lapacke/src/lapacke_cgesvd.c"
76
- #include "lapacke/src/lapacke_dpotrf.c"
77
- #include "lapacke/src/lapacke_cgesdd.c"
78
- #include "lapacke/src/lapacke_dgeev_work.c"
79
- #include "lapacke/src/lapacke_spotrf.c"
58
+ #include "lapacke/src/lapacke_zpotri_work.c"
80
59
  #include "lapacke/src/lapacke_sgeev.c"
81
- #include "lapacke/src/lapacke_dgetrf.c"
82
- #include "lapacke/src/lapacke_cgesdd_work.c"
60
+ #include "lapacke/src/lapacke_dgesvd.c"
83
61
  #include "lapacke/src/lapacke_zpotrf.c"
84
- #include "lapacke/src/lapacke_zgeev.c"
85
- #include "lapacke/src/lapacke_spotri.c"
86
- #include "lapacke/src/lapacke_zgeev_work.c"
87
- #include "lapacke/src/lapacke_sgesvd.c"
88
- #include "lapacke/src/lapacke_cpotri.c"
89
- #include "lapacke/src/lapacke_zgetrf_work.c"
90
- #include "lapacke/src/lapacke_cgetri.c"
91
- #include "lapacke/src/lapacke_dpotri.c"
92
- #include "lapacke/src/lapacke_cgetrf_work.c"
62
+ #include "lapacke/src/lapacke_cgeev.c"
63
+ #include "lapacke/src/lapacke_spotri_work.c"
64
+ #include "lapacke/src/lapacke_zgetrf.c"
65
+ #include "lapacke/src/lapacke_dgetrs_work.c"
66
+ #include "lapacke/src/lapacke_cgesdd_work.c"
67
+ #include "lapacke/src/lapacke_spotrs_work.c"
68
+ #include "lapacke/src/lapacke_cpotrs_work.c"
69
+ #include "lapacke/src/lapacke_cgetrs.c"
70
+ #include "lapacke/src/lapacke_sgeqrf.c"
71
+ #include "lapacke/src/lapacke_sgesdd.c"
72
+ #include "lapacke/src/lapacke_sgesdd_work.c"
93
73
  #include "lapacke/src/lapacke_zgetrs_work.c"
94
74
  #include "lapacke/src/lapacke_sgetri.c"
95
- #include "lapacke/src/lapacke_zgesvd.c"
96
- #include "lapacke/src/lapacke_sgetrs.c"
97
- #include "lapacke/src/lapacke_dgetrs_work.c"
75
+ #include "lapacke/src/lapacke_spotri.c"
76
+ #include "lapacke/src/lapacke_dpotrf.c"
98
77
  #include "lapacke/src/lapacke_cgetrs_work.c"
99
- #include "lapacke/src/lapacke_zpotrs_work.c"
100
- #include "lapacke/src/lapacke_cgetrf.c"
78
+ #include "lapacke/src/lapacke_zgetrf_work.c"
79
+ #include "lapacke/src/lapacke_sgetrf_work.c"
80
+ #include "lapacke/src/lapacke_dgesvd_work.c"
81
+ #include "lapacke/src/lapacke_dgesdd.c"
82
+ #include "lapacke/src/lapacke_cgetri_work.c"
83
+ #include "lapacke/src/lapacke_zpotrs.c"
84
+ #include "lapacke/src/lapacke_zgesvd_work.c"
85
+ #include "lapacke/src/lapacke_dpotrs_work.c"
86
+ #include "lapacke/src/lapacke_dormqr.c"
87
+ #include "lapacke/src/lapacke_dpotrs.c"
88
+ #include "lapacke/src/lapacke_sgetrf.c"
89
+ #include "lapacke/src/lapacke_dpotrf_work.c"
90
+ #include "lapacke/src/lapacke_sgetrs.c"
91
+ #include "lapacke/utils/lapacke_sge_nancheck.c"
92
+ #include "lapacke/utils/lapacke_zge_trans.c"
93
+ #include "lapacke/utils/lapacke_dpo_trans.c"
94
+ #include "lapacke/utils/lapacke_cpo_trans.c"
95
+ #include "lapacke/utils/lapacke_cge_trans.c"
96
+ #include "lapacke/utils/lapacke_dge_nancheck.c"
97
+ #include "lapacke/utils/lapacke_cpo_nancheck.c"
98
+ #include "lapacke/utils/lapacke_c_nancheck.c"
99
+ #include "lapacke/utils/lapacke_lsame.c"
100
+ #include "lapacke/utils/lapacke_str_nancheck.c"
101
+ #include "lapacke/utils/lapacke_zpo_trans.c"
102
+ #include "lapacke/utils/lapacke_str_trans.c"
103
+ #include "lapacke/utils/lapacke_ztr_nancheck.c"
104
+ #include "lapacke/utils/lapacke_cge_nancheck.c"
105
+ #include "lapacke/utils/lapacke_d_nancheck.c"
106
+ #include "lapacke/utils/lapacke_ctr_trans.c"
107
+ #include "lapacke/utils/lapacke_dge_trans.c"
108
+ #include "lapacke/utils/lapacke_sge_trans.c"
109
+ #include "lapacke/utils/lapacke_zge_nancheck.c"
110
+ #include "lapacke/utils/lapacke_dtr_nancheck.c"
111
+ #include "lapacke/utils/lapacke_s_nancheck.c"
112
+ #include "lapacke/utils/lapacke_spo_trans.c"
113
+ #include "lapacke/utils/lapacke_dtr_trans.c"
114
+ #include "lapacke/utils/lapacke_xerbla.c"
115
+ #include "lapacke/utils/lapacke_ctr_nancheck.c"
116
+ #include "lapacke/utils/lapacke_ztr_trans.c"
117
+ #include "lapacke/utils/lapacke_z_nancheck.c"
118
+ #include "lapacke/utils/lapacke_dpo_nancheck.c"
119
+ #include "lapacke/utils/lapacke_zpo_nancheck.c"
120
+ #include "lapacke/utils/lapacke_spo_nancheck.c"
@@ -0,0 +1,77 @@
1
+ /*****************************************************************************
2
+ Copyright (c) 2014, Intel Corp.
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice,
9
+ this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+ * Neither the name of Intel Corporation nor the names of its contributors
14
+ may be used to endorse or promote products derived from this software
15
+ without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27
+ THE POSSIBILITY OF SUCH DAMAGE.
28
+ *****************************************************************************
29
+ * Contents: Native high-level C interface to LAPACK function cgeqrf
30
+ * Author: Intel Corporation
31
+ * Generated November 2015
32
+ *****************************************************************************/
33
+
34
+ #include "lapacke_utils.h"
35
+
36
+ lapack_int LAPACKE_cgeqrf( int matrix_layout, lapack_int m, lapack_int n,
37
+ lapack_complex_float* a, lapack_int lda,
38
+ lapack_complex_float* tau )
39
+ {
40
+ lapack_int info = 0;
41
+ lapack_int lwork = -1;
42
+ lapack_complex_float* work = NULL;
43
+ lapack_complex_float work_query;
44
+ if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
45
+ LAPACKE_xerbla( "LAPACKE_cgeqrf", -1 );
46
+ return -1;
47
+ }
48
+ #ifndef LAPACK_DISABLE_NAN_CHECK
49
+ /* Optionally check input matrices for NaNs */
50
+ if( LAPACKE_cge_nancheck( matrix_layout, m, n, a, lda ) ) {
51
+ return -4;
52
+ }
53
+ #endif
54
+ /* Query optimal working array(s) size */
55
+ info = LAPACKE_cgeqrf_work( matrix_layout, m, n, a, lda, tau, &work_query,
56
+ lwork );
57
+ if( info != 0 ) {
58
+ goto exit_level_0;
59
+ }
60
+ lwork = LAPACK_C2INT( work_query );
61
+ /* Allocate memory for work arrays */
62
+ work = (lapack_complex_float*)
63
+ LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
64
+ if( work == NULL ) {
65
+ info = LAPACK_WORK_MEMORY_ERROR;
66
+ goto exit_level_0;
67
+ }
68
+ /* Call middle-level interface */
69
+ info = LAPACKE_cgeqrf_work( matrix_layout, m, n, a, lda, tau, work, lwork );
70
+ /* Release memory and exit */
71
+ LAPACKE_free( work );
72
+ exit_level_0:
73
+ if( info == LAPACK_WORK_MEMORY_ERROR ) {
74
+ LAPACKE_xerbla( "LAPACKE_cgeqrf", info );
75
+ }
76
+ return info;
77
+ }
@@ -0,0 +1,89 @@
1
+ /*****************************************************************************
2
+ Copyright (c) 2014, Intel Corp.
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice,
9
+ this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+ * Neither the name of Intel Corporation nor the names of its contributors
14
+ may be used to endorse or promote products derived from this software
15
+ without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27
+ THE POSSIBILITY OF SUCH DAMAGE.
28
+ *****************************************************************************
29
+ * Contents: Native middle-level C interface to LAPACK function cgeqrf
30
+ * Author: Intel Corporation
31
+ * Generated November 2015
32
+ *****************************************************************************/
33
+
34
+ #include "lapacke_utils.h"
35
+
36
+ lapack_int LAPACKE_cgeqrf_work( int matrix_layout, lapack_int m, lapack_int n,
37
+ lapack_complex_float* a, lapack_int lda,
38
+ lapack_complex_float* tau,
39
+ lapack_complex_float* work, lapack_int lwork )
40
+ {
41
+ lapack_int info = 0;
42
+ if( matrix_layout == LAPACK_COL_MAJOR ) {
43
+ /* Call LAPACK function and adjust info */
44
+ LAPACK_cgeqrf( &m, &n, a, &lda, tau, work, &lwork, &info );
45
+ if( info < 0 ) {
46
+ info = info - 1;
47
+ }
48
+ } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
49
+ lapack_int lda_t = MAX(1,m);
50
+ lapack_complex_float* a_t = NULL;
51
+ /* Check leading dimension(s) */
52
+ if( lda < n ) {
53
+ info = -5;
54
+ LAPACKE_xerbla( "LAPACKE_cgeqrf_work", info );
55
+ return info;
56
+ }
57
+ /* Query optimal working array(s) size if requested */
58
+ if( lwork == -1 ) {
59
+ LAPACK_cgeqrf( &m, &n, a, &lda_t, tau, work, &lwork, &info );
60
+ return (info < 0) ? (info - 1) : info;
61
+ }
62
+ /* Allocate memory for temporary array(s) */
63
+ a_t = (lapack_complex_float*)
64
+ LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
65
+ if( a_t == NULL ) {
66
+ info = LAPACK_TRANSPOSE_MEMORY_ERROR;
67
+ goto exit_level_0;
68
+ }
69
+ /* Transpose input matrices */
70
+ LAPACKE_cge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
71
+ /* Call LAPACK function and adjust info */
72
+ LAPACK_cgeqrf( &m, &n, a_t, &lda_t, tau, work, &lwork, &info );
73
+ if( info < 0 ) {
74
+ info = info - 1;
75
+ }
76
+ /* Transpose output matrices */
77
+ LAPACKE_cge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
78
+ /* Release memory and exit */
79
+ LAPACKE_free( a_t );
80
+ exit_level_0:
81
+ if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
82
+ LAPACKE_xerbla( "LAPACKE_cgeqrf_work", info );
83
+ }
84
+ } else {
85
+ info = -1;
86
+ LAPACKE_xerbla( "LAPACKE_cgeqrf_work", info );
87
+ }
88
+ return info;
89
+ }
@@ -0,0 +1,88 @@
1
+ /*****************************************************************************
2
+ Copyright (c) 2014, Intel Corp.
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice,
9
+ this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+ * Neither the name of Intel Corporation nor the names of its contributors
14
+ may be used to endorse or promote products derived from this software
15
+ without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27
+ THE POSSIBILITY OF SUCH DAMAGE.
28
+ *****************************************************************************
29
+ * Contents: Native high-level C interface to LAPACK function cunmqr
30
+ * Author: Intel Corporation
31
+ * Generated November 2015
32
+ *****************************************************************************/
33
+
34
+ #include "lapacke_utils.h"
35
+
36
+ lapack_int LAPACKE_cunmqr( int matrix_layout, char side, char trans,
37
+ lapack_int m, lapack_int n, lapack_int k,
38
+ const lapack_complex_float* a, lapack_int lda,
39
+ const lapack_complex_float* tau,
40
+ lapack_complex_float* c, lapack_int ldc )
41
+ {
42
+ lapack_int info = 0;
43
+ lapack_int lwork = -1;
44
+ lapack_complex_float* work = NULL;
45
+ lapack_complex_float work_query;
46
+ lapack_int r;
47
+ if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
48
+ LAPACKE_xerbla( "LAPACKE_cunmqr", -1 );
49
+ return -1;
50
+ }
51
+ #ifndef LAPACK_DISABLE_NAN_CHECK
52
+ /* Optionally check input matrices for NaNs */
53
+ r = LAPACKE_lsame( side, 'l' ) ? m : n;
54
+ if( LAPACKE_cge_nancheck( matrix_layout, r, k, a, lda ) ) {
55
+ return -7;
56
+ }
57
+ if( LAPACKE_cge_nancheck( matrix_layout, m, n, c, ldc ) ) {
58
+ return -10;
59
+ }
60
+ if( LAPACKE_c_nancheck( k, tau, 1 ) ) {
61
+ return -9;
62
+ }
63
+ #endif
64
+ /* Query optimal working array(s) size */
65
+ info = LAPACKE_cunmqr_work( matrix_layout, side, trans, m, n, k, a, lda, tau,
66
+ c, ldc, &work_query, lwork );
67
+ if( info != 0 ) {
68
+ goto exit_level_0;
69
+ }
70
+ lwork = LAPACK_C2INT( work_query );
71
+ /* Allocate memory for work arrays */
72
+ work = (lapack_complex_float*)
73
+ LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
74
+ if( work == NULL ) {
75
+ info = LAPACK_WORK_MEMORY_ERROR;
76
+ goto exit_level_0;
77
+ }
78
+ /* Call middle-level interface */
79
+ info = LAPACKE_cunmqr_work( matrix_layout, side, trans, m, n, k, a, lda, tau,
80
+ c, ldc, work, lwork );
81
+ /* Release memory and exit */
82
+ LAPACKE_free( work );
83
+ exit_level_0:
84
+ if( info == LAPACK_WORK_MEMORY_ERROR ) {
85
+ LAPACKE_xerbla( "LAPACKE_cunmqr", info );
86
+ }
87
+ return info;
88
+ }