From 35f9253a0d19a523e1b10b25a149e3fb8d93c9c8 Mon Sep 17 00:00:00 2001 From: Michael Schneeberger Date: Thu, 4 Aug 2022 16:18:34 +0200 Subject: add 'install_requires' to setup.py, add missing link to README.md --- README.md | 14 +++++++------- polymatrix/expression/mixins/expressionmixin.py | 1 - setup.py | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 08e5c9a..b1bad09 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Some aspects of the library: * multiple polynomial expressions are combined using functions like * [`polymatrix.v_stack`](https://gitlab.nccr-automation.ch/michael.schneeberger/polymatrix/-/blob/main/polymatrix/__init__.py) * [`polymatrix.block_diag`](https://gitlab.nccr-automation.ch/michael.schneeberger/polymatrix/-/blob/main/polymatrix/__init__.py). -* polynomial expressions are manipulated using bounded functions like +* polynomial expressions are manipulated using methods like * [`diff`](https://gitlab.nccr-automation.ch/michael.schneeberger/polymatrix/-/blob/main/polymatrix/expression/mixins/expressionmixin.py), * [`reshape`](https://gitlab.nccr-automation.ch/michael.schneeberger/polymatrix/-/blob/main/polymatrix/expression/mixins/expressionmixin.py) * [`substitute`](https://gitlab.nccr-automation.ch/michael.schneeberger/polymatrix/-/blob/main/polymatrix/expression/mixins/expressionmixin.py) @@ -27,13 +27,13 @@ Some aspects of the library: In this example, two polynomial expressions are defined using sympy expressions -$f_1(x_1, x_2) = x_1 + x_2$ +$\quad f_1(x_1, x_2) = x_1 + x_2$ -$f_2(x_1, x_2) = x_1 + x_1 x_2$ +$\quad f_2(x_1, x_2) = x_1 + x_1 x_2$ -Then, the two expression are combined using the `__add__` (or equivalently `+`) function +Then, the two expression are combined using the [`__add__`](https://gitlab.nccr-automation.ch/michael.schneeberger/polymatrix/-/blob/main/polymatrix/expression/mixins/expressionmixin.py) (or equivalently `+`) function -$f_3(x_1, x_2) = f_1(x_1, x_2) + f_2(x_1, x_2) = 2 x_1 + x_2 + x_1 x_2$ +$\quad f_3(x_1, x_2) = f_1(x_1, x_2) + f_2(x_1, x_2) = 2 x_1 + x_2 + x_1 x_2$ Finally, different representations of the polynomial are printed. @@ -66,6 +66,6 @@ state, matrix_repr = polymatrix.to_matrix_repr((f3,), x).apply(state) # prints the numpy matrix representations of the polynomial matrix # array([[2., 1.]]) # array([[0. , 0.5, 0.5, 0. ]]) -print(matrix_repr.data[0][1]) -print(matrix_repr.data[0][2].toarray()) +print(matrix_repr.data[0][1]) # numpy array +print(matrix_repr.data[0][2].toarray()) # sparse scipy array ``` diff --git a/polymatrix/expression/mixins/expressionmixin.py b/polymatrix/expression/mixins/expressionmixin.py index a5acff1..4afa44f 100644 --- a/polymatrix/expression/mixins/expressionmixin.py +++ b/polymatrix/expression/mixins/expressionmixin.py @@ -2,7 +2,6 @@ import abc import dataclasses import typing import numpy as np -from sympy import re from polymatrix.expression.init.initadditionexpr import init_addition_expr from polymatrix.expression.init.initcacheexpr import init_cache_expr diff --git a/setup.py b/setup.py index 3188bd3..5e09fe8 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ with open(path.join(here, 'README.md'), encoding='utf-8') as f: setup( name='polymatrix', version='0.0.1a1', - install_requires=['dataclass-abc'], + install_requires=['dataclass-abc', 'numpy', 'scipy', 'sympy'], description='A library to represent and manipulate multivariate polynomials', long_description=long_description, long_description_content_type='text/markdown', -- cgit v1.2.1