emerge 0.4.10__py3-none-any.whl → 0.4.11__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of emerge might be problematic. Click here for more details.

emerge/__init__.py CHANGED
@@ -20,8 +20,8 @@ import os
20
20
 
21
21
  NTHREADS = "1"
22
22
 
23
- os.environ["OMP_NUM_THREADS"] = NTHREADS
24
- os.environ["MKL_NUM_THREADS"] = NTHREADS
23
+ os.environ["OMP_NUM_THREADS"] = "4"
24
+ os.environ["MKL_NUM_THREADS"] = "4"
25
25
  os.environ["OPENBLAS_NUM_THREADS"] = NTHREADS
26
26
  os.environ["VECLIB_MAXIMUM_THREADS"] = NTHREADS
27
27
  os.environ["NUMEXPR_NUM_THREADS"] = NTHREADS
@@ -0,0 +1,455 @@
1
+ # Copyright (c) 2016 Adrian Haas and ETH Zürich
2
+ # Modifications Copyright (c) 2025 Robert Fennis
3
+ #
4
+ # SPDX-License-Identifier: BSD-3-Clause AND GPL-2.0-or-later
5
+ #
6
+ # This file incorporates code from the PyPardiso project, which is
7
+ # distributed under the BSD 3-Clause License. You may redistribute
8
+ # and/or modify this file under either
9
+ #
10
+ # * the terms of the BSD 3-Clause License (see below), or
11
+ # * the terms of the GNU General Public License, version 2 or later.
12
+ #
13
+ # ----------------------------------------------------------------------
14
+ # BSD 3-Clause License
15
+ #
16
+ # Redistribution and use in source and binary forms, with or without
17
+ # modification, are permitted provided that the following conditions are
18
+ # met:
19
+ # 1. Redistributions of source code must retain the above copyright
20
+ # notice, this list of conditions and the following disclaimer.
21
+ # 2. Redistributions in binary form must reproduce the above copyright
22
+ # notice, this list of conditions and the following disclaimer in the
23
+ # documentation and/or other materials provided with the distribution.
24
+ # 3. Neither the name of ETH Zürich nor the names of its contributors
25
+ # may be used to endorse or promote products derived from this
26
+ # software without specific prior written permission.
27
+ #
28
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32
+ # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
38
+ # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
39
+ # DAMAGE.
40
+ # ----------------------------------------------------------------------
41
+
42
+ # coding: utf-8
43
+ import scipy.sparse as sp
44
+ # coding: utf-8
45
+ import os
46
+ import sys
47
+ import glob
48
+ import ctypes
49
+ import warnings
50
+ import hashlib
51
+ import site
52
+ from ctypes.util import find_library
53
+
54
+ import numpy as np
55
+ import scipy.sparse as sp
56
+ from scipy.sparse import SparseEfficiencyWarning, csr_matrix
57
+
58
+
59
+ _PARDISO_ERROR_CODES = """
60
+ 0 | No error.
61
+ -1 | Input inconsistent.
62
+ -2 | Not enough memory.
63
+ -3 | Reordering problem.
64
+ -4 | Zero pivot, numerical fac. or iterative refinement problem.
65
+ -5 | Unclassified (internal) error.
66
+ -6 | Preordering failed (matrix types 11(real and nonsymmetric), 13(complex and nonsymmetric) only).
67
+ -7 | Diagonal Matrix problem.
68
+ -8 | 32-bit integer overflow problem.
69
+ -10 | No license file pardiso.lic found.
70
+ -11 | License is expired.
71
+ -12 | Wrong username or hostname.
72
+ -100 | Reached maximum number of Krylov-subspace iteration in iterative solver.
73
+ -101 | No sufficient convergence in Krylov-subspace iteration within 25 iterations.
74
+ -102 | Error in Krylov-subspace iteration.
75
+ -103 | Bread-Down in Krylov-subspace iteration
76
+ """
77
+
78
+ class MKL_Complex16(ctypes.Structure):
79
+ _fields_ = [("real", ctypes.c_double),
80
+ ("imag", ctypes.c_double)]
81
+
82
+ cpx16_p = ctypes.POINTER(MKL_Complex16)
83
+
84
+ class PyPardisoSolver:
85
+ """
86
+ Python interface to the Intel MKL PARDISO library for solving large sparse linear systems of equations Ax=b.
87
+
88
+ Pardiso documentation: https://software.intel.com/en-us/node/470282
89
+
90
+ --- Basic usage ---
91
+ matrix type: real (float64) and nonsymetric
92
+ methods: solve, factorize
93
+
94
+ - use the "solve(A,b)" method to solve Ax=b for x, where A is a sparse CSR (or CSC) matrix and b is a numpy array
95
+ - use the "factorize(A)" method first, if you intend to solve the system more than once for different right-hand
96
+ sides, the factorization will be reused automatically afterwards
97
+
98
+
99
+ --- Advanced usage ---
100
+ methods: get_iparm, get_iparms, set_iparm, set_matrix_type, set_phase
101
+
102
+ - additional options can be accessed by setting the iparms (see Pardiso documentation for description)
103
+ - other matrix types can be chosen with the "set_matrix_type" method. complex matrix types are currently not
104
+ supported. pypardiso is only teste for mtype=11 (real and nonsymetric)
105
+ - the solving phases can be set with the "set_phase" method
106
+ - The out-of-core (OOC) solver either fails or crashes my computer, be careful with iparm[60]
107
+
108
+
109
+ --- Statistical info ---
110
+ methods: set_statistical_info_on, set_statistical_info_off
111
+
112
+ - the Pardiso solver writes statistical info to the C stdout if desired
113
+ - if you use pypardiso from within a jupyter notebook you can turn the statistical info on and capture the output
114
+ real-time by wrapping your call to "solve" with wurlitzer.sys_pipes() (https://github.com/minrk/wurlitzer,
115
+ https://pypi.python.org/pypi/wurlitzer/)
116
+ - wurlitzer dosen't work on windows, info appears in notebook server console window if used from jupyter notebook
117
+
118
+
119
+ --- Memory usage ---
120
+ methods: remove_stored_factorization, free_memory
121
+
122
+ - remove_stored_factorization can be used to delete the wrapper's copy of matrix A
123
+ - free_memory releases the internal memory of the solver
124
+
125
+ """
126
+
127
+ def __init__(self, mtype=11, phase=13, size_limit_storage=5e7):
128
+
129
+ self.libmkl = None
130
+
131
+ # custom mkl_rt path in environment variable
132
+ mkl_rt = os.environ.get('PYPARDISO_MKL_RT')
133
+
134
+ # Look for the mkl_rt shared library with ctypes.util.find_library
135
+ if mkl_rt is None:
136
+ mkl_rt = find_library('mkl_rt')
137
+ # also look for mkl_rt.1, Windows-specific, see
138
+ # https://github.com/haasad/PyPardisoProject/issues/12
139
+ if mkl_rt is None:
140
+ mkl_rt = find_library('mkl_rt.1')
141
+
142
+ # If we can't find mkl_rt with find_library, we search the directory
143
+ # tree, using a few assumptions:
144
+ # - the shared library can be found in a subdirectory of sys.prefix
145
+ # https://docs.python.org/3.9/library/sys.html#sys.prefix
146
+ # or in the user site in case of user-local installation like
147
+ # `pip install --user`
148
+ # https://peps.python.org/pep-0370/
149
+ # https://docs.python.org/3/library/site.html#site.USER_BASE
150
+ # - either in `lib` (linux and macOS) or `Library\bin` (windows)
151
+ # - if there are multiple matches for `mkl_rt`, try shorter paths
152
+ # first
153
+ if mkl_rt is None:
154
+ globs = glob.glob(
155
+ f'{sys.prefix}/[Ll]ib*/**/*mkl_rt*', recursive=True
156
+ ) or glob.glob(
157
+ f'{site.USER_BASE}/[Ll]ib*/**/*mkl_rt*', recursive=True
158
+ )
159
+ for path in sorted(globs, key=len):
160
+ try:
161
+ self.libmkl = ctypes.CDLL(path)
162
+ break
163
+ except (OSError, ImportError):
164
+ pass
165
+
166
+ if self.libmkl is None:
167
+ raise ImportError(
168
+ 'Shared library mkl_rt not found. '
169
+ 'Use environment variable PYPARDISO_MKL_RT to provide a custom path.'
170
+ )
171
+ else:
172
+ self.libmkl = ctypes.CDLL(mkl_rt)
173
+
174
+ self._mkl_pardiso = self.libmkl.pardiso
175
+
176
+ # determine 32bit or 64bit architecture
177
+ if ctypes.sizeof(ctypes.c_void_p) == 8:
178
+ self._pt_type = (ctypes.c_int64, np.int64)
179
+ else:
180
+ self._pt_type = (ctypes.c_int32, np.int32)
181
+
182
+ self._mkl_pardiso.argtypes = [ctypes.POINTER(self._pt_type[0]), # pt
183
+ ctypes.POINTER(ctypes.c_int32), # maxfct
184
+ ctypes.POINTER(ctypes.c_int32), # mnum
185
+ ctypes.POINTER(ctypes.c_int32), # mtype
186
+ ctypes.POINTER(ctypes.c_int32), # phase
187
+ ctypes.POINTER(ctypes.c_int32), # n
188
+ ctypes.POINTER(None), # a
189
+ ctypes.POINTER(ctypes.c_int32), # ia
190
+ ctypes.POINTER(ctypes.c_int32), # ja
191
+ ctypes.POINTER(ctypes.c_int32), # perm
192
+ ctypes.POINTER(ctypes.c_int32), # nrhs
193
+ ctypes.POINTER(ctypes.c_int32), # iparm
194
+ ctypes.POINTER(ctypes.c_int32), # msglvl
195
+ ctypes.POINTER(None), # b
196
+ ctypes.POINTER(None), # x
197
+ ctypes.POINTER(ctypes.c_int32)] # error
198
+
199
+ self._mkl_pardiso.restype = None
200
+
201
+ self.pt = np.zeros(64, dtype=self._pt_type[1])
202
+ self.iparm = np.zeros(64, dtype=np.int32)
203
+ self.perm = np.zeros(0, dtype=np.int32)
204
+
205
+ self.mtype = mtype
206
+ self.phase = phase
207
+ self.msglvl = False
208
+
209
+ self.factorized_A = csr_matrix((0, 0))
210
+ self.size_limit_storage = size_limit_storage
211
+ self._solve_transposed = False
212
+
213
+ def factorize(self, A):
214
+ """
215
+ Factorize the matrix A, the factorization will automatically be used if the same matrix A is passed to the
216
+ solve method. This will drastically increase the speed of solve, if solve is called more than once for the
217
+ same matrix A
218
+
219
+ --- Parameters ---
220
+ A: sparse square CSR matrix (scipy.sparse.csr.csr_matrix), CSC matrix also possible
221
+ """
222
+
223
+ self._check_A(A)
224
+
225
+ if A.nnz > self.size_limit_storage:
226
+ self.factorized_A = self._hash_csr_matrix(A)
227
+ else:
228
+ self.factorized_A = A.copy()
229
+
230
+ self.set_phase(12)
231
+ b = np.zeros((A.shape[0], 1))
232
+ self._call_pardiso(A, b)
233
+
234
+ def solve(self, A, b):
235
+ """
236
+ solve Ax=b for x
237
+
238
+ --- Parameters ---
239
+ A: sparse square CSR matrix (scipy.sparse.csr.csr_matrix), CSC matrix also possible
240
+ b: numpy ndarray
241
+ right-hand side(s), b.shape[0] needs to be the same as A.shape[0]
242
+
243
+ --- Returns ---
244
+ x: numpy ndarray
245
+ solution of the system of linear equations, same shape as input b
246
+ """
247
+
248
+ self._check_A(A)
249
+ b = self._check_b(A, b)
250
+
251
+ if self._is_already_factorized(A):
252
+ self.set_phase(33)
253
+ else:
254
+ self.set_phase(13)
255
+
256
+ x = self._call_pardiso(A, b)
257
+
258
+ # it is possible to call the solver with empty columns, but computationally expensive to check this
259
+ # beforehand, therefore only the result is checked for infinite elements.
260
+ # if not np.isfinite(x).all():
261
+ # warnings.warn('The result contains infinite elements. Make sure that matrix A contains no empty columns.',
262
+ # PyPardisoWarning)
263
+ # --> this check doesn't work consistently, maybe add an advanced input check method for A
264
+
265
+ return x
266
+
267
+ def _is_already_factorized(self, A):
268
+ if isinstance(self.factorized_A, str):
269
+ return self._hash_csr_matrix(A) == self.factorized_A
270
+ else:
271
+ return self._csr_matrix_equal(A, self.factorized_A)
272
+
273
+ def _csr_matrix_equal(self, a1, a2):
274
+ return all((np.array_equal(a1.indptr, a2.indptr),
275
+ np.array_equal(a1.indices, a2.indices),
276
+ np.array_equal(a1.data, a2.data)))
277
+
278
+ def _hash_csr_matrix(self, matrix):
279
+ return (hashlib.sha1(matrix.indices).hexdigest() +
280
+ hashlib.sha1(matrix.indptr).hexdigest() +
281
+ hashlib.sha1(matrix.data).hexdigest())
282
+
283
+ def _check_A(self, A):
284
+ if A.shape[0] != A.shape[1]:
285
+ raise ValueError('Matrix A needs to be square, but has shape: {}'.format(A.shape))
286
+
287
+ if sp.issparse(A) and A.format == "csr":
288
+ self._solve_transposed = False
289
+ self.set_iparm(12, 1)
290
+ elif sp.issparse(A) and A.format == "csc":
291
+ self._solve_transposed = True
292
+ self.set_iparm(12, 0)
293
+ else:
294
+ msg = 'PyPardiso requires matrix A to be in CSR or CSC format, but matrix A is: {}'.format(type(A))
295
+ raise TypeError(msg)
296
+
297
+ # scipy allows unsorted csr-indices, which lead to completely wrong pardiso results
298
+ if not A.has_sorted_indices:
299
+ A.sort_indices()
300
+
301
+ # scipy allows csr matrices with empty rows. a square matrix with an empty row is singular. calling
302
+ # pardiso with a matrix A that contains empty rows leads to a segfault, same applies for csc with
303
+ # empty columns
304
+ if not np.diff(A.indptr).all():
305
+ row_col = 'column' if self._solve_transposed else 'row'
306
+ raise ValueError('Matrix A is singular, because it contains empty {}(s)'.format(row_col))
307
+
308
+ def _check_b(self, A, b):
309
+ if sp.issparse(b):
310
+ warnings.warn('PyPardiso requires the right-hand side b to be a dense array for maximum efficiency',
311
+ SparseEfficiencyWarning)
312
+ b = b.todense()
313
+
314
+ # pardiso expects fortran (column-major) order for b
315
+ if not b.flags.f_contiguous:
316
+ b = np.asfortranarray(b)
317
+
318
+ if b.shape[0] != A.shape[0]:
319
+ raise ValueError("Dimension mismatch: Matrix A {} and array b {}".format(A.shape, b.shape))
320
+
321
+ if b.dtype != np.float64:
322
+ if b.dtype in [np.float16, np.float32, np.int16, np.int32, np.int64]:
323
+ warnings.warn("Array b's data type was converted from {} to float64".format(str(b.dtype)),
324
+ PyPardisoWarning)
325
+ b = b.astype(np.float64)
326
+ elif b.dtype in (np.complex128, np.complex64):
327
+ b = b.astype(np.complex128)
328
+ else:
329
+ raise TypeError('Dtype {} for array b is not supported'.format(str(b.dtype)))
330
+
331
+ return b
332
+
333
+ def _call_pardiso(self, A, b):
334
+ self.set_iparm(2,3)
335
+ self.set_iparm(3,6)
336
+ self.set_iparm(10,13)
337
+ self.set_iparm(13,2)
338
+
339
+ x = np.zeros_like(b)
340
+ pardiso_error = ctypes.c_int32(0)
341
+ c_int32_p = ctypes.POINTER(ctypes.c_int32)
342
+ c_float64_p = ctypes.POINTER(ctypes.c_double)
343
+
344
+ # 1-based indexing
345
+ ia = A.indptr + 1
346
+ ja = A.indices + 1
347
+
348
+ mtype = 3
349
+
350
+ if A.dtype == np.complex128:
351
+ val_ptr = A.data.ctypes.data_as(cpx16_p)
352
+ rhs_ptr = b.ctypes.data_as(cpx16_p)
353
+ x_ptr = x.ctypes.data_as(cpx16_p)
354
+ else:
355
+ val_ptr = A.data.ctypes.data_as(c_float64_p)
356
+ rhs_ptr = b.ctypes.data_as(c_float64_p)
357
+ x_ptr = x.ctypes.data_as(c_float64_p)
358
+
359
+ self._mkl_pardiso(self.pt.ctypes.data_as(ctypes.POINTER(self._pt_type[0])), # pt
360
+ ctypes.byref(ctypes.c_int32(1)), # maxfct
361
+ ctypes.byref(ctypes.c_int32(1)), # mnum
362
+ ctypes.byref(ctypes.c_int32(mtype)), # mtype -> 11 for real-nonsymetric
363
+ ctypes.byref(ctypes.c_int32(self.phase)), # phase -> 13
364
+ ctypes.byref(ctypes.c_int32(A.shape[0])), # N -> number of equations/size of matrix
365
+ val_ptr, # A -> non-zero entries in matrix
366
+ ia.ctypes.data_as(c_int32_p), # ia -> csr-indptr
367
+ ja.ctypes.data_as(c_int32_p), # ja -> csr-indices
368
+ self.perm.ctypes.data_as(c_int32_p), # perm -> empty
369
+ ctypes.byref(ctypes.c_int32(1 if b.ndim == 1 else b.shape[1])), # nrhs
370
+ self.iparm.ctypes.data_as(c_int32_p), # iparm-array
371
+ ctypes.byref(ctypes.c_int32(self.msglvl)), # msg-level -> 1: statistical info is printed
372
+ rhs_ptr, # b -> right-hand side vector/matrix
373
+ x_ptr, # x -> output
374
+ ctypes.byref(pardiso_error)) # pardiso error
375
+
376
+ if pardiso_error.value != 0:
377
+ raise PyPardisoError(pardiso_error.value)
378
+ else:
379
+ return np.ascontiguousarray(x) # change memory-layout back from fortran to c order
380
+
381
+ def get_iparms(self):
382
+ """Returns a dictionary of iparms"""
383
+ return dict(enumerate(self.iparm, 1))
384
+
385
+ def get_iparm(self, i):
386
+ """Returns the i-th iparm (1-based indexing)"""
387
+ return self.iparm[i-1]
388
+
389
+ def set_iparm(self, i, value):
390
+ """set the i-th iparm to 'value' (1-based indexing)"""
391
+ if i not in {1, 2, 3, 4, 5, 6, 8, 10, 11, 12, 13, 18, 19, 21, 24, 25, 27, 28, 31, 34, 35, 36, 37, 56, 60}:
392
+ warnings.warn('{} is no input iparm. See the Pardiso documentation.'.format(value), PyPardisoWarning)
393
+ self.iparm[i-1] = value
394
+
395
+ def set_matrix_type(self, mtype):
396
+ """Set the matrix type (see Pardiso documentation)"""
397
+ self.mtype = mtype
398
+
399
+ def set_statistical_info_on(self):
400
+ """Display statistical info (appears in notebook server console window if pypardiso is
401
+ used from jupyter notebook, use wurlitzer to redirect info to the notebook)"""
402
+ self.msglvl = 1
403
+
404
+ def set_statistical_info_off(self):
405
+ """Turns statistical info off"""
406
+ self.msglvl = 0
407
+
408
+ def set_phase(self, phase):
409
+ """Set the phase(s) for the solver. See the Pardiso documentation for details."""
410
+ self.phase = phase
411
+
412
+ def remove_stored_factorization(self):
413
+ """removes the stored factorization, this will free the memory in python, but the factorization in pardiso
414
+ is still accessible with a direct call to self._call_pardiso(A,b) with phase=33"""
415
+ self.factorized_A = sp.csr_matrix((0, 0))
416
+
417
+ def free_memory(self, everything=False):
418
+ """release mkl's internal memory, either only for the factorization (ie the LU-decomposition) or all of
419
+ mkl's internal memory if everything=True"""
420
+ self.remove_stored_factorization()
421
+ A = sp.csr_matrix((0, 0))
422
+ b = np.zeros(0)
423
+ self.set_phase(-1 if everything else 0)
424
+ self._call_pardiso(A, b)
425
+ self.set_phase(13)
426
+
427
+ def pardiso_solve(self, A: csr_matrix, b: np.ndarray):
428
+ if sp.issparse(A) and A.format == "csc":
429
+ A = A.tocsr()
430
+
431
+ self._check_A(A)
432
+
433
+ if not self._is_already_factorized(A):
434
+ self.factorize(A)
435
+
436
+ try:
437
+ x = self.solve(A, b)
438
+ except PyPardisoError as e:
439
+ print('Error Codes:')
440
+ print(_PARDISO_ERROR_CODES)
441
+
442
+ return x.squeeze()
443
+
444
+ class PyPardisoWarning(UserWarning):
445
+ pass
446
+
447
+
448
+ class PyPardisoError(Exception):
449
+
450
+ def __init__(self, value):
451
+ self.value = value
452
+
453
+ def __str__(self):
454
+ return ('The Pardiso solver failed with error code {}. '
455
+ 'See Pardiso documentation for details.'.format(self.value))
emerge/_emerge/solver.py CHANGED
@@ -32,32 +32,14 @@ from enum import Enum
32
32
 
33
33
  _PARDISO_AVAILABLE = False
34
34
  _UMFPACK_AVAILABLE = False
35
- _PARDISO_ERROR_CODES = """
36
- 0 | No error.
37
- -1 | Input inconsistent.
38
- -2 | Not enough memory.
39
- -3 | Reordering problem.
40
- -4 | Zero pivot, numerical fac. or iterative refinement problem.
41
- -5 | Unclassified (internal) error.
42
- -6 | Preordering failed (matrix types 11(real and nonsymmetric), 13(complex and nonsymmetric) only).
43
- -7 | Diagonal Matrix problem.
44
- -8 | 32-bit integer overflow problem.
45
- -10 | No license file pardiso.lic found.
46
- -11 | License is expired.
47
- -12 | Wrong username or hostname.
48
- -100 | Reached maximum number of Krylov-subspace iteration in iterative solver.
49
- -101 | No sufficient convergence in Krylov-subspace iteration within 25 iterations.
50
- -102 | Error in Krylov-subspace iteration.
51
- -103 | Bread-Down in Krylov-subspace iteration
52
- """
35
+
53
36
  """ Check if the PC runs on a non-ARM architechture
54
37
  If so, attempt to import PyPardiso (if its installed)
55
38
  """
56
39
 
57
40
  if 'arm' not in platform.processor():
58
41
  try:
59
- from pypardiso import spsolve as pardiso_solve
60
- from pypardiso.pardiso_wrapper import PyPardisoError
42
+ from .pardiso.pardiso_solver import PyPardisoSolver, PyPardisoError
61
43
  _PARDISO_AVAILABLE = True
62
44
  except ModuleNotFoundError as e:
63
45
  logger.info('Pardiso not found, defaulting to SuperLU')
@@ -426,12 +408,12 @@ class SolverUMFPACK(Solver):
426
408
 
427
409
  class SolverPardiso(Solver):
428
410
  """ Implements the PARDISO solver through PyPardiso. """
429
- real_only: bool = True
411
+ real_only: bool = False
430
412
  req_sorter: bool = False
431
413
 
432
414
  def __init__(self):
433
415
  super().__init__()
434
-
416
+ self.solver: PyPardisoSolver = PyPardisoSolver()
435
417
  self.A: np.ndarray = None
436
418
  self.b: np.ndarray = None
437
419
 
@@ -439,11 +421,7 @@ class SolverPardiso(Solver):
439
421
  logger.info(f'Calling Pardiso Solver. ID={id}')
440
422
  self.A = A
441
423
  self.b = b
442
- try:
443
- x = pardiso_solve(A, b)
444
- except PyPardisoError as e:
445
- print('Error Codes:')
446
- print(_PARDISO_ERROR_CODES)
424
+ x = self.solver.solve(A, b)
447
425
  return x, 0
448
426
 
449
427
  ## ----- DIRECT EIG SOLVERS --------------------------------------
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: emerge
3
- Version: 0.4.10
3
+ Version: 0.4.11
4
4
  Summary: An open source EM FEM simulator in Python
5
5
  Project-URL: Homepage, https://github.com/FennisRobert/EMerge
6
6
  Project-URL: Issues, https://github.com/FennisRobert/EMerge/issues
@@ -10,13 +10,12 @@ Requires-Dist: gmsh>=4.13.1
10
10
  Requires-Dist: joblib>=1.5.1
11
11
  Requires-Dist: loguru>=0.7.3
12
12
  Requires-Dist: matplotlib>=3.8.0
13
+ Requires-Dist: mkl!=2024.0; platform_machine == 'x86_64' or platform_machine == 'AMD64'
13
14
  Requires-Dist: numba-progress>=1.1.3
14
15
  Requires-Dist: numba>=0.57.0
15
16
  Requires-Dist: numpy<2.3,>=1.24
16
17
  Requires-Dist: pyvista>=0.45.2
17
18
  Requires-Dist: scipy>=1.14.0
18
- Provides-Extra: pypardiso
19
- Requires-Dist: pypardiso; (platform_machine == 'x86_64' or platform_machine == 'AMD64') and extra == 'pypardiso'
20
19
  Provides-Extra: umfpack
21
20
  Requires-Dist: scikit-umfpack; (sys_platform != 'win32') and extra == 'umfpack'
22
21
  Description-Content-Type: text/markdown
@@ -1,4 +1,4 @@
1
- emerge/__init__.py,sha256=cSI-U9W6sLpv5QctE_KmH0poAKWF4p8cMYZ4bBteoCM,1997
1
+ emerge/__init__.py,sha256=WnFoys_CM_EBaFBf7OprK2QJcBbhparelu1uzP8uBJY,1987
2
2
  emerge/__main__.py,sha256=WVf16sfrOI910QWohrQDaChZdRifMNoS6VKzCT6f3ZA,92
3
3
  emerge/cli.py,sha256=xrNPoX5VtUA0KPRRwZPxC0rGtBDKc2FF8Ro-uPuO-Hg,665
4
4
  emerge/lib.py,sha256=usURQQhFdk5oSmcbr6AAUT50-Z-k6jnePdE3BdvUaYY,2548
@@ -21,7 +21,7 @@ emerge/_emerge/plot.py,sha256=cf1I9mj7EIUJcq8vmANlUkqoV6QqVaJaP-zlC-T9E18,8041
21
21
  emerge/_emerge/selection.py,sha256=HoRILOW52pJG1griLqdI5NsIEa3kwB0lsSojVcWtaBA,21087
22
22
  emerge/_emerge/simmodel.py,sha256=xlQoS1ecj7w1vXHI_X5NRpvkqDTqOSAbpt5vUIQK1-w,17300
23
23
  emerge/_emerge/simulation_data.py,sha256=E3567Ro1YxQlidwZrc5G8IxG46Gnfy-k0wYWxckt1Iw,14128
24
- emerge/_emerge/solver.py,sha256=Ynij5wphKHC9ibi7nzSyzPEQ1eUFBBuLtKOhQ-YZwVg,38814
24
+ emerge/_emerge/solver.py,sha256=LjFEYMQYl1vnbVg_gd8HW5o_YhWjXHccIaJHJpX1gXU,37943
25
25
  emerge/_emerge/system.py,sha256=p4HNz7d_LMRNE9Gk75vVdFecDH2iN_groAM9u-yQTpk,1618
26
26
  emerge/_emerge/elements/__init__.py,sha256=I3n9aic6lJW-oGeqTEZ-Fpxvyl2i-WqsHdnrM3v1oB8,799
27
27
  emerge/_emerge/elements/femdata.py,sha256=Gul5JJQq_gEDjFyf9RwLU-E7Aoh7hIpmrR7nL8SX4Hg,7893
@@ -44,6 +44,7 @@ emerge/_emerge/geo/pcb_tools/macro.py,sha256=ZlKDIZQTXjgklUJZVkaDa17eHIfo9ssq1jX
44
44
  emerge/_emerge/mth/common_functions.py,sha256=23_5QpwvoCSTHSkRVuDJlE1ANEPMSe6hSAH56aEmcxc,1233
45
45
  emerge/_emerge/mth/integrals.py,sha256=E-vfe21_VGlyJRhqNADdALUhXIKPrwuekTo4GwUyZGA,2702
46
46
  emerge/_emerge/mth/optimized.py,sha256=oI3D_hUZXSUMGODMdyY9NZggV2Y7YP5Ky09ZmO4VMZ8,13710
47
+ emerge/_emerge/pardiso/pardiso_solver.py,sha256=u3qCr4wXmUA7MZjTCDMq_2Ho3YWjtlelUQtFuBEPe2s,19043
47
48
  emerge/_emerge/physics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
49
  emerge/_emerge/physics/microwave/__init__.py,sha256=QHeILGYWmvbfLl1o9wrTiWLm0evfXDgS0JiikUoMTts,28
49
50
  emerge/_emerge/physics/microwave/adaptive_freq.py,sha256=5Ph2V4TTDjrFMeI7MI20JID9BNUNQ_ygtDSHj5Bkpmw,9736
@@ -72,8 +73,8 @@ emerge/_emerge/projects/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
72
73
  emerge/_emerge/projects/_gen_base.txt,sha256=oQ1y985IeqLo4T7jmKiXLUukn2rSMXfXQS09FoYOqkk,607
73
74
  emerge/_emerge/projects/_load_base.txt,sha256=JTAhWvHXJQYKe-aDD4HDdmE7f3VXxeurhDzwFCegrEg,511
74
75
  emerge/_emerge/projects/generate_project.py,sha256=TNw-0SpLc82MBq0bd9hB_yqvBZCgmuPonCBsHTp91uk,1450
75
- emerge-0.4.10.dist-info/METADATA,sha256=remQfJ3rwwkledMVscUFWMSUSZnOyaS2lIS5tbiPCkQ,2952
76
- emerge-0.4.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
77
- emerge-0.4.10.dist-info/entry_points.txt,sha256=8rFvAXticpKg4OTC8JEvAksnduW72KIEskCGG9XnFf8,43
78
- emerge-0.4.10.dist-info/licenses/LICENSE,sha256=6tAv8fkWA_-Ell_nboaXajWH3H-vRftIr_4CU2t0S4Y,15180
79
- emerge-0.4.10.dist-info/RECORD,,
76
+ emerge-0.4.11.dist-info/METADATA,sha256=GSNdpruqnvbva-q-O6S8vae9jRXJ4JLa15TK24azZJI,2901
77
+ emerge-0.4.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
78
+ emerge-0.4.11.dist-info/entry_points.txt,sha256=8rFvAXticpKg4OTC8JEvAksnduW72KIEskCGG9XnFf8,43
79
+ emerge-0.4.11.dist-info/licenses/LICENSE,sha256=6tAv8fkWA_-Ell_nboaXajWH3H-vRftIr_4CU2t0S4Y,15180
80
+ emerge-0.4.11.dist-info/RECORD,,