00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include "lapacke.h"
00035 #include "lapacke_utils.h"
00036
00037 lapack_int LAPACKE_cstedc_work( int matrix_order, char compz, lapack_int n,
00038 float* d, float* e, lapack_complex_float* z,
00039 lapack_int ldz, lapack_complex_float* work,
00040 lapack_int lwork, float* rwork,
00041 lapack_int lrwork, lapack_int* iwork,
00042 lapack_int liwork )
00043 {
00044 lapack_int info = 0;
00045 if( matrix_order == LAPACK_COL_MAJOR ) {
00046
00047 LAPACK_cstedc( &compz, &n, d, e, z, &ldz, work, &lwork, rwork, &lrwork,
00048 iwork, &liwork, &info );
00049 if( info < 0 ) {
00050 info = info - 1;
00051 }
00052 } else if( matrix_order == LAPACK_ROW_MAJOR ) {
00053 lapack_int ldz_t = MAX(1,n);
00054 lapack_complex_float* z_t = NULL;
00055
00056 if( ldz < n ) {
00057 info = -7;
00058 LAPACKE_xerbla( "LAPACKE_cstedc_work", info );
00059 return info;
00060 }
00061
00062 if( liwork == -1 || lrwork == -1 || lwork == -1 ) {
00063 LAPACK_cstedc( &compz, &n, d, e, z, &ldz_t, work, &lwork, rwork,
00064 &lrwork, iwork, &liwork, &info );
00065 return (info < 0) ? (info - 1) : info;
00066 }
00067
00068 if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
00069 z_t = (lapack_complex_float*)
00070 LAPACKE_malloc( sizeof(lapack_complex_float) *
00071 ldz_t * MAX(1,n) );
00072 if( z_t == NULL ) {
00073 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
00074 goto exit_level_0;
00075 }
00076 }
00077
00078 if( LAPACKE_lsame( compz, 'v' ) ) {
00079 LAPACKE_cge_trans( matrix_order, n, n, z, ldz, z_t, ldz_t );
00080 }
00081
00082 LAPACK_cstedc( &compz, &n, d, e, z_t, &ldz_t, work, &lwork, rwork,
00083 &lrwork, iwork, &liwork, &info );
00084 if( info < 0 ) {
00085 info = info - 1;
00086 }
00087
00088 if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
00089 LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, z_t, ldz_t, z, ldz );
00090 }
00091
00092 if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
00093 LAPACKE_free( z_t );
00094 }
00095 exit_level_0:
00096 if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
00097 LAPACKE_xerbla( "LAPACKE_cstedc_work", info );
00098 }
00099 } else {
00100 info = -1;
00101 LAPACKE_xerbla( "LAPACKE_cstedc_work", info );
00102 }
00103 return info;
00104 }