PyPyNum 1.15.1__tar.gz → 1.16.1__tar.gz
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.
- {pypynum-1.15.1 → pypynum-1.16.1}/PKG-INFO +94 -41
- {pypynum-1.15.1 → pypynum-1.16.1}/PyPyNum.egg-info/PKG-INFO +94 -41
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/README.md +93 -40
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/__init__.py +1 -1
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/arrays.py +69 -19
- pypynum-1.16.1/pypynum/consts.py +262 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/dists.py +2 -2
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/matrices.py +74 -40
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/multiprec.py +35 -2
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/seqs.py +55 -3
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/special.py +133 -12
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/tensors.py +3 -15
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/tools.py +203 -17
- {pypynum-1.15.1 → pypynum-1.16.1}/setup.py +1 -1
- pypynum-1.15.1/pypynum/consts.py +0 -68
- {pypynum-1.15.1 → pypynum-1.16.1}/PyPyNum.egg-info/SOURCES.txt +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/PyPyNum.egg-info/dependency_links.txt +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/PyPyNum.egg-info/top_level.txt +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/PyPyNum.png +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/chars.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/ciphers.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/crandom.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/dataproc.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/equations.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/fft.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/files.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/geoms.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/graphs.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/groups.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/images.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/interp.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/kernels.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/logics.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/maths.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/networks.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/numbers.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/plotting.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/polys.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/pprinters.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/quats.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/random.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/regs.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/stattest.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/symbols.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/test.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/this.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/trees.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/types.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/ufuncs.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/utils.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/vectors.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/pypynum/zh_cn.py +0 -0
- {pypynum-1.15.1 → pypynum-1.16.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyPyNum
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.16.1
|
|
4
4
|
Summary: PyPyNum is a Python library for math & science computations, covering algebra, calculus, stats, with data structures like matrices, vectors, tensors. It offers numerical tools, programs, and supports computational ops, functions, processing, simulation, & visualization in data science & ML, crucial for research, engineering, & data processing.
|
|
5
5
|
Home-page: https://github.com/PythonSJL/PyPyNum
|
|
6
6
|
Author: Shen Jiayi
|
|
@@ -234,7 +234,7 @@ processing.</font><font color = red>[Python>=3.4]</font>
|
|
|
234
234
|
[](https://pepy.tech/project/pypynum)
|
|
235
235
|
[](https://pepy.tech/project/pypynum)
|
|
236
236
|
|
|
237
|
-
## Version -> 1.
|
|
237
|
+
## PyPyNum | Version -> 1.16.1 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
|
|
238
238
|
|
|
239
239
|

|
|
240
240
|
|
|
@@ -327,41 +327,79 @@ Python interpreter and run it!
|
|
|
327
327
|
```
|
|
328
328
|
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
329
329
|
|
|
330
|
-
Fixed
|
|
330
|
+
Fixed and improved the basic
|
|
331
|
+
operation function of 'Array'.
|
|
331
332
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
conditions for multi precision
|
|
333
|
+
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
335
334
|
|
|
336
|
-
|
|
335
|
+
We will remove 'Tensor' in
|
|
336
|
+
future versions. Because its
|
|
337
|
+
computational functions have
|
|
338
|
+
already been implemented in
|
|
339
|
+
'Array'. The current version
|
|
340
|
+
will throw 'FutureWarning' as a
|
|
341
|
+
warning.
|
|
337
342
|
|
|
338
343
|
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
339
344
|
|
|
340
|
-
|
|
345
|
+
Fixed the calculation error of
|
|
346
|
+
'mp_euler_gamma', which was
|
|
347
|
+
caused when modifying the
|
|
348
|
+
iteration stop condition
|
|
349
|
+
previously.
|
|
341
350
|
|
|
342
|
-
|
|
351
|
+
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
343
352
|
|
|
344
|
-
|
|
353
|
+
<<< Here are the newly added functions >>>
|
|
345
354
|
|
|
346
|
-
left by previous debugging.
|
|
347
355
|
|
|
348
|
-
|
|
356
|
+
cos_sim(seq1: Union[list, tuple, str], seq2: Union[list, tuple, str], is_vector: bool = False) -> float
|
|
357
|
+
Introduction
|
|
358
|
+
==========
|
|
359
|
+
Calculate the cosine similarity between two sequences.
|
|
349
360
|
|
|
350
|
-
|
|
361
|
+
The cosine similarity is a measure of similarity between two non-zero vectors. It is defined as the cosine of the
|
|
362
|
+
angle between them, which is computed as the dot product of the vectors divided by the product of their magnitudes.
|
|
363
|
+
This function supports both numerical vectors and frequency distributions of sequences.
|
|
351
364
|
|
|
352
|
-
|
|
365
|
+
Example
|
|
366
|
+
==========
|
|
367
|
+
>>> cos_sim("hello world", "world hello")
|
|
368
|
+
0.9999999999999998
|
|
369
|
+
>>>
|
|
370
|
+
:param seq1: First sequence to compare.
|
|
371
|
+
:param seq2: Second sequence to compare.
|
|
372
|
+
:param is_vector: A boolean indicating whether the input sequences are numerical vectors. Default is False.
|
|
373
|
+
:return: The cosine similarity between the two sequences, ranging from -1 to 1.
|
|
353
374
|
|
|
354
|
-
hypergeometric functions in the
|
|
355
375
|
|
|
356
|
-
|
|
376
|
+
replace(seq: Union[list, tuple], old: Union[list, tuple], new: Union[list, tuple], count: int = -1) -> Union[list, tuple]
|
|
377
|
+
Introduction
|
|
378
|
+
==========
|
|
379
|
+
Replace occurrences of the subsequence 'old' in 'seq' with 'new'.
|
|
357
380
|
|
|
358
|
-
|
|
381
|
+
This function is designed to handle sequences such as lists or tuples and replace specified subsequences
|
|
382
|
+
with new ones. It also allows limiting the number of replacements.
|
|
359
383
|
|
|
360
|
-
|
|
384
|
+
Example
|
|
385
|
+
==========
|
|
386
|
+
>>> replace([1, 2, 3, 4, 2, 3], [2, 3], [5, 6])
|
|
387
|
+
[1, 5, 6, 4, 5, 6]
|
|
388
|
+
>>>
|
|
389
|
+
:param seq: The sequence in which to replace the subsequence.
|
|
390
|
+
:param old: The subsequence to be replaced.
|
|
391
|
+
:param new: The subsequence to replace with.
|
|
392
|
+
:param count: The maximum number of replacements to perform. Default is -1 (unlimited).
|
|
393
|
+
:return: The modified sequence with replacements.
|
|
361
394
|
|
|
362
|
-
|
|
395
|
+
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
363
396
|
|
|
364
|
-
|
|
397
|
+
Other functions and classes have
|
|
398
|
+
also undergone certain
|
|
399
|
+
modifications, such as adding a
|
|
400
|
+
"reduce" parameter to the "qr"
|
|
401
|
+
function to determine whether to
|
|
402
|
+
crop the matrix.
|
|
365
403
|
|
|
366
404
|
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
367
405
|
```
|
|
@@ -399,15 +437,16 @@ PyPyNum
|
|
|
399
437
|
│ ├── asarray(data: Any) -> Any
|
|
400
438
|
│ ├── aslist(data: Any) -> Any
|
|
401
439
|
│ ├── boolarray(data: Any) -> Any
|
|
402
|
-
│ ├── fill(shape:
|
|
403
|
-
│ ├── full(shape:
|
|
404
|
-
│ ├── full_like(a: Any, fill_value: Any, rtype:
|
|
440
|
+
│ ├── fill(shape: typing.Union[list, tuple], sequence: typing.Union[list, tuple], repeat: bool, pad: typing.Any, rtype: typing.Callable) -> typing.Any
|
|
441
|
+
│ ├── full(shape: typing.Union[list, tuple], fill_value: typing.Any, rtype: typing.Callable) -> typing.Any
|
|
442
|
+
│ ├── full_like(a: typing.Any, fill_value: typing.Any, rtype: typing.Callable) -> typing.Any
|
|
405
443
|
│ ├── get_shape(data: Any) -> Any
|
|
406
444
|
│ ├── is_valid_array(_array: Any, _shape: Any) -> Any
|
|
407
|
-
│ ├── ones(shape:
|
|
408
|
-
│ ├── ones_like(a: Any, rtype:
|
|
409
|
-
│ ├──
|
|
410
|
-
│
|
|
445
|
+
│ ├── ones(shape: typing.Union[list, tuple], rtype: typing.Callable) -> typing.Any
|
|
446
|
+
│ ├── ones_like(a: typing.Any, rtype: typing.Callable) -> typing.Any
|
|
447
|
+
│ ├── tensorproduct(tensors: pypynum.arrays.Array) -> pypynum.arrays.Array
|
|
448
|
+
│ ├── zeros(shape: typing.Union[list, tuple], rtype: typing.Callable) -> typing.Any
|
|
449
|
+
│ └── zeros_like(a: typing.Any, rtype: typing.Callable) -> typing.Any
|
|
411
450
|
├── chars
|
|
412
451
|
│ ├── CLASS
|
|
413
452
|
│ └── FUNCTION
|
|
@@ -668,13 +707,15 @@ PyPyNum
|
|
|
668
707
|
│ ├── CLASS
|
|
669
708
|
│ │ └── Matrix(pypynum.arrays.Array)/__init__(self: Any, data: Any, check: Any) -> Any
|
|
670
709
|
│ └── FUNCTION
|
|
671
|
-
│ ├── cholesky(matrix:
|
|
710
|
+
│ ├── cholesky(matrix: pypynum.matrices.Matrix, hermitian: bool) -> pypynum.matrices.Matrix
|
|
672
711
|
│ ├── eigen(matrix: pypynum.matrices.Matrix) -> tuple
|
|
673
712
|
│ ├── hessenberg(matrix: pypynum.matrices.Matrix) -> tuple
|
|
674
|
-
│ ├── identity(n: int) -> pypynum.matrices.Matrix
|
|
713
|
+
│ ├── identity(n: int, m: int) -> pypynum.matrices.Matrix
|
|
675
714
|
│ ├── lu(matrix: pypynum.matrices.Matrix) -> tuple
|
|
676
715
|
│ ├── mat(data: Any) -> Any
|
|
677
|
-
│ ├──
|
|
716
|
+
│ ├── perm_mat(num_rows: int, num_cols: int, row_swaps: typing.Union[list, tuple], col_swaps: typing.Union[list, tuple], rtype: typing.Callable) -> typing.Any
|
|
717
|
+
│ ├── perm_mat_indices(num_rows: int, num_cols: int, row_swaps: typing.Union[list, tuple], col_swaps: typing.Union[list, tuple]) -> tuple
|
|
718
|
+
│ ├── qr(matrix: pypynum.matrices.Matrix, reduce: bool) -> tuple
|
|
678
719
|
│ ├── rank_decomp(matrix: pypynum.matrices.Matrix) -> tuple
|
|
679
720
|
│ ├── rotate90(matrix: pypynum.matrices.Matrix, times: int) -> pypynum.matrices.Matrix
|
|
680
721
|
│ ├── svd(matrix: pypynum.matrices.Matrix) -> tuple
|
|
@@ -692,6 +733,7 @@ PyPyNum
|
|
|
692
733
|
│ ├── mp_asin(x: typing.Union[int, float, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
|
|
693
734
|
│ ├── mp_atan(x: typing.Union[int, float, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
|
|
694
735
|
│ ├── mp_atan2(y: typing.Union[int, float, str, decimal.Decimal], x: typing.Union[int, float, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
|
|
736
|
+
│ ├── mp_catalan(sigfigs: int) -> decimal.Decimal
|
|
695
737
|
│ ├── mp_cos(x: typing.Union[int, float, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
|
|
696
738
|
│ ├── mp_cosh(x: typing.Union[int, float, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
|
|
697
739
|
│ ├── mp_e(sigfigs: int, method: str) -> decimal.Decimal
|
|
@@ -775,32 +817,40 @@ PyPyNum
|
|
|
775
817
|
│ └── FUNCTION
|
|
776
818
|
│ ├── arithmetic_sequence(a1: typing.Union[int, float], an: typing.Union[int, float], d: typing.Union[int, float], n: typing.Union[int, float], s: typing.Union[int, float]) -> dict
|
|
777
819
|
│ ├── bell_triangle(n: int) -> list
|
|
778
|
-
│ ├── bernoulli(n: int, single: bool) -> list
|
|
820
|
+
│ ├── bernoulli(n: int, single: bool) -> typing.Union[list, tuple]
|
|
779
821
|
│ ├── catalan(n: int, single: bool) -> typing.Union[int, list]
|
|
780
822
|
│ ├── farey(n: int) -> list
|
|
781
823
|
│ ├── fibonacci(n: int, single: bool) -> typing.Union[int, list]
|
|
782
824
|
│ ├── geometric_sequence(a1: typing.Union[int, float], an: typing.Union[int, float], r: typing.Union[int, float], n: typing.Union[int, float], s: typing.Union[int, float]) -> dict
|
|
783
825
|
│ ├── lucas(n: int, single: bool) -> typing.Union[int, list]
|
|
826
|
+
│ ├── padovan(n: int, single: bool) -> typing.Union[int, list]
|
|
784
827
|
│ ├── pascal_triangle(n: int) -> list
|
|
785
828
|
│ ├── pell(n: int, single: bool) -> typing.Union[int, list]
|
|
829
|
+
│ ├── pelllucas(n: int, single: bool) -> typing.Union[int, list]
|
|
830
|
+
│ ├── perrin(n: int, single: bool) -> typing.Union[int, list]
|
|
786
831
|
│ ├── recaman(n: int, single: bool) -> typing.Union[int, list]
|
|
787
832
|
│ ├── stirling1(n: int) -> list
|
|
788
833
|
│ ├── stirling2(n: int) -> list
|
|
834
|
+
│ ├── sylvester(n: int, single: bool) -> typing.Union[int, list]
|
|
789
835
|
│ ├── tetranacci(n: int, single: bool) -> typing.Union[int, list]
|
|
790
836
|
│ └── tribonacci(n: int, single: bool) -> typing.Union[int, list]
|
|
791
837
|
├── special
|
|
792
838
|
│ ├── CLASS
|
|
793
839
|
│ └── FUNCTION
|
|
794
|
-
│ ├──
|
|
795
|
-
│ ├──
|
|
796
|
-
│ ├──
|
|
797
|
-
│ ├──
|
|
798
|
-
│ ├──
|
|
799
|
-
│ ├──
|
|
840
|
+
│ ├── besseli0(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
841
|
+
│ ├── besseli1(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
842
|
+
│ ├── besseliv(v: typing.Union[int, float], x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
843
|
+
│ ├── besselj0(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
844
|
+
│ ├── besselj1(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
845
|
+
│ ├── besseljv(v: typing.Union[int, float], x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
800
846
|
│ ├── hyp0f1(b0: typing.Union[int, float, complex], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
801
847
|
│ ├── hyp1f1(a0: typing.Union[int, float, complex], b0: typing.Union[int, float, complex], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
802
848
|
│ ├── hyp2f1(a0: typing.Union[int, float, complex], a1: typing.Union[int, float, complex], b0: typing.Union[int, float, complex], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
803
|
-
│
|
|
849
|
+
│ ├── hyppfq(a: typing.Union[list, tuple], b: typing.Union[list, tuple], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
850
|
+
│ ├── qbinomial(n: typing.Union[int, float, complex], m: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
851
|
+
│ ├── qfactorial(n: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
852
|
+
│ ├── qgamma(n: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
853
|
+
│ └── qpochhammer(a: typing.Union[int, float, complex], q: typing.Union[int, float, complex], n: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
804
854
|
├── stattest
|
|
805
855
|
│ ├── CLASS
|
|
806
856
|
│ └── FUNCTION
|
|
@@ -819,8 +869,7 @@ PyPyNum
|
|
|
819
869
|
│ │ └── Tensor(pypynum.arrays.Array)/__init__(self: Any, data: Any, check: Any) -> Any
|
|
820
870
|
│ └── FUNCTION
|
|
821
871
|
│ ├── ten(data: list) -> pypynum.tensors.Tensor
|
|
822
|
-
│
|
|
823
|
-
│ └── tensorproduct(tensors: pypynum.tensors.Tensor) -> pypynum.tensors.Tensor
|
|
872
|
+
│ └── tensor_and_number(tensor: Any, operator: Any, number: Any) -> Any
|
|
824
873
|
├── test
|
|
825
874
|
│ ├── CLASS
|
|
826
875
|
│ └── FUNCTION
|
|
@@ -831,16 +880,20 @@ PyPyNum
|
|
|
831
880
|
│ ├── CLASS
|
|
832
881
|
│ └── FUNCTION
|
|
833
882
|
│ ├── classify(array: typing.Union[list, tuple]) -> dict
|
|
883
|
+
│ ├── cos_sim(seq1: typing.Union[list, tuple, str], seq2: typing.Union[list, tuple, str], is_vector: bool) -> float
|
|
834
884
|
│ ├── dedup(iterable: typing.Union[list, tuple, str]) -> typing.Union[list, tuple, str]
|
|
835
885
|
│ ├── fast_pow(a: typing.Any, n: int, init: typing.Any, mul: typing.Callable) -> typing.Any
|
|
836
886
|
│ ├── frange(start: typing.Union[int, float], stop: typing.Union[int, float], step: float) -> list
|
|
837
887
|
│ ├── geomspace(start: typing.Union[int, float], stop: typing.Union[int, float], number: int) -> list
|
|
838
|
-
│ ├──
|
|
888
|
+
│ ├── lcsubseq(x: typing.Union[list, tuple, str], y: typing.Union[list, tuple, str]) -> list
|
|
889
|
+
│ ├── lcsubstr(x: typing.Union[list, tuple, str], y: typing.Union[list, tuple, str]) -> list
|
|
890
|
+
│ ├── levenshtein(x: typing.Union[list, tuple, str], y: typing.Union[list, tuple, str]) -> int
|
|
839
891
|
│ ├── linspace(start: typing.Union[int, float], stop: typing.Union[int, float], number: int) -> list
|
|
840
892
|
│ ├── magic_square(n: int) -> list
|
|
841
893
|
│ ├── primality(n: int, iter_num: int) -> bool
|
|
842
894
|
│ ├── prime_factors(integer: int, dictionary: bool, pollard_rho: bool) -> typing.Union[list, dict]
|
|
843
895
|
│ ├── primes(limit: int) -> list
|
|
896
|
+
│ ├── replace(seq: typing.Union[list, tuple], old: typing.Union[list, tuple], new: typing.Union[list, tuple], count: int) -> typing.Union[list, tuple]
|
|
844
897
|
│ ├── semiprimes(limit: int) -> list
|
|
845
898
|
│ ├── split(iterable: typing.Union[list, tuple, str], key: typing.Union[list, tuple], retain: bool) -> list
|
|
846
899
|
│ └── twinprimes(limit: int) -> list
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyPyNum
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.16.1
|
|
4
4
|
Summary: PyPyNum is a Python library for math & science computations, covering algebra, calculus, stats, with data structures like matrices, vectors, tensors. It offers numerical tools, programs, and supports computational ops, functions, processing, simulation, & visualization in data science & ML, crucial for research, engineering, & data processing.
|
|
5
5
|
Home-page: https://github.com/PythonSJL/PyPyNum
|
|
6
6
|
Author: Shen Jiayi
|
|
@@ -234,7 +234,7 @@ processing.</font><font color = red>[Python>=3.4]</font>
|
|
|
234
234
|
[](https://pepy.tech/project/pypynum)
|
|
235
235
|
[](https://pepy.tech/project/pypynum)
|
|
236
236
|
|
|
237
|
-
## Version -> 1.
|
|
237
|
+
## PyPyNum | Version -> 1.16.1 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
|
|
238
238
|
|
|
239
239
|

|
|
240
240
|
|
|
@@ -327,41 +327,79 @@ Python interpreter and run it!
|
|
|
327
327
|
```
|
|
328
328
|
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
329
329
|
|
|
330
|
-
Fixed
|
|
330
|
+
Fixed and improved the basic
|
|
331
|
+
operation function of 'Array'.
|
|
331
332
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
conditions for multi precision
|
|
333
|
+
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
335
334
|
|
|
336
|
-
|
|
335
|
+
We will remove 'Tensor' in
|
|
336
|
+
future versions. Because its
|
|
337
|
+
computational functions have
|
|
338
|
+
already been implemented in
|
|
339
|
+
'Array'. The current version
|
|
340
|
+
will throw 'FutureWarning' as a
|
|
341
|
+
warning.
|
|
337
342
|
|
|
338
343
|
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
339
344
|
|
|
340
|
-
|
|
345
|
+
Fixed the calculation error of
|
|
346
|
+
'mp_euler_gamma', which was
|
|
347
|
+
caused when modifying the
|
|
348
|
+
iteration stop condition
|
|
349
|
+
previously.
|
|
341
350
|
|
|
342
|
-
|
|
351
|
+
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
343
352
|
|
|
344
|
-
|
|
353
|
+
<<< Here are the newly added functions >>>
|
|
345
354
|
|
|
346
|
-
left by previous debugging.
|
|
347
355
|
|
|
348
|
-
|
|
356
|
+
cos_sim(seq1: Union[list, tuple, str], seq2: Union[list, tuple, str], is_vector: bool = False) -> float
|
|
357
|
+
Introduction
|
|
358
|
+
==========
|
|
359
|
+
Calculate the cosine similarity between two sequences.
|
|
349
360
|
|
|
350
|
-
|
|
361
|
+
The cosine similarity is a measure of similarity between two non-zero vectors. It is defined as the cosine of the
|
|
362
|
+
angle between them, which is computed as the dot product of the vectors divided by the product of their magnitudes.
|
|
363
|
+
This function supports both numerical vectors and frequency distributions of sequences.
|
|
351
364
|
|
|
352
|
-
|
|
365
|
+
Example
|
|
366
|
+
==========
|
|
367
|
+
>>> cos_sim("hello world", "world hello")
|
|
368
|
+
0.9999999999999998
|
|
369
|
+
>>>
|
|
370
|
+
:param seq1: First sequence to compare.
|
|
371
|
+
:param seq2: Second sequence to compare.
|
|
372
|
+
:param is_vector: A boolean indicating whether the input sequences are numerical vectors. Default is False.
|
|
373
|
+
:return: The cosine similarity between the two sequences, ranging from -1 to 1.
|
|
353
374
|
|
|
354
|
-
hypergeometric functions in the
|
|
355
375
|
|
|
356
|
-
|
|
376
|
+
replace(seq: Union[list, tuple], old: Union[list, tuple], new: Union[list, tuple], count: int = -1) -> Union[list, tuple]
|
|
377
|
+
Introduction
|
|
378
|
+
==========
|
|
379
|
+
Replace occurrences of the subsequence 'old' in 'seq' with 'new'.
|
|
357
380
|
|
|
358
|
-
|
|
381
|
+
This function is designed to handle sequences such as lists or tuples and replace specified subsequences
|
|
382
|
+
with new ones. It also allows limiting the number of replacements.
|
|
359
383
|
|
|
360
|
-
|
|
384
|
+
Example
|
|
385
|
+
==========
|
|
386
|
+
>>> replace([1, 2, 3, 4, 2, 3], [2, 3], [5, 6])
|
|
387
|
+
[1, 5, 6, 4, 5, 6]
|
|
388
|
+
>>>
|
|
389
|
+
:param seq: The sequence in which to replace the subsequence.
|
|
390
|
+
:param old: The subsequence to be replaced.
|
|
391
|
+
:param new: The subsequence to replace with.
|
|
392
|
+
:param count: The maximum number of replacements to perform. Default is -1 (unlimited).
|
|
393
|
+
:return: The modified sequence with replacements.
|
|
361
394
|
|
|
362
|
-
|
|
395
|
+
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
363
396
|
|
|
364
|
-
|
|
397
|
+
Other functions and classes have
|
|
398
|
+
also undergone certain
|
|
399
|
+
modifications, such as adding a
|
|
400
|
+
"reduce" parameter to the "qr"
|
|
401
|
+
function to determine whether to
|
|
402
|
+
crop the matrix.
|
|
365
403
|
|
|
366
404
|
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
367
405
|
```
|
|
@@ -399,15 +437,16 @@ PyPyNum
|
|
|
399
437
|
│ ├── asarray(data: Any) -> Any
|
|
400
438
|
│ ├── aslist(data: Any) -> Any
|
|
401
439
|
│ ├── boolarray(data: Any) -> Any
|
|
402
|
-
│ ├── fill(shape:
|
|
403
|
-
│ ├── full(shape:
|
|
404
|
-
│ ├── full_like(a: Any, fill_value: Any, rtype:
|
|
440
|
+
│ ├── fill(shape: typing.Union[list, tuple], sequence: typing.Union[list, tuple], repeat: bool, pad: typing.Any, rtype: typing.Callable) -> typing.Any
|
|
441
|
+
│ ├── full(shape: typing.Union[list, tuple], fill_value: typing.Any, rtype: typing.Callable) -> typing.Any
|
|
442
|
+
│ ├── full_like(a: typing.Any, fill_value: typing.Any, rtype: typing.Callable) -> typing.Any
|
|
405
443
|
│ ├── get_shape(data: Any) -> Any
|
|
406
444
|
│ ├── is_valid_array(_array: Any, _shape: Any) -> Any
|
|
407
|
-
│ ├── ones(shape:
|
|
408
|
-
│ ├── ones_like(a: Any, rtype:
|
|
409
|
-
│ ├──
|
|
410
|
-
│
|
|
445
|
+
│ ├── ones(shape: typing.Union[list, tuple], rtype: typing.Callable) -> typing.Any
|
|
446
|
+
│ ├── ones_like(a: typing.Any, rtype: typing.Callable) -> typing.Any
|
|
447
|
+
│ ├── tensorproduct(tensors: pypynum.arrays.Array) -> pypynum.arrays.Array
|
|
448
|
+
│ ├── zeros(shape: typing.Union[list, tuple], rtype: typing.Callable) -> typing.Any
|
|
449
|
+
│ └── zeros_like(a: typing.Any, rtype: typing.Callable) -> typing.Any
|
|
411
450
|
├── chars
|
|
412
451
|
│ ├── CLASS
|
|
413
452
|
│ └── FUNCTION
|
|
@@ -668,13 +707,15 @@ PyPyNum
|
|
|
668
707
|
│ ├── CLASS
|
|
669
708
|
│ │ └── Matrix(pypynum.arrays.Array)/__init__(self: Any, data: Any, check: Any) -> Any
|
|
670
709
|
│ └── FUNCTION
|
|
671
|
-
│ ├── cholesky(matrix:
|
|
710
|
+
│ ├── cholesky(matrix: pypynum.matrices.Matrix, hermitian: bool) -> pypynum.matrices.Matrix
|
|
672
711
|
│ ├── eigen(matrix: pypynum.matrices.Matrix) -> tuple
|
|
673
712
|
│ ├── hessenberg(matrix: pypynum.matrices.Matrix) -> tuple
|
|
674
|
-
│ ├── identity(n: int) -> pypynum.matrices.Matrix
|
|
713
|
+
│ ├── identity(n: int, m: int) -> pypynum.matrices.Matrix
|
|
675
714
|
│ ├── lu(matrix: pypynum.matrices.Matrix) -> tuple
|
|
676
715
|
│ ├── mat(data: Any) -> Any
|
|
677
|
-
│ ├──
|
|
716
|
+
│ ├── perm_mat(num_rows: int, num_cols: int, row_swaps: typing.Union[list, tuple], col_swaps: typing.Union[list, tuple], rtype: typing.Callable) -> typing.Any
|
|
717
|
+
│ ├── perm_mat_indices(num_rows: int, num_cols: int, row_swaps: typing.Union[list, tuple], col_swaps: typing.Union[list, tuple]) -> tuple
|
|
718
|
+
│ ├── qr(matrix: pypynum.matrices.Matrix, reduce: bool) -> tuple
|
|
678
719
|
│ ├── rank_decomp(matrix: pypynum.matrices.Matrix) -> tuple
|
|
679
720
|
│ ├── rotate90(matrix: pypynum.matrices.Matrix, times: int) -> pypynum.matrices.Matrix
|
|
680
721
|
│ ├── svd(matrix: pypynum.matrices.Matrix) -> tuple
|
|
@@ -692,6 +733,7 @@ PyPyNum
|
|
|
692
733
|
│ ├── mp_asin(x: typing.Union[int, float, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
|
|
693
734
|
│ ├── mp_atan(x: typing.Union[int, float, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
|
|
694
735
|
│ ├── mp_atan2(y: typing.Union[int, float, str, decimal.Decimal], x: typing.Union[int, float, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
|
|
736
|
+
│ ├── mp_catalan(sigfigs: int) -> decimal.Decimal
|
|
695
737
|
│ ├── mp_cos(x: typing.Union[int, float, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
|
|
696
738
|
│ ├── mp_cosh(x: typing.Union[int, float, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
|
|
697
739
|
│ ├── mp_e(sigfigs: int, method: str) -> decimal.Decimal
|
|
@@ -775,32 +817,40 @@ PyPyNum
|
|
|
775
817
|
│ └── FUNCTION
|
|
776
818
|
│ ├── arithmetic_sequence(a1: typing.Union[int, float], an: typing.Union[int, float], d: typing.Union[int, float], n: typing.Union[int, float], s: typing.Union[int, float]) -> dict
|
|
777
819
|
│ ├── bell_triangle(n: int) -> list
|
|
778
|
-
│ ├── bernoulli(n: int, single: bool) -> list
|
|
820
|
+
│ ├── bernoulli(n: int, single: bool) -> typing.Union[list, tuple]
|
|
779
821
|
│ ├── catalan(n: int, single: bool) -> typing.Union[int, list]
|
|
780
822
|
│ ├── farey(n: int) -> list
|
|
781
823
|
│ ├── fibonacci(n: int, single: bool) -> typing.Union[int, list]
|
|
782
824
|
│ ├── geometric_sequence(a1: typing.Union[int, float], an: typing.Union[int, float], r: typing.Union[int, float], n: typing.Union[int, float], s: typing.Union[int, float]) -> dict
|
|
783
825
|
│ ├── lucas(n: int, single: bool) -> typing.Union[int, list]
|
|
826
|
+
│ ├── padovan(n: int, single: bool) -> typing.Union[int, list]
|
|
784
827
|
│ ├── pascal_triangle(n: int) -> list
|
|
785
828
|
│ ├── pell(n: int, single: bool) -> typing.Union[int, list]
|
|
829
|
+
│ ├── pelllucas(n: int, single: bool) -> typing.Union[int, list]
|
|
830
|
+
│ ├── perrin(n: int, single: bool) -> typing.Union[int, list]
|
|
786
831
|
│ ├── recaman(n: int, single: bool) -> typing.Union[int, list]
|
|
787
832
|
│ ├── stirling1(n: int) -> list
|
|
788
833
|
│ ├── stirling2(n: int) -> list
|
|
834
|
+
│ ├── sylvester(n: int, single: bool) -> typing.Union[int, list]
|
|
789
835
|
│ ├── tetranacci(n: int, single: bool) -> typing.Union[int, list]
|
|
790
836
|
│ └── tribonacci(n: int, single: bool) -> typing.Union[int, list]
|
|
791
837
|
├── special
|
|
792
838
|
│ ├── CLASS
|
|
793
839
|
│ └── FUNCTION
|
|
794
|
-
│ ├──
|
|
795
|
-
│ ├──
|
|
796
|
-
│ ├──
|
|
797
|
-
│ ├──
|
|
798
|
-
│ ├──
|
|
799
|
-
│ ├──
|
|
840
|
+
│ ├── besseli0(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
841
|
+
│ ├── besseli1(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
842
|
+
│ ├── besseliv(v: typing.Union[int, float], x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
843
|
+
│ ├── besselj0(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
844
|
+
│ ├── besselj1(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
845
|
+
│ ├── besseljv(v: typing.Union[int, float], x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
800
846
|
│ ├── hyp0f1(b0: typing.Union[int, float, complex], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
801
847
|
│ ├── hyp1f1(a0: typing.Union[int, float, complex], b0: typing.Union[int, float, complex], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
802
848
|
│ ├── hyp2f1(a0: typing.Union[int, float, complex], a1: typing.Union[int, float, complex], b0: typing.Union[int, float, complex], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
803
|
-
│
|
|
849
|
+
│ ├── hyppfq(a: typing.Union[list, tuple], b: typing.Union[list, tuple], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
850
|
+
│ ├── qbinomial(n: typing.Union[int, float, complex], m: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
851
|
+
│ ├── qfactorial(n: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
852
|
+
│ ├── qgamma(n: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
853
|
+
│ └── qpochhammer(a: typing.Union[int, float, complex], q: typing.Union[int, float, complex], n: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
|
|
804
854
|
├── stattest
|
|
805
855
|
│ ├── CLASS
|
|
806
856
|
│ └── FUNCTION
|
|
@@ -819,8 +869,7 @@ PyPyNum
|
|
|
819
869
|
│ │ └── Tensor(pypynum.arrays.Array)/__init__(self: Any, data: Any, check: Any) -> Any
|
|
820
870
|
│ └── FUNCTION
|
|
821
871
|
│ ├── ten(data: list) -> pypynum.tensors.Tensor
|
|
822
|
-
│
|
|
823
|
-
│ └── tensorproduct(tensors: pypynum.tensors.Tensor) -> pypynum.tensors.Tensor
|
|
872
|
+
│ └── tensor_and_number(tensor: Any, operator: Any, number: Any) -> Any
|
|
824
873
|
├── test
|
|
825
874
|
│ ├── CLASS
|
|
826
875
|
│ └── FUNCTION
|
|
@@ -831,16 +880,20 @@ PyPyNum
|
|
|
831
880
|
│ ├── CLASS
|
|
832
881
|
│ └── FUNCTION
|
|
833
882
|
│ ├── classify(array: typing.Union[list, tuple]) -> dict
|
|
883
|
+
│ ├── cos_sim(seq1: typing.Union[list, tuple, str], seq2: typing.Union[list, tuple, str], is_vector: bool) -> float
|
|
834
884
|
│ ├── dedup(iterable: typing.Union[list, tuple, str]) -> typing.Union[list, tuple, str]
|
|
835
885
|
│ ├── fast_pow(a: typing.Any, n: int, init: typing.Any, mul: typing.Callable) -> typing.Any
|
|
836
886
|
│ ├── frange(start: typing.Union[int, float], stop: typing.Union[int, float], step: float) -> list
|
|
837
887
|
│ ├── geomspace(start: typing.Union[int, float], stop: typing.Union[int, float], number: int) -> list
|
|
838
|
-
│ ├──
|
|
888
|
+
│ ├── lcsubseq(x: typing.Union[list, tuple, str], y: typing.Union[list, tuple, str]) -> list
|
|
889
|
+
│ ├── lcsubstr(x: typing.Union[list, tuple, str], y: typing.Union[list, tuple, str]) -> list
|
|
890
|
+
│ ├── levenshtein(x: typing.Union[list, tuple, str], y: typing.Union[list, tuple, str]) -> int
|
|
839
891
|
│ ├── linspace(start: typing.Union[int, float], stop: typing.Union[int, float], number: int) -> list
|
|
840
892
|
│ ├── magic_square(n: int) -> list
|
|
841
893
|
│ ├── primality(n: int, iter_num: int) -> bool
|
|
842
894
|
│ ├── prime_factors(integer: int, dictionary: bool, pollard_rho: bool) -> typing.Union[list, dict]
|
|
843
895
|
│ ├── primes(limit: int) -> list
|
|
896
|
+
│ ├── replace(seq: typing.Union[list, tuple], old: typing.Union[list, tuple], new: typing.Union[list, tuple], count: int) -> typing.Union[list, tuple]
|
|
844
897
|
│ ├── semiprimes(limit: int) -> list
|
|
845
898
|
│ ├── split(iterable: typing.Union[list, tuple, str], key: typing.Union[list, tuple], retain: bool) -> list
|
|
846
899
|
│ └── twinprimes(limit: int) -> list
|