void F77WRAP_GETRI(const F77_INTEGER *N, TYPE *A, const F77_INTEGER *lda, const F77_INTEGER *ipiv0, TYPE *work, F77_INTEGER *lwork, F77_INTEGER *info) { const int n = *N; int *ipiv=NULL; int i, lwrk = *lwork; if (lwrk != -1) { ipiv = malloc(n*sizeof(int)); ATL_assert(ipiv); for (i=0; i != n; i++) ipiv[i] = ipiv0[i] - 1; } *info = ATL_getri(AtlasColMajor, *N, A, *lda, ipiv, work, &lwrk); if (work) *work = lwrk; else if (*lwork == -1) ATL_xerbla(5, __FILE__, "For workspace query, workspace cannot be NULL\n"); if (ipiv) free(ipiv); }
int clapack_sgetri(const enum CBLAS_ORDER Order, const int N, float *A, const int lda, const int *ipiv) { int ierr=0, lwrk; int Mjoin(PATL,GetNB)(); void *vp; lwrk = Mjoin(PATL,GetNB)(); if (lwrk <= N) lwrk *= N; else lwrk = N*N; vp = malloc(ATL_Cachelen + ATL_MulBySize(lwrk)); if (vp) { ierr = ATL_getri(Order, N, A, lda, ipiv, ATL_AlignPtr(vp), &lwrk); free(vp); } else { cblas_xerbla(7, "clapack_sgetri", "Cannot allocate workspace of %d\n", lwrk); return(-7); } return(ierr); }