-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit da4fc23
Showing
257 changed files
with
27,686 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 7d68660430f77a669483229bb780418f | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.. py:module:: zmodn | ||
Modular Arithmetic | ||
================== | ||
|
||
.. python-apigen-group:: modular-arithmetic | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
The latest released version of :obj:`Zmodn` can be installed from `PyPI <https://pypi.org/project/zmodn/>`_ with `pip`: | ||
|
||
.. code-block:: console | ||
pip install zmodn | ||
To install your library locally so that it can be imported from anywhere in your system, you can use the command :obj:`pip install .` in the root directory of your project (the directory containing the :obj:`setup.py` or :obj:`pyproject.toml` file). | ||
|
||
Here are the detailed steps: | ||
|
||
1. Open a terminal. | ||
2. Navigate to the root directory of your project. | ||
3. Execute the command :obj:`pip install .`. | ||
|
||
This command will install your library in your global Python environment (or in the active virtual environment if you are using one). Once installed, you should be able to import your library from any Python script on your system. | ||
|
||
Note: If you are using a virtual environment and want your library to be available globally, make sure the virtual environment is not active when you run the :obj:`pip install .` command. | ||
|
||
Additionally, if you make changes to your library and want them reflected in the installed version, you'll need to uninstall the old version and reinstall the new one. You can do this with the commands :obj:`pip uninstall your-library-name` and :obj:`pip install .`. | ||
|
||
|
||
Updated Documentation | ||
_____________________ | ||
|
||
To generate the documentation, you need to run the following command in the root directory of docs: | ||
|
||
.. code-block:: console | ||
sphinx-apidoc -o source/ ../zmodn | ||
make html | ||
Now, suppose you did som changes to our code and now you want to rebuild that HTML, go to your docs directory and run | ||
the following command: | ||
|
||
.. code-block:: console | ||
make clean html | ||
This will delete the old HTML files and rebuild them. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
The :doc:`getting-started` guide is intended to help you get started with installing and using the library in your own | ||
projects. See ":doc:`Basic Usage`" for more detailed information on how to use the library. | ||
|
||
Install the package | ||
------------------- | ||
|
||
The last stable release is available on PyPI and can be installed with pip: | ||
|
||
.. code-block:: console | ||
pip install zmodn | ||
zmodn.__version__ | ||
Create a :obj:`~.zmodn.Zmodn` instance | ||
------------------------------ | ||
|
||
The :obj:`zmodn` class is the main interface to the library. It represents a set of integers modulo a given modulus. The | ||
modulus must be a positive integer. The representatives of the set are given as a list of integers or a single integer. | ||
In this example, we create a :obj:`Zmodn` instance representing the set of integers modulo 5 with representatives 1, 2, | ||
3, 4, and 5 (which are equivalent to 1, 2, 3, 4, and 0 modulo 5, respectively): | ||
|
||
.. code-block:: python | ||
from zmodn import Zmodn | ||
zmodn = Zmodn([1, 2, 3, 4, 5], 5) | ||
The :obj:`Zmodn` class is a subclass of :obj:`numpy.ndarray`, so it can be used in the same way as a NumPy array: | ||
|
||
.. code-block:: python | ||
zmodn[0] | ||
zmodn[1:3] | ||
zmodn[0] = 6 | ||
zmodn[1:3] = [7, 8] | ||
zmodn[0] = 1 | ||
zmodn[1:3] = [2, 3] | ||
The :obj:`Zmodn` class also supports the :obj:`len` function, which returns the number of representatives: | ||
|
||
.. code-block:: python | ||
len(zmodn) | ||
The :obj:`Zmodn` class supports the :obj:`in` operator, which checks if a given representative is in the set: | ||
|
||
.. code-block:: python | ||
1 in zmodn | ||
2 in zmodn | ||
3 in zmodn | ||
4 in zmodn | ||
5 in zmodn | ||
6 in zmodn | ||
7 in zmodn | ||
8 in zmodn | ||
The :obj:`Zmodn` class supports the :obj:`bool` function, which returns :obj:`True` if the set is not empty and | ||
|
||
:obj:`False` otherwise: | ||
|
||
.. code-block:: python | ||
bool(zmodn) | ||
Perform arithmetic operations | ||
----------------------------- | ||
|
||
Once you have two :obj:`Zmodn` instances, you can perform arithmetic can be performed using normal NumPy arithmetic. | ||
|
||
standard element-wise array arithmetic operations -- addition, subtraction, multiplication, division and exponentiation | ||
are easily performed on :obj:`Zmodn` instances. For example, to add two :obj:`Zmodn` instances, you can use the :obj:`+` | ||
operator: | ||
|
||
.. code-block:: python | ||
zmodn1 = Zmodn([1, 2, 3, 4, 5], 5) | ||
zmodn2 = Zmodn([1, 2, 3, 4, 5], 5) | ||
zmodn1 + zmodn2 | ||
The :obj:`Zmodn` class also supports the :obj:`-`, :obj:`*`, :obj:`/`, and :obj:`**` operators: | ||
|
||
.. code-block:: python | ||
zmodn1 - zmodn2 | ||
zmodn1 * zmodn2 | ||
zmodn1 / zmodn2 | ||
zmodn1 ** zmodn2 | ||
The :obj:`Zmodn` class supports the :obj:`==` and :obj:`!=` operators, which check if two :obj:`Zmodn` instances are equal or not equal, respectively: | ||
|
||
.. code-block:: python | ||
zmodn1 == zmodn2 | ||
zmodn1 != zmodn2 | ||
See :doc:`/basic-usage/operations` for more information on the arithmetic operations. |
Oops, something went wrong.