Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/source/petsc-interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ SciPy in the following way:
import scipy.sparse as sp

indptr, indices, data = petsc_mat.getValuesCSR()
scipy_mat = sp.csr_matrix((data, indices, indptr), shape=petsc_mat.getSize())
scipy_mat = sp.csr_array((data, indices, indptr), shape=petsc_mat.getSize())

The sparsity pattern may then be straightforwardly plotted
using matplotlib:
Expand Down
4 changes: 2 additions & 2 deletions pyop2/scripts/spydump
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ plots if two input file names are given."""
import matplotlib
import numpy as np
import pylab
from scipy.sparse import csr_matrix
from scipy.sparse import csr_array

COOKIE = 1211216 # from petscmat.h
IntType = '>i4' # big-endian, 4 byte integer
Expand All @@ -66,7 +66,7 @@ def readmat(filename):

def dump2csr(filename):
(M, N), (I, J, V) = readmat(filename)
return csr_matrix((V, J, I))
return csr_array((V, J, I))


def compare_dump(files, outfile=None, marker='.', markersize=.5):
Expand Down
4 changes: 2 additions & 2 deletions tests/firedrake/regression/test_covariance_operator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse import csr_array
import petsctools
from firedrake import *
from firedrake.adjoint import (
Expand All @@ -21,7 +21,7 @@ def petsc2numpy_mat(petsc_mat):
comm = petsc_mat.getComm()
local_mat = petsc_mat.getRedundantMatrix(
comm.size, PETSc.COMM_SELF)
return csr_matrix(
return csr_array(
local_mat.getValuesCSR()[::-1],
shape=local_mat.getSize()
).todense()
Expand Down
Loading