Readme and docstrings updated

This commit is contained in:
Nicolas 2025-12-21 14:03:30 +01:00
parent 74e9c6e50b
commit 60891395d0
4 changed files with 44 additions and 3 deletions

View File

@ -1,6 +1,6 @@
# Copapy
Copapy is a Python framework for deterministic, low-latency realtime computation, targeting hardware applications - for example in the fields of robotics, aerospace, embedded systems and control systems in general.
Copapy is a Python framework for deterministic, low-latency realtime computation with automatic differentiation support, targeting hardware applications - for example in the fields of robotics, aerospace, embedded systems and control systems in general.
GPU frameworks like PyTorch, JAX and TensorFlow jump-started the development in the field of AI. With the right balance of flexibility and performance, they allow for fast iteration of new ideas while still being performant enough to test or even use them in production.
@ -12,7 +12,7 @@ The main features can be summarized as:
- Fast to write & easy to read
- Memory and type safety with a minimal set of runtime errors
- Deterministic execution
- Autograd for efficient realtime optimization
- Automatic differentiation for efficient realtime optimization (reverse-mode)
- Optimized machine code for x86_64, AArch64 and ARMv7
- Highly portable to new architectures
- Small Python package with minimal dependencies and no cross-compile toolchain required

View File

@ -1,3 +1,38 @@
"""
Copapy is a Python framework for deterministic, low-latency
realtime computation with automatic differentiation, targeting
hardware applications - for example in the fields of robotics,
aerospace, embedded systems and control systems in general.
Main features:
- Automatic differentiation (reverse-mode)
- Generates optimized machine code
- Highly portable to new architectures
- Small Python package with minimal dependencies
Example usage:
>>> import copapy as cp
>>> # Define variables
>>> a = cp.value(0.25)
>>> b = cp.value(0.87)
>>> # Define computations
>>> c = a + b * 2.0
>>> d = c ** 2 + cp.sin(a)
>>> e = cp.sqrt(b)
>>> # Create a target (default is local), compile and run
>>> tg = cp.Target()
>>> tg.compile(c, d, e)
>>> tg.run()
>>> # Read the results
>>> print("Result c:", tg.read_value(c))
>>> print("Result d:", tg.read_value(d))
>>> print("Result e:", tg.read_value(e))
"""
from ._target import Target, jit
from ._basic_types import NumLike, value, generic_sdb, iif
from ._vectors import vector, distance, scalar_projection, angle_between, rotate_vector, vector_projection

View File

@ -15,7 +15,8 @@ def grad(x: Any, y: Sequence[value[Any]]) -> list[unifloat]: ...
def grad(x: Any, y: matrix[Any]) -> matrix[float]: ...
def grad(x: Any, y: value[Any] | Sequence[value[Any]] | vector[Any] | matrix[Any]) -> Any:
"""Returns the partial derivative dx/dy where x needs to be a scalar
and y might be a scalar, a list of scalars, a vector or matrix.
and y might be a scalar, a list of scalars, a vector or matrix. It
uses automatic differentiation in reverse-mode.
Arguments:
x: Value to return derivative of

View File

@ -1,3 +1,8 @@
"""
Backend module for Copapy: contains internal data types
and give access to compiler internals and debugging tools.
"""
from ._target import add_read_command
from ._basic_types import Net, Op, Node, CPConstant, Write, stencil_db_from_package
from ._compiler import compile_to_dag, \