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_dtgsyl( int matrix_order, char trans, lapack_int ijob,
00038 lapack_int m, lapack_int n, const double* a,
00039 lapack_int lda, const double* b, lapack_int ldb,
00040 double* c, lapack_int ldc, const double* d,
00041 lapack_int ldd, const double* e, lapack_int lde,
00042 double* f, lapack_int ldf, double* scale,
00043 double* dif )
00044 {
00045 lapack_int info = 0;
00046 lapack_int lwork = -1;
00047 lapack_int* iwork = NULL;
00048 double* work = NULL;
00049 double work_query;
00050 if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
00051 LAPACKE_xerbla( "LAPACKE_dtgsyl", -1 );
00052 return -1;
00053 }
00054 #ifndef LAPACK_DISABLE_NAN_CHECK
00055
00056 if( LAPACKE_dge_nancheck( matrix_order, m, m, a, lda ) ) {
00057 return -6;
00058 }
00059 if( LAPACKE_dge_nancheck( matrix_order, n, n, b, ldb ) ) {
00060 return -8;
00061 }
00062 if( LAPACKE_dge_nancheck( matrix_order, m, n, c, ldc ) ) {
00063 return -10;
00064 }
00065 if( LAPACKE_dge_nancheck( matrix_order, m, m, d, ldd ) ) {
00066 return -12;
00067 }
00068 if( LAPACKE_dge_nancheck( matrix_order, n, n, e, lde ) ) {
00069 return -14;
00070 }
00071 if( LAPACKE_dge_nancheck( matrix_order, m, n, f, ldf ) ) {
00072 return -16;
00073 }
00074 #endif
00075
00076 iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,m+n+6) );
00077 if( iwork == NULL ) {
00078 info = LAPACK_WORK_MEMORY_ERROR;
00079 goto exit_level_0;
00080 }
00081
00082 info = LAPACKE_dtgsyl_work( matrix_order, trans, ijob, m, n, a, lda, b, ldb,
00083 c, ldc, d, ldd, e, lde, f, ldf, scale, dif,
00084 &work_query, lwork, iwork );
00085 if( info != 0 ) {
00086 goto exit_level_1;
00087 }
00088 lwork = (lapack_int)work_query;
00089
00090 work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
00091 if( work == NULL ) {
00092 info = LAPACK_WORK_MEMORY_ERROR;
00093 goto exit_level_1;
00094 }
00095
00096 info = LAPACKE_dtgsyl_work( matrix_order, trans, ijob, m, n, a, lda, b, ldb,
00097 c, ldc, d, ldd, e, lde, f, ldf, scale, dif,
00098 work, lwork, iwork );
00099
00100 LAPACKE_free( work );
00101 exit_level_1:
00102 LAPACKE_free( iwork );
00103 exit_level_0:
00104 if( info == LAPACK_WORK_MEMORY_ERROR ) {
00105 LAPACKE_xerbla( "LAPACKE_dtgsyl", info );
00106 }
00107 return info;
00108 }