diff options
Diffstat (limited to 'python-one-relator-curvature.spec')
-rw-r--r-- | python-one-relator-curvature.spec | 387 |
1 files changed, 387 insertions, 0 deletions
diff --git a/python-one-relator-curvature.spec b/python-one-relator-curvature.spec new file mode 100644 index 0000000..6fa984f --- /dev/null +++ b/python-one-relator-curvature.spec @@ -0,0 +1,387 @@ +%global _empty_manifest_terminate_build 0 +Name: python-one-relator-curvature +Version: 0.3.3 +Release: 1 +Summary: A package for studying regular sectional curvature of one relator groups +License: MIT License +URL: https://github.com/antonydellavecchia/one_relator_curvature +Source0: https://mirrors.aliyun.com/pypi/web/packages/20/da/bd77085179d6d1b46eaa8db926e4dab7c7596f33be0e64b83fdfa85bb0da/one-relator-curvature-0.3.3.tar.gz +BuildArch: noarch + +Requires: python3-matplotlib +Requires: python3-mpmath +Requires: python3-sqlalchemy +Requires: python3-pulp +Requires: python3-networkx +Requires: python3-cplex + +%description +# One Relator Curvature + +## About +This project provides an api for studying regular sectional curvature of one-relator groups. + + + +## Installation + +```pip install one-relator-curvature``` + + +## Usage +There are two different ways of using the project, either through a collection of command line exposed functions, or as an imported python module + +### CLI + +Some function are exposed as command line tools. + +* solve_example +* solve_examples +* get_all_cycle_data +* get_polytope +* get_polytopes + +### Example Usage + +### Using cli script +For solving all results in te given word range, this command stores database files in the output directory. + + +```one-relator-curvature solve_examples --output-dir /home/$USER/generated_examples --word-size-range 10 11``` + +To export polytope for a given word. Stores json for polytope in output directory + + +```one-relator-curvature get_polytope --word BabbAba -output-dir /home/$USER/polytope_examples``` + +To export polytopes for cycles of a given word. Stores json for polytope in output directory + + +```one-relator-curvature get_polytope --word BabbAba -output-dir /home/$USER/polytope_examples --cycles``` + + +#### Importing as Python Module + +``` +from one_relator_curvature.example import Example +import matplotlib.pyplot as plt + +example = Example("Babba") +example.generate_inequalities() +example.solve() +example.plot() +plt.show() +``` + +### Importing Polytopes into Polymake + +The following code can be run as a polymake script passing the directory of any polytopes output by the commands get_polytope and get_polytopes +``` + +use JSON::Parse 'json_file_to_perl'; +use JSON; +use Path::Class; +use application 'polytope'; + +sub read_inequalities_json { + my $inequalities_file = $_[0]; + my $inequalities = json_file_to_perl ($inequalities_file); + my $regions_inequalities = $inequalities->{"regions_inequalities"}; + my $links_inequalities = $inequalities->{"links_inequalities"}; + my $all_inequalities = (); + + push(@$all_inequalities, @$regions_inequalities); + push(@$all_inequalities, @$links_inequalities); + + my $word_polytopes = {"regions" => new Polytope(INEQUALITIES=>$regions_inequalities), + "links" => new Polytope(INEQUALITIES=>$links_inequalities), + "intersection" => new Polytope(INEQUALITIES=>$all_inequalities)}; + + return $word_polytopes; +} + +sub main { + my $polytopes_dir = dir($ARGV[0]); + + for my $polytope_file ($polytopes_dir->children) { + my $word_polytopes = read_inequalities_json($polytope_file); + my $intersection_polytope = $word_polytopes->{"intersection"}; + my $polytope_dim = $intersection_polytope->DIM; + + print "$polytope_file intersection polytope dimension $polytope_dim \n"; + } +} + +main() +``` + + + + + + + +%package -n python3-one-relator-curvature +Summary: A package for studying regular sectional curvature of one relator groups +Provides: python-one-relator-curvature +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-one-relator-curvature +# One Relator Curvature + +## About +This project provides an api for studying regular sectional curvature of one-relator groups. + + + +## Installation + +```pip install one-relator-curvature``` + + +## Usage +There are two different ways of using the project, either through a collection of command line exposed functions, or as an imported python module + +### CLI + +Some function are exposed as command line tools. + +* solve_example +* solve_examples +* get_all_cycle_data +* get_polytope +* get_polytopes + +### Example Usage + +### Using cli script +For solving all results in te given word range, this command stores database files in the output directory. + + +```one-relator-curvature solve_examples --output-dir /home/$USER/generated_examples --word-size-range 10 11``` + +To export polytope for a given word. Stores json for polytope in output directory + + +```one-relator-curvature get_polytope --word BabbAba -output-dir /home/$USER/polytope_examples``` + +To export polytopes for cycles of a given word. Stores json for polytope in output directory + + +```one-relator-curvature get_polytope --word BabbAba -output-dir /home/$USER/polytope_examples --cycles``` + + +#### Importing as Python Module + +``` +from one_relator_curvature.example import Example +import matplotlib.pyplot as plt + +example = Example("Babba") +example.generate_inequalities() +example.solve() +example.plot() +plt.show() +``` + +### Importing Polytopes into Polymake + +The following code can be run as a polymake script passing the directory of any polytopes output by the commands get_polytope and get_polytopes +``` + +use JSON::Parse 'json_file_to_perl'; +use JSON; +use Path::Class; +use application 'polytope'; + +sub read_inequalities_json { + my $inequalities_file = $_[0]; + my $inequalities = json_file_to_perl ($inequalities_file); + my $regions_inequalities = $inequalities->{"regions_inequalities"}; + my $links_inequalities = $inequalities->{"links_inequalities"}; + my $all_inequalities = (); + + push(@$all_inequalities, @$regions_inequalities); + push(@$all_inequalities, @$links_inequalities); + + my $word_polytopes = {"regions" => new Polytope(INEQUALITIES=>$regions_inequalities), + "links" => new Polytope(INEQUALITIES=>$links_inequalities), + "intersection" => new Polytope(INEQUALITIES=>$all_inequalities)}; + + return $word_polytopes; +} + +sub main { + my $polytopes_dir = dir($ARGV[0]); + + for my $polytope_file ($polytopes_dir->children) { + my $word_polytopes = read_inequalities_json($polytope_file); + my $intersection_polytope = $word_polytopes->{"intersection"}; + my $polytope_dim = $intersection_polytope->DIM; + + print "$polytope_file intersection polytope dimension $polytope_dim \n"; + } +} + +main() +``` + + + + + + + +%package help +Summary: Development documents and examples for one-relator-curvature +Provides: python3-one-relator-curvature-doc +%description help +# One Relator Curvature + +## About +This project provides an api for studying regular sectional curvature of one-relator groups. + + + +## Installation + +```pip install one-relator-curvature``` + + +## Usage +There are two different ways of using the project, either through a collection of command line exposed functions, or as an imported python module + +### CLI + +Some function are exposed as command line tools. + +* solve_example +* solve_examples +* get_all_cycle_data +* get_polytope +* get_polytopes + +### Example Usage + +### Using cli script +For solving all results in te given word range, this command stores database files in the output directory. + + +```one-relator-curvature solve_examples --output-dir /home/$USER/generated_examples --word-size-range 10 11``` + +To export polytope for a given word. Stores json for polytope in output directory + + +```one-relator-curvature get_polytope --word BabbAba -output-dir /home/$USER/polytope_examples``` + +To export polytopes for cycles of a given word. Stores json for polytope in output directory + + +```one-relator-curvature get_polytope --word BabbAba -output-dir /home/$USER/polytope_examples --cycles``` + + +#### Importing as Python Module + +``` +from one_relator_curvature.example import Example +import matplotlib.pyplot as plt + +example = Example("Babba") +example.generate_inequalities() +example.solve() +example.plot() +plt.show() +``` + +### Importing Polytopes into Polymake + +The following code can be run as a polymake script passing the directory of any polytopes output by the commands get_polytope and get_polytopes +``` + +use JSON::Parse 'json_file_to_perl'; +use JSON; +use Path::Class; +use application 'polytope'; + +sub read_inequalities_json { + my $inequalities_file = $_[0]; + my $inequalities = json_file_to_perl ($inequalities_file); + my $regions_inequalities = $inequalities->{"regions_inequalities"}; + my $links_inequalities = $inequalities->{"links_inequalities"}; + my $all_inequalities = (); + + push(@$all_inequalities, @$regions_inequalities); + push(@$all_inequalities, @$links_inequalities); + + my $word_polytopes = {"regions" => new Polytope(INEQUALITIES=>$regions_inequalities), + "links" => new Polytope(INEQUALITIES=>$links_inequalities), + "intersection" => new Polytope(INEQUALITIES=>$all_inequalities)}; + + return $word_polytopes; +} + +sub main { + my $polytopes_dir = dir($ARGV[0]); + + for my $polytope_file ($polytopes_dir->children) { + my $word_polytopes = read_inequalities_json($polytope_file); + my $intersection_polytope = $word_polytopes->{"intersection"}; + my $polytope_dim = $intersection_polytope->DIM; + + print "$polytope_file intersection polytope dimension $polytope_dim \n"; + } +} + +main() +``` + + + + + + + +%prep +%autosetup -n one-relator-curvature-0.3.3 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-one-relator-curvature -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 0.3.3-1 +- Package Spec generated |