Skip to content

Commit

Permalink
Implement proxy objects for iluplusplus_precond_parameter and preproc…
Browse files Browse the repository at this point in the history
…essing_sequence
  • Loading branch information
LJeub committed Oct 1, 2021
1 parent cf35b21 commit 974024e
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions ilupp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,42 @@ def __repr__(self):
return '<%dx%d %s with nnz=%d, %s>' % (M, N, self.__class__.__name__, self.total_nnz, dt)


class iluplusplus_precond_parameter:
"""Construct iluplusplus_precond_parameter object.
Args:
dtype: numpy dtype specification for either 32bit or 64bit integer.
Defaults to 32bit. Set this to 64bit when working with very large
matrices with 64bit indices.
"""
def __new__(cls, dtype=np.int32):
dtype = np.dtype(dtype)
if dtype.type is np.int32:
return _ilupp.iluplusplus_precond_parameter()
elif dtype.type is np.int64:
return _ilupp64.iluplusplus_precond_parameter()
else:
raise ValueError('dtype should be either 32bit or 64bit integer')


class preprocessing_sequence:
"""Construct preprocessing_sequence object.
Args:
dtype: numpy dtype specification for either 32bit or 64bit integer.
Defaults to 32bit. Set this to 64bit when working with very large
matrices with 64bit indices.
"""
def __new__(cls, dtype=np.int32):
dtype = np.dtype(dtype)
if dtype.type is np.int32:
return _ilupp.preprocessing_sequence()
elif dtype.type is np.int64:
return _ilupp64.preprocessing_sequence()
else:
raise ValueError('dtype should be either 32bit or 64bit integer')


class ILUppPreconditioner(_BaseWrapper):
"""A multilevel ILU++ preconditioner.
Expand Down

0 comments on commit 974024e

Please sign in to comment.