matrix-dict 1.0.0__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.
@@ -0,0 +1,145 @@
1
+ Metadata-Version: 2.4
2
+ Name: matrix-dict
3
+ Version: 1.0.0
4
+ Summary: A 100x100 dictionary-based matrix with 10,000 accessible indexes
5
+ Author-email: amphibiar <amphibiar@example.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/amphibiar/matrix-dict
8
+ Project-URL: Repository, https://github.com/amphibiar/matrix-dict
9
+ Project-URL: Issues, https://github.com/amphibiar/matrix-dict/issues
10
+ Keywords: matrix,dictionary,data-structure,100x100,grid
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Software Development :: Libraries
21
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
22
+ Requires-Python: >=3.8
23
+ Description-Content-Type: text/markdown
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=7.0; extra == "dev"
26
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
27
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
28
+
29
+ # matrix-dict
30
+
31
+ A 100x100 dictionary-based matrix with 10,000 accessible indexes for Python.
32
+
33
+ ## Features
34
+
35
+ - **Fixed 100x100 size** - Exactly 10,000 cells
36
+ - **Dictionary-like access** - Use `(row, col)` tuple keys
37
+ - **Default values** - Initialize all cells with a default
38
+ - **Bulk operations** - Set/get entire rows, columns, or submatrices
39
+ - **Iteration** - Iterate over all 10,000 positions efficiently
40
+ - **Slicing** - Extract rectangular submatrices
41
+ - **List conversion** - Convert to/from nested lists
42
+ - **Type hints** - Full typing support
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ pip install matrix-dict
48
+ ```
49
+
50
+ Or from source:
51
+ ```bash
52
+ git clone https://github.com/amphibiar/matrix-dict
53
+ cd matrix-dict
54
+ pip install -e .
55
+ ```
56
+
57
+ ## Quick Start
58
+
59
+ ```python
60
+ from matrix_dict import create_matrix
61
+
62
+ # Create a 100x100 matrix with default value 0
63
+ matrix = create_matrix(default_value=0)
64
+
65
+ # Set individual cells
66
+ matrix[(0, 0)] = 100
67
+ matrix[(50, 50)] = 2500
68
+
69
+ # Access cells
70
+ value = matrix[(0, 0)] # 100
71
+
72
+ # Fill with a loop
73
+ for row in range(100):
74
+ for col in range(100):
75
+ matrix[(row, col)] = row * 100 + col
76
+
77
+ # Or iterate directly
78
+ for (row, col), _ in matrix:
79
+ matrix[(row, col)] = row * 100 + col
80
+
81
+ # Get entire row/column
82
+ row_5 = matrix.get_row(5) # [500, 501, ..., 599]
83
+ col_3 = matrix.get_col(3) # [3, 103, 203, ..., 9903]
84
+
85
+ # Set entire row/column
86
+ matrix.set_row(0, [i * 2 for i in range(100)])
87
+ matrix.set_col(5, [i * 3 for i in range(100)])
88
+
89
+ # Submatrix operations
90
+ sub = matrix.get_submatrix(0, 10, 0, 10) # 10x10 top-left
91
+ matrix.set_submatrix(20, 20, [[1, 2], [3, 4]])
92
+
93
+ # Check if explicitly set
94
+ if (50, 50) in matrix:
95
+ print("Cell was set")
96
+
97
+ # Convert to/from list
98
+ data = matrix.to_list() # 100x100 list of lists
99
+ new_matrix = MatrixDict.from_list(data)
100
+ ```
101
+
102
+ ## API Reference
103
+
104
+ ### `create_matrix(default_value=None) -> MatrixDict`
105
+ Factory function to create a new matrix.
106
+
107
+ ### `MatrixDict(default_value=None)`
108
+ Main class. Initialize with optional default value for all 10,000 cells.
109
+
110
+ #### Item Access
111
+ - `matrix[(row, col)] = value` - Set cell
112
+ - `value = matrix[(row, col)]` - Get cell (returns default if not set)
113
+ - `(row, col) in matrix` - Check if explicitly set
114
+
115
+ #### Bulk Operations
116
+ - `matrix.fill(value)` - Fill all 10,000 cells
117
+ - `matrix.clear()` - Clear all explicitly set values
118
+ - `matrix.set_row(row, values)` - Set row from list of 100
119
+ - `matrix.set_col(col, values)` - Set column from list of 100
120
+ - `matrix.get_row(row) -> List` - Get row as list
121
+ - `matrix.get_col(col) -> List` - Get column as list
122
+
123
+ #### Submatrix
124
+ - `matrix.get_submatrix(r_start, r_end, c_start, c_end) -> List[List]`
125
+ - `matrix.set_submatrix(row_start, col_start, values)`
126
+
127
+ #### Iteration
128
+ - `for (row, col), value in matrix:` - All 10,000 positions
129
+ - `matrix.iterate_row(row)` - Iterate (col, value) in row
130
+ - `matrix.iterate_col(col)` - Iterate (row, value) in column
131
+ - `matrix.items()` - Explicitly set (key, value) pairs
132
+ - `matrix.keys()` - Explicitly set keys
133
+ - `matrix.values()` - Explicitly set values
134
+
135
+ #### Conversion
136
+ - `matrix.to_list()` - Convert to 100x100 list of lists
137
+ - `MatrixDict.from_list(data, default_value)` - Create from list
138
+
139
+ ## Requirements
140
+
141
+ - Python 3.8+
142
+
143
+ ## License
144
+
145
+ MIT
@@ -0,0 +1,4 @@
1
+ matrix_dict-1.0.0.dist-info/METADATA,sha256=5nHt2kHInAO2U_mAeHG7or-9mYYiyqpc4U2VAFVrKI0,4400
2
+ matrix_dict-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
3
+ matrix_dict-1.0.0.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
4
+ matrix_dict-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+