From 8e9a7503ba2d357f9ef74c1ac24f5ba2de30d839 Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Thu, 12 Jan 2017 18:13:33 +0100
Subject: [PATCH] Fix check on triangular part of pentagonal matrices

---
 compute/ztpgqrt.c | 2 +-
 compute/ztpqrt.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/compute/ztpgqrt.c b/compute/ztpgqrt.c
index e5b094153..1cdab39d8 100644
--- a/compute/ztpgqrt.c
+++ b/compute/ztpgqrt.c
@@ -391,7 +391,7 @@ int MORSE_ztpgqrt_Tile_Async( int L,
         morse_error("MORSE_ztpgqrt_Tile", "only square tiles supported");
         return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE);
     }
-    if (((Q2->m - L) % Q2->mb) != 0) {
+    if ( (L != 0) && (((Q2->m - L) % Q2->mb) != 0) ) {
         morse_error("MORSE_ztpgqrt_Tile", "Triangular part must be aligned with tiles");
         return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE);
     }
diff --git a/compute/ztpqrt.c b/compute/ztpqrt.c
index f7c958815..adb72fe9a 100644
--- a/compute/ztpqrt.c
+++ b/compute/ztpqrt.c
@@ -348,7 +348,7 @@ int MORSE_ztpqrt_Tile_Async( int L, MORSE_desc_t *A, MORSE_desc_t *B, MORSE_desc
         morse_error("MORSE_ztpqrt_Tile", "only square tiles supported");
         return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE);
     }
-    if (((B->m - L) % B->mb) != 0) {
+    if ( (L != 0) && (((B->m - L) % B->mb) != 0) ) {
         morse_error("MORSE_ztpqrt_Tile", "Triangular part must be aligned with tiles");
         return morse_request_fail(sequence, request, MORSE_ERR_ILLEGAL_VALUE);
     }
-- 
GitLab