Jam Balaya
b5a075fa53
Fix qr_solve() failure on well-conditioned matrices with zero pivot ( #1083 )
...
* Fix qr_solve() failure on well-conditioned matrices with zero pivot
In householder(), the sign convention
p[j] = -sign(Re(A[j,j])) * sqrt(s)
collapses to zero when A[j,j] is exactly zero, because ctx.sign(0) == 0.
A zero p[j] makes kappa = 1/(s - p[j]*A[j,j]) = 1/s instead of the
correct 2/||v||**2, corrupting the Householder reflection. The damage
propagates to subsequent columns and eventually trips the
"matrix is numerically singular" guard.
Default sign to ctx.one when A[j,j] is zero (matching LAPACK's dlarfg
convention) so the reflection is computed correctly. The existing
singularity check is left in place to catch genuinely zero column
slices.
Fixes #983 .
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com >
2026-05-19 03:02:53 +03:00
Sergey B Kirpichev
fbf61435bf
Merge pull request #1081 from skirpichev/fix-frexp/1080
...
Support special numbers in mpf_frexp() like math.frexp()
2026-05-15 03:43:59 +03:00
Sergey B Kirpichev
5393b8d55e
Support special numbers in mpf_frexp() like math.frexp()
...
Closes #1080
2026-05-14 06:10:42 +03:00
Sergey B Kirpichev
d84dc68b9d
Merge pull request #1079 from skirpichev/rounding-refine-docs/1076
...
Improve documentation about rounding in the mp context
2026-05-13 08:31:12 +03:00
Sergey B Kirpichev
eefbdcb6ad
Improve documentation about rounding in the mp context
...
See #1076
Also (small optimization) unify _normalize and normalize.
2026-05-13 07:55:29 +03:00
Sergey B Kirpichev
3a09694b91
Merge pull request #1074 from skirpichev/opt-trailing/1073
...
Speedup removal trailing zeros in _normalize/from_man_exp()
2026-04-20 02:32:41 +03:00
Sergey B Kirpichev
63304aee63
Add coverage test for _normalize (man == 1 and bc != 1 case)
2026-04-19 06:27:38 +03:00
Sergey B Kirpichev
8a965fe43b
Speedup removal trailing zeros in _normalize/from_man_exp()
...
| Benchmark | ref | patch |
|----------------|:-------:|:-----------------------:|
| 2 | 404 ns | 398 ns: 1.01x faster |
| 2**3 | 403 ns | 398 ns: 1.01x faster |
| 2**10 | 1.96 us | 1.91 us: 1.03x faster |
| 2**100 | 6.21 us | 2.52 us: 2.47x faster |
| 2**10000 | 1.04 ms | 5.90 us: 175.48x faster |
| Geometric mean | (ref) | 2.78x faster |
Benchmark hidden because not significant (1): 2**10000 + 1
$ cat bench.py
import pyperf
from mpmath.libmp import from_int
runner = pyperf.Runner()
for s in ['2', '2**3', '2**10', '2**100',
'2**10000', '2**10000 + 1']:
i = eval(s)
runner.bench_func(s, from_int, i)
Closes #1073
Co-authored-by: Fredrik Johansson <fredrik.johansson@gmail.com >
2026-04-19 06:27:32 +03:00
Sergey B Kirpichev
6e3d54ef7e
Merge pull request #1072 from skirpichev/fix-root-sig/1067
...
Fix signature of root()
2026-04-17 15:36:13 +03:00
Sergey B Kirpichev
4118cfd0db
Fix signature of root()
...
Closes #1067
2026-04-17 05:42:03 +03:00
Sergey B Kirpichev
3cbeab5ca3
Merge pull request #1071 from skirpichev/test-on-3.15
...
Test on CPython 3.15 (no GMP)
2026-04-03 11:34:11 +03:00
Sergey B Kirpichev
f9822f0954
Test on CPython 3.15 (no GMP)
...
DeprecationWarning's are filtered out in pyexpect-enabled tests,
see pexpect/pexpect#827 .
2026-04-03 11:11:36 +03:00
Sergey B Kirpichev
09178c95b3
Merge pull request #1070 from skirpichev/wa-1046-v2
...
Amend 1108318e (restrict fix to CPython < 3.14)
2026-03-31 05:34:00 +03:00
Sergey B Kirpichev
527d9d228c
Amend 1108318e (restrict fix to CPython < 3.14)
...
Closes #1046
2026-03-31 05:11:56 +03:00
Doug Torrance
7b40a40cc6
Add executable bit to test_version_frozen.sh ( #1066 )
...
This fixes the "script-not-executable" warning in the Debian package.
2026-03-15 23:26:08 +03:00
Sergey B Kirpichev
f8a7f426e4
Merge pull request #1061 from skirpichev/wa-for-s390x/1046
...
Add a workaround for test on s390x
2026-03-11 15:14:50 +03:00
Tim M
f98636edf6
Added Moore-Penrose pseudoinverse. ( #1030 )
2026-03-10 18:37:22 +03:00
Sergey B Kirpichev
73ce23d164
Merge pull request #1063 from skirpichev/revert-backport-action
...
Revert "Add backport action"
2026-03-09 04:11:57 +03:00
Sergey B Kirpichev
5d48d2abd9
Revert "Add backport action"
...
This reverts commit 319703eafd .
2026-03-08 04:52:53 +03:00
Sergey B Kirpichev
1108318e0f
Add a workaround for test on s390x
...
Closes #1046
2026-03-07 04:33:02 +03:00
flurin4
45f5adbb37
Test frozen package version ( #1055 )
...
Add bash script to test package version in a frozen application version and a separate CI job to run it. Closes #1044 .
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com >
2026-03-07 04:32:29 +03:00
Sergey B Kirpichev
893bb431aa
Merge pull request #1057 from skirpichev/drop-deprecated1
...
Remove deprecated behavior
2026-03-07 04:18:42 +03:00
Sergey B Kirpichev
8ffd139b16
Merge pull request #1059 from skirpichev/misc
...
Misc fixes
2026-03-07 04:17:26 +03:00
Sergey B Kirpichev
c9c3946a9b
Adapt test for a "wrong" tuple for mpf constructor
2026-03-07 03:39:34 +03:00
Sergey B Kirpichev
4b84174154
Fix typo in mpc_fibonacci()
2026-03-07 03:30:49 +03:00
Sergey B Kirpichev
3952417cd6
Ignore bc field of mpf's in few tests
2026-03-07 03:14:23 +03:00
Sergey B Kirpichev
22bbe9ad4c
Amend 5ac8dcda
2026-03-07 03:01:50 +03:00
Sergey B Kirpichev
718a67cb8e
Add 'import mpmath' to default imports in CLI
2026-03-06 06:04:10 +03:00
Sergey B Kirpichev
6665df00dd
Correct fp._convert_param() to properly handle real and complex types
...
Remember, that the gmpy2 backend returns mpfr and mpc types
for mixed-mode arithmetics, when one operand is mpz or mpq.
Examples:
>>> mpz(1) + 0.1
mpfr('1.1000000000000001')
>>> mpz(1) + 1j
mpc('1.0+1.0j')
Also, mpfr type returned for true division of mpz's.
2026-03-06 05:58:10 +03:00
Sergey B Kirpichev
801a2e6955
Use ctx.isnpint()
2026-03-06 05:01:56 +03:00
Sergey B Kirpichev
3a454f6643
Use asc=True per default for polynomial functions
2026-03-04 07:28:50 +03:00
Sergey B Kirpichev
ca0f67d9ab
Use signed=True per default in to_man_exp()
2026-03-04 07:28:50 +03:00
Sergey B Kirpichev
82e0a49593
Drop DeprecationWarning for force_type kwarg for matrix()
...
(Note that kwargs now aren't used.)
2026-03-04 07:28:50 +03:00
Sergey B Kirpichev
81204d1105
Drop deprecated to/from_pickable() functions
2026-03-04 07:28:50 +03:00
Sergey B Kirpichev
754c073e7d
Drop deprecated bitcount() function
2026-03-04 07:28:49 +03:00
Sergey B Kirpichev
3ba4132a93
Drop deprecated mp.mpnumeric
2026-03-04 07:28:49 +03:00
Sergey B Kirpichev
485fe73586
Drop deprecated fp.is_special()
2026-03-04 07:28:49 +03:00
Sergey B Kirpichev
60de9789bf
Keep forever deprecated aliases for mpc/mpf_log()
2026-03-04 07:28:49 +03:00
Sergey B Kirpichev
6bc4fe86f3
Cleanup conftest.py
2026-03-04 07:28:49 +03:00
Sergey B Kirpichev
cd25f9b536
Drop deprecated rational module
2026-03-04 07:28:49 +03:00
Sergey B Kirpichev
8f3e715b1e
Drop deprecated math2 module
2026-03-04 07:28:49 +03:00
Sergey B Kirpichev
b7728d8dbd
Merge pull request #1058 from skirpichev/drop-py3.9
...
Drop support for CPython 3.9
2026-03-04 07:28:05 +03:00
Sergey B Kirpichev
9677a2a939
Amend docstring for round_digits()
2026-03-04 07:23:41 +03:00
Sergey B Kirpichev
2f6a5d52f3
Drop support for CPython 3.9
...
(Following https://github.com/sympy/sympy/pull/28816 )
2026-03-04 07:14:17 +03:00
Sergey B Kirpichev
0669eb773f
Merge pull request #1054 from skirpichev/update-dependabot-cfg
...
Improve dependabot settings
2026-03-02 13:17:31 +03:00
Sergey B Kirpichev
e33d20e34b
Merge pull request #1048 from skirpichev/file-version/1044
...
Use version_file option of setuptools-scm to keep version info
2026-03-02 12:58:28 +03:00
Sergey B Kirpichev
163096b16f
Improve dependabot settings
...
* group multiple updates
* forbid auto rebase to reduce cost of CI (Use `@dependabot rebase` manually instead.)
2026-03-02 09:05:43 +03:00
Sergey B Kirpichev
cf2ca665b4
Merge pull request #1051 from mpmath/dependabot/github_actions/actions/download-artifact-8
...
Bump actions/download-artifact from 7 to 8
2026-03-02 03:01:11 +03:00
Sergey B Kirpichev
14802e5d83
Merge pull request #1052 from mpmath/dependabot/github_actions/actions/upload-artifact-7
...
Bump actions/upload-artifact from 6 to 7
2026-03-02 03:00:47 +03:00
dependabot[bot]
a0a3e580f3
Bump actions/upload-artifact from 6 to 7
...
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact ) from 6 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases )
- [Commits](https://github.com/actions/upload-artifact/compare/v6...v7 )
---
updated-dependencies:
- dependency-name: actions/upload-artifact
dependency-version: '7'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
2026-03-01 22:57:12 +00:00