lapack_int LAPACKE_slaset( int matrix_layout, char uplo, lapack_int m, lapack_int n, float alpha, float beta, float* a, lapack_int lda ) { if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_slaset", -1 ); return -1; } /***************************************************************************** * Note: we do not check NaNs in A since the goal of this subroutine is to * initialized A. It is OK if A has NaNs in input. *****************************************************************************/ #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_s_nancheck( 1, &alpha, 1 ) ) { return -5; } if( LAPACKE_s_nancheck( 1, &beta, 1 ) ) { return -6; } #endif return LAPACKE_slaset_work( matrix_layout, uplo, m, n, alpha, beta, a, lda ); }
lapack_int LAPACKE_ssfrk( int matrix_order, char transr, char uplo, char trans, lapack_int n, lapack_int k, float alpha, const float* a, lapack_int lda, float beta, float* c ) { if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_ssfrk", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ lapack_int ka = LAPACKE_lsame( trans, 'n' ) ? k : n; lapack_int na = LAPACKE_lsame( trans, 'n' ) ? n : k; if( LAPACKE_sge_nancheck( matrix_order, na, ka, a, lda ) ) { return -8; } if( LAPACKE_s_nancheck( 1, &alpha, 1 ) ) { return -7; } if( LAPACKE_s_nancheck( 1, &beta, 1 ) ) { return -10; } if( LAPACKE_spf_nancheck( n, c ) ) { return -11; } #endif return LAPACKE_ssfrk_work( matrix_order, transr, uplo, trans, n, k, alpha, a, lda, beta, c ); }
lapack_int LAPACKE_sstedc( int matrix_order, char compz, lapack_int n, float* d, float* e, float* z, lapack_int ldz ) { lapack_int info = 0; lapack_int liwork = -1; lapack_int lwork = -1; lapack_int* iwork = NULL; float* work = NULL; lapack_int iwork_query; float work_query; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_sstedc", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_s_nancheck( n, d, 1 ) ) { return -4; } if( LAPACKE_s_nancheck( n-1, e, 1 ) ) { return -5; } if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) { if( LAPACKE_sge_nancheck( matrix_order, n, n, z, ldz ) ) { return -6; } } #endif /* Query optimal working array(s) size */ info = LAPACKE_sstedc_work( matrix_order, compz, n, d, e, z, ldz, &work_query, lwork, &iwork_query, liwork ); if( info != 0 ) { goto exit_level_0; } liwork = (lapack_int)iwork_query; lwork = (lapack_int)work_query; /* Allocate memory for work arrays */ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork ); if( iwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } work = (float*)LAPACKE_malloc( sizeof(float) * lwork ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_sstedc_work( matrix_order, compz, n, d, e, z, ldz, work, lwork, iwork, liwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( iwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_sstedc", info ); } return info; }
lapack_int LAPACKE_ssbevx( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int kd, float* ab, lapack_int ldab, float* q, lapack_int ldq, float vl, float vu, lapack_int il, lapack_int iu, float abstol, lapack_int* m, float* w, float* z, lapack_int ldz, lapack_int* ifail ) { lapack_int info = 0; lapack_int* iwork = NULL; float* work = NULL; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_ssbevx", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_ssb_nancheck( matrix_order, uplo, n, kd, ab, ldab ) ) { return -7; } if( LAPACKE_s_nancheck( 1, &abstol, 1 ) ) { return -15; } if( LAPACKE_lsame( range, 'v' ) ) { if( LAPACKE_s_nancheck( 1, &vl, 1 ) ) { return -11; } } if( LAPACKE_lsame( range, 'v' ) ) { if( LAPACKE_s_nancheck( 1, &vu, 1 ) ) { return -12; } } #endif /* Allocate memory for working array(s) */ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,5*n) ); if( iwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,7*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_ssbevx_work( matrix_order, jobz, range, uplo, n, kd, ab, ldab, q, ldq, vl, vu, il, iu, abstol, m, w, z, ldz, work, iwork, ifail ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( iwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_ssbevx", info ); } return info; }
lapack_int LAPACKE_sbdsdc( int matrix_order, char uplo, char compq, lapack_int n, float* d, float* e, float* u, lapack_int ldu, float* vt, lapack_int ldvt, float* q, lapack_int* iq ) { lapack_int info = 0; /* Additional scalars declarations for work arrays */ size_t lwork; lapack_int* iwork = NULL; float* work = NULL; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_sbdsdc", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_s_nancheck( n, d, 1 ) ) { return -5; } if( LAPACKE_s_nancheck( n, e, 1 ) ) { return -6; } #endif /* Additional scalars initializations for work arrays */ if( LAPACKE_lsame( compq, 'i' ) ) { lwork = (size_t)3*MAX(1,n)*MAX(1,n)+4*MAX(1,n); } else if( LAPACKE_lsame( compq, 'p' ) ) { lwork = MAX(1,6*n); } else if( LAPACKE_lsame( compq, 'n' ) ) { lwork = MAX(1,4*n); } else { lwork = 1; /* Any value */ } /* Allocate memory for working array(s) */ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,8*n) ); if( iwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } work = (float*)LAPACKE_malloc( sizeof(float) * lwork ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_sbdsdc_work( matrix_order, uplo, compq, n, d, e, u, ldu, vt, ldvt, q, iq, work, iwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( iwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_sbdsdc", info ); } return info; }
lapack_logical LAPACKE_sgt_nancheck( lapack_int n, const float *dl, const float *d, const float *du ) { return LAPACKE_s_nancheck( n-1, dl, 1 ) || LAPACKE_s_nancheck( n , d, 1 ) || LAPACKE_s_nancheck( n-1, du, 1 ); }
lapack_int LAPACKE_cbdsqr( int matrix_order, char uplo, lapack_int n, lapack_int ncvt, lapack_int nru, lapack_int ncc, float* d, float* e, lapack_complex_float* vt, lapack_int ldvt, lapack_complex_float* u, lapack_int ldu, lapack_complex_float* c, lapack_int ldc ) { lapack_int info = 0; float* work = NULL; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_cbdsqr", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( ncc != 0 ) { if( LAPACKE_cge_nancheck( matrix_order, n, ncc, c, ldc ) ) { return -13; } } if( LAPACKE_s_nancheck( n, d, 1 ) ) { return -7; } if( LAPACKE_s_nancheck( n-1, e, 1 ) ) { return -8; } if( nru != 0 ) { if( LAPACKE_cge_nancheck( matrix_order, nru, n, u, ldu ) ) { return -11; } } if( ncvt != 0 ) { if( LAPACKE_cge_nancheck( matrix_order, n, ncvt, vt, ldvt ) ) { return -9; } } #endif /* Allocate memory for working array(s) */ work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,4*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } /* Call middle-level interface */ info = LAPACKE_cbdsqr_work( matrix_order, uplo, n, ncvt, nru, ncc, d, e, vt, ldvt, u, ldu, c, ldc, work ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_cbdsqr", info ); } return info; }
lapack_int LAPACKE_sbdsvdx( int matrix_layout, char uplo, char jobz, char range, lapack_int n, float* d, float* e, float vl, float vu, lapack_int il, lapack_int iu, lapack_int* ns, float* s, float* z, lapack_int ldz, lapack_int* superb ) { lapack_int info = 0; lapack_int lwork = MAX(14*n,1); float* work = NULL; lapack_int* iwork = NULL; lapack_int i; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_sbdsvdx", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_s_nancheck( n, d, 1 ) ) { return -6; } if( LAPACKE_s_nancheck( n - 1, e, 1 ) ) { return -7; } #endif /* Allocate memory for work arrays */ work = (float*)LAPACKE_malloc( sizeof(float) * lwork ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(12*n,1) ); if( iwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_sbdsvdx_work( matrix_layout, uplo, jobz, range, n, d, e, vl, vu, il, iu, ns, s, z, ldz, work, iwork); /* Backup significant data from working array(s) */ for( i=0; i<12*n-1; i++ ) { superb[i] = iwork[i+1]; } /* Release memory and exit */ LAPACKE_free( iwork ); exit_level_1: LAPACKE_free( work ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_sbdsvdx", info ); } return info; }
lapack_int LAPACKE_spttrf( lapack_int n, float* d, float* e ) { #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_s_nancheck( n, d, 1 ) ) { return -2; } if( LAPACKE_s_nancheck( n-1, e, 1 ) ) { return -3; } #endif return LAPACKE_spttrf_work( n, d, e ); }
lapack_int LAPACKE_slartgp( float f, float g, float* cs, float* sn, float* r ) { #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_s_nancheck( 1, &f, 1 ) ) { return -1; } if( LAPACKE_s_nancheck( 1, &g, 1 ) ) { return -2; } #endif return LAPACKE_slartgp_work( f, g, cs, sn, r ); }
lapack_int LAPACKE_cstein( int matrix_layout, lapack_int n, const float* d, const float* e, lapack_int m, const float* w, const lapack_int* iblock, const lapack_int* isplit, lapack_complex_float* z, lapack_int ldz, lapack_int* ifailv ) { lapack_int info = 0; lapack_int* iwork = NULL; float* work = NULL; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_cstein", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK if( LAPACKE_get_nancheck() ) { /* Optionally check input matrices for NaNs */ if( LAPACKE_s_nancheck( n, d, 1 ) ) { return -3; } if( LAPACKE_s_nancheck( n-1, e, 1 ) ) { return -4; } if( LAPACKE_s_nancheck( n, w, 1 ) ) { return -6; } } #endif /* Allocate memory for working array(s) */ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,n) ); if( iwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,5*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_cstein_work( matrix_layout, n, d, e, m, w, iblock, isplit, z, ldz, work, iwork, ifailv ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( iwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_cstein", info ); } return info; }
lapack_int LAPACKE_sgglse( int matrix_layout, lapack_int m, lapack_int n, lapack_int p, float* a, lapack_int lda, float* b, lapack_int ldb, float* c, float* d, float* x ) { lapack_int info = 0; lapack_int lwork = -1; float* work = NULL; float work_query; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_sgglse", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_sge_nancheck( matrix_layout, m, n, a, lda ) ) { return -5; } if( LAPACKE_sge_nancheck( matrix_layout, p, n, b, ldb ) ) { return -7; } if( LAPACKE_s_nancheck( m, c, 1 ) ) { return -9; } if( LAPACKE_s_nancheck( p, d, 1 ) ) { return -10; } #endif /* Query optimal working array(s) size */ info = LAPACKE_sgglse_work( matrix_layout, m, n, p, a, lda, b, ldb, c, d, x, &work_query, lwork ); if( info != 0 ) { goto exit_level_0; } lwork = (lapack_int)work_query; /* Allocate memory for work arrays */ work = (float*)LAPACKE_malloc( sizeof(float) * lwork ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } /* Call middle-level interface */ info = LAPACKE_sgglse_work( matrix_layout, m, n, p, a, lda, b, ldb, c, d, x, work, lwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_sgglse", info ); } return info; }
lapack_int LAPACKE_slarfg( lapack_int n, float* alpha, float* x, lapack_int incx, float* tau ) { #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_s_nancheck( 1, alpha, 1 ) ) { return -2; } if( LAPACKE_s_nancheck( 1+(n-2)*ABS(incx), x, incx ) ) { return -3; } #endif return LAPACKE_slarfg_work( n, alpha, x, incx, tau ); }
float LAPACKE_slapy2( float x, float y ) { #ifndef LAPACK_DISABLE_NAN_CHECK if( LAPACKE_get_nancheck() ) { /* Optionally check input matrices for NaNs */ if( LAPACKE_s_nancheck( 1, &x, 1 ) ) { return -1; } if( LAPACKE_s_nancheck( 1, &y, 1 ) ) { return -2; } } #endif return LAPACKE_slapy2_work( x, y ); }
lapack_int LAPACKE_stfsm( int matrix_layout, char transr, char side, char uplo, char trans, char diag, lapack_int m, lapack_int n, float alpha, const float* a, float* b, lapack_int ldb ) { if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_stfsm", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK if( LAPACKE_get_nancheck() ) { /* Optionally check input matrices for NaNs */ if( IS_S_NONZERO(alpha) ) { if( LAPACKE_stf_nancheck( matrix_layout, transr, uplo, diag, n, a ) ) { return -10; } } if( LAPACKE_s_nancheck( 1, &alpha, 1 ) ) { return -9; } if( IS_S_NONZERO(alpha) ) { if( LAPACKE_sge_nancheck( matrix_layout, m, n, b, ldb ) ) { return -11; } } } #endif return LAPACKE_stfsm_work( matrix_layout, transr, side, uplo, trans, diag, m, n, alpha, a, b, ldb ); }
lapack_int LAPACKE_cposvx( int matrix_order, char fact, char uplo, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* af, lapack_int ldaf, char* equed, float* s, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* x, lapack_int ldx, float* rcond, float* ferr, float* berr ) { lapack_int info = 0; float* rwork = NULL; lapack_complex_float* work = NULL; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_cposvx", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_cpo_nancheck( matrix_order, uplo, n, a, lda ) ) { return -6; } if( LAPACKE_lsame( fact, 'f' ) ) { if( LAPACKE_cpo_nancheck( matrix_order, uplo, n, af, ldaf ) ) { return -8; } } if( LAPACKE_cge_nancheck( matrix_order, n, nrhs, b, ldb ) ) { return -12; } if( LAPACKE_lsame( fact, 'f' ) && LAPACKE_lsame( *equed, 'y' ) ) { if( LAPACKE_s_nancheck( n, s, 1 ) ) { return -11; } } #endif /* Allocate memory for working array(s) */ rwork = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,n) ); if( rwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } work = (lapack_complex_float*) LAPACKE_malloc( sizeof(lapack_complex_float) * MAX(1,2*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_cposvx_work( matrix_order, fact, uplo, n, nrhs, a, lda, af, ldaf, equed, s, b, ldb, x, ldx, rcond, ferr, berr, work, rwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( rwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_cposvx", info ); } return info; }
lapack_int LAPACKE_clagsy( int matrix_layout, lapack_int n, lapack_int k, const float* d, lapack_complex_float* a, lapack_int lda, lapack_int* iseed ) { lapack_int info = 0; lapack_complex_float* work = NULL; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_clagsy", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK if( LAPACKE_get_nancheck() ) { /* Optionally check input matrices for NaNs */ if( LAPACKE_s_nancheck( n, d, 1 ) ) { return -4; } } #endif /* Allocate memory for working array(s) */ work = (lapack_complex_float*) LAPACKE_malloc( sizeof(lapack_complex_float) * MAX(1,2*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } /* Call middle-level interface */ info = LAPACKE_clagsy_work( matrix_layout, n, k, d, a, lda, iseed, work ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_clagsy", info ); } return info; }
lapack_int LAPACKE_cgelss( int matrix_order, lapack_int m, lapack_int n, lapack_int nrhs, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, float* s, float rcond, lapack_int* rank ) { lapack_int info = 0; lapack_int lwork = -1; float* rwork = NULL; lapack_complex_float* work = NULL; lapack_complex_float work_query; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_cgelss", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_cge_nancheck( matrix_order, m, n, a, lda ) ) { return -5; } if( LAPACKE_cge_nancheck( matrix_order, MAX(m,n), nrhs, b, ldb ) ) { return -7; } if( LAPACKE_s_nancheck( 1, &rcond, 1 ) ) { return -10; } #endif /* Allocate memory for working array(s) */ rwork = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,5*MIN(m,n)) ); if( rwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } /* Query optimal working array(s) size */ info = LAPACKE_cgelss_work( matrix_order, m, n, nrhs, a, lda, b, ldb, s, rcond, rank, &work_query, lwork, rwork ); if( info != 0 ) { goto exit_level_1; } lwork = LAPACK_C2INT( work_query ); /* Allocate memory for work arrays */ work = (lapack_complex_float*) LAPACKE_malloc( sizeof(lapack_complex_float) * lwork ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_cgelss_work( matrix_order, m, n, nrhs, a, lda, b, ldb, s, rcond, rank, work, lwork, rwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( rwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_cgelss", info ); } return info; }
lapack_int LAPACKE_spteqr( int matrix_order, char compz, lapack_int n, float* d, float* e, float* z, lapack_int ldz ) { lapack_int info = 0; /* Additional scalars declarations for work arrays */ lapack_int lwork; float* work = NULL; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_spteqr", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_s_nancheck( n, d, 1 ) ) { return -4; } if( LAPACKE_s_nancheck( n-1, e, 1 ) ) { return -5; } if( LAPACKE_lsame( compz, 'v' ) ) { if( LAPACKE_sge_nancheck( matrix_order, n, n, z, ldz ) ) { return -6; } } #endif /* Additional scalars initializations for work arrays */ if( LAPACKE_lsame( compz, 'n' ) ) { lwork = 1; } else { lwork = MAX(1,4*n-4); } /* Allocate memory for working array(s) */ work = (float*)LAPACKE_malloc( sizeof(float) * lwork ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } /* Call middle-level interface */ info = LAPACKE_spteqr_work( matrix_order, compz, n, d, e, z, ldz, work ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_spteqr", info ); } return info; }
lapack_int LAPACKE_slatms( int matrix_layout, lapack_int m, lapack_int n, char dist, lapack_int* iseed, char sym, float* d, lapack_int mode, float cond, float dmax, lapack_int kl, lapack_int ku, char pack, float* a, lapack_int lda ) { lapack_int info = 0; float* work = NULL; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_slatms", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK if( LAPACKE_get_nancheck() ) { /* Optionally check input matrices for NaNs */ if( LAPACKE_sge_nancheck( matrix_layout, m, n, a, lda ) ) { return -14; } if( LAPACKE_s_nancheck( 1, &cond, 1 ) ) { return -9; } if( LAPACKE_s_nancheck( MIN(n,m), d, 1 ) ) { return -7; } if( LAPACKE_s_nancheck( 1, &dmax, 1 ) ) { return -10; } } #endif /* Allocate memory for working array(s) */ work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,3*(MAX(n,m))) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } /* Call middle-level interface */ info = LAPACKE_slatms_work( matrix_layout, m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_slatms", info ); } return info; }
lapack_int LAPACKE_sgttrf( lapack_int n, float* dl, float* d, float* du, float* du2, lapack_int* ipiv ) { #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_s_nancheck( n, d, 1 ) ) { return -3; } if( LAPACKE_s_nancheck( n-1, dl, 1 ) ) { return -2; } if( LAPACKE_s_nancheck( n-1, du, 1 ) ) { return -4; } #endif return LAPACKE_sgttrf_work( n, dl, d, du, du2, ipiv ); }
lapack_int LAPACKE_classq( lapack_int n, lapack_complex_float* x, lapack_int incx, float* scale, float* sumsq ) { #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input vector `x` and in/out scalars `scale` and `sumsq` for NaNs */ if( LAPACKE_c_nancheck( 1+(n-2)*ABS(incx), x, incx ) ) { return -2; } if( LAPACKE_s_nancheck( 1, scale, 1 ) ) { return -4; } if( LAPACKE_s_nancheck( 1, sumsq, 1 ) ) { return -5; } #endif return LAPACKE_classq_work( n, x, incx, scale, sumsq ); }
lapack_logical LAPACKE_stp_nancheck( int matrix_order, char uplo, char diag, lapack_int n, const float *ap ) { lapack_int i, len; lapack_logical colmaj, upper, unit; if( ap == NULL ) return (lapack_logical) 0; colmaj = ( matrix_order == LAPACK_COL_MAJOR ); upper = LAPACKE_lsame( uplo, 'u' ); unit = LAPACKE_lsame( diag, 'u' ); if( ( !colmaj && ( matrix_order != LAPACK_ROW_MAJOR ) ) || ( !upper && !LAPACKE_lsame( uplo, 'l' ) ) || ( !unit && !LAPACKE_lsame( diag, 'n' ) ) ) { /* Just exit if any of input parameters are wrong */ return (lapack_logical) 0; } if( unit ) { /* Unit case, diagonal should be excluded from the check for NaN. */ /* Since col_major upper and row_major lower are equal, * and col_major lower and row_major upper are equals too - * using one code for equal cases. XOR( colmaj, upper ) */ if( ( colmaj || upper ) && !( colmaj && upper ) ) { for( i = 1; i < n; i++ ) if( LAPACKE_s_nancheck( i, &ap[ ((size_t)i+1)*i/2 ], 1 ) ) return (lapack_logical) 1; } else { for( i = 0; i < n-1; i++ ) if( LAPACKE_s_nancheck( n-i-1, &ap[ (size_t)i+1 + i*((size_t)2*n-i+1)/2 ], 1 ) ) return (lapack_logical) 1; } return (lapack_logical) 0; } else { /* Non-unit case - just check whole array for NaNs. */ len = n*(n+1)/2; return LAPACKE_s_nancheck( len, ap, 1 ); } }
lapack_int LAPACKE_sptsv( int matrix_order, lapack_int n, lapack_int nrhs, float* d, float* e, float* b, lapack_int ldb ) { if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_sptsv", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_sge_nancheck( matrix_order, n, nrhs, b, ldb ) ) { return -6; } if( LAPACKE_s_nancheck( n, d, 1 ) ) { return -4; } if( LAPACKE_s_nancheck( n-1, e, 1 ) ) { return -5; } #endif return LAPACKE_sptsv_work( matrix_order, n, nrhs, d, e, b, ldb ); }
lapack_int LAPACKE_sormbr( int matrix_layout, char vect, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc ) { lapack_int info = 0; lapack_int lwork = -1; float* work = NULL; float work_query; lapack_int nq, ar, ac; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_sormbr", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ nq = LAPACKE_lsame( side, 'l' ) ? m : n; ar = LAPACKE_lsame( vect, 'q' ) ? nq : MIN(nq,k); ac = LAPACKE_lsame( vect, 'q' ) ? MIN(nq,k) : nq; if( LAPACKE_sge_nancheck( matrix_layout, ar, ac, a, lda ) ) { return -8; } if( LAPACKE_sge_nancheck( matrix_layout, m, n, c, ldc ) ) { return -11; } if( LAPACKE_s_nancheck( MIN(nq,k), tau, 1 ) ) { return -10; } #endif /* Query optimal working array(s) size */ info = LAPACKE_sormbr_work( matrix_layout, vect, side, trans, m, n, k, a, lda, tau, c, ldc, &work_query, lwork ); if( info != 0 ) { goto exit_level_0; } lwork = (lapack_int)work_query; /* Allocate memory for work arrays */ work = (float*)LAPACKE_malloc( sizeof(float) * lwork ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } /* Call middle-level interface */ info = LAPACKE_sormbr_work( matrix_layout, vect, side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_sormbr", info ); } return info; }
lapack_int LAPACKE_sdisna( char job, lapack_int m, lapack_int n, const float* d, float* sep ) { #ifndef LAPACK_DISABLE_NAN_CHECK if( LAPACKE_get_nancheck() ) { /* Optionally check input matrices for NaNs */ if( LAPACKE_s_nancheck( MIN(m,n), d, 1 ) ) { return -4; } } #endif return LAPACKE_sdisna_work( job, m, n, d, sep ); }
lapack_int LAPACKE_sormlq( int matrix_order, char side, char trans, lapack_int m, lapack_int n, lapack_int k, const float* a, lapack_int lda, const float* tau, float* c, lapack_int ldc ) { lapack_int info = 0; lapack_int lwork = -1; float* work = NULL; float work_query; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_sormlq", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_sge_nancheck( matrix_order, k, m, a, lda ) ) { return -7; } if( LAPACKE_sge_nancheck( matrix_order, m, n, c, ldc ) ) { return -10; } if( LAPACKE_s_nancheck( k, tau, 1 ) ) { return -9; } #endif /* Query optimal working array(s) size */ info = LAPACKE_sormlq_work( matrix_order, side, trans, m, n, k, a, lda, tau, c, ldc, &work_query, lwork ); if( info != 0 ) { goto exit_level_0; } lwork = (lapack_int)work_query; /* Allocate memory for work arrays */ work = (float*)LAPACKE_malloc( sizeof(float) * lwork ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } /* Call middle-level interface */ info = LAPACKE_sormlq_work( matrix_order, side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_sormlq", info ); } return info; }
lapack_int LAPACKE_sggbak( int matrix_layout, char job, char side, lapack_int n, lapack_int ilo, lapack_int ihi, const float* lscale, const float* rscale, lapack_int m, float* v, lapack_int ldv ) { if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_sggbak", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_s_nancheck( n, lscale, 1 ) ) { return -7; } if( LAPACKE_s_nancheck( n, rscale, 1 ) ) { return -8; } if( LAPACKE_sge_nancheck( matrix_layout, n, m, v, ldv ) ) { return -10; } #endif return LAPACKE_sggbak_work( matrix_layout, job, side, n, ilo, ihi, lscale, rscale, m, v, ldv ); }
lapack_int LAPACKE_cpbcon( int matrix_layout, char uplo, lapack_int n, lapack_int kd, const lapack_complex_float* ab, lapack_int ldab, float anorm, float* rcond ) { lapack_int info = 0; float* rwork = NULL; lapack_complex_float* work = NULL; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_cpbcon", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK if( LAPACKE_get_nancheck() ) { /* Optionally check input matrices for NaNs */ if( LAPACKE_cpb_nancheck( matrix_layout, uplo, n, kd, ab, ldab ) ) { return -5; } if( LAPACKE_s_nancheck( 1, &anorm, 1 ) ) { return -7; } } #endif /* Allocate memory for working array(s) */ rwork = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,n) ); if( rwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } work = (lapack_complex_float*) LAPACKE_malloc( sizeof(lapack_complex_float) * MAX(1,2*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_cpbcon_work( matrix_layout, uplo, n, kd, ab, ldab, anorm, rcond, work, rwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( rwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_cpbcon", info ); } return info; }
lapack_int LAPACKE_cgtcon( char norm, lapack_int n, const lapack_complex_float* dl, const lapack_complex_float* d, const lapack_complex_float* du, const lapack_complex_float* du2, const lapack_int* ipiv, float anorm, float* rcond ) { lapack_int info = 0; lapack_complex_float* work = NULL; #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_s_nancheck( 1, &anorm, 1 ) ) { return -8; } if( LAPACKE_c_nancheck( n, d, 1 ) ) { return -4; } if( LAPACKE_c_nancheck( n-1, dl, 1 ) ) { return -3; } if( LAPACKE_c_nancheck( n-1, du, 1 ) ) { return -5; } if( LAPACKE_c_nancheck( n-2, du2, 1 ) ) { return -6; } #endif /* Allocate memory for working array(s) */ work = (lapack_complex_float*) LAPACKE_malloc( sizeof(lapack_complex_float) * MAX(1,2*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } /* Call middle-level interface */ info = LAPACKE_cgtcon_work( norm, n, dl, d, du, du2, ipiv, anorm, rcond, work ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_cgtcon", info ); } return info; }