nmatrix-lapacke 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ext/nmatrix/data/complex.h +364 -0
- data/ext/nmatrix/data/data.h +638 -0
- data/ext/nmatrix/data/meta.h +64 -0
- data/ext/nmatrix/data/ruby_object.h +389 -0
- data/ext/nmatrix/math/asum.h +120 -0
- data/ext/nmatrix/math/cblas_enums.h +36 -0
- data/ext/nmatrix/math/cblas_templates_core.h +507 -0
- data/ext/nmatrix/math/gemm.h +241 -0
- data/ext/nmatrix/math/gemv.h +178 -0
- data/ext/nmatrix/math/getrf.h +255 -0
- data/ext/nmatrix/math/getrs.h +121 -0
- data/ext/nmatrix/math/imax.h +79 -0
- data/ext/nmatrix/math/laswp.h +165 -0
- data/ext/nmatrix/math/long_dtype.h +49 -0
- data/ext/nmatrix/math/math.h +744 -0
- data/ext/nmatrix/math/nrm2.h +160 -0
- data/ext/nmatrix/math/rot.h +117 -0
- data/ext/nmatrix/math/rotg.h +106 -0
- data/ext/nmatrix/math/scal.h +71 -0
- data/ext/nmatrix/math/trsm.h +332 -0
- data/ext/nmatrix/math/util.h +148 -0
- data/ext/nmatrix/nm_memory.h +60 -0
- data/ext/nmatrix/nmatrix.h +408 -0
- data/ext/nmatrix/ruby_constants.h +106 -0
- data/ext/nmatrix/storage/common.h +176 -0
- data/ext/nmatrix/storage/dense/dense.h +128 -0
- data/ext/nmatrix/storage/list/list.h +137 -0
- data/ext/nmatrix/storage/storage.h +98 -0
- data/ext/nmatrix/storage/yale/class.h +1139 -0
- data/ext/nmatrix/storage/yale/iterators/base.h +142 -0
- data/ext/nmatrix/storage/yale/iterators/iterator.h +130 -0
- data/ext/nmatrix/storage/yale/iterators/row.h +449 -0
- data/ext/nmatrix/storage/yale/iterators/row_stored.h +139 -0
- data/ext/nmatrix/storage/yale/iterators/row_stored_nd.h +168 -0
- data/ext/nmatrix/storage/yale/iterators/stored_diagonal.h +123 -0
- data/ext/nmatrix/storage/yale/math/transpose.h +110 -0
- data/ext/nmatrix/storage/yale/yale.h +202 -0
- data/ext/nmatrix/types.h +54 -0
- data/ext/nmatrix/util/io.h +115 -0
- data/ext/nmatrix/util/sl_list.h +143 -0
- data/ext/nmatrix/util/util.h +78 -0
- data/ext/nmatrix_lapacke/extconf.rb +200 -0
- data/ext/nmatrix_lapacke/lapacke.cpp +100 -0
- data/ext/nmatrix_lapacke/lapacke/include/lapacke.h +16445 -0
- data/ext/nmatrix_lapacke/lapacke/include/lapacke_config.h +119 -0
- data/ext/nmatrix_lapacke/lapacke/include/lapacke_mangling.h +17 -0
- data/ext/nmatrix_lapacke/lapacke/include/lapacke_mangling_with_flags.h +17 -0
- data/ext/nmatrix_lapacke/lapacke/include/lapacke_utils.h +579 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cgeev.c +89 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cgeev_work.c +141 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cgesdd.c +106 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cgesdd_work.c +158 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cgesvd.c +94 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cgesvd_work.c +149 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cgetrf.c +51 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cgetrf_work.c +83 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cgetri.c +77 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cgetri_work.c +89 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cgetrs.c +56 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cgetrs_work.c +102 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cpotrf.c +50 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cpotrf_work.c +82 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cpotri.c +50 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cpotri_work.c +82 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cpotrs.c +55 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_cpotrs_work.c +101 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dgeev.c +78 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dgeev_work.c +136 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dgesdd.c +88 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dgesdd_work.c +153 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dgesvd.c +83 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dgesvd_work.c +144 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dgetrf.c +50 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dgetrf_work.c +81 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dgetri.c +75 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dgetri_work.c +87 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dgetrs.c +55 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dgetrs_work.c +99 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dpotrf.c +50 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dpotrf_work.c +81 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dpotri.c +50 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dpotri_work.c +81 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dpotrs.c +54 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_dpotrs_work.c +97 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_sgeev.c +78 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_sgeev_work.c +134 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_sgesdd.c +88 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_sgesdd_work.c +152 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_sgesvd.c +83 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_sgesvd_work.c +143 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_sgetrf.c +50 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_sgetrf_work.c +81 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_sgetri.c +75 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_sgetri_work.c +87 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_sgetrs.c +55 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_sgetrs_work.c +99 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_spotrf.c +50 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_spotrf_work.c +81 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_spotri.c +50 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_spotri_work.c +81 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_spotrs.c +54 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_spotrs_work.c +97 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zgeev.c +89 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zgeev_work.c +141 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zgesdd.c +106 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zgesdd_work.c +158 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zgesvd.c +94 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zgesvd_work.c +149 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zgetrf.c +51 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zgetrf_work.c +83 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zgetri.c +77 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zgetri_work.c +89 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zgetrs.c +56 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zgetrs_work.c +102 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zpotrf.c +50 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zpotrf_work.c +82 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zpotri.c +50 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zpotri_work.c +82 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zpotrs.c +55 -0
- data/ext/nmatrix_lapacke/lapacke/src/lapacke_zpotrs_work.c +101 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_cge_nancheck.c +62 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_cge_trans.c +65 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_cpo_nancheck.c +43 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_cpo_trans.c +45 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_ctr_nancheck.c +85 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_ctr_trans.c +85 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_dge_nancheck.c +62 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_dge_trans.c +65 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_dpo_nancheck.c +43 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_dpo_trans.c +45 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_dtr_nancheck.c +85 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_dtr_trans.c +85 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_lsame.c +41 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_sge_nancheck.c +62 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_sge_trans.c +65 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_spo_nancheck.c +43 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_spo_trans.c +45 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_str_nancheck.c +85 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_str_trans.c +85 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_xerbla.c +46 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_zge_nancheck.c +62 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_zge_trans.c +65 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_zpo_nancheck.c +43 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_zpo_trans.c +45 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_ztr_nancheck.c +85 -0
- data/ext/nmatrix_lapacke/lapacke/utils/lapacke_ztr_trans.c +85 -0
- data/ext/nmatrix_lapacke/lapacke_nmatrix.h +16 -0
- data/ext/nmatrix_lapacke/make_lapacke_cpp.rb +9 -0
- data/ext/nmatrix_lapacke/math_lapacke.cpp +967 -0
- data/ext/nmatrix_lapacke/math_lapacke/cblas_local.h +576 -0
- data/ext/nmatrix_lapacke/math_lapacke/cblas_templates_lapacke.h +51 -0
- data/ext/nmatrix_lapacke/math_lapacke/lapacke_templates.h +356 -0
- data/ext/nmatrix_lapacke/nmatrix_lapacke.cpp +42 -0
- data/lib/nmatrix/lapack_ext_common.rb +69 -0
- data/lib/nmatrix/lapacke.rb +213 -0
- data/spec/00_nmatrix_spec.rb +730 -0
- data/spec/01_enum_spec.rb +190 -0
- data/spec/02_slice_spec.rb +389 -0
- data/spec/03_nmatrix_monkeys_spec.rb +78 -0
- data/spec/2x2_dense_double.mat +0 -0
- data/spec/4x4_sparse.mat +0 -0
- data/spec/4x5_dense.mat +0 -0
- data/spec/blas_spec.rb +193 -0
- data/spec/elementwise_spec.rb +303 -0
- data/spec/homogeneous_spec.rb +99 -0
- data/spec/io/fortran_format_spec.rb +88 -0
- data/spec/io/harwell_boeing_spec.rb +98 -0
- data/spec/io/test.rua +9 -0
- data/spec/io_spec.rb +149 -0
- data/spec/lapack_core_spec.rb +482 -0
- data/spec/leakcheck.rb +16 -0
- data/spec/math_spec.rb +730 -0
- data/spec/nmatrix_yale_resize_test_associations.yaml +2802 -0
- data/spec/nmatrix_yale_spec.rb +286 -0
- data/spec/plugins/lapacke/lapacke_spec.rb +303 -0
- data/spec/rspec_monkeys.rb +56 -0
- data/spec/rspec_spec.rb +34 -0
- data/spec/shortcuts_spec.rb +310 -0
- data/spec/slice_set_spec.rb +157 -0
- data/spec/spec_helper.rb +140 -0
- data/spec/stat_spec.rb +203 -0
- data/spec/test.pcd +20 -0
- data/spec/utm5940.mtx +83844 -0
- metadata +262 -0
@@ -0,0 +1,141 @@
|
|
1
|
+
/*****************************************************************************
|
2
|
+
Copyright (c) 2011, 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 zgeev
|
30
|
+
* Author: Intel Corporation
|
31
|
+
* Generated November, 2011
|
32
|
+
*****************************************************************************/
|
33
|
+
|
34
|
+
#include "lapacke_utils.h"
|
35
|
+
|
36
|
+
lapack_int LAPACKE_zgeev_work( int matrix_order, char jobvl, char jobvr,
|
37
|
+
lapack_int n, lapack_complex_double* a,
|
38
|
+
lapack_int lda, lapack_complex_double* w,
|
39
|
+
lapack_complex_double* vl, lapack_int ldvl,
|
40
|
+
lapack_complex_double* vr, lapack_int ldvr,
|
41
|
+
lapack_complex_double* work, lapack_int lwork,
|
42
|
+
double* rwork )
|
43
|
+
{
|
44
|
+
lapack_int info = 0;
|
45
|
+
if( matrix_order == LAPACK_COL_MAJOR ) {
|
46
|
+
/* Call LAPACK function and adjust info */
|
47
|
+
LAPACK_zgeev( &jobvl, &jobvr, &n, a, &lda, w, vl, &ldvl, vr, &ldvr,
|
48
|
+
work, &lwork, rwork, &info );
|
49
|
+
if( info < 0 ) {
|
50
|
+
info = info - 1;
|
51
|
+
}
|
52
|
+
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
|
53
|
+
lapack_int lda_t = MAX(1,n);
|
54
|
+
lapack_int ldvl_t = MAX(1,n);
|
55
|
+
lapack_int ldvr_t = MAX(1,n);
|
56
|
+
lapack_complex_double* a_t = NULL;
|
57
|
+
lapack_complex_double* vl_t = NULL;
|
58
|
+
lapack_complex_double* vr_t = NULL;
|
59
|
+
/* Check leading dimension(s) */
|
60
|
+
if( lda < n ) {
|
61
|
+
info = -6;
|
62
|
+
LAPACKE_xerbla( "LAPACKE_zgeev_work", info );
|
63
|
+
return info;
|
64
|
+
}
|
65
|
+
if( ldvl < n ) {
|
66
|
+
info = -9;
|
67
|
+
LAPACKE_xerbla( "LAPACKE_zgeev_work", info );
|
68
|
+
return info;
|
69
|
+
}
|
70
|
+
if( ldvr < n ) {
|
71
|
+
info = -11;
|
72
|
+
LAPACKE_xerbla( "LAPACKE_zgeev_work", info );
|
73
|
+
return info;
|
74
|
+
}
|
75
|
+
/* Query optimal working array(s) size if requested */
|
76
|
+
if( lwork == -1 ) {
|
77
|
+
LAPACK_zgeev( &jobvl, &jobvr, &n, a, &lda_t, w, vl, &ldvl_t, vr,
|
78
|
+
&ldvr_t, work, &lwork, rwork, &info );
|
79
|
+
return (info < 0) ? (info - 1) : info;
|
80
|
+
}
|
81
|
+
/* Allocate memory for temporary array(s) */
|
82
|
+
a_t = (lapack_complex_double*)
|
83
|
+
LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,n) );
|
84
|
+
if( a_t == NULL ) {
|
85
|
+
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
86
|
+
goto exit_level_0;
|
87
|
+
}
|
88
|
+
if( LAPACKE_lsame( jobvl, 'v' ) ) {
|
89
|
+
vl_t = (lapack_complex_double*)
|
90
|
+
LAPACKE_malloc( sizeof(lapack_complex_double) *
|
91
|
+
ldvl_t * MAX(1,n) );
|
92
|
+
if( vl_t == NULL ) {
|
93
|
+
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
94
|
+
goto exit_level_1;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
if( LAPACKE_lsame( jobvr, 'v' ) ) {
|
98
|
+
vr_t = (lapack_complex_double*)
|
99
|
+
LAPACKE_malloc( sizeof(lapack_complex_double) *
|
100
|
+
ldvr_t * MAX(1,n) );
|
101
|
+
if( vr_t == NULL ) {
|
102
|
+
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
103
|
+
goto exit_level_2;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
/* Transpose input matrices */
|
107
|
+
LAPACKE_zge_trans( matrix_order, n, n, a, lda, a_t, lda_t );
|
108
|
+
/* Call LAPACK function and adjust info */
|
109
|
+
LAPACK_zgeev( &jobvl, &jobvr, &n, a_t, &lda_t, w, vl_t, &ldvl_t, vr_t,
|
110
|
+
&ldvr_t, work, &lwork, rwork, &info );
|
111
|
+
if( info < 0 ) {
|
112
|
+
info = info - 1;
|
113
|
+
}
|
114
|
+
/* Transpose output matrices */
|
115
|
+
LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
|
116
|
+
if( LAPACKE_lsame( jobvl, 'v' ) ) {
|
117
|
+
LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, vl_t, ldvl_t, vl, ldvl );
|
118
|
+
}
|
119
|
+
if( LAPACKE_lsame( jobvr, 'v' ) ) {
|
120
|
+
LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, vr_t, ldvr_t, vr, ldvr );
|
121
|
+
}
|
122
|
+
/* Release memory and exit */
|
123
|
+
if( LAPACKE_lsame( jobvr, 'v' ) ) {
|
124
|
+
LAPACKE_free( vr_t );
|
125
|
+
}
|
126
|
+
exit_level_2:
|
127
|
+
if( LAPACKE_lsame( jobvl, 'v' ) ) {
|
128
|
+
LAPACKE_free( vl_t );
|
129
|
+
}
|
130
|
+
exit_level_1:
|
131
|
+
LAPACKE_free( a_t );
|
132
|
+
exit_level_0:
|
133
|
+
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
|
134
|
+
LAPACKE_xerbla( "LAPACKE_zgeev_work", info );
|
135
|
+
}
|
136
|
+
} else {
|
137
|
+
info = -1;
|
138
|
+
LAPACKE_xerbla( "LAPACKE_zgeev_work", info );
|
139
|
+
}
|
140
|
+
return info;
|
141
|
+
}
|
@@ -0,0 +1,106 @@
|
|
1
|
+
/*****************************************************************************
|
2
|
+
Copyright (c) 2011, 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 zgesdd
|
30
|
+
* Author: Intel Corporation
|
31
|
+
* Generated November, 2011
|
32
|
+
*****************************************************************************/
|
33
|
+
|
34
|
+
#include "lapacke_utils.h"
|
35
|
+
|
36
|
+
lapack_int LAPACKE_zgesdd( int matrix_order, char jobz, lapack_int m,
|
37
|
+
lapack_int n, lapack_complex_double* a,
|
38
|
+
lapack_int lda, double* s, lapack_complex_double* u,
|
39
|
+
lapack_int ldu, lapack_complex_double* vt,
|
40
|
+
lapack_int ldvt )
|
41
|
+
{
|
42
|
+
lapack_int info = 0;
|
43
|
+
lapack_int lwork = -1;
|
44
|
+
/* Additional scalars declarations for work arrays */
|
45
|
+
size_t lrwork;
|
46
|
+
lapack_int* iwork = NULL;
|
47
|
+
double* rwork = NULL;
|
48
|
+
lapack_complex_double* work = NULL;
|
49
|
+
lapack_complex_double work_query;
|
50
|
+
if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
|
51
|
+
LAPACKE_xerbla( "LAPACKE_zgesdd", -1 );
|
52
|
+
return -1;
|
53
|
+
}
|
54
|
+
#ifndef LAPACK_DISABLE_NAN_CHECK
|
55
|
+
/* Optionally check input matrices for NaNs */
|
56
|
+
if( LAPACKE_zge_nancheck( matrix_order, m, n, a, lda ) ) {
|
57
|
+
return -5;
|
58
|
+
}
|
59
|
+
#endif
|
60
|
+
/* Additional scalars initializations for work arrays */
|
61
|
+
if( LAPACKE_lsame( jobz, 'n' ) ) {
|
62
|
+
lrwork = MAX(1,5*MIN(m,n));
|
63
|
+
} else {
|
64
|
+
lrwork = (size_t)5*MAX(1,MIN(m,n))*MAX(1,MIN(m,n))+7*MIN(m,n);
|
65
|
+
}
|
66
|
+
/* Allocate memory for working array(s) */
|
67
|
+
iwork = (lapack_int*)
|
68
|
+
LAPACKE_malloc( sizeof(lapack_int) * MAX(1,8*MIN(m,n)) );
|
69
|
+
if( iwork == NULL ) {
|
70
|
+
info = LAPACK_WORK_MEMORY_ERROR;
|
71
|
+
goto exit_level_0;
|
72
|
+
}
|
73
|
+
rwork = (double*)LAPACKE_malloc( sizeof(double) * lrwork );
|
74
|
+
if( rwork == NULL ) {
|
75
|
+
info = LAPACK_WORK_MEMORY_ERROR;
|
76
|
+
goto exit_level_1;
|
77
|
+
}
|
78
|
+
/* Query optimal working array(s) size */
|
79
|
+
info = LAPACKE_zgesdd_work( matrix_order, jobz, m, n, a, lda, s, u, ldu, vt,
|
80
|
+
ldvt, &work_query, lwork, rwork, iwork );
|
81
|
+
if( info != 0 ) {
|
82
|
+
goto exit_level_2;
|
83
|
+
}
|
84
|
+
lwork = LAPACK_Z2INT( work_query );
|
85
|
+
/* Allocate memory for work arrays */
|
86
|
+
work = (lapack_complex_double*)
|
87
|
+
LAPACKE_malloc( sizeof(lapack_complex_double) * lwork );
|
88
|
+
if( work == NULL ) {
|
89
|
+
info = LAPACK_WORK_MEMORY_ERROR;
|
90
|
+
goto exit_level_2;
|
91
|
+
}
|
92
|
+
/* Call middle-level interface */
|
93
|
+
info = LAPACKE_zgesdd_work( matrix_order, jobz, m, n, a, lda, s, u, ldu, vt,
|
94
|
+
ldvt, work, lwork, rwork, iwork );
|
95
|
+
/* Release memory and exit */
|
96
|
+
LAPACKE_free( work );
|
97
|
+
exit_level_2:
|
98
|
+
LAPACKE_free( rwork );
|
99
|
+
exit_level_1:
|
100
|
+
LAPACKE_free( iwork );
|
101
|
+
exit_level_0:
|
102
|
+
if( info == LAPACK_WORK_MEMORY_ERROR ) {
|
103
|
+
LAPACKE_xerbla( "LAPACKE_zgesdd", info );
|
104
|
+
}
|
105
|
+
return info;
|
106
|
+
}
|
@@ -0,0 +1,158 @@
|
|
1
|
+
/*****************************************************************************
|
2
|
+
Copyright (c) 2011, 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 zgesdd
|
30
|
+
* Author: Intel Corporation
|
31
|
+
* Generated November, 2011
|
32
|
+
*****************************************************************************/
|
33
|
+
|
34
|
+
#include "lapacke_utils.h"
|
35
|
+
|
36
|
+
lapack_int LAPACKE_zgesdd_work( int matrix_order, char jobz, lapack_int m,
|
37
|
+
lapack_int n, lapack_complex_double* a,
|
38
|
+
lapack_int lda, double* s,
|
39
|
+
lapack_complex_double* u, lapack_int ldu,
|
40
|
+
lapack_complex_double* vt, lapack_int ldvt,
|
41
|
+
lapack_complex_double* work, lapack_int lwork,
|
42
|
+
double* rwork, lapack_int* iwork )
|
43
|
+
{
|
44
|
+
lapack_int info = 0;
|
45
|
+
if( matrix_order == LAPACK_COL_MAJOR ) {
|
46
|
+
/* Call LAPACK function and adjust info */
|
47
|
+
LAPACK_zgesdd( &jobz, &m, &n, a, &lda, s, u, &ldu, vt, &ldvt, work,
|
48
|
+
&lwork, rwork, iwork, &info );
|
49
|
+
if( info < 0 ) {
|
50
|
+
info = info - 1;
|
51
|
+
}
|
52
|
+
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
|
53
|
+
lapack_int nrows_u = ( LAPACKE_lsame( jobz, 'a' ) ||
|
54
|
+
LAPACKE_lsame( jobz, 's' ) ||
|
55
|
+
( LAPACKE_lsame( jobz, 'o' ) && m<n) ) ? m : 1;
|
56
|
+
lapack_int ncols_u = ( LAPACKE_lsame( jobz, 'a' ) ||
|
57
|
+
( LAPACKE_lsame( jobz, 'o' ) && m<n) ) ? m :
|
58
|
+
( LAPACKE_lsame( jobz, 's' ) ? MIN(m,n) : 1);
|
59
|
+
lapack_int nrows_vt = ( LAPACKE_lsame( jobz, 'a' ) ||
|
60
|
+
( LAPACKE_lsame( jobz, 'o' ) && m<n) ) ? n :
|
61
|
+
( LAPACKE_lsame( jobz, 's' ) ? MIN(m,n) : 1);
|
62
|
+
lapack_int lda_t = MAX(1,m);
|
63
|
+
lapack_int ldu_t = MAX(1,nrows_u);
|
64
|
+
lapack_int ldvt_t = MAX(1,nrows_vt);
|
65
|
+
lapack_complex_double* a_t = NULL;
|
66
|
+
lapack_complex_double* u_t = NULL;
|
67
|
+
lapack_complex_double* vt_t = NULL;
|
68
|
+
/* Check leading dimension(s) */
|
69
|
+
if( lda < n ) {
|
70
|
+
info = -6;
|
71
|
+
LAPACKE_xerbla( "LAPACKE_zgesdd_work", info );
|
72
|
+
return info;
|
73
|
+
}
|
74
|
+
if( ldu < ncols_u ) {
|
75
|
+
info = -9;
|
76
|
+
LAPACKE_xerbla( "LAPACKE_zgesdd_work", info );
|
77
|
+
return info;
|
78
|
+
}
|
79
|
+
if( ldvt < n ) {
|
80
|
+
info = -11;
|
81
|
+
LAPACKE_xerbla( "LAPACKE_zgesdd_work", info );
|
82
|
+
return info;
|
83
|
+
}
|
84
|
+
/* Query optimal working array(s) size if requested */
|
85
|
+
if( lwork == -1 ) {
|
86
|
+
LAPACK_zgesdd( &jobz, &m, &n, a, &lda_t, s, u, &ldu_t, vt, &ldvt_t,
|
87
|
+
work, &lwork, rwork, iwork, &info );
|
88
|
+
return (info < 0) ? (info - 1) : info;
|
89
|
+
}
|
90
|
+
/* Allocate memory for temporary array(s) */
|
91
|
+
a_t = (lapack_complex_double*)
|
92
|
+
LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,n) );
|
93
|
+
if( a_t == NULL ) {
|
94
|
+
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
95
|
+
goto exit_level_0;
|
96
|
+
}
|
97
|
+
if( LAPACKE_lsame( jobz, 'a' ) || LAPACKE_lsame( jobz, 's' ) ||
|
98
|
+
( LAPACKE_lsame( jobz, 'o' ) && (m<n) ) ) {
|
99
|
+
u_t = (lapack_complex_double*)
|
100
|
+
LAPACKE_malloc( sizeof(lapack_complex_double) *
|
101
|
+
ldu_t * MAX(1,ncols_u) );
|
102
|
+
if( u_t == NULL ) {
|
103
|
+
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
104
|
+
goto exit_level_1;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
if( LAPACKE_lsame( jobz, 'a' ) || LAPACKE_lsame( jobz, 's' ) ||
|
108
|
+
( LAPACKE_lsame( jobz, 'o' ) && (m>=n) ) ) {
|
109
|
+
vt_t = (lapack_complex_double*)
|
110
|
+
LAPACKE_malloc( sizeof(lapack_complex_double) *
|
111
|
+
ldvt_t * MAX(1,n) );
|
112
|
+
if( vt_t == NULL ) {
|
113
|
+
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
114
|
+
goto exit_level_2;
|
115
|
+
}
|
116
|
+
}
|
117
|
+
/* Transpose input matrices */
|
118
|
+
LAPACKE_zge_trans( matrix_order, m, n, a, lda, a_t, lda_t );
|
119
|
+
/* Call LAPACK function and adjust info */
|
120
|
+
LAPACK_zgesdd( &jobz, &m, &n, a_t, &lda_t, s, u_t, &ldu_t, vt_t,
|
121
|
+
&ldvt_t, work, &lwork, rwork, iwork, &info );
|
122
|
+
if( info < 0 ) {
|
123
|
+
info = info - 1;
|
124
|
+
}
|
125
|
+
/* Transpose output matrices */
|
126
|
+
LAPACKE_zge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
|
127
|
+
if( LAPACKE_lsame( jobz, 'a' ) || LAPACKE_lsame( jobz, 's' ) ||
|
128
|
+
( LAPACKE_lsame( jobz, 'o' ) && (m<n) ) ) {
|
129
|
+
LAPACKE_zge_trans( LAPACK_COL_MAJOR, nrows_u, ncols_u, u_t, ldu_t,
|
130
|
+
u, ldu );
|
131
|
+
}
|
132
|
+
if( LAPACKE_lsame( jobz, 'a' ) || LAPACKE_lsame( jobz, 's' ) ||
|
133
|
+
( LAPACKE_lsame( jobz, 'o' ) && (m>=n) ) ) {
|
134
|
+
LAPACKE_zge_trans( LAPACK_COL_MAJOR, nrows_vt, n, vt_t, ldvt_t, vt,
|
135
|
+
ldvt );
|
136
|
+
}
|
137
|
+
/* Release memory and exit */
|
138
|
+
if( LAPACKE_lsame( jobz, 'a' ) || LAPACKE_lsame( jobz, 's' ) ||
|
139
|
+
( LAPACKE_lsame( jobz, 'o' ) && (m>=n) ) ) {
|
140
|
+
LAPACKE_free( vt_t );
|
141
|
+
}
|
142
|
+
exit_level_2:
|
143
|
+
if( LAPACKE_lsame( jobz, 'a' ) || LAPACKE_lsame( jobz, 's' ) ||
|
144
|
+
( LAPACKE_lsame( jobz, 'o' ) && (m<n) ) ) {
|
145
|
+
LAPACKE_free( u_t );
|
146
|
+
}
|
147
|
+
exit_level_1:
|
148
|
+
LAPACKE_free( a_t );
|
149
|
+
exit_level_0:
|
150
|
+
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
|
151
|
+
LAPACKE_xerbla( "LAPACKE_zgesdd_work", info );
|
152
|
+
}
|
153
|
+
} else {
|
154
|
+
info = -1;
|
155
|
+
LAPACKE_xerbla( "LAPACKE_zgesdd_work", info );
|
156
|
+
}
|
157
|
+
return info;
|
158
|
+
}
|
@@ -0,0 +1,94 @@
|
|
1
|
+
/*****************************************************************************
|
2
|
+
Copyright (c) 2011, 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 zgesvd
|
30
|
+
* Author: Intel Corporation
|
31
|
+
* Generated November, 2011
|
32
|
+
*****************************************************************************/
|
33
|
+
|
34
|
+
#include "lapacke_utils.h"
|
35
|
+
|
36
|
+
lapack_int LAPACKE_zgesvd( int matrix_order, char jobu, char jobvt,
|
37
|
+
lapack_int m, lapack_int n, lapack_complex_double* a,
|
38
|
+
lapack_int lda, double* s, lapack_complex_double* u,
|
39
|
+
lapack_int ldu, lapack_complex_double* vt,
|
40
|
+
lapack_int ldvt, double* superb )
|
41
|
+
{
|
42
|
+
lapack_int info = 0;
|
43
|
+
lapack_int lwork = -1;
|
44
|
+
double* rwork = NULL;
|
45
|
+
lapack_complex_double* work = NULL;
|
46
|
+
lapack_complex_double work_query;
|
47
|
+
lapack_int i;
|
48
|
+
if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
|
49
|
+
LAPACKE_xerbla( "LAPACKE_zgesvd", -1 );
|
50
|
+
return -1;
|
51
|
+
}
|
52
|
+
#ifndef LAPACK_DISABLE_NAN_CHECK
|
53
|
+
/* Optionally check input matrices for NaNs */
|
54
|
+
if( LAPACKE_zge_nancheck( matrix_order, m, n, a, lda ) ) {
|
55
|
+
return -6;
|
56
|
+
}
|
57
|
+
#endif
|
58
|
+
/* Allocate memory for working array(s) */
|
59
|
+
rwork = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,5*MIN(m,n)) );
|
60
|
+
if( rwork == NULL ) {
|
61
|
+
info = LAPACK_WORK_MEMORY_ERROR;
|
62
|
+
goto exit_level_0;
|
63
|
+
}
|
64
|
+
/* Query optimal working array(s) size */
|
65
|
+
info = LAPACKE_zgesvd_work( matrix_order, jobu, jobvt, m, n, a, lda, s, u,
|
66
|
+
ldu, vt, ldvt, &work_query, lwork, rwork );
|
67
|
+
if( info != 0 ) {
|
68
|
+
goto exit_level_1;
|
69
|
+
}
|
70
|
+
lwork = LAPACK_Z2INT( work_query );
|
71
|
+
/* Allocate memory for work arrays */
|
72
|
+
work = (lapack_complex_double*)
|
73
|
+
LAPACKE_malloc( sizeof(lapack_complex_double) * lwork );
|
74
|
+
if( work == NULL ) {
|
75
|
+
info = LAPACK_WORK_MEMORY_ERROR;
|
76
|
+
goto exit_level_1;
|
77
|
+
}
|
78
|
+
/* Call middle-level interface */
|
79
|
+
info = LAPACKE_zgesvd_work( matrix_order, jobu, jobvt, m, n, a, lda, s, u,
|
80
|
+
ldu, vt, ldvt, work, lwork, rwork );
|
81
|
+
/* Backup significant data from working array(s) */
|
82
|
+
for( i=0; i<MIN(m,n)-1; i++ ) {
|
83
|
+
superb[i] = rwork[i];
|
84
|
+
}
|
85
|
+
/* Release memory and exit */
|
86
|
+
LAPACKE_free( work );
|
87
|
+
exit_level_1:
|
88
|
+
LAPACKE_free( rwork );
|
89
|
+
exit_level_0:
|
90
|
+
if( info == LAPACK_WORK_MEMORY_ERROR ) {
|
91
|
+
LAPACKE_xerbla( "LAPACKE_zgesvd", info );
|
92
|
+
}
|
93
|
+
return info;
|
94
|
+
}
|