Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
python-mumps
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kwant
python-mumps
Commits
40d9ec33
Commit
40d9ec33
authored
7 years ago
by
Joseph Weston
Browse files
Options
Downloads
Patches
Plain Diff
rename modules to maintain sanity
parent
00f15f52
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
mumpy/_mumps.pxd
+0
-0
0 additions, 0 deletions
mumpy/_mumps.pxd
mumpy/cmumps.py
+0
-11
0 additions, 11 deletions
mumpy/cmumps.py
mumpy/mumps.pyx
+33
-34
33 additions, 34 deletions
mumpy/mumps.pyx
mumpy/mumpy.py
+13
-13
13 additions, 13 deletions
mumpy/mumpy.py
setup.py
+6
-6
6 additions, 6 deletions
setup.py
with
52 additions
and
64 deletions
mumpy/
c
mumps.pxd
→
mumpy/
_
mumps.pxd
+
0
−
0
View file @
40d9ec33
File moved
This diff is collapsed.
Click to expand it.
mumpy/cmumps.py
deleted
100644 → 0
+
0
−
11
View file @
00f15f52
# Copyright 2011-2016 Anton Akhmerov, Christoph Groth, and Michael Wimmer and
# Copyright 2017 Bas Nijholt.
#
# This file is part of mumpy. It is subject to the license terms in the file
# LICENSE found in the top-level directory of this distribution. A list of
# mumpy authors can be found in the file AUTHORS.md at the top-level
# directory of this distribution and at https://github.com/basnijholt/mumpy
import
numpy
as
np
int_dtype
=
np
.
int32
This diff is collapsed.
Click to expand it.
mumpy/
_
mumps.pyx
→
mumpy/mumps.pyx
+
33
−
34
View file @
40d9ec33
...
...
@@ -8,16 +8,15 @@
cimport
numpy
as
np
import
numpy
as
np
from
.
cimport
cmumps
from
.
import
cmumps
from
.
cimport
_mumps
as
mumps
from
.fortran_helpers
import
assert_fortran_matvec
,
assert_fortran_mat
int_dtype
=
cmumps
.
int_dtype
int_dtype
=
np
.
int32
# Proxy classes for Python access to the control and info parameters of MUMPS
cdef
class
mumps_int_array
:
cdef
c
mumps
.
MUMPS_INT
*
array
cdef
mumps
.
MUMPS_INT
*
array
def
__init__
(
self
):
self
.
array
=
NULL
...
...
@@ -30,14 +29,14 @@ cdef class mumps_int_array:
# workaround for the fact that cython cannot pass pointers to an __init__()
cdef
make_mumps_int_array
(
c
mumps
.
MUMPS_INT
*
array
):
cdef
make_mumps_int_array
(
mumps
.
MUMPS_INT
*
array
):
wrapper
=
mumps_int_array
()
wrapper
.
array
=
array
return
wrapper
cdef
class
smumps_real_array
:
cdef
c
mumps
.
SMUMPS_REAL
*
array
cdef
mumps
.
SMUMPS_REAL
*
array
def
__init__
(
self
):
self
.
array
=
NULL
...
...
@@ -49,14 +48,14 @@ cdef class smumps_real_array:
self
.
array
[
key
-
1
]
=
value
cdef
make_smumps_real_array
(
c
mumps
.
SMUMPS_REAL
*
array
):
cdef
make_smumps_real_array
(
mumps
.
SMUMPS_REAL
*
array
):
wrapper
=
smumps_real_array
()
wrapper
.
array
=
array
return
wrapper
cdef
class
dmumps_real_array
:
cdef
c
mumps
.
DMUMPS_REAL
*
array
cdef
mumps
.
DMUMPS_REAL
*
array
def
__init__
(
self
):
self
.
array
=
NULL
...
...
@@ -68,14 +67,14 @@ cdef class dmumps_real_array:
self
.
array
[
key
-
1
]
=
value
cdef
make_dmumps_real_array
(
c
mumps
.
DMUMPS_REAL
*
array
):
cdef
make_dmumps_real_array
(
mumps
.
DMUMPS_REAL
*
array
):
wrapper
=
dmumps_real_array
()
wrapper
.
array
=
array
return
wrapper
cdef
class
c
mumps_real_array
:
cdef
c
mumps
.
CMUMPS_REAL
*
array
cdef
class
mumps_real_array
:
cdef
mumps
.
CMUMPS_REAL
*
array
def
__init__
(
self
):
self
.
array
=
NULL
...
...
@@ -87,14 +86,14 @@ cdef class cmumps_real_array:
self
.
array
[
key
-
1
]
=
value
cdef
make_
c
mumps_real_array
(
c
mumps
.
CMUMPS_REAL
*
array
):
wrapper
=
c
mumps_real_array
()
cdef
make_mumps_real_array
(
mumps
.
CMUMPS_REAL
*
array
):
wrapper
=
mumps_real_array
()
wrapper
.
array
=
array
return
wrapper
cdef
class
zmumps_real_array
:
cdef
c
mumps
.
ZMUMPS_REAL
*
array
cdef
mumps
.
ZMUMPS_REAL
*
array
def
__init__
(
self
):
self
.
array
=
NULL
...
...
@@ -106,7 +105,7 @@ cdef class zmumps_real_array:
self
.
array
[
key
-
1
]
=
value
cdef
make_zmumps_real_array
(
c
mumps
.
ZMUMPS_REAL
*
array
):
cdef
make_zmumps_real_array
(
mumps
.
ZMUMPS_REAL
*
array
):
wrapper
=
zmumps_real_array
()
wrapper
.
array
=
array
return
wrapper
...
...
@@ -114,7 +113,7 @@ cdef make_zmumps_real_array(cmumps.ZMUMPS_REAL *array):
#############################################################
cdef
class
zmumps
:
cdef
c
mumps
.
ZMUMPS_STRUC_C
params
cdef
mumps
.
ZMUMPS_STRUC_C
params
cdef
public
mumps_int_array
icntl
cdef
public
zmumps_real_array
cntl
...
...
@@ -129,7 +128,7 @@ cdef class zmumps:
self
.
params
.
par
=
1
self
.
params
.
comm_fortran
=
-
987654
c
mumps
.
zmumps_c
(
&
self
.
params
)
mumps
.
zmumps_c
(
&
self
.
params
)
self
.
icntl
=
make_mumps_int_array
(
self
.
params
.
icntl
)
self
.
cntl
=
make_zmumps_real_array
(
self
.
params
.
cntl
)
...
...
@@ -145,10 +144,10 @@ cdef class zmumps:
def
__dealloc__
(
self
):
self
.
params
.
job
=
-
2
c
mumps
.
zmumps_c
(
&
self
.
params
)
mumps
.
zmumps_c
(
&
self
.
params
)
def
call
(
self
):
c
mumps
.
zmumps_c
(
&
self
.
params
)
mumps
.
zmumps_c
(
&
self
.
params
)
def
_set_job
(
self
,
value
):
self
.
params
.
job
=
value
...
...
@@ -163,15 +162,15 @@ cdef class zmumps:
return
self
.
params
.
sym
def
set_assembled_matrix
(
self
,
c
mumps
.
MUMPS_INT
N
,
np
.
ndarray
[
c
mumps
.
MUMPS_INT
,
ndim
=
1
]
i
,
np
.
ndarray
[
c
mumps
.
MUMPS_INT
,
ndim
=
1
]
j
,
mumps
.
MUMPS_INT
N
,
np
.
ndarray
[
mumps
.
MUMPS_INT
,
ndim
=
1
]
i
,
np
.
ndarray
[
mumps
.
MUMPS_INT
,
ndim
=
1
]
j
,
np
.
ndarray
[
np
.
complex128_t
,
ndim
=
1
]
a
):
self
.
params
.
n
=
N
self
.
params
.
nz
=
a
.
shape
[
0
]
self
.
params
.
irn
=
<
c
mumps
.
MUMPS_INT
*>
i
.
data
self
.
params
.
jcn
=
<
c
mumps
.
MUMPS_INT
*>
j
.
data
self
.
params
.
a
=
<
c
mumps
.
ZMUMPS_COMPLEX
*>
a
.
data
self
.
params
.
irn
=
<
mumps
.
MUMPS_INT
*>
i
.
data
self
.
params
.
jcn
=
<
mumps
.
MUMPS_INT
*>
j
.
data
self
.
params
.
a
=
<
mumps
.
ZMUMPS_COMPLEX
*>
a
.
data
def
set_dense_rhs
(
self
,
np
.
ndarray
rhs
):
...
...
@@ -184,11 +183,11 @@ cdef class zmumps:
else
:
self
.
params
.
nrhs
=
rhs
.
shape
[
1
]
self
.
params
.
lrhs
=
rhs
.
shape
[
0
]
self
.
params
.
rhs
=
<
c
mumps
.
ZMUMPS_COMPLEX
*>
rhs
.
data
self
.
params
.
rhs
=
<
mumps
.
ZMUMPS_COMPLEX
*>
rhs
.
data
def
set_sparse_rhs
(
self
,
np
.
ndarray
[
c
mumps
.
MUMPS_INT
,
ndim
=
1
]
col_ptr
,
np
.
ndarray
[
c
mumps
.
MUMPS_INT
,
ndim
=
1
]
row_ind
,
np
.
ndarray
[
mumps
.
MUMPS_INT
,
ndim
=
1
]
col_ptr
,
np
.
ndarray
[
mumps
.
MUMPS_INT
,
ndim
=
1
]
row_ind
,
np
.
ndarray
[
np
.
complex128_t
,
ndim
=
1
]
data
):
if
row_ind
.
shape
[
0
]
!=
data
.
shape
[
0
]:
...
...
@@ -197,13 +196,13 @@ cdef class zmumps:
self
.
params
.
nz_rhs
=
data
.
shape
[
0
]
self
.
params
.
nrhs
=
col_ptr
.
shape
[
0
]
-
1
self
.
params
.
rhs_sparse
=
<
c
mumps
.
ZMUMPS_COMPLEX
*>
data
.
data
self
.
params
.
irhs_sparse
=
<
c
mumps
.
MUMPS_INT
*>
row_ind
.
data
self
.
params
.
irhs_ptr
=
<
c
mumps
.
MUMPS_INT
*>
col_ptr
.
data
self
.
params
.
rhs_sparse
=
<
mumps
.
ZMUMPS_COMPLEX
*>
data
.
data
self
.
params
.
irhs_sparse
=
<
mumps
.
MUMPS_INT
*>
row_ind
.
data
self
.
params
.
irhs_ptr
=
<
mumps
.
MUMPS_INT
*>
col_ptr
.
data
def
set_schur
(
self
,
np
.
ndarray
[
np
.
complex128_t
,
ndim
=
2
,
mode
=
'
c
'
]
schur
,
np
.
ndarray
[
c
mumps
.
MUMPS_INT
,
ndim
=
1
]
schur_vars
):
np
.
ndarray
[
mumps
.
MUMPS_INT
,
ndim
=
1
]
schur_vars
):
if
schur
.
shape
[
0
]
!=
schur
.
shape
[
1
]:
raise
ValueError
(
"
Schur matrix must be squared!
"
)
...
...
@@ -212,5 +211,5 @@ cdef class zmumps:
"
with Schur complement size!
"
)
self
.
params
.
size_schur
=
schur
.
shape
[
0
]
self
.
params
.
schur
=
<
c
mumps
.
ZMUMPS_COMPLEX
*>
schur
.
data
self
.
params
.
listvar_schur
=
<
c
mumps
.
MUMPS_INT
*>
schur_vars
.
data
self
.
params
.
schur
=
<
mumps
.
ZMUMPS_COMPLEX
*>
schur
.
data
self
.
params
.
listvar_schur
=
<
mumps
.
MUMPS_INT
*>
schur_vars
.
data
This diff is collapsed.
Click to expand it.
mumpy/mump
s
.py
→
mumpy/mump
y
.py
+
13
−
13
View file @
40d9ec33
...
...
@@ -15,7 +15,7 @@ import time
import
numpy
as
np
import
scipy.sparse
import
warnings
from
.
import
_
mumps
from
.
import
mumps
from
.fortran_helpers
import
prepare_for_fortran
orderings
=
{
'
amd
'
:
0
,
'
amf
'
:
2
,
'
scotch
'
:
3
,
'
pord
'
:
4
,
'
metis
'
:
5
,
...
...
@@ -48,10 +48,10 @@ def possible_orderings():
possible_orderings
.
cached
=
[
'
auto
'
]
for
ordering
in
[
0
,
2
,
3
,
4
,
5
,
6
]:
data
=
np
.
asfortranarray
([
1
,
1
],
dtype
=
np
.
complex128
)
row
=
np
.
asfortranarray
([
1
,
2
],
dtype
=
_
mumps
.
int_dtype
)
col
=
np
.
asfortranarray
([
1
,
2
],
dtype
=
_
mumps
.
int_dtype
)
row
=
np
.
asfortranarray
([
1
,
2
],
dtype
=
mumps
.
int_dtype
)
col
=
np
.
asfortranarray
([
1
,
2
],
dtype
=
mumps
.
int_dtype
)
instance
=
_
mumps
.
zmumps
()
instance
=
mumps
.
zmumps
()
instance
.
set_assembled_matrix
(
2
,
row
,
col
,
data
)
instance
.
icntl
[
7
]
=
ordering
instance
.
job
=
1
...
...
@@ -226,7 +226,7 @@ class MUMPSContext:
dtype
,
row
,
col
,
data
=
_make_assembled_from_coo
(
a
,
overwrite_a
)
if
dtype
!=
self
.
dtype
:
self
.
mumps_instance
=
getattr
(
_
mumps
,
dtype
+
"
mumps
"
)(
self
.
verbose
)
self
.
mumps_instance
=
getattr
(
mumps
,
dtype
+
"
mumps
"
)(
self
.
verbose
)
self
.
dtype
=
dtype
self
.
n
=
a
.
shape
[
0
]
...
...
@@ -475,9 +475,9 @@ def schur_complement(a, indices, ordering='auto', ooc=False, pivot_tol=0.01,
raise
ValueError
(
"
Unknown ordering
'"
+
ordering
+
"'
!
"
)
dtype
,
row
,
col
,
data
=
_make_assembled_from_coo
(
a
,
overwrite_a
)
indices
=
_make
_
mumps_index_array
(
indices
)
indices
=
_makemumps_index_array
(
indices
)
mumps_instance
=
getattr
(
_
mumps
,
dtype
+
"
mumps
"
)()
mumps_instance
=
getattr
(
mumps
,
dtype
+
"
mumps
"
)()
mumps_instance
.
set_assembled_matrix
(
a
.
shape
[
0
],
row
,
col
,
data
)
mumps_instance
.
icntl
[
7
]
=
orderings
[
ordering
]
...
...
@@ -505,8 +505,8 @@ def schur_complement(a, indices, ordering='auto', ooc=False, pivot_tol=0.01,
def
_make_assembled_from_coo
(
a
,
overwrite_a
):
dtype
,
data
=
prepare_for_fortran
(
overwrite_a
,
a
.
data
)
row
=
np
.
asfortranarray
(
a
.
row
.
astype
(
_
mumps
.
int_dtype
))
col
=
np
.
asfortranarray
(
a
.
col
.
astype
(
_
mumps
.
int_dtype
))
row
=
np
.
asfortranarray
(
a
.
row
.
astype
(
mumps
.
int_dtype
))
col
=
np
.
asfortranarray
(
a
.
col
.
astype
(
mumps
.
int_dtype
))
# MUMPS uses Fortran indices.
row
+=
1
...
...
@@ -519,8 +519,8 @@ def _make_sparse_rhs_from_csc(b, dtype):
dtype
,
data
=
prepare_for_fortran
(
True
,
b
.
data
,
np
.
zeros
(
1
,
dtype
=
dtype
))[:
2
]
col_ptr
=
np
.
asfortranarray
(
b
.
indptr
.
astype
(
_
mumps
.
int_dtype
))
row_ind
=
np
.
asfortranarray
(
b
.
indices
.
astype
(
_
mumps
.
int_dtype
))
col_ptr
=
np
.
asfortranarray
(
b
.
indptr
.
astype
(
mumps
.
int_dtype
))
row_ind
=
np
.
asfortranarray
(
b
.
indices
.
astype
(
mumps
.
int_dtype
))
# MUMPS uses Fortran indices.
col_ptr
+=
1
...
...
@@ -529,8 +529,8 @@ def _make_sparse_rhs_from_csc(b, dtype):
return
dtype
,
col_ptr
,
row_ind
,
data
def
_make
_
mumps_index_array
(
a
):
a
=
np
.
asfortranarray
(
a
.
astype
(
_
mumps
.
int_dtype
))
def
_makemumps_index_array
(
a
):
a
=
np
.
asfortranarray
(
a
.
astype
(
mumps
.
int_dtype
))
a
+=
1
# Fortran indices
return
a
This diff is collapsed.
Click to expand it.
setup.py
+
6
−
6
View file @
40d9ec33
...
...
@@ -170,7 +170,7 @@ def search_mumps():
def
configure_special_extensions
(
exts
,
build_summary
):
# Special config for MUMPS.
mumps
=
exts
[
'
mumpy.
_
mumps
'
]
mumps
=
exts
[
'
mumpy.mumps
'
]
if
'
libraries
'
in
mumps
:
build_summary
.
append
(
'
User-configured MUMPS
'
)
else
:
...
...
@@ -180,15 +180,15 @@ def configure_special_extensions(exts, build_summary):
def
main
():
mumps
=
{
'
mumpy.
_
mumps
'
:
dict
(
sources
=
[
'
mumpy/
_
mumps.pyx
'
],
depends
=
[
'
mumpy/
c
mumps.pxd
'
])}
mumps
=
{
'
mumpy.mumps
'
:
dict
(
sources
=
[
'
mumpy/mumps.pyx
'
],
depends
=
[
'
mumpy/
_
mumps.pxd
'
])}
# Add NumPy header path to include_dirs of all the extensions.
import
numpy
numpy_include
=
numpy
.
get_include
()
mumps
[
'
mumpy.
_
mumps
'
].
setdefault
(
'
include_dirs
'
,
[]).
append
(
numpy_include
)
aliases
=
[(
'
mumps
'
,
'
mumpy.
_
mumps
'
)]
mumps
[
'
mumpy.mumps
'
].
setdefault
(
'
include_dirs
'
,
[]).
append
(
numpy_include
)
aliases
=
[(
'
mumps
'
,
'
mumpy.mumps
'
)]
global
build_summary
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment