A small library implementing linear combinations of "stuff".
Project description
linear-combination
------------------
A small library implementing linear combinations of "stuff".
Such a linear combination is stored as a map, mapping "stuff" to its coefficient.
That is {"a" 5, "b" 17} stands for the linear combination 5 * "a" + 17 * "b"::
import linear_combination.linear_combination as lc
lc1 = lc.LinearCombination( {"x":7,"y":8} )
lc2 = lc.LinearCombination( {"x":2.1, "z":3} )
print( lc1 + lc2 )
# => "+9.10 x +8 y +3 z"
The main application is to `Hopf Algebras <https://en.wikipedia.org/wiki/Hopf_algebra>`_.
The package comes with two sample implementations of Hopf algebrase;
the concatenation Hop algebra and, its dual, the shuffle algebras (Reutenauer - Free Lie algebras).
Much of its code is borrowed from `free-lie-algebra-py <https://github.com/bottler/free-lie-algebra-py>`_, by Jeremy Reizenstein::
import linear_combination.linear_combination as lc
import linear_combination.words as words
print( lc.LinearCombination.lift( words.ShuffleWord( (1,2 ) ) ) * lc.LinearCombination.lift( words.ShuffleWord( (3,4 ) ) ) )
# => +1 1234 +1 1324 +1 1342 +1 3124 +1 3142 +1 3412
Installation
------------
Install with::
pip install linear-combination-py
or::
pip install git+git://github.com/diehlj/linear-combination-py
Copyright © 2018 Joscha Diehl
Distributed under the `Eclipse Public License <https://opensource.org/licenses/eclipse-1.0.php>`_.
------------------
A small library implementing linear combinations of "stuff".
Such a linear combination is stored as a map, mapping "stuff" to its coefficient.
That is {"a" 5, "b" 17} stands for the linear combination 5 * "a" + 17 * "b"::
import linear_combination.linear_combination as lc
lc1 = lc.LinearCombination( {"x":7,"y":8} )
lc2 = lc.LinearCombination( {"x":2.1, "z":3} )
print( lc1 + lc2 )
# => "+9.10 x +8 y +3 z"
The main application is to `Hopf Algebras <https://en.wikipedia.org/wiki/Hopf_algebra>`_.
The package comes with two sample implementations of Hopf algebrase;
the concatenation Hop algebra and, its dual, the shuffle algebras (Reutenauer - Free Lie algebras).
Much of its code is borrowed from `free-lie-algebra-py <https://github.com/bottler/free-lie-algebra-py>`_, by Jeremy Reizenstein::
import linear_combination.linear_combination as lc
import linear_combination.words as words
print( lc.LinearCombination.lift( words.ShuffleWord( (1,2 ) ) ) * lc.LinearCombination.lift( words.ShuffleWord( (3,4 ) ) ) )
# => +1 1234 +1 1324 +1 1342 +1 3124 +1 3142 +1 3412
Installation
------------
Install with::
pip install linear-combination-py
or::
pip install git+git://github.com/diehlj/linear-combination-py
Copyright © 2018 Joscha Diehl
Distributed under the `Eclipse Public License <https://opensource.org/licenses/eclipse-1.0.php>`_.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for linear-combination-py-0.1.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 714602087455b830be2f80e8d49c4a6db6132a88b01df47d9d318c5f60695ff0 |
|
MD5 | 3eb31f2ed35560a08619d9436409c2ae |
|
BLAKE2b-256 | d4063eb97b7b3c1bb2e0e51da4c7e316e93de6443240aa68adb413ffaf7b5c2e |
Close
Hashes for linear_combination_py-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9496a084a9013ebfb6996210998256e8d47378efaa3153feada43d106e09f42b |
|
MD5 | 1a5111cd60ca99f65a14b2f8cd338d8c |
|
BLAKE2b-256 | 357f08cf2733c469fdfbf42a01c06691365d676327a9abb08cbe4a87ce8861d9 |