Installation¶
cordic can be installed from PyPI, GitHub, or built from source.
Prerequisites¶
- Python 3.10+
- NumPy (installed automatically as a dependency)
For source builds you additionally need:
- A C compiler (
gccorclang) mesonandmeson-pythonbuild systemnumpy(forf2pycompilation)
PyPI¶
For using the PyPI package in your project, add the following to your configuration file:
[project]
dependencies = [
"cordic"
]
cordic
pip¶
pip install --upgrade cordic
uv¶
# Add to a uv project
uv add cordic
# Or install into the current environment
uv pip install cordic
pipenv¶
pipenv install cordic
poetry¶
poetry add cordic
pdm¶
pdm add cordic
hatch¶
hatch add cordic
git¶
Install the latest development version directly from the repository:
pip install --upgrade "git+https://github.com/eggzec/cordic.git#egg=cordic"
Building locally¶
Clone and build from source to modify the C code or test local changes:
git clone https://github.com/eggzec/cordic.git
cd cordic
uv pip install .
This invokes the meson build system to compile the C sources via f2py
and install the resulting extension module.
C compiler required
Source builds require a working C compiler. On most Linux distributions,
install gcc:
Verifying the installation¶
After installation, verify that the package loads correctly:
import cordic
print(cordic.cos(1.0)) # ≈ 0.5403
print(cordic.sqrt(2.0)) # ≈ 1.4142
print("cordic is working!")
Dependencies¶
- Python >=3.10
- numpy