From 53f0b8861371e06684671325f8570ce8f057bcc3 Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Wed, 9 Nov 2016 18:03:01 +0100
Subject: [PATCH] Add support for csr and ijv in spmBase

---
 spm.c | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/spm.c b/spm.c
index 919aec3e..0fc78f42 100644
--- a/spm.c
+++ b/spm.c
@@ -185,13 +185,33 @@ spmBase( pastix_spm_t *spm,
     n   = spm->n;
     nnz = spm->nnz;
 
-    assert( nnz == (spm->colptr[n] - spm->colptr[0]) );
+    switch(spm->fmttype)
+    {
+    case PastixCSC:
+        assert( nnz == (spm->colptr[n] - spm->colptr[0]) );
 
-    for (i = 0; i <= n; i++) {
-        spm->colptr[i] += baseadj;
-    }
-    for (i = 0; i < nnz; i++) {
-        spm->rowptr[i] += baseadj;
+        for (i = 0; i <= n; i++) {
+            spm->colptr[i] += baseadj;
+        }
+        for (i = 0; i < nnz; i++) {
+            spm->rowptr[i] += baseadj;
+        }
+        break;
+
+    case PastixCSR:
+        assert( nnz == (spm->rowptr[n] - spm->rowptr[0]) );
+        for (i = 0; i <= n; i++) {
+            spm->rowptr[i] += baseadj;
+        }
+        for (i = 0; i < nnz; i++) {
+            spm->colptr[i] += baseadj;
+        }
+        break;
+    case PastixIJV:
+        for (i = 0; i < nnz; i++) {
+            spm->rowptr[i] += baseadj;
+            spm->colptr[i] += baseadj;
+        }
     }
 
     if (spm->loc2glob != NULL) {
-- 
GitLab