PyPyNum 1.16.1__tar.gz → 1.16.2__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.
Files changed (53) hide show
  1. {pypynum-1.16.1 → pypynum-1.16.2}/PKG-INFO +74 -61
  2. {pypynum-1.16.1 → pypynum-1.16.2}/PyPyNum.egg-info/PKG-INFO +74 -61
  3. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/README.md +73 -60
  4. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/__init__.py +1 -1
  5. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/arrays.py +24 -16
  6. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/chars.py +10 -1
  7. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/dists.py +2 -2
  8. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/maths.py +11 -11
  9. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/seqs.py +2 -1
  10. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/special.py +277 -3
  11. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/tools.py +84 -12
  12. pypynum-1.16.2/pypynum/vectors.py +102 -0
  13. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/zh_cn.py +6 -6
  14. {pypynum-1.16.1 → pypynum-1.16.2}/setup.py +1 -1
  15. pypynum-1.16.1/pypynum/vectors.py +0 -93
  16. {pypynum-1.16.1 → pypynum-1.16.2}/PyPyNum.egg-info/SOURCES.txt +0 -0
  17. {pypynum-1.16.1 → pypynum-1.16.2}/PyPyNum.egg-info/dependency_links.txt +0 -0
  18. {pypynum-1.16.1 → pypynum-1.16.2}/PyPyNum.egg-info/top_level.txt +0 -0
  19. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/PyPyNum.png +0 -0
  20. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/ciphers.py +0 -0
  21. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/consts.py +0 -0
  22. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/crandom.py +0 -0
  23. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/dataproc.py +0 -0
  24. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/equations.py +0 -0
  25. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/fft.py +0 -0
  26. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/files.py +0 -0
  27. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/geoms.py +0 -0
  28. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/graphs.py +0 -0
  29. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/groups.py +0 -0
  30. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/images.py +0 -0
  31. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/interp.py +0 -0
  32. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/kernels.py +0 -0
  33. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/logics.py +0 -0
  34. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/matrices.py +0 -0
  35. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/multiprec.py +0 -0
  36. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/networks.py +0 -0
  37. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/numbers.py +0 -0
  38. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/plotting.py +0 -0
  39. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/polys.py +0 -0
  40. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/pprinters.py +0 -0
  41. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/quats.py +0 -0
  42. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/random.py +0 -0
  43. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/regs.py +0 -0
  44. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/stattest.py +0 -0
  45. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/symbols.py +0 -0
  46. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/tensors.py +0 -0
  47. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/test.py +0 -0
  48. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/this.py +0 -0
  49. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/trees.py +0 -0
  50. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/types.py +0 -0
  51. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/ufuncs.py +0 -0
  52. {pypynum-1.16.1 → pypynum-1.16.2}/pypynum/utils.py +0 -0
  53. {pypynum-1.16.1 → pypynum-1.16.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyPyNum
3
- Version: 1.16.1
3
+ Version: 1.16.2
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
- ## PyPyNum | Version -> 1.16.1 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
237
+ ## Version -> 1.16.2 | 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
 
@@ -247,6 +247,15 @@ The logo cannot be displayed on PyPI, it can be viewed in Gitee or GitHub.
247
247
  + Update versions periodically to add more practical features
248
248
  + If you need to contact, please add QQ number 2261748025 (Py𝙿𝚢𝚝𝚑𝚘𝚗-水晶兰), or through my email 2261748025@qq.com
249
249
 
250
+ ```
251
+ +++++++++++++++++++++++++++++++++++++++++
252
+ + Tip: +
253
+ + Have suggestions or feature requests? +
254
+ + Feel free to share them with us. +
255
+ + Your feedback is highly appreciated! +
256
+ +++++++++++++++++++++++++++++++++++++++++
257
+ ```
258
+
250
259
  ### Name and Function Introduction of Submodules
251
260
 
252
261
  | Submodule Name | Function Introduction |
@@ -327,79 +336,69 @@ Python interpreter and run it!
327
336
  ```
328
337
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
329
338
 
330
- Fixed and improved the basic
331
- operation function of 'Array'.
332
-
333
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
334
-
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.
342
-
343
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
344
-
345
- Fixed the calculation error of
346
- 'mp_euler_gamma', which was
347
- caused when modifying the
348
- iteration stop condition
349
- previously.
350
-
351
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
352
-
353
339
  <<< Here are the newly added functions >>>
354
340
 
355
341
 
356
- cos_sim(seq1: Union[list, tuple, str], seq2: Union[list, tuple, str], is_vector: bool = False) -> float
342
+ kmp_table(pattern: Union[list, tuple, str]) -> list
357
343
  Introduction
358
344
  ==========
359
- Calculate the cosine similarity between two sequences.
345
+ Generate the KMP (Knuth-Morris-Pratt) table for a given pattern.
360
346
 
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.
347
+ The KMP table is used to efficiently find occurrences of a pattern within a sequence by avoiding unnecessary
348
+ comparisons after a mismatch. This table determines how many characters can be skipped after a mismatch.
364
349
 
365
350
  Example
366
- ==========
367
- >>> cos_sim("hello world", "world hello")
368
- 0.9999999999999998
351
+ ========
352
+ >>> kmp_table("AGCTGATCGTACGTAAGCTAGCTA")
353
+ [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 2, 3, 4, 1, 2, 3, 4, 1]
369
354
  >>>
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.
355
+ :param pattern: The pattern for which to generate the KMP table.
356
+ :return: A list representing the KMP table for the given pattern.
374
357
 
375
358
 
376
- replace(seq: Union[list, tuple], old: Union[list, tuple], new: Union[list, tuple], count: int = -1) -> Union[list, tuple]
359
+ findall(seq: Union[list, tuple, str], pat: Union[list, tuple, str]) -> list
377
360
  Introduction
378
361
  ==========
379
- Replace occurrences of the subsequence 'old' in 'seq' with 'new'.
362
+ Find all indices of the subsequence 'pat' in 'seq'.
380
363
 
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.
364
+ This function is designed to handle sequences such as lists, tuples, or strings and find all indices
365
+ of specified subsequences. It allows overlapping matches.
383
366
 
384
367
  Example
385
- ==========
386
- >>> replace([1, 2, 3, 4, 2, 3], [2, 3], [5, 6])
387
- [1, 5, 6, 4, 5, 6]
368
+ ========
369
+ >>> findall([2, 1, 2, 1, 2, 1, 2, 1], [1, 2, 1, 2])
370
+ [1, 3]
388
371
  >>>
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.
372
+ :param seq: The sequence in which to find the subsequence.
373
+ :param pat: The subsequence to be found.
374
+ :return: A list of starting indices where the subsequence is found.
375
+
376
+
377
+ ---------------------------------------------------------------------------------------
378
+ | q-functions generalize classical math functions by introducing parameter q. |
379
+ | They are key in combinatorics and special functions, widely applied. |
380
+ | As q approaches 1, they revert to classical forms. |
381
+ | Examples include q-factorials, q-binomial coefficients, Jackson q-Bessel functions. |
382
+ | These functions are crucial in fractals, chaotic systems, quantum groups. |
383
+ | They provide tools for solving complex mathematical challenges effectively. |
384
+ ---------------------------------------------------------------------------------------
385
+
386
+
387
+ Here are the 12 new q-functions added in the current version (adding the previous 4 makes a total of 16):
394
388
 
395
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
396
389
 
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.
390
+ qbeta(a: Union[int, float, complex], b: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
391
+ qcos_large(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
392
+ qcos_small(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
393
+ qcosh_large(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
394
+ qcosh_small(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
395
+ qexp_large(z: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
396
+ qexp_small(z: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
397
+ qpi(q: Union[int, float, complex]) -> Union[int, float, complex]
398
+ qsin_large(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
399
+ qsin_small(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
400
+ qsinh_large(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
401
+ qsinh_small(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
403
402
 
404
403
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
405
404
  ```
@@ -500,7 +499,7 @@ PyPyNum
500
499
  │ ├── gamma_pdf(x: Any, shape: Any, scale: Any) -> Any
501
500
  │ ├── geometric_pmf(k: Any, p: Any) -> Any
502
501
  │ ├── hypergeom_pmf(k: Any, mg: Any, n: Any, nt: Any) -> Any
503
- │ ├── inv_gauss_pdf(x: Any, mu: Any, lambda_: Any, alpha: Any) -> Any
502
+ │ ├── invgauss_pdf(x: Any, mu: Any, lambda_: Any, alpha: Any) -> Any
504
503
  │ ├── levy_pdf(x: Any, c: Any) -> Any
505
504
  │ ├── log_logistic_cdf(x: Any, alpha: Any, beta: Any) -> Any
506
505
  │ ├── log_logistic_pdf(x: Any, alpha: Any, beta: Any) -> Any
@@ -646,7 +645,7 @@ PyPyNum
646
645
  │ ├── cosh(x: typing.Union[int, float]) -> typing.Union[int, float]
647
646
  │ ├── cot(x: typing.Union[int, float]) -> typing.Union[int, float]
648
647
  │ ├── coth(x: typing.Union[int, float]) -> typing.Union[int, float]
649
- │ ├── cov(x: typing.Union[list, tuple], y: typing.Union[list, tuple], dof: int) -> typing.Union[int, float, complex]
648
+ │ ├── cov(x: typing.Union[list, tuple], y: typing.Union[list, tuple], ddof: int) -> typing.Union[int, float, complex]
650
649
  │ ├── crt(n: typing.Union[list, tuple], a: typing.Union[list, tuple]) -> int
651
650
  │ ├── csc(x: typing.Union[int, float]) -> typing.Union[int, float]
652
651
  │ ├── csch(x: typing.Union[int, float]) -> typing.Union[int, float]
@@ -694,13 +693,13 @@ PyPyNum
694
693
  │ ├── sinh(x: typing.Union[int, float]) -> typing.Union[int, float]
695
694
  │ ├── skew(data: typing.Union[list, tuple]) -> float
696
695
  │ ├── square_mean(numbers: typing.Union[list, tuple]) -> typing.Union[int, float, complex]
697
- │ ├── std(numbers: typing.Union[list, tuple], dof: int) -> typing.Union[int, float, complex]
696
+ │ ├── std(numbers: typing.Union[list, tuple], ddof: int) -> typing.Union[int, float, complex]
698
697
  │ ├── sumprod(arrays: typing.Union[list, tuple]) -> typing.Union[int, float, complex]
699
698
  │ ├── tan(x: typing.Union[int, float]) -> typing.Union[int, float]
700
699
  │ ├── tanh(x: typing.Union[int, float]) -> typing.Union[int, float]
701
700
  │ ├── totient(n: int) -> int
702
701
  │ ├── upper_gamma(s: typing.Union[int, float, complex], x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
703
- │ ├── var(numbers: typing.Union[list, tuple], dof: int) -> typing.Union[int, float, complex]
702
+ │ ├── var(numbers: typing.Union[list, tuple], ddof: int) -> typing.Union[int, float, complex]
704
703
  │ ├── xlogy(x: typing.Union[int, float, complex], y: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
705
704
  │ └── zeta(alpha: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
706
705
  ├── matrices
@@ -847,10 +846,22 @@ PyPyNum
847
846
  │ ├── hyp1f1(a0: typing.Union[int, float, complex], b0: typing.Union[int, float, complex], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
848
847
  │ ├── 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]
849
848
  │ ├── hyppfq(a: typing.Union[list, tuple], b: typing.Union[list, tuple], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
849
+ │ ├── qbeta(a: typing.Union[int, float, complex], b: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
850
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
+ │ ├── qcos_large(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
852
+ │ ├── qcos_small(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
853
+ │ ├── qcosh_large(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
854
+ │ ├── qcosh_small(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
855
+ │ ├── qexp_large(z: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
856
+ │ ├── qexp_small(z: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
851
857
  │ ├── qfactorial(n: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
852
858
  │ ├── 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]
859
+ ├── qpi(q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
860
+ │ ├── qpochhammer(a: typing.Union[int, float, complex], q: typing.Union[int, float, complex], n: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
861
+ │ ├── qsin_large(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
862
+ │ ├── qsin_small(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
863
+ │ ├── qsinh_large(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
864
+ │ └── qsinh_small(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
854
865
  ├── stattest
855
866
  │ ├── CLASS
856
867
  │ └── FUNCTION
@@ -883,8 +894,10 @@ PyPyNum
883
894
  │ ├── cos_sim(seq1: typing.Union[list, tuple, str], seq2: typing.Union[list, tuple, str], is_vector: bool) -> float
884
895
  │ ├── dedup(iterable: typing.Union[list, tuple, str]) -> typing.Union[list, tuple, str]
885
896
  │ ├── fast_pow(a: typing.Any, n: int, init: typing.Any, mul: typing.Callable) -> typing.Any
897
+ │ ├── findall(seq: typing.Union[list, tuple, str], pat: typing.Union[list, tuple, str]) -> list
886
898
  │ ├── frange(start: typing.Union[int, float], stop: typing.Union[int, float], step: float) -> list
887
899
  │ ├── geomspace(start: typing.Union[int, float], stop: typing.Union[int, float], number: int) -> list
900
+ │ ├── kmp_table(pattern: typing.Union[list, tuple, str]) -> list
888
901
  │ ├── lcsubseq(x: typing.Union[list, tuple, str], y: typing.Union[list, tuple, str]) -> list
889
902
  │ ├── lcsubstr(x: typing.Union[list, tuple, str], y: typing.Union[list, tuple, str]) -> list
890
903
  │ ├── levenshtein(x: typing.Union[list, tuple, str], y: typing.Union[list, tuple, str]) -> int
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PyPyNum
3
- Version: 1.16.1
3
+ Version: 1.16.2
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
- ## PyPyNum | Version -> 1.16.1 | PyPI -> https://pypi.org/project/PyPyNum/ | Gitee -> https://www.gitee.com/PythonSJL/PyPyNum | GitHub -> https://github.com/PythonSJL/PyPyNum
237
+ ## Version -> 1.16.2 | 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
 
@@ -247,6 +247,15 @@ The logo cannot be displayed on PyPI, it can be viewed in Gitee or GitHub.
247
247
  + Update versions periodically to add more practical features
248
248
  + If you need to contact, please add QQ number 2261748025 (Py𝙿𝚢𝚝𝚑𝚘𝚗-水晶兰), or through my email 2261748025@qq.com
249
249
 
250
+ ```
251
+ +++++++++++++++++++++++++++++++++++++++++
252
+ + Tip: +
253
+ + Have suggestions or feature requests? +
254
+ + Feel free to share them with us. +
255
+ + Your feedback is highly appreciated! +
256
+ +++++++++++++++++++++++++++++++++++++++++
257
+ ```
258
+
250
259
  ### Name and Function Introduction of Submodules
251
260
 
252
261
  | Submodule Name | Function Introduction |
@@ -327,79 +336,69 @@ Python interpreter and run it!
327
336
  ```
328
337
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
329
338
 
330
- Fixed and improved the basic
331
- operation function of 'Array'.
332
-
333
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
334
-
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.
342
-
343
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
344
-
345
- Fixed the calculation error of
346
- 'mp_euler_gamma', which was
347
- caused when modifying the
348
- iteration stop condition
349
- previously.
350
-
351
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
352
-
353
339
  <<< Here are the newly added functions >>>
354
340
 
355
341
 
356
- cos_sim(seq1: Union[list, tuple, str], seq2: Union[list, tuple, str], is_vector: bool = False) -> float
342
+ kmp_table(pattern: Union[list, tuple, str]) -> list
357
343
  Introduction
358
344
  ==========
359
- Calculate the cosine similarity between two sequences.
345
+ Generate the KMP (Knuth-Morris-Pratt) table for a given pattern.
360
346
 
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.
347
+ The KMP table is used to efficiently find occurrences of a pattern within a sequence by avoiding unnecessary
348
+ comparisons after a mismatch. This table determines how many characters can be skipped after a mismatch.
364
349
 
365
350
  Example
366
- ==========
367
- >>> cos_sim("hello world", "world hello")
368
- 0.9999999999999998
351
+ ========
352
+ >>> kmp_table("AGCTGATCGTACGTAAGCTAGCTA")
353
+ [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 2, 3, 4, 1, 2, 3, 4, 1]
369
354
  >>>
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.
355
+ :param pattern: The pattern for which to generate the KMP table.
356
+ :return: A list representing the KMP table for the given pattern.
374
357
 
375
358
 
376
- replace(seq: Union[list, tuple], old: Union[list, tuple], new: Union[list, tuple], count: int = -1) -> Union[list, tuple]
359
+ findall(seq: Union[list, tuple, str], pat: Union[list, tuple, str]) -> list
377
360
  Introduction
378
361
  ==========
379
- Replace occurrences of the subsequence 'old' in 'seq' with 'new'.
362
+ Find all indices of the subsequence 'pat' in 'seq'.
380
363
 
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.
364
+ This function is designed to handle sequences such as lists, tuples, or strings and find all indices
365
+ of specified subsequences. It allows overlapping matches.
383
366
 
384
367
  Example
385
- ==========
386
- >>> replace([1, 2, 3, 4, 2, 3], [2, 3], [5, 6])
387
- [1, 5, 6, 4, 5, 6]
368
+ ========
369
+ >>> findall([2, 1, 2, 1, 2, 1, 2, 1], [1, 2, 1, 2])
370
+ [1, 3]
388
371
  >>>
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.
372
+ :param seq: The sequence in which to find the subsequence.
373
+ :param pat: The subsequence to be found.
374
+ :return: A list of starting indices where the subsequence is found.
375
+
376
+
377
+ ---------------------------------------------------------------------------------------
378
+ | q-functions generalize classical math functions by introducing parameter q. |
379
+ | They are key in combinatorics and special functions, widely applied. |
380
+ | As q approaches 1, they revert to classical forms. |
381
+ | Examples include q-factorials, q-binomial coefficients, Jackson q-Bessel functions. |
382
+ | These functions are crucial in fractals, chaotic systems, quantum groups. |
383
+ | They provide tools for solving complex mathematical challenges effectively. |
384
+ ---------------------------------------------------------------------------------------
385
+
386
+
387
+ Here are the 12 new q-functions added in the current version (adding the previous 4 makes a total of 16):
394
388
 
395
- !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
396
389
 
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.
390
+ qbeta(a: Union[int, float, complex], b: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
391
+ qcos_large(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
392
+ qcos_small(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
393
+ qcosh_large(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
394
+ qcosh_small(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
395
+ qexp_large(z: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
396
+ qexp_small(z: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
397
+ qpi(q: Union[int, float, complex]) -> Union[int, float, complex]
398
+ qsin_large(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
399
+ qsin_small(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
400
+ qsinh_large(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
401
+ qsinh_small(x: Union[int, float, complex], q: Union[int, float, complex]) -> Union[int, float, complex]
403
402
 
404
403
  !=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
405
404
  ```
@@ -500,7 +499,7 @@ PyPyNum
500
499
  │ ├── gamma_pdf(x: Any, shape: Any, scale: Any) -> Any
501
500
  │ ├── geometric_pmf(k: Any, p: Any) -> Any
502
501
  │ ├── hypergeom_pmf(k: Any, mg: Any, n: Any, nt: Any) -> Any
503
- │ ├── inv_gauss_pdf(x: Any, mu: Any, lambda_: Any, alpha: Any) -> Any
502
+ │ ├── invgauss_pdf(x: Any, mu: Any, lambda_: Any, alpha: Any) -> Any
504
503
  │ ├── levy_pdf(x: Any, c: Any) -> Any
505
504
  │ ├── log_logistic_cdf(x: Any, alpha: Any, beta: Any) -> Any
506
505
  │ ├── log_logistic_pdf(x: Any, alpha: Any, beta: Any) -> Any
@@ -646,7 +645,7 @@ PyPyNum
646
645
  │ ├── cosh(x: typing.Union[int, float]) -> typing.Union[int, float]
647
646
  │ ├── cot(x: typing.Union[int, float]) -> typing.Union[int, float]
648
647
  │ ├── coth(x: typing.Union[int, float]) -> typing.Union[int, float]
649
- │ ├── cov(x: typing.Union[list, tuple], y: typing.Union[list, tuple], dof: int) -> typing.Union[int, float, complex]
648
+ │ ├── cov(x: typing.Union[list, tuple], y: typing.Union[list, tuple], ddof: int) -> typing.Union[int, float, complex]
650
649
  │ ├── crt(n: typing.Union[list, tuple], a: typing.Union[list, tuple]) -> int
651
650
  │ ├── csc(x: typing.Union[int, float]) -> typing.Union[int, float]
652
651
  │ ├── csch(x: typing.Union[int, float]) -> typing.Union[int, float]
@@ -694,13 +693,13 @@ PyPyNum
694
693
  │ ├── sinh(x: typing.Union[int, float]) -> typing.Union[int, float]
695
694
  │ ├── skew(data: typing.Union[list, tuple]) -> float
696
695
  │ ├── square_mean(numbers: typing.Union[list, tuple]) -> typing.Union[int, float, complex]
697
- │ ├── std(numbers: typing.Union[list, tuple], dof: int) -> typing.Union[int, float, complex]
696
+ │ ├── std(numbers: typing.Union[list, tuple], ddof: int) -> typing.Union[int, float, complex]
698
697
  │ ├── sumprod(arrays: typing.Union[list, tuple]) -> typing.Union[int, float, complex]
699
698
  │ ├── tan(x: typing.Union[int, float]) -> typing.Union[int, float]
700
699
  │ ├── tanh(x: typing.Union[int, float]) -> typing.Union[int, float]
701
700
  │ ├── totient(n: int) -> int
702
701
  │ ├── upper_gamma(s: typing.Union[int, float, complex], x: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
703
- │ ├── var(numbers: typing.Union[list, tuple], dof: int) -> typing.Union[int, float, complex]
702
+ │ ├── var(numbers: typing.Union[list, tuple], ddof: int) -> typing.Union[int, float, complex]
704
703
  │ ├── xlogy(x: typing.Union[int, float, complex], y: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
705
704
  │ └── zeta(alpha: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
706
705
  ├── matrices
@@ -847,10 +846,22 @@ PyPyNum
847
846
  │ ├── hyp1f1(a0: typing.Union[int, float, complex], b0: typing.Union[int, float, complex], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
848
847
  │ ├── 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]
849
848
  │ ├── hyppfq(a: typing.Union[list, tuple], b: typing.Union[list, tuple], z: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
849
+ │ ├── qbeta(a: typing.Union[int, float, complex], b: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
850
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
+ │ ├── qcos_large(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
852
+ │ ├── qcos_small(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
853
+ │ ├── qcosh_large(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
854
+ │ ├── qcosh_small(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
855
+ │ ├── qexp_large(z: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
856
+ │ ├── qexp_small(z: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
851
857
  │ ├── qfactorial(n: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
852
858
  │ ├── 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]
859
+ ├── qpi(q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
860
+ │ ├── qpochhammer(a: typing.Union[int, float, complex], q: typing.Union[int, float, complex], n: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
861
+ │ ├── qsin_large(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
862
+ │ ├── qsin_small(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
863
+ │ ├── qsinh_large(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
864
+ │ └── qsinh_small(x: typing.Union[int, float, complex], q: typing.Union[int, float, complex]) -> typing.Union[int, float, complex]
854
865
  ├── stattest
855
866
  │ ├── CLASS
856
867
  │ └── FUNCTION
@@ -883,8 +894,10 @@ PyPyNum
883
894
  │ ├── cos_sim(seq1: typing.Union[list, tuple, str], seq2: typing.Union[list, tuple, str], is_vector: bool) -> float
884
895
  │ ├── dedup(iterable: typing.Union[list, tuple, str]) -> typing.Union[list, tuple, str]
885
896
  │ ├── fast_pow(a: typing.Any, n: int, init: typing.Any, mul: typing.Callable) -> typing.Any
897
+ │ ├── findall(seq: typing.Union[list, tuple, str], pat: typing.Union[list, tuple, str]) -> list
886
898
  │ ├── frange(start: typing.Union[int, float], stop: typing.Union[int, float], step: float) -> list
887
899
  │ ├── geomspace(start: typing.Union[int, float], stop: typing.Union[int, float], number: int) -> list
900
+ │ ├── kmp_table(pattern: typing.Union[list, tuple, str]) -> list
888
901
  │ ├── lcsubseq(x: typing.Union[list, tuple, str], y: typing.Union[list, tuple, str]) -> list
889
902
  │ ├── lcsubstr(x: typing.Union[list, tuple, str], y: typing.Union[list, tuple, str]) -> list
890
903
  │ ├── levenshtein(x: typing.Union[list, tuple, str], y: typing.Union[list, tuple, str]) -> int