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_cggsvd( int matrix_order, char jobu, char jobv, char jobq,
00038 lapack_int m, lapack_int n, lapack_int p,
00039 lapack_int* k, lapack_int* l,
00040 lapack_complex_float* a, lapack_int lda,
00041 lapack_complex_float* b, lapack_int ldb,
00042 float* alpha, float* beta, lapack_complex_float* u,
00043 lapack_int ldu, lapack_complex_float* v,
00044 lapack_int ldv, lapack_complex_float* q,
00045 lapack_int ldq, lapack_int* iwork )
00046 {
00047 lapack_int info = 0;
00048 float* rwork = NULL;
00049 lapack_complex_float* work = NULL;
00050 if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
00051 LAPACKE_xerbla( "LAPACKE_cggsvd", -1 );
00052 return -1;
00053 }
00054 #ifndef LAPACK_DISABLE_NAN_CHECK
00055
00056 if( LAPACKE_cge_nancheck( matrix_order, m, n, a, lda ) ) {
00057 return -10;
00058 }
00059 if( LAPACKE_cge_nancheck( matrix_order, p, n, b, ldb ) ) {
00060 return -12;
00061 }
00062 #endif
00063
00064 rwork = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,2*n) );
00065 if( rwork == NULL ) {
00066 info = LAPACK_WORK_MEMORY_ERROR;
00067 goto exit_level_0;
00068 }
00069 work = (lapack_complex_float*)
00070 LAPACKE_malloc( sizeof(lapack_complex_float) * MAX(1,MAX3(3*n,m,p)+n) );
00071 if( work == NULL ) {
00072 info = LAPACK_WORK_MEMORY_ERROR;
00073 goto exit_level_1;
00074 }
00075
00076 info = LAPACKE_cggsvd_work( matrix_order, jobu, jobv, jobq, m, n, p, k, l,
00077 a, lda, b, ldb, alpha, beta, u, ldu, v, ldv, q,
00078 ldq, work, rwork, iwork );
00079
00080 LAPACKE_free( work );
00081 exit_level_1:
00082 LAPACKE_free( rwork );
00083 exit_level_0:
00084 if( info == LAPACK_WORK_MEMORY_ERROR ) {
00085 LAPACKE_xerbla( "LAPACKE_cggsvd", info );
00086 }
00087 return info;
00088 }