Browse Source

Add early returns

tags/v0.3.11^2
Martin Kroeker GitHub 5 years ago
parent
commit
c9b67141f0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 36 additions and 18 deletions
  1. +6
    -6
      relapack/src/dgetrf.c
  2. +2
    -1
      relapack/src/dsytrf.c
  3. +2
    -2
      relapack/src/dsytrf_rook.c
  4. +5
    -0
      relapack/src/dtrsyl.c
  5. +7
    -2
      relapack/src/zgetrf.c
  6. +2
    -2
      relapack/src/zhetrf_rook.c
  7. +2
    -1
      relapack/src/zsytrf.c
  8. +3
    -2
      relapack/src/zsytrf_rook.c
  9. +5
    -0
      relapack/src/ztrsyl.c
  10. +2
    -2
      relapack/src/ztrtri.c

+ 6
- 6
relapack/src/dgetrf.c View File

@@ -29,15 +29,16 @@ void RELAPACK_dgetrf(
return;
}

const blasint sn = MIN(*m, *n);
if (*m == 0 || *n == 0) return;

const blasint sn = MIN(*m, *n);
RELAPACK_dgetrf_rec(m, &sn, A, ldA, ipiv, info);

// Right remainder
if (*m < *n) {
// Constants
const double ONE[] = { 1. };
const blasint iONE[] = { 1. };
const blasint iONE[] = { 1 };

// Splitting
const blasint rn = *n - *m;
@@ -60,13 +61,11 @@ static void RELAPACK_dgetrf_rec(
double *A, const blasint *ldA, blasint *ipiv,
blasint *info
) {

if (*n <= MAX(CROSSOVER_DGETRF, 1)) {
if ( *n <= MAX(CROSSOVER_DGETRF, 1)) {
// Unblocked
LAPACK(dgetf2)(m, n, A, ldA, ipiv, info);
LAPACK(dgetrf2)(m, n, A, ldA, ipiv, info);
return;
}

// Constants
const double ONE[] = { 1. };
const double MONE[] = { -1. };
@@ -95,6 +94,7 @@ static void RELAPACK_dgetrf_rec(

// recursion(A_L, ipiv_T)
RELAPACK_dgetrf_rec(m, &n1, A_L, ldA, ipiv_T, info);
if (*info) return;
// apply pivots to A_R
LAPACK(dlaswp)(&n2, A_R, ldA, iONE, &n1, ipiv_T, iONE);



+ 2
- 1
relapack/src/dsytrf.c View File

@@ -36,7 +36,7 @@ void RELAPACK_dsytrf(
*info = -2;
else if (*ldA < MAX(1, *n))
*info = -4;
else if (*lWork < minlWork && *lWork != -1)
else if ((*lWork < 1 || *lWork < minlWork) && *lWork != -1)
*info = -7;
else if (*lWork == -1) {
// Work size query
@@ -67,6 +67,7 @@ void RELAPACK_dsytrf(
blasint nout;

// Recursive kernel
if (*n != 0)
RELAPACK_dsytrf_rec(&cleanuplo, n, n, &nout, A, ldA, ipiv, cleanWork, n, info);

#if XSYTRF_ALLOW_MALLOC


+ 2
- 2
relapack/src/dsytrf_rook.c View File

@@ -36,7 +36,7 @@ void RELAPACK_dsytrf_rook(
*info = -2;
else if (*ldA < MAX(1, *n))
*info = -4;
else if (*lWork < minlWork && *lWork != -1)
else if ((*lWork <1 || *lWork < minlWork) && *lWork != -1)
*info = -7;
else if (*lWork == -1) {
// Work size query
@@ -56,7 +56,7 @@ void RELAPACK_dsytrf_rook(

if (*info) {
const blasint minfo = -*info;
LAPACK(xerbla)("DSYTRF", &minfo, strlen("DSYTRF"));
LAPACK(xerbla)("DSYTRF_ROOK", &minfo, strlen("DSYTRF_ROOK"));
return;
}



+ 5
- 0
relapack/src/dtrsyl.c View File

@@ -49,6 +49,11 @@ void RELAPACK_dtrsyl(
return;
}

if (*m == 0 || *n == 0) {
*scale = 1.;
return;
}

// Clean char * arguments
const char cleantranA = notransA ? 'N' : (transA ? 'T' : 'C');
const char cleantranB = notransB ? 'N' : (transB ? 'T' : 'C');


+ 7
- 2
relapack/src/zgetrf.c View File

@@ -30,6 +30,7 @@ void RELAPACK_zgetrf(
return;
}

if (*m == 0 || *n == 0) return;
const blasint sn = MIN(*m, *n);

RELAPACK_zgetrf_rec(m, &sn, A, ldA, ipiv, info);
@@ -62,9 +63,11 @@ static void RELAPACK_zgetrf_rec(
blasint *info
) {

if (*n <= MAX(CROSSOVER_ZGETRF, 1)) {
if (*m == 0 || *n == 0) return;

if ( *n <= MAX(CROSSOVER_ZGETRF, 1)) {
// Unblocked
LAPACK(zgetf2)(m, n, A, ldA, ipiv, info);
LAPACK(zgetrf2)(m, n, A, ldA, ipiv, info);
return;
}

@@ -96,6 +99,8 @@ static void RELAPACK_zgetrf_rec(

// recursion(A_L, ipiv_T)
RELAPACK_zgetrf_rec(m, &n1, A_L, ldA, ipiv_T, info);
if (*info) return;

// apply pivots to A_R
LAPACK(zlaswp)(&n2, A_R, ldA, iONE, &n1, ipiv_T, iONE);



+ 2
- 2
relapack/src/zhetrf_rook.c View File

@@ -36,7 +36,7 @@ void RELAPACK_zhetrf_rook(
*info = -2;
else if (*ldA < MAX(1, *n))
*info = -4;
else if (*lWork < minlWork && *lWork != -1)
else if ((*lWork < 1 || *lWork < minlWork) && *lWork != -1)
*info = -7;
else if (*lWork == -1) {
// Work size query
@@ -56,7 +56,7 @@ void RELAPACK_zhetrf_rook(

if (*info) {
const blasint minfo = -*info;
LAPACK(xerbla)("ZHETRF", &minfo, strlen("ZHETRF"));
LAPACK(xerbla)("ZHETRF_ROOK", &minfo, strlen("ZHETRF_ROOK"));
return;
}



+ 2
- 1
relapack/src/zsytrf.c View File

@@ -36,7 +36,7 @@ void RELAPACK_zsytrf(
*info = -2;
else if (*ldA < MAX(1, *n))
*info = -4;
else if (*lWork < minlWork && *lWork != -1)
else if ((*lWork < 1 || *lWork < minlWork) && *lWork != -1)
*info = -7;
else if (*lWork == -1) {
// Work size query
@@ -67,6 +67,7 @@ void RELAPACK_zsytrf(
blasint nout;

// Recursive kernel
if (*n != 0)
RELAPACK_zsytrf_rec(&cleanuplo, n, n, &nout, A, ldA, ipiv, cleanWork, n, info);

#if XSYTRF_ALLOW_MALLOC


+ 3
- 2
relapack/src/zsytrf_rook.c View File

@@ -36,7 +36,7 @@ void RELAPACK_zsytrf_rook(
*info = -2;
else if (*ldA < MAX(1, *n))
*info = -4;
else if (*lWork < minlWork && *lWork != -1)
else if ((*lWork < 1 || *lWork < minlWork) && *lWork != -1)
*info = -7;
else if (*lWork == -1) {
// Work size query
@@ -56,7 +56,7 @@ void RELAPACK_zsytrf_rook(

if (*info) {
const blasint minfo = -*info;
LAPACK(xerbla)("ZSYTRF", &minfo, strlen("ZSYTRF"));
LAPACK(xerbla)("ZSYTRF_ROOK", &minfo, strlen("ZSYTRF_ROOK"));
return;
}

@@ -67,6 +67,7 @@ void RELAPACK_zsytrf_rook(
blasint nout;

// Recursive kernel
if (*n != 0)
RELAPACK_zsytrf_rook_rec(&cleanuplo, n, n, &nout, A, ldA, ipiv, cleanWork, n, info);

#if XSYTRF_ALLOW_MALLOC


+ 5
- 0
relapack/src/ztrsyl.c View File

@@ -47,6 +47,11 @@ void RELAPACK_ztrsyl(
return;
}

if (*m == 0 || *n == 0) {
*scale = 1.;
return;
}

// Clean char * arguments
const char cleantranA = notransA ? 'N' : 'C';
const char cleantranB = notransB ? 'N' : 'C';


+ 2
- 2
relapack/src/ztrtri.c View File

@@ -69,8 +69,8 @@ static void RELAPACK_ztrtri_rec(
}

// Constants
const double ONE[] = { 1. };
const double MONE[] = { -1. };
const double ONE[] = { 1., 0. };
const double MONE[] = { -1. , 0. };

// Splitting
const blasint n1 = ZREC_SPLIT(*n);


Loading…
Cancel
Save