Go to the documentation of this file.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_zcposv( int matrix_order, char uplo, lapack_int n,
00038 lapack_int nrhs, lapack_complex_double* a,
00039 lapack_int lda, lapack_complex_double* b,
00040 lapack_int ldb, lapack_complex_double* x,
00041 lapack_int ldx, lapack_int* iter )
00042 {
00043 lapack_int info = 0;
00044 double* rwork = NULL;
00045 lapack_complex_float* swork = NULL;
00046 lapack_complex_double* work = NULL;
00047 if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
00048 LAPACKE_xerbla( "LAPACKE_zcposv", -1 );
00049 return -1;
00050 }
00051 #ifndef LAPACK_DISABLE_NAN_CHECK
00052
00053 if( LAPACKE_zpo_nancheck( matrix_order, uplo, n, a, lda ) ) {
00054 return -5;
00055 }
00056 if( LAPACKE_zge_nancheck( matrix_order, n, nrhs, b, ldb ) ) {
00057 return -7;
00058 }
00059 #endif
00060
00061 rwork = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,n) );
00062 if( rwork == NULL ) {
00063 info = LAPACK_WORK_MEMORY_ERROR;
00064 goto exit_level_0;
00065 }
00066 swork = (lapack_complex_float*)
00067 LAPACKE_malloc( sizeof(lapack_complex_float) *
00068 MAX(1,n) * MAX(1,n+nrhs) );
00069 if( swork == NULL ) {
00070 info = LAPACK_WORK_MEMORY_ERROR;
00071 goto exit_level_1;
00072 }
00073 work = (lapack_complex_double*)
00074 LAPACKE_malloc( sizeof(lapack_complex_double) *
00075 MAX(1,n) * MAX(1,nrhs) );
00076 if( work == NULL ) {
00077 info = LAPACK_WORK_MEMORY_ERROR;
00078 goto exit_level_2;
00079 }
00080
00081 info = LAPACKE_zcposv_work( matrix_order, uplo, n, nrhs, a, lda, b, ldb, x,
00082 ldx, work, swork, rwork, iter );
00083
00084 LAPACKE_free( work );
00085 exit_level_2:
00086 LAPACKE_free( swork );
00087 exit_level_1:
00088 LAPACKE_free( rwork );
00089 exit_level_0:
00090 if( info == LAPACK_WORK_MEMORY_ERROR ) {
00091 LAPACKE_xerbla( "LAPACKE_zcposv", info );
00092 }
00093 return info;
00094 }