lapack_int LAPACKE_cgelq2( int matrix_order, lapack_int m, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* tau ) { lapack_int info = 0; lapack_complex_float* work = NULL; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_cgelq2", -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 -4; } #endif /* Allocate memory for working array(s) */ work = (lapack_complex_float*) LAPACKE_malloc( sizeof(lapack_complex_float) * MAX(1,m) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } /* Call middle-level interface */ info = LAPACKE_cgelq2_work( matrix_order, m, n, a, lda, tau, work ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_cgelq2", info ); } return info; }
int CORE_cgelqt(int M, int N, int IB, PLASMA_Complex32_t *A, int LDA, PLASMA_Complex32_t *T, int LDT, PLASMA_Complex32_t *TAU, PLASMA_Complex32_t *WORK) { int i, k, sb; int iinfo; /* Check input arguments */ if (M < 0) { coreblas_error(1, "Illegal value of M"); return -1; } if (N < 0) { coreblas_error(2, "Illegal value of N"); return -2; } if ((IB < 0) || ( (IB == 0) && ((M > 0) && (N > 0)) )) { coreblas_error(3, "Illegal value of IB"); return -3; } if ((LDA < max(1,M)) && (M > 0)) { coreblas_error(5, "Illegal value of LDA"); return -5; } if ((LDT < max(1,IB)) && (IB > 0)) { coreblas_error(7, "Illegal value of LDT"); return -7; } /* Quick return */ if ((M == 0) || (N == 0) || (IB == 0)) return PLASMA_SUCCESS; k = min(M, N); for(i = 0; i < k; i += IB) { sb = min(IB, k-i); iinfo = LAPACKE_cgelq2_work(LAPACK_COL_MAJOR, sb, N-i, &A[LDA*i+i], LDA, &TAU[i], WORK); LAPACKE_clarft_work(LAPACK_COL_MAJOR, lapack_const(PlasmaForward), lapack_const(PlasmaRowwise), N-i, sb, &A[LDA*i+i], LDA, &TAU[i], &T[LDT*i], LDT); if (M > i+sb) { LAPACKE_clarfb_work( LAPACK_COL_MAJOR, lapack_const(PlasmaRight), lapack_const(PlasmaNoTrans), lapack_const(PlasmaForward), lapack_const(PlasmaRowwise), M-i-sb, N-i, sb, &A[LDA*i+i], LDA, &T[LDT*i], LDT, &A[LDA*i+(i+sb)], LDA, WORK, M-i-sb); } } return PLASMA_SUCCESS; }