PyPyNum 1.11.1__tar.gz → 1.11.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.
- {pypynum-1.11.1 → pypynum-1.11.2}/PKG-INFO +114 -87
- {pypynum-1.11.1 → pypynum-1.11.2}/PyPyNum.egg-info/PKG-INFO +114 -87
- {pypynum-1.11.1 → pypynum-1.11.2}/PyPyNum.egg-info/SOURCES.txt +1 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/Matrix.py +22 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/README.md +113 -86
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/__init__.py +4 -3
- pypynum-1.11.2/pypynum/chars.py +51 -0
- pypynum-1.11.2/pypynum/confs.py +81 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/polynomial.py +14 -5
- pypynum-1.11.2/pypynum/random.py +56 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/utils.py +176 -2
- {pypynum-1.11.1 → pypynum-1.11.2}/setup.py +1 -1
- pypynum-1.11.1/pypynum/chars.py +0 -28
- pypynum-1.11.1/pypynum/random.py +0 -129
- {pypynum-1.11.1 → pypynum-1.11.2}/PyPyNum.egg-info/dependency_links.txt +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/PyPyNum.egg-info/top_level.txt +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/Array.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/FourierT.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/Geometry.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/Graph.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/Group.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/Logic.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/NeuralN.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/PyPyNum.png +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/Quaternion.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/Symbolics.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/Tensor.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/Tree.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/Vector.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/cipher.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/constants.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/dists.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/equations.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/errors.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/file.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/highprec.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/image.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/maths.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/numbers.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/plotting.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/pprinters.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/regression.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/sequence.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/stattest.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/test.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/this.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/tools.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/types.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/pypynum/ufuncs.py +0 -0
- {pypynum-1.11.1 → pypynum-1.11.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyPyNum
|
|
3
|
-
Version: 1.11.
|
|
3
|
+
Version: 1.11.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
|
[](https://pepy.tech/project/pypynum)
|
|
235
235
|
[](https://pepy.tech/project/pypynum)
|
|
236
236
|
|
|
237
|
-
## Version -> 1.11.
|
|
237
|
+
## Version -> 1.11.2 | 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
|
|
|
@@ -263,6 +263,7 @@ The logo cannot be displayed on PyPI, it can be viewed in Gitee or GitHub.
|
|
|
263
263
|
| `pypynum.Array` | 多维数组 Multidimensional array |
|
|
264
264
|
| `pypynum.chars` | 特殊数学符号 Special mathematical symbols |
|
|
265
265
|
| `pypynum.cipher` | 加密解密算法 Encryption and decryption algorithm |
|
|
266
|
+
| `pypynum.confs` | 通用配置 Universal configuration |
|
|
266
267
|
| `pypynum.constants` | 数学常数集合 Set of mathematical constants |
|
|
267
268
|
| `pypynum.dists` | 概率分布 Probability distribution |
|
|
268
269
|
| `pypynum.equations` | 方程求解 Solving equations |
|
|
@@ -336,93 +337,110 @@ Python interpreter and run it!
|
|
|
336
337
|
```
|
|
337
338
|
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
338
339
|
|
|
339
|
-
|
|
340
|
+
新增了Config类
|
|
340
341
|
|
|
341
|
-
|
|
342
|
+
Added Config class
|
|
342
343
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
344
|
+
Introduction
|
|
345
|
+
The Config class is designed to manage and configure application settings. It provides a mechanism to ensure consistency in configurations and prevents accidental changes by limiting attribute modification.
|
|
346
|
+
Roadmap
|
|
347
|
+
The Config class is currently stable. Future updates may include new configuration options to support additional features.
|
|
348
|
+
Usage
|
|
349
|
+
Modifying Configuration:
|
|
350
|
+
You can modify the configuration by setting attributes directly, but only with predefined boolean values.
|
|
351
|
+
config. use_latex = True # Enable LaTeX formatting
|
|
352
|
+
Reading Configuration:
|
|
353
|
+
You can read the current configuration by accessing the attributes.
|
|
354
|
+
print(config. use_unicode) # Output: False
|
|
355
|
+
Ensuring Exclusive Configuration:
|
|
356
|
+
The Config class is designed to be mutually exclusive, meaning only one configuration item can be True at a time.
|
|
357
|
+
config. use_std = True # This will automatically set other configuration items to False
|
|
358
|
+
Getting Configuration Information:
|
|
359
|
+
Use the __repr__ method to get a string representation of the current configuration.
|
|
360
|
+
print(config) # Output: Config(use_latex=True, use_std=False, use_unicode=False)
|
|
361
|
+
|
|
362
|
+
修改配置时,您可以像这样导入“from pypynum import config”
|
|
363
|
+
|
|
364
|
+
When modifying the configuration, you can import 'from pypynum import config' like this
|
|
365
|
+
|
|
366
|
+
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
367
|
+
|
|
368
|
+
一些类现在支持以Unicode或LaTeX显示数据
|
|
369
|
+
|
|
370
|
+
Some classes now support displaying data in Unicode or LaTeX
|
|
351
371
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
8 | 96 19 96 -94 -95 75 40 -74
|
|
425
|
-
=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
372
|
+
|
|
373
|
+
Polynomial :
|
|
374
|
+
Standard 27x - 85x^4 + 25x^12 + 54x^42 + x^47 - 29x^61 - 73x^66 - 53x^72 - 90x^94 - 99x^97
|
|
375
|
+
Unicode 27x - 85x⁴ + 25x¹² + 54x⁴² + x⁴⁷ - 29x⁶¹ - 73x⁶⁶ - 53x⁷² - 90x⁹⁴ - 99x⁹⁷
|
|
376
|
+
LaTeX 27x - 85x^{4} + 25x^{12} + 54x^{42} + x^{47} - 29x^{61} - 73x^{66} - 53x^{72} - 90x^{94} - 99x^{97}
|
|
377
|
+
|
|
378
|
+
IntervalSet :
|
|
379
|
+
Standard [-94, -61) U [-41, -20] U (-1, 76] U (78, 85)
|
|
380
|
+
Unicode [-94, -61) ∪ [-41, -20] ∪ (-1, 76] ∪ (78, 85)
|
|
381
|
+
LaTeX \left[-94, -61\right) \cup \left[-41, -20\right] \cup \left(-1, 76\right] \cup \left(78, 85\right)
|
|
382
|
+
|
|
383
|
+
Matrix :
|
|
384
|
+
Standard
|
|
385
|
+
[[-65 26 81 -47]
|
|
386
|
+
[ 60 85 4 -23]
|
|
387
|
+
[ 27 56 86 -7]
|
|
388
|
+
[ 38 79 47 76]]
|
|
389
|
+
LaTeX
|
|
390
|
+
\begin{bmatrix}-65 & 26 & 81 & -47\\60 & 85 & 4 & -23\\27 & 56 & 86 & -7\\38 & 79 & 47 & 76\end{bmatrix}
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
Matrix自带的latex()方法可以设置LaTeX矩阵类型与元素间距
|
|
394
|
+
The LaTeX() method that comes with Matrix allows you to set the LaTeX matrix type and element spacing
|
|
395
|
+
|
|
396
|
+
EXAMPLE :
|
|
397
|
+
>>> print(A.latex(matrix_type="vmatrix", row_spacing=5, col_spacing=5, spacing_unit="mm"))
|
|
398
|
+
\begin{vmatrix}-65 & \hspace{5mm} & 26 & \hspace{5mm} & 81 & \hspace{5mm} & -47\\[5mm]60 & \hspace{5mm} & 85 & \hspace{5mm} & 4 & \hspace{5mm} & -23\\[5mm]27 & \hspace{5mm} & 56 & \hspace{5mm} & 86 & \hspace{5mm} & -7\\[5mm]38 & \hspace{5mm} & 79 & \hspace{5mm} & 47 & \hspace{5mm} & 76\end{vmatrix}
|
|
399
|
+
|
|
400
|
+
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
401
|
+
|
|
402
|
+
新增了IntervalSet类
|
|
403
|
+
|
|
404
|
+
Added IntervalSet class
|
|
405
|
+
|
|
406
|
+
支持区间的各种集合运算
|
|
407
|
+
|
|
408
|
+
Support various set operations for intervals
|
|
409
|
+
|
|
410
|
+
class IntervalSet(builtins.object)
|
|
411
|
+
| __and__ = intersection(self, other)
|
|
412
|
+
| __eq__ = is_equal(self, other)
|
|
413
|
+
| __ge__ = is_superset(self, other)
|
|
414
|
+
| __gt__ = is_proper_superset(self, other)
|
|
415
|
+
| __init__(self, intervals=None)
|
|
416
|
+
| It is a set of intervals and supports multiple operations.
|
|
417
|
+
| :param intervals: A sequence containing multiple intervals
|
|
418
|
+
| __le__ = is_subset(self, other)
|
|
419
|
+
| __lt__ = is_proper_subset(self, other)
|
|
420
|
+
| __matmul__ = complement(self, other)
|
|
421
|
+
| __ne__ = is_not_equal(self, other)
|
|
422
|
+
| __or__ = union(self, other)
|
|
423
|
+
| __repr__(self, use_latex=False)
|
|
424
|
+
| Return repr(self).
|
|
425
|
+
| __sub__ = difference(self, other)
|
|
426
|
+
| __xor__ = symmetric_difference(self, other)
|
|
427
|
+
| add_interval(self, start, end, start_open=False, end_open=False)
|
|
428
|
+
| add_intervals(self, intervals)
|
|
429
|
+
| complement(self, other)
|
|
430
|
+
| difference(self, other)
|
|
431
|
+
| intersection(self, other)
|
|
432
|
+
| is_equal(self, other)
|
|
433
|
+
| is_not_equal(self, other)
|
|
434
|
+
| is_proper_subset(self, other)
|
|
435
|
+
| is_proper_superset(self, other)
|
|
436
|
+
| is_subset(self, other)
|
|
437
|
+
| is_superset(self, other)
|
|
438
|
+
| latex(self)
|
|
439
|
+
| remove_interval(self, start, end, start_open=False, end_open=False)
|
|
440
|
+
| symmetric_difference(self, other)
|
|
441
|
+
| union(self, other)
|
|
442
|
+
|
|
443
|
+
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
426
444
|
```
|
|
427
445
|
|
|
428
446
|
### 运行用时测试
|
|
@@ -579,6 +597,10 @@ PyPyNum
|
|
|
579
597
|
├── chars
|
|
580
598
|
│ ├── CLASS
|
|
581
599
|
│ └── FUNCTION
|
|
600
|
+
│ ├── int2subscript(standard_str: str) -> str
|
|
601
|
+
│ ├── int2superscript(standard_str: str) -> str
|
|
602
|
+
│ ├── subscript2int(subscript_str: str) -> str
|
|
603
|
+
│ └── superscript2int(superscript_str: str) -> str
|
|
582
604
|
├── cipher
|
|
583
605
|
│ ├── CLASS
|
|
584
606
|
│ └── FUNCTION
|
|
@@ -594,6 +616,9 @@ PyPyNum
|
|
|
594
616
|
│ ├── rot13(text: str) -> str
|
|
595
617
|
│ ├── substitution(text: str, sub_map: dict, decrypt: bool) -> str
|
|
596
618
|
│ └── vigenere(text: str, key: str, decrypt: bool) -> str
|
|
619
|
+
├── confs
|
|
620
|
+
│ ├── CLASS
|
|
621
|
+
│ └── FUNCTION
|
|
597
622
|
├── constants
|
|
598
623
|
│ ├── CLASS
|
|
599
624
|
│ └── FUNCTION
|
|
@@ -779,9 +804,10 @@ PyPyNum
|
|
|
779
804
|
├── random
|
|
780
805
|
│ ├── CLASS
|
|
781
806
|
│ └── FUNCTION
|
|
807
|
+
│ ├── __create_nested_list(dimensions: Any, func: Any) -> Any
|
|
808
|
+
│ ├── __validate_shape(shape: Any) -> Any
|
|
782
809
|
│ ├── choice(seq: typing.Union[list, tuple, str], shape: typing.Union[list, tuple]) -> Any
|
|
783
810
|
│ ├── gauss(mu: typing.Union[int, float], sigma: typing.Union[int, float], shape: typing.Union[list, tuple]) -> typing.Union[float, list]
|
|
784
|
-
│ ├── gauss_error(original: typing.Union[list, tuple], mu: typing.Union[int, float], sigma: typing.Union[int, float]) -> list
|
|
785
811
|
│ ├── rand(shape: typing.Union[list, tuple]) -> typing.Union[float, list]
|
|
786
812
|
│ ├── randint(a: int, b: int, shape: typing.Union[list, tuple]) -> typing.Union[int, list]
|
|
787
813
|
│ └── uniform(a: typing.Union[int, float], b: typing.Union[int, float], shape: typing.Union[list, tuple]) -> typing.Union[float, list]
|
|
@@ -849,6 +875,7 @@ PyPyNum
|
|
|
849
875
|
└── utils
|
|
850
876
|
├── CLASS
|
|
851
877
|
│ ├── InfIterator(object)/__init__(self: Any, start: typing.Union[int, float, complex], mode: str, common: typing.Union[int, float, complex]) -> Any
|
|
878
|
+
│ ├── IntervalSet(object)/__init__(self: Any, intervals: Any) -> Any
|
|
852
879
|
│ ├── LinkedList(object)/__init__(self: Any) -> Any
|
|
853
880
|
│ ├── LinkedListNode(object)/__init__(self: Any, value: Any, next_node: Any) -> Any
|
|
854
881
|
│ └── OrderedSet(object)/__init__(self: Any, sequence: Any) -> Any
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PyPyNum
|
|
3
|
-
Version: 1.11.
|
|
3
|
+
Version: 1.11.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
|
[](https://pepy.tech/project/pypynum)
|
|
235
235
|
[](https://pepy.tech/project/pypynum)
|
|
236
236
|
|
|
237
|
-
## Version -> 1.11.
|
|
237
|
+
## Version -> 1.11.2 | 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
|
|
|
@@ -263,6 +263,7 @@ The logo cannot be displayed on PyPI, it can be viewed in Gitee or GitHub.
|
|
|
263
263
|
| `pypynum.Array` | 多维数组 Multidimensional array |
|
|
264
264
|
| `pypynum.chars` | 特殊数学符号 Special mathematical symbols |
|
|
265
265
|
| `pypynum.cipher` | 加密解密算法 Encryption and decryption algorithm |
|
|
266
|
+
| `pypynum.confs` | 通用配置 Universal configuration |
|
|
266
267
|
| `pypynum.constants` | 数学常数集合 Set of mathematical constants |
|
|
267
268
|
| `pypynum.dists` | 概率分布 Probability distribution |
|
|
268
269
|
| `pypynum.equations` | 方程求解 Solving equations |
|
|
@@ -336,93 +337,110 @@ Python interpreter and run it!
|
|
|
336
337
|
```
|
|
337
338
|
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
338
339
|
|
|
339
|
-
|
|
340
|
+
新增了Config类
|
|
340
341
|
|
|
341
|
-
|
|
342
|
+
Added Config class
|
|
342
343
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
344
|
+
Introduction
|
|
345
|
+
The Config class is designed to manage and configure application settings. It provides a mechanism to ensure consistency in configurations and prevents accidental changes by limiting attribute modification.
|
|
346
|
+
Roadmap
|
|
347
|
+
The Config class is currently stable. Future updates may include new configuration options to support additional features.
|
|
348
|
+
Usage
|
|
349
|
+
Modifying Configuration:
|
|
350
|
+
You can modify the configuration by setting attributes directly, but only with predefined boolean values.
|
|
351
|
+
config. use_latex = True # Enable LaTeX formatting
|
|
352
|
+
Reading Configuration:
|
|
353
|
+
You can read the current configuration by accessing the attributes.
|
|
354
|
+
print(config. use_unicode) # Output: False
|
|
355
|
+
Ensuring Exclusive Configuration:
|
|
356
|
+
The Config class is designed to be mutually exclusive, meaning only one configuration item can be True at a time.
|
|
357
|
+
config. use_std = True # This will automatically set other configuration items to False
|
|
358
|
+
Getting Configuration Information:
|
|
359
|
+
Use the __repr__ method to get a string representation of the current configuration.
|
|
360
|
+
print(config) # Output: Config(use_latex=True, use_std=False, use_unicode=False)
|
|
361
|
+
|
|
362
|
+
修改配置时,您可以像这样导入“from pypynum import config”
|
|
363
|
+
|
|
364
|
+
When modifying the configuration, you can import 'from pypynum import config' like this
|
|
365
|
+
|
|
366
|
+
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
367
|
+
|
|
368
|
+
一些类现在支持以Unicode或LaTeX显示数据
|
|
369
|
+
|
|
370
|
+
Some classes now support displaying data in Unicode or LaTeX
|
|
351
371
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
8 | 96 19 96 -94 -95 75 40 -74
|
|
425
|
-
=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
372
|
+
|
|
373
|
+
Polynomial :
|
|
374
|
+
Standard 27x - 85x^4 + 25x^12 + 54x^42 + x^47 - 29x^61 - 73x^66 - 53x^72 - 90x^94 - 99x^97
|
|
375
|
+
Unicode 27x - 85x⁴ + 25x¹² + 54x⁴² + x⁴⁷ - 29x⁶¹ - 73x⁶⁶ - 53x⁷² - 90x⁹⁴ - 99x⁹⁷
|
|
376
|
+
LaTeX 27x - 85x^{4} + 25x^{12} + 54x^{42} + x^{47} - 29x^{61} - 73x^{66} - 53x^{72} - 90x^{94} - 99x^{97}
|
|
377
|
+
|
|
378
|
+
IntervalSet :
|
|
379
|
+
Standard [-94, -61) U [-41, -20] U (-1, 76] U (78, 85)
|
|
380
|
+
Unicode [-94, -61) ∪ [-41, -20] ∪ (-1, 76] ∪ (78, 85)
|
|
381
|
+
LaTeX \left[-94, -61\right) \cup \left[-41, -20\right] \cup \left(-1, 76\right] \cup \left(78, 85\right)
|
|
382
|
+
|
|
383
|
+
Matrix :
|
|
384
|
+
Standard
|
|
385
|
+
[[-65 26 81 -47]
|
|
386
|
+
[ 60 85 4 -23]
|
|
387
|
+
[ 27 56 86 -7]
|
|
388
|
+
[ 38 79 47 76]]
|
|
389
|
+
LaTeX
|
|
390
|
+
\begin{bmatrix}-65 & 26 & 81 & -47\\60 & 85 & 4 & -23\\27 & 56 & 86 & -7\\38 & 79 & 47 & 76\end{bmatrix}
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
Matrix自带的latex()方法可以设置LaTeX矩阵类型与元素间距
|
|
394
|
+
The LaTeX() method that comes with Matrix allows you to set the LaTeX matrix type and element spacing
|
|
395
|
+
|
|
396
|
+
EXAMPLE :
|
|
397
|
+
>>> print(A.latex(matrix_type="vmatrix", row_spacing=5, col_spacing=5, spacing_unit="mm"))
|
|
398
|
+
\begin{vmatrix}-65 & \hspace{5mm} & 26 & \hspace{5mm} & 81 & \hspace{5mm} & -47\\[5mm]60 & \hspace{5mm} & 85 & \hspace{5mm} & 4 & \hspace{5mm} & -23\\[5mm]27 & \hspace{5mm} & 56 & \hspace{5mm} & 86 & \hspace{5mm} & -7\\[5mm]38 & \hspace{5mm} & 79 & \hspace{5mm} & 47 & \hspace{5mm} & 76\end{vmatrix}
|
|
399
|
+
|
|
400
|
+
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
401
|
+
|
|
402
|
+
新增了IntervalSet类
|
|
403
|
+
|
|
404
|
+
Added IntervalSet class
|
|
405
|
+
|
|
406
|
+
支持区间的各种集合运算
|
|
407
|
+
|
|
408
|
+
Support various set operations for intervals
|
|
409
|
+
|
|
410
|
+
class IntervalSet(builtins.object)
|
|
411
|
+
| __and__ = intersection(self, other)
|
|
412
|
+
| __eq__ = is_equal(self, other)
|
|
413
|
+
| __ge__ = is_superset(self, other)
|
|
414
|
+
| __gt__ = is_proper_superset(self, other)
|
|
415
|
+
| __init__(self, intervals=None)
|
|
416
|
+
| It is a set of intervals and supports multiple operations.
|
|
417
|
+
| :param intervals: A sequence containing multiple intervals
|
|
418
|
+
| __le__ = is_subset(self, other)
|
|
419
|
+
| __lt__ = is_proper_subset(self, other)
|
|
420
|
+
| __matmul__ = complement(self, other)
|
|
421
|
+
| __ne__ = is_not_equal(self, other)
|
|
422
|
+
| __or__ = union(self, other)
|
|
423
|
+
| __repr__(self, use_latex=False)
|
|
424
|
+
| Return repr(self).
|
|
425
|
+
| __sub__ = difference(self, other)
|
|
426
|
+
| __xor__ = symmetric_difference(self, other)
|
|
427
|
+
| add_interval(self, start, end, start_open=False, end_open=False)
|
|
428
|
+
| add_intervals(self, intervals)
|
|
429
|
+
| complement(self, other)
|
|
430
|
+
| difference(self, other)
|
|
431
|
+
| intersection(self, other)
|
|
432
|
+
| is_equal(self, other)
|
|
433
|
+
| is_not_equal(self, other)
|
|
434
|
+
| is_proper_subset(self, other)
|
|
435
|
+
| is_proper_superset(self, other)
|
|
436
|
+
| is_subset(self, other)
|
|
437
|
+
| is_superset(self, other)
|
|
438
|
+
| latex(self)
|
|
439
|
+
| remove_interval(self, start, end, start_open=False, end_open=False)
|
|
440
|
+
| symmetric_difference(self, other)
|
|
441
|
+
| union(self, other)
|
|
442
|
+
|
|
443
|
+
!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=!=
|
|
426
444
|
```
|
|
427
445
|
|
|
428
446
|
### 运行用时测试
|
|
@@ -579,6 +597,10 @@ PyPyNum
|
|
|
579
597
|
├── chars
|
|
580
598
|
│ ├── CLASS
|
|
581
599
|
│ └── FUNCTION
|
|
600
|
+
│ ├── int2subscript(standard_str: str) -> str
|
|
601
|
+
│ ├── int2superscript(standard_str: str) -> str
|
|
602
|
+
│ ├── subscript2int(subscript_str: str) -> str
|
|
603
|
+
│ └── superscript2int(superscript_str: str) -> str
|
|
582
604
|
├── cipher
|
|
583
605
|
│ ├── CLASS
|
|
584
606
|
│ └── FUNCTION
|
|
@@ -594,6 +616,9 @@ PyPyNum
|
|
|
594
616
|
│ ├── rot13(text: str) -> str
|
|
595
617
|
│ ├── substitution(text: str, sub_map: dict, decrypt: bool) -> str
|
|
596
618
|
│ └── vigenere(text: str, key: str, decrypt: bool) -> str
|
|
619
|
+
├── confs
|
|
620
|
+
│ ├── CLASS
|
|
621
|
+
│ └── FUNCTION
|
|
597
622
|
├── constants
|
|
598
623
|
│ ├── CLASS
|
|
599
624
|
│ └── FUNCTION
|
|
@@ -779,9 +804,10 @@ PyPyNum
|
|
|
779
804
|
├── random
|
|
780
805
|
│ ├── CLASS
|
|
781
806
|
│ └── FUNCTION
|
|
807
|
+
│ ├── __create_nested_list(dimensions: Any, func: Any) -> Any
|
|
808
|
+
│ ├── __validate_shape(shape: Any) -> Any
|
|
782
809
|
│ ├── choice(seq: typing.Union[list, tuple, str], shape: typing.Union[list, tuple]) -> Any
|
|
783
810
|
│ ├── gauss(mu: typing.Union[int, float], sigma: typing.Union[int, float], shape: typing.Union[list, tuple]) -> typing.Union[float, list]
|
|
784
|
-
│ ├── gauss_error(original: typing.Union[list, tuple], mu: typing.Union[int, float], sigma: typing.Union[int, float]) -> list
|
|
785
811
|
│ ├── rand(shape: typing.Union[list, tuple]) -> typing.Union[float, list]
|
|
786
812
|
│ ├── randint(a: int, b: int, shape: typing.Union[list, tuple]) -> typing.Union[int, list]
|
|
787
813
|
│ └── uniform(a: typing.Union[int, float], b: typing.Union[int, float], shape: typing.Union[list, tuple]) -> typing.Union[float, list]
|
|
@@ -849,6 +875,7 @@ PyPyNum
|
|
|
849
875
|
└── utils
|
|
850
876
|
├── CLASS
|
|
851
877
|
│ ├── InfIterator(object)/__init__(self: Any, start: typing.Union[int, float, complex], mode: str, common: typing.Union[int, float, complex]) -> Any
|
|
878
|
+
│ ├── IntervalSet(object)/__init__(self: Any, intervals: Any) -> Any
|
|
852
879
|
│ ├── LinkedList(object)/__init__(self: Any) -> Any
|
|
853
880
|
│ ├── LinkedListNode(object)/__init__(self: Any, value: Any, next_node: Any) -> Any
|
|
854
881
|
│ └── OrderedSet(object)/__init__(self: Any, sequence: Any) -> Any
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from .Array import Array
|
|
2
|
+
from .confs import config
|
|
2
3
|
from .errors import ShapeError
|
|
3
4
|
|
|
4
5
|
MatchError = ShapeError("The shapes of two matrices do not match")
|
|
@@ -195,6 +196,27 @@ class Matrix(Array):
|
|
|
195
196
|
transpose = t
|
|
196
197
|
trace = tr
|
|
197
198
|
|
|
199
|
+
def latex(self, matrix_type="bmatrix", row_spacing=0, col_spacing=0, spacing_unit="mm"):
|
|
200
|
+
valid_matrix_types = ["Bmatrix", "Vmatrix", "array", "bmatrix", "matrix", "pmatrix", "smallmatrix", "vmatrix"]
|
|
201
|
+
valid_units = ["bp", "cc", "cm", "dd", "em", "ex", "in", "mm", "mu", "pc", "pt", "sp"]
|
|
202
|
+
if matrix_type not in valid_matrix_types:
|
|
203
|
+
raise ValueError("Invalid matrix type. Choose from {}".format(valid_matrix_types))
|
|
204
|
+
if spacing_unit not in valid_units:
|
|
205
|
+
raise ValueError("Invalid spacing unit. Choose from {}".format(valid_units))
|
|
206
|
+
alignment = "c" * len(self[0]) if matrix_type == "array" else None
|
|
207
|
+
col_separator = " & " if col_spacing == 0 else " & \\hspace{{{}{}}} & ".format(col_spacing, spacing_unit)
|
|
208
|
+
row_separator = "\\\\" if row_spacing == 0 else "\\\\[{}{}]".format(row_spacing, spacing_unit)
|
|
209
|
+
latex_str = ["\\begin{{{}}}".format(matrix_type), "{{{}}}".format(alignment) if alignment else "",
|
|
210
|
+
row_separator.join([col_separator.join(map(str, row)) for row in self]),
|
|
211
|
+
"\\end{{{}}}".format(matrix_type)]
|
|
212
|
+
return "".join(latex_str)
|
|
213
|
+
|
|
214
|
+
def __repr__(self, use_latex=False):
|
|
215
|
+
use_latex = config.use_latex or use_latex
|
|
216
|
+
return self.latex() if use_latex else super().__repr__()
|
|
217
|
+
|
|
218
|
+
__str__ = __repr__
|
|
219
|
+
|
|
198
220
|
def __setitem__(self, key, value):
|
|
199
221
|
if isinstance(key, (int, slice)):
|
|
200
222
|
self.data[key] = value
|