PyPyNum 1.15.1__py3-none-any.whl → 1.16.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyPyNum
3
- Version: 1.15.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
  [![Downloads](https://static.pepy.tech/badge/pypynum/month)](https://pepy.tech/project/pypynum)
235
235
  [![Downloads](https://static.pepy.tech/badge/pypynum/week)](https://pepy.tech/project/pypynum)
236
236
 
237
- ## Version -> 1.15.1 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
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
  ![LOGO](PyPyNum.png)
240
240
 
@@ -327,41 +327,79 @@ Python interpreter and run it!
327
327
  ```
328
328
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
329
329
 
330
- Fixed most of the known issues,
330
+ Fixed and improved the basic
331
+ operation function of 'Array'.
331
332
 
332
- especially modified the stopping
333
-
334
- conditions for multi precision
333
+ !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
335
334
 
336
- computation iterations.
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
- The printout in
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
- "trees.BinaryTree.count_nodes()"
351
+ !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
343
352
 
344
- was deleted, which is the trace
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
- Rename the "Bessel" submodule to
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
- "Special" and add some
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
- form of "hyp * f *".
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
- 在“zh_cn”子模块中,把“多精度欧拉数”
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: Any, sequence: Any, repeat: Any, pad: Any, rtype: Any) -> Any
403
- │ ├── full(shape: Any, fill_value: Any, rtype: Any) -> Any
404
- │ ├── full_like(a: Any, fill_value: Any, rtype: Any) -> Any
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: Any, rtype: Any) -> Any
408
- │ ├── ones_like(a: Any, rtype: Any) -> Any
409
- │ ├── zeros(shape: Any, rtype: Any) -> Any
410
- └── zeros_like(a: Any, rtype: Any) -> Any
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: Any, hermitian: Any) -> Any
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
- │ ├── qr(matrix: pypynum.matrices.Matrix) -> tuple
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
- │ ├── bessel_i0(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
795
- │ ├── bessel_i1(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
796
- │ ├── bessel_iv(v: typing.Union[int, float], x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
797
- │ ├── bessel_j0(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
798
- │ ├── bessel_j1(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
799
- │ ├── bessel_jv(v: typing.Union[int, float], x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
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
- └── hyppfq(a: typing.Union[list, tuple], b: typing.Union[list, tuple], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
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
- ├── tensor_and_number(tensor: Any, operator: Any, number: Any) -> Any
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
- │ ├── levenshtein_distance(s1: str, s2: str) -> int
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,13 +1,13 @@
1
1
  pypynum/PyPyNum.png,sha256=t96tJPWfHxT8kcXm_qZI2z5W36TgOqjCU9qdgbmlFws,11623
2
- pypynum/README.md,sha256=oGDg-RgxcZdGxz-2LKm5GDQMc9Vgo-dL-4aoT-_lZ5w,79731
3
- pypynum/__init__.py,sha256=2bZzEIZciHbpUWzg1talwAxh1GsgLMQHJNzlxi6yc_M,2640
4
- pypynum/arrays.py,sha256=NiNs_wTeVgQpJuSe5OrIdFFG0Nln_ed4Im3hua0ZBnE,13293
2
+ pypynum/README.md,sha256=y4JBXggitGZ9Gy0b9fmCo4sZbLJ064DqYZ29J0lbVi8,83919
3
+ pypynum/__init__.py,sha256=3ozuifHA8CK2c6h9uFuZo3xkTsYgixL4VZesQMeObkw,2640
4
+ pypynum/arrays.py,sha256=GpU_smZ-9Bw897tWDGTTPMThQ_VfCvjfrIq6OGpuiDI,15492
5
5
  pypynum/chars.py,sha256=6XNmH0zYsv0pfadW3KoevrR8xQPIkles9oGikjS6R1I,2181
6
6
  pypynum/ciphers.py,sha256=kC7wZk3FF-MCCvn2-1YxiaRa4ImDKxyyihJYc6Dyf5E,10008
7
- pypynum/consts.py,sha256=xELv4DIKEqBdwF9tUqCmTQVbgVrlrj385ht5eawvshU,1406
7
+ pypynum/consts.py,sha256=enetPwJevWgYXuGEasAb-tXMHpvL2xWKUe-B1gTwInk,8416
8
8
  pypynum/crandom.py,sha256=44GZ7o6y5PwgL-cZLkXUZaAUfiW6aadyRNfMdxTnH30,5111
9
9
  pypynum/dataproc.py,sha256=bJ2a1-S7TQj8V8vzXZ3ooP32fBe99NQU0orPGprEIdg,9231
10
- pypynum/dists.py,sha256=qyZLsXF1x3QYjsge50wMWrPcFoMHs5yBbHAbg5L9rDw,29698
10
+ pypynum/dists.py,sha256=SGxZ08n4mRaqegHILoaJNH4jzPzk-fsE7kvN-EmegPQ,29697
11
11
  pypynum/equations.py,sha256=_oywKzbrOPOOhD4yu83qqNiIOKQPbJJs6SghdkGbqUw,561
12
12
  pypynum/fft.py,sha256=AtG0tESykzEs4gDsXhcizW7qhQnmw0gjcWcXefBqzhs,1401
13
13
  pypynum/files.py,sha256=iLtTc5UTtUUWoh2sDJl5Yyy_rT8-Vi0pby5c2J95EqE,3397
@@ -19,8 +19,8 @@ pypynum/interp.py,sha256=wNMa6M_IRpSe026tuRxXfr244oBtgHOpCpYlGd4eyhA,4920
19
19
  pypynum/kernels.py,sha256=GMwWnjLWEprFXSEAIN8d6GZrC2KDx6qhJdbcLBoYOTg,15869
20
20
  pypynum/logics.py,sha256=EwvWFNND14__oWx7o-_oYIUubmVhp3DrvBcnRCWW8vc,10999
21
21
  pypynum/maths.py,sha256=McuOXRktbjcjZpTfWEoHnmFkeeQVacMoHyThqTIC27E,32808
22
- pypynum/matrices.py,sha256=zmY_heAt5zIeXNg5q5L-Kex3rxe9ra1NoBzn0KozMcA,20633
23
- pypynum/multiprec.py,sha256=3eg4J4fSlymcFq2543YeSkC1g_kxq4K3gq-5l9Hhk4c,19113
22
+ pypynum/matrices.py,sha256=useh4_Hlk3YBRTSTJK6SsErTRnDVblsqB0a7iw1mB_k,22439
23
+ pypynum/multiprec.py,sha256=LCaj0pkZIXmPKodm2Jt5RdyTg20Q6Js-n7PGBzqMXhk,20111
24
24
  pypynum/networks.py,sha256=iSOvC9JW1h4AFGokGGOTkKie5hAYN_YT9H4f3apI9b8,3275
25
25
  pypynum/numbers.py,sha256=EPzw8zq5U7GQj8URu2VxeVIXS-_XQm2ADmSAIHa816k,11133
26
26
  pypynum/plotting.py,sha256=mbIYK5TpY1qvuMJrqz4d8bxJEiZww3AI684vSKV-DgU,7781
@@ -29,21 +29,21 @@ pypynum/pprinters.py,sha256=Qt9-V5SUyoOqC3lsUU5D5zSSM-MmcnFCUyUtLxhS4pE,2514
29
29
  pypynum/quats.py,sha256=tn1ZogMiV8FGYucZ3u8ynG6SFpPjhFAachVHxgBdDZk,8000
30
30
  pypynum/random.py,sha256=fGaJfwS0QUWV-qb8hldXpRUYJ-79n7Al0gEmPJMAwJc,2254
31
31
  pypynum/regs.py,sha256=mV1r1KkXAv07FmcTntaBF0rcwHBXUyXPvC9h6UOkhE0,2042
32
- pypynum/seqs.py,sha256=UqV6n7txwJHMrevZz3zgHSjOj_uSTwDzcWoFZV5qSWo,10212
33
- pypynum/special.py,sha256=kSj-4gJtuBUb5gP62SZumclSl82DYVBkgpm6YEkFkQs,7324
32
+ pypynum/seqs.py,sha256=Hch8ebCrVFHUfKig54CVGzf3xXkVJlVbLsE0e7flOX4,11666
33
+ pypynum/special.py,sha256=58pRacza__MwnovWFRemVglszF1wdUwgA4uyS25M47w,11643
34
34
  pypynum/stattest.py,sha256=nCAqFjaHVa9EOaWcmgWrhPuBoyLdoypkz6_YeM_AOd8,5511
35
35
  pypynum/symbols.py,sha256=u-Dig3OLs6qoLzxMpTAYJGq5uSWDMvgU13TAHKLyjMY,2768
36
- pypynum/tensors.py,sha256=gKpklk-7R9FHRD9iUOXOG6d-h-mL3I_E7TAL-xOWKu8,3685
36
+ pypynum/tensors.py,sha256=F87npY9VbaCAr0OvTwsW1GAhEQPQAQTVlJzeVuf4zSg,3418
37
37
  pypynum/test.py,sha256=HY6TiQr9-wIadRoXElu8TJkVWKMxcahisyWBtew8B9c,8730
38
38
  pypynum/this.py,sha256=wT7DwodxqOQ7LoDaUtvskMkAb8CODL_56mtXPy12P54,3411
39
- pypynum/tools.py,sha256=INPFU05zViokLV3i3R7-TEbe0IHz5Ah2C5cBbw2RGUg,16163
39
+ pypynum/tools.py,sha256=PWE4eHVHcFrbKTz-ohiRPc1xo2_FvQj3LpfDvWe8mh0,23035
40
40
  pypynum/trees.py,sha256=b02t69vBjc3ibKaUAkWfBvMDdsugF4DpGC2-q4RsgEU,39779
41
41
  pypynum/types.py,sha256=v1lGIL_p0xgxL6mGX7uBQBHBa7UScKCsgPkW8Q6nzlk,3348
42
42
  pypynum/ufuncs.py,sha256=Lmr_ZVsswQqbGo2MB8gjd_lijRBOZIy2q2wQBOHvYxM,3549
43
43
  pypynum/utils.py,sha256=BhH_iSU44bS6tC3MMrDfIfGhIsQg9nMVlp6fl0-KcRA,21001
44
44
  pypynum/vectors.py,sha256=GGVk0YSLVm-hzJjm068W7tNRYu8NqPgOKtWHIOTn9yY,3212
45
45
  pypynum/zh_cn.py,sha256=YBmTCO0h-xMDEo9pfpaR1qvh0qaL811psoZDdBniuzE,13818
46
- PyPyNum-1.15.1.dist-info/METADATA,sha256=Y5FgUI664jDpN27t7-h8fQp47a_6vVgdzn8_SaQKVRU,94110
47
- PyPyNum-1.15.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
48
- PyPyNum-1.15.1.dist-info/top_level.txt,sha256=4wW_Xb4bRglmiMsdPAe9f75MkXhNpuN88H17g_Cr5u8,8
49
- PyPyNum-1.15.1.dist-info/RECORD,,
46
+ PyPyNum-1.16.1.dist-info/METADATA,sha256=CjPWR4mVYBqmVNqYNTXXnA0dhosQvbClUg614eNIzZM,98298
47
+ PyPyNum-1.16.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
48
+ PyPyNum-1.16.1.dist-info/top_level.txt,sha256=4wW_Xb4bRglmiMsdPAe9f75MkXhNpuN88H17g_Cr5u8,8
49
+ PyPyNum-1.16.1.dist-info/RECORD,,
pypynum/README.md CHANGED
@@ -20,7 +20,7 @@ processing.</font><font color = red>[Python>=3.4]</font>
20
20
  [![Downloads](https://static.pepy.tech/badge/pypynum/month)](https://pepy.tech/project/pypynum)
21
21
  [![Downloads](https://static.pepy.tech/badge/pypynum/week)](https://pepy.tech/project/pypynum)
22
22
 
23
- ## Version -> 1.15.1 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
23
+ ## PyPyNum | Version -> 1.16.1 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
24
24
 
25
25
  ![LOGO](PyPyNum.png)
26
26
 
@@ -113,41 +113,79 @@ Python interpreter and run it!
113
113
  ```
114
114
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
115
115
 
116
- Fixed most of the known issues,
116
+ Fixed and improved the basic
117
+ operation function of 'Array'.
117
118
 
118
- especially modified the stopping
119
-
120
- conditions for multi precision
119
+ !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
121
120
 
122
- computation iterations.
121
+ We will remove 'Tensor' in
122
+ future versions. Because its
123
+ computational functions have
124
+ already been implemented in
125
+ 'Array'. The current version
126
+ will throw 'FutureWarning' as a
127
+ warning.
123
128
 
124
129
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
125
130
 
126
- The printout in
131
+ Fixed the calculation error of
132
+ 'mp_euler_gamma', which was
133
+ caused when modifying the
134
+ iteration stop condition
135
+ previously.
127
136
 
128
- "trees.BinaryTree.count_nodes()"
137
+ !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
129
138
 
130
- was deleted, which is the trace
139
+ <<< Here are the newly added functions >>>
131
140
 
132
- left by previous debugging.
133
141
 
134
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
142
+ cos_sim(seq1: Union[list, tuple, str], seq2: Union[list, tuple, str], is_vector: bool = False) -> float
143
+ Introduction
144
+ ==========
145
+ Calculate the cosine similarity between two sequences.
135
146
 
136
- Rename the "Bessel" submodule to
147
+ The cosine similarity is a measure of similarity between two non-zero vectors. It is defined as the cosine of the
148
+ angle between them, which is computed as the dot product of the vectors divided by the product of their magnitudes.
149
+ This function supports both numerical vectors and frequency distributions of sequences.
137
150
 
138
- "Special" and add some
151
+ Example
152
+ ==========
153
+ >>> cos_sim("hello world", "world hello")
154
+ 0.9999999999999998
155
+ >>>
156
+ :param seq1: First sequence to compare.
157
+ :param seq2: Second sequence to compare.
158
+ :param is_vector: A boolean indicating whether the input sequences are numerical vectors. Default is False.
159
+ :return: The cosine similarity between the two sequences, ranging from -1 to 1.
139
160
 
140
- hypergeometric functions in the
141
161
 
142
- form of "hyp * f *".
162
+ replace(seq: Union[list, tuple], old: Union[list, tuple], new: Union[list, tuple], count: int = -1) -> Union[list, tuple]
163
+ Introduction
164
+ ==========
165
+ Replace occurrences of the subsequence 'old' in 'seq' with 'new'.
143
166
 
144
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
167
+ This function is designed to handle sequences such as lists or tuples and replace specified subsequences
168
+ with new ones. It also allows limiting the number of replacements.
145
169
 
146
- 在“zh_cn”子模块中,把“多精度欧拉数”
170
+ Example
171
+ ==========
172
+ >>> replace([1, 2, 3, 4, 2, 3], [2, 3], [5, 6])
173
+ [1, 5, 6, 4, 5, 6]
174
+ >>>
175
+ :param seq: The sequence in which to replace the subsequence.
176
+ :param old: The subsequence to be replaced.
177
+ :param new: The subsequence to replace with.
178
+ :param count: The maximum number of replacements to perform. Default is -1 (unlimited).
179
+ :return: The modified sequence with replacements.
147
180
 
148
- 改名为“多精度自然常数”,并且增加了
181
+ !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
149
182
 
150
- “多精度欧拉伽马”。
183
+ Other functions and classes have
184
+ also undergone certain
185
+ modifications, such as adding a
186
+ "reduce" parameter to the "qr"
187
+ function to determine whether to
188
+ crop the matrix.
151
189
 
152
190
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
153
191
  ```
@@ -185,15 +223,16 @@ PyPyNum
185
223
  │ ├── asarray(data: Any) -> Any
186
224
  │ ├── aslist(data: Any) -> Any
187
225
  │ ├── boolarray(data: Any) -> Any
188
- │ ├── fill(shape: Any, sequence: Any, repeat: Any, pad: Any, rtype: Any) -> Any
189
- │ ├── full(shape: Any, fill_value: Any, rtype: Any) -> Any
190
- │ ├── full_like(a: Any, fill_value: Any, rtype: Any) -> Any
226
+ │ ├── fill(shape: typing.Union[list, tuple], sequence: typing.Union[list, tuple], repeat: bool, pad: typing.Any, rtype: typing.Callable) -> typing.Any
227
+ │ ├── full(shape: typing.Union[list, tuple], fill_value: typing.Any, rtype: typing.Callable) -> typing.Any
228
+ │ ├── full_like(a: typing.Any, fill_value: typing.Any, rtype: typing.Callable) -> typing.Any
191
229
  │ ├── get_shape(data: Any) -> Any
192
230
  │ ├── is_valid_array(_array: Any, _shape: Any) -> Any
193
- │ ├── ones(shape: Any, rtype: Any) -> Any
194
- │ ├── ones_like(a: Any, rtype: Any) -> Any
195
- │ ├── zeros(shape: Any, rtype: Any) -> Any
196
- └── zeros_like(a: Any, rtype: Any) -> Any
231
+ │ ├── ones(shape: typing.Union[list, tuple], rtype: typing.Callable) -> typing.Any
232
+ │ ├── ones_like(a: typing.Any, rtype: typing.Callable) -> typing.Any
233
+ │ ├── tensorproduct(tensors: pypynum.arrays.Array) -> pypynum.arrays.Array
234
+ ├── zeros(shape: typing.Union[list, tuple], rtype: typing.Callable) -> typing.Any
235
+ │ └── zeros_like(a: typing.Any, rtype: typing.Callable) -> typing.Any
197
236
  ├── chars
198
237
  │ ├── CLASS
199
238
  │ └── FUNCTION
@@ -454,13 +493,15 @@ PyPyNum
454
493
  │ ├── CLASS
455
494
  │ │ └── Matrix(pypynum.arrays.Array)/__init__(self: Any, data: Any, check: Any) -> Any
456
495
  │ └── FUNCTION
457
- │ ├── cholesky(matrix: Any, hermitian: Any) -> Any
496
+ │ ├── cholesky(matrix: pypynum.matrices.Matrix, hermitian: bool) -> pypynum.matrices.Matrix
458
497
  │ ├── eigen(matrix: pypynum.matrices.Matrix) -> tuple
459
498
  │ ├── hessenberg(matrix: pypynum.matrices.Matrix) -> tuple
460
- │ ├── identity(n: int) -> pypynum.matrices.Matrix
499
+ │ ├── identity(n: int, m: int) -> pypynum.matrices.Matrix
461
500
  │ ├── lu(matrix: pypynum.matrices.Matrix) -> tuple
462
501
  │ ├── mat(data: Any) -> Any
463
- │ ├── qr(matrix: pypynum.matrices.Matrix) -> tuple
502
+ │ ├── 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
503
+ │ ├── perm_mat_indices(num_rows: int, num_cols: int, row_swaps: typing.Union[list, tuple], col_swaps: typing.Union[list, tuple]) -> tuple
504
+ │ ├── qr(matrix: pypynum.matrices.Matrix, reduce: bool) -> tuple
464
505
  │ ├── rank_decomp(matrix: pypynum.matrices.Matrix) -> tuple
465
506
  │ ├── rotate90(matrix: pypynum.matrices.Matrix, times: int) -> pypynum.matrices.Matrix
466
507
  │ ├── svd(matrix: pypynum.matrices.Matrix) -> tuple
@@ -478,6 +519,7 @@ PyPyNum
478
519
  │ ├── mp_asin(x: typing.Union[int, float, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
479
520
  │ ├── mp_atan(x: typing.Union[int, float, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
480
521
  │ ├── mp_atan2(y: typing.Union[int, float, str, decimal.Decimal], x: typing.Union[int, float, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
522
+ │ ├── mp_catalan(sigfigs: int) -> decimal.Decimal
481
523
  │ ├── mp_cos(x: typing.Union[int, float, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
482
524
  │ ├── mp_cosh(x: typing.Union[int, float, str, decimal.Decimal], sigfigs: int) -> decimal.Decimal
483
525
  │ ├── mp_e(sigfigs: int, method: str) -> decimal.Decimal
@@ -561,32 +603,40 @@ PyPyNum
561
603
  │ └── FUNCTION
562
604
  │ ├── 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
563
605
  │ ├── bell_triangle(n: int) -> list
564
- │ ├── bernoulli(n: int, single: bool) -> list
606
+ │ ├── bernoulli(n: int, single: bool) -> typing.Union[list, tuple]
565
607
  │ ├── catalan(n: int, single: bool) -> typing.Union[int, list]
566
608
  │ ├── farey(n: int) -> list
567
609
  │ ├── fibonacci(n: int, single: bool) -> typing.Union[int, list]
568
610
  │ ├── 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
569
611
  │ ├── lucas(n: int, single: bool) -> typing.Union[int, list]
612
+ │ ├── padovan(n: int, single: bool) -> typing.Union[int, list]
570
613
  │ ├── pascal_triangle(n: int) -> list
571
614
  │ ├── pell(n: int, single: bool) -> typing.Union[int, list]
615
+ │ ├── pelllucas(n: int, single: bool) -> typing.Union[int, list]
616
+ │ ├── perrin(n: int, single: bool) -> typing.Union[int, list]
572
617
  │ ├── recaman(n: int, single: bool) -> typing.Union[int, list]
573
618
  │ ├── stirling1(n: int) -> list
574
619
  │ ├── stirling2(n: int) -> list
620
+ │ ├── sylvester(n: int, single: bool) -> typing.Union[int, list]
575
621
  │ ├── tetranacci(n: int, single: bool) -> typing.Union[int, list]
576
622
  │ └── tribonacci(n: int, single: bool) -> typing.Union[int, list]
577
623
  ├── special
578
624
  │ ├── CLASS
579
625
  │ └── FUNCTION
580
- │ ├── bessel_i0(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
581
- │ ├── bessel_i1(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
582
- │ ├── bessel_iv(v: typing.Union[int, float], x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
583
- │ ├── bessel_j0(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
584
- │ ├── bessel_j1(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
585
- │ ├── bessel_jv(v: typing.Union[int, float], x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
626
+ │ ├── besseli0(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
627
+ │ ├── besseli1(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
628
+ │ ├── besseliv(v: typing.Union[int, float], x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
629
+ │ ├── besselj0(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
630
+ │ ├── besselj1(x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
631
+ │ ├── besseljv(v: typing.Union[int, float], x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
586
632
  │ ├── hyp0f1(b0: typing.Union[int, float, complex], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
587
633
  │ ├── hyp1f1(a0: typing.Union[int, float, complex], b0: typing.Union[int, float, complex], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
588
634
  │ ├── 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]
589
- └── hyppfq(a: typing.Union[list, tuple], b: typing.Union[list, tuple], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
635
+ ├── hyppfq(a: typing.Union[list, tuple], b: typing.Union[list, tuple], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
636
+ │ ├── qbinomial(n: typing.Union[int, float, complex], m: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
637
+ │ ├── qfactorial(n: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
638
+ │ ├── qgamma(n: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
639
+ │ └── qpochhammer(a: typing.Union[int, float, complex], q: typing.Union[int, float, complex], n: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
590
640
  ├── stattest
591
641
  │ ├── CLASS
592
642
  │ └── FUNCTION
@@ -605,8 +655,7 @@ PyPyNum
605
655
  │ │ └── Tensor(pypynum.arrays.Array)/__init__(self: Any, data: Any, check: Any) -> Any
606
656
  │ └── FUNCTION
607
657
  │ ├── ten(data: list) -> pypynum.tensors.Tensor
608
- ├── tensor_and_number(tensor: Any, operator: Any, number: Any) -> Any
609
- │ └── tensorproduct(tensors: pypynum.tensors.Tensor) -> pypynum.tensors.Tensor
658
+ └── tensor_and_number(tensor: Any, operator: Any, number: Any) -> Any
610
659
  ├── test
611
660
  │ ├── CLASS
612
661
  │ └── FUNCTION
@@ -617,16 +666,20 @@ PyPyNum
617
666
  │ ├── CLASS
618
667
  │ └── FUNCTION
619
668
  │ ├── classify(array: typing.Union[list, tuple]) -> dict
669
+ │ ├── cos_sim(seq1: typing.Union[list, tuple, str], seq2: typing.Union[list, tuple, str], is_vector: bool) -> float
620
670
  │ ├── dedup(iterable: typing.Union[list, tuple, str]) -> typing.Union[list, tuple, str]
621
671
  │ ├── fast_pow(a: typing.Any, n: int, init: typing.Any, mul: typing.Callable) -> typing.Any
622
672
  │ ├── frange(start: typing.Union[int, float], stop: typing.Union[int, float], step: float) -> list
623
673
  │ ├── geomspace(start: typing.Union[int, float], stop: typing.Union[int, float], number: int) -> list
624
- │ ├── levenshtein_distance(s1: str, s2: str) -> int
674
+ │ ├── lcsubseq(x: typing.Union[list, tuple, str], y: typing.Union[list, tuple, str]) -> list
675
+ │ ├── lcsubstr(x: typing.Union[list, tuple, str], y: typing.Union[list, tuple, str]) -> list
676
+ │ ├── levenshtein(x: typing.Union[list, tuple, str], y: typing.Union[list, tuple, str]) -> int
625
677
  │ ├── linspace(start: typing.Union[int, float], stop: typing.Union[int, float], number: int) -> list
626
678
  │ ├── magic_square(n: int) -> list
627
679
  │ ├── primality(n: int, iter_num: int) -> bool
628
680
  │ ├── prime_factors(integer: int, dictionary: bool, pollard_rho: bool) -> typing.Union[list, dict]
629
681
  │ ├── primes(limit: int) -> list
682
+ │ ├── replace(seq: typing.Union[list, tuple], old: typing.Union[list, tuple], new: typing.Union[list, tuple], count: int) -> typing.Union[list, tuple]
630
683
  │ ├── semiprimes(limit: int) -> list
631
684
  │ ├── split(iterable: typing.Union[list, tuple, str], key: typing.Union[list, tuple], retain: bool) -> list
632
685
  │ └── twinprimes(limit: int) -> list
pypynum/__init__.py CHANGED
@@ -68,7 +68,7 @@ from .ufuncs import *
68
68
  from .utils import *
69
69
  from .vectors import *
70
70
 
71
- __version__ = "1.15.1"
71
+ __version__ = "1.16.1"
72
72
  print("PyPyNum", "Version -> " + __version__, "PyPI -> https://pypi.org/project/PyPyNum/",
73
73
  "Gitee -> https://www.gitee.com/PythonSJL/PyPyNum", "GitHub -> https://github.com/PythonSJL/PyPyNum", sep=" | ")
74
74
  for _ in list(globals().keys()):