From 941c433ad98e5f8b85c3fcc2dbead00ac81dd9b8 Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Wed, 31 Jan 2018 16:51:24 +0100
Subject: [PATCH] Change the test in tpqrt

---
 coreblas/compute/core_ztpmqrt.c |  2 +-
 coreblas/compute/core_ztpqrt.c  | 17 +++++++++++------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/coreblas/compute/core_ztpmqrt.c b/coreblas/compute/core_ztpmqrt.c
index e83dbfc9e..b6199e5c6 100644
--- a/coreblas/compute/core_ztpmqrt.c
+++ b/coreblas/compute/core_ztpmqrt.c
@@ -174,7 +174,7 @@ int CORE_ztpmqrt( MORSE_enum side, MORSE_enum trans,
                      WORK, ldwork );
     }
     /* TT case */
-    else  if( L == M ) {
+    else if( L == M ) {
         CORE_zttmqr( side, trans, m1, n1, M, N, K, IB,
                      A, LDA, B, LDB, V, LDV, T, LDT,
                      WORK, ldwork );
diff --git a/coreblas/compute/core_ztpqrt.c b/coreblas/compute/core_ztpqrt.c
index 1b1137b23..ab95fce0a 100644
--- a/coreblas/compute/core_ztpqrt.c
+++ b/coreblas/compute/core_ztpqrt.c
@@ -132,6 +132,11 @@ int CORE_ztpqrt( int M, int N, int L, int IB,
         coreblas_error(6, "Illegal value of LDT");
         return -10;
     }
+    if ((L != 0) && (L != chameleon_min(M, N))) {
+        //LAPACKE_ztpmqrt_work( LAPACK_COL_MAJOR, M, N, K, L, IB, V, LDV, T, LDT, A, LDA, B, LDB, WORK );
+        coreblas_error( 6, "Illegal value of L (only 0 or min(M,N) handled for now)");
+        return -6;
+    }
 #endif /*!defined(NDEBUG)*/
 
     /* Quick return */
@@ -141,13 +146,13 @@ int CORE_ztpqrt( int M, int N, int L, int IB,
     if ( L == 0 ) {
         CORE_ztsqrt( M, N, IB, A, LDA, B, LDB, T, LDT, WORK, WORK+N );
     }
-    else if (L == M) {
+    else /* if (L == M) */ {
         CORE_zttqrt( M, N, IB, A, LDA, B, LDB, T, LDT, WORK, WORK+N );
     }
-    else {
-        //LAPACKE_ztpqrt_work( LAPACK_COL_MAJOR, M, N, L, IB, A, LDA, B, LDB, T, LDT, WORK );
-        coreblas_error( 3, "Illegal value of L (only 0 or M handled for now)");
-        return -3;
-    }
+    /* else { */
+    /*     //LAPACKE_ztpqrt_work( LAPACK_COL_MAJOR, M, N, L, IB, A, LDA, B, LDB, T, LDT, WORK ); */
+    /*     coreblas_error( 3, "Illegal value of L (only 0 or M handled for now)"); */
+    /*     return -3; */
+    /* } */
     return MORSE_SUCCESS;
 }
-- 
GitLab