Rotate any square matrix clockwise and anticlockwise in any degree of angle.
matrix-rotation is a simple package for rotating elements of any square matrix in clockwise and anticlockwise direction. This rotation can be performed with any degree of angle or step size. This version is most suitable for small size matrix.
Use in python code
Following are some of the sample examples to show the use of matrix_rotation package. This package has a function named rotate_matrix which essentially takes input 2 dimensional square matrix as a first argument, degree as a second argument to determine the step size and default clockwise rotation as the final argument. print_rotate_matrix function is just the extension of rotate_matrix function which print the original matrix and rotated matrix on the console. Let's take a look.
>> from matrix_rotation import rotate_matrix, print_rotate_matrix
>>> matrix = [['a', 'b', 'c'],\
['h', 'i', 'd'],\
['g', 'f', 'e']]
>>> rotated_matrix = rotate_matrix(matrix, degree=2, clockwise=True)
>>> rotated_matrix
[['g', 'h', 'a'], ['f', 'i', 'b'], ['e', 'd', 'c']]
>>> rotated_matrix = print_rotate_matrix(matrix, degree=2, clockwise=True)
Original Matrix:
[['a', 'b', 'c'],
['h', 'i', 'd'],
['g', 'f', 'e']]
Clockwise Rotated Matrix with Degree = 2:
[['g', 'h', 'a'],
['f', 'i', 'b'],
['e', 'd', 'c']]
---------------------------------------------
>>> rotated_matrix
[['g', 'h', 'a'], ['f', 'i', 'b'], ['e', 'd', 'c']]
Use in command line interface (CLI)
matrix_rotation --help
Usage: matrix_rotation [OPTIONS]
Options:
-M, --matrix TEXT Use to show default examples of matrix rotation.
Otherwise use the input matrix from command
line. Input example : [["a", "b"],["d", "c"]]
-D, --degree INTEGER Degree of rotation. Can rotate matrix in between
0 degree to 360 degree. [default: (1)]
-C, --clockwise BOOLEAN Use True to rotate matrix in a clockwise
direction. False for rotation in anticlockwise
direction. [default: (True)]
-S, --print_matrix BOOLEAN Use True to show the result of Original and
Rotated Matrix. [default: (False)]
--help Show this message and exit.
For more information please visit GitHub
License
MIT License
Metadata
Release files for matrix-rotation 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| matrix_rotation-0.2.2.tar.gz | 6.9 kB | Without provenance | Details for matrix_rotation-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| matrix_rotation-0.2.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for matrix_rotation-0.2.2-py2.py3-none-any.whl |
Total release size: 14.8 kB
Release files / matrix_rotation-0.2.2.tar.gz
| Download URL | matrix_rotation-0.2.2.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e55969868928dea5c27671615cee60099606b4630ecfdbaafda7587de9e0d92b
|
|
BLAKE2b-256 checksum How to use checksums |
868b521b80f1aeaa0b0e4899eab05133e5a750aed882dc2d01ca5e192949f406
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.2
|
Release files / matrix_rotation-0.2.2-py2.py3-none-any.whl
| Download URL | matrix_rotation-0.2.2-py2.py3-none-any.whl |
|---|---|
| Size | 7.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
61eb03710e2405788810f5c7c369ccb79c005204eb7df8ff4fa08a0ae0532473
|
|
BLAKE2b-256 checksum How to use checksums |
8ae325d3c9111fee8b32e05304591c38dc07acb320c2abb08df105dd59efee5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.2
|
Security for matrix-rotation 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.