Add files
This commit is contained in:
92
python/.gitignore
vendored
Normal file
92
python/.gitignore
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
# http://www.gnu.org/software/automake
|
||||
|
||||
Makefile.in
|
||||
|
||||
# http://www.gnu.org/software/autoconf
|
||||
|
||||
autom4te.cache
|
||||
aclocal.m4
|
||||
compile
|
||||
configure
|
||||
depcomp
|
||||
install-sh
|
||||
missing
|
||||
stamp-h1
|
||||
|
||||
config.*
|
||||
|
||||
libtool
|
||||
|
||||
Makefile
|
||||
!docs/Makefile
|
||||
|
||||
b2_class_test
|
||||
test_tree_interactive
|
||||
|
||||
|
||||
m4/libtool.m4
|
||||
m4/ltoptions.m4
|
||||
m4/ltsugar.m4
|
||||
m4/ltversion.m4
|
||||
m4/lt~obsolete.m4
|
||||
|
||||
serialization_test*
|
||||
|
||||
/config
|
||||
|
||||
.DS_Store
|
||||
*.dirstamp
|
||||
*.deps
|
||||
|
||||
*~
|
||||
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
|
||||
# Python folder
|
||||
%src
|
||||
*.pyc
|
||||
.idea
|
||||
|
||||
# Sphinx documentation
|
||||
docs/build/
|
||||
|
||||
# Setuptools distribution folder.
|
||||
/dist/
|
||||
|
||||
# Python egg metadata, regenerated from source files by setuptools.
|
||||
/*.egg-info
|
||||
|
||||
|
||||
# temporary files
|
||||
*.tmp
|
||||
|
||||
build/
|
||||
54
python/ADDITIONAL_GPL_TERMS
Normal file
54
python/ADDITIONAL_GPL_TERMS
Normal file
@@ -0,0 +1,54 @@
|
||||
Bertini(TM) version 2
|
||||
Authors: D.J. Bates, D.A. Brake, J.D. Hauenstein, A.J. Sommese, C.W. Wampler
|
||||
http://bertini.nd.edu
|
||||
Copyright(C) 2016
|
||||
|
||||
*NOTICE*
|
||||
|
||||
This program is free software in that it is free to download (as source code or as a binary) and free to use on the computer(s) to which it was downloaded. You may redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation (<http://www.gnu.org/licenses/>) with the additional terms and conditions listed below which are permitted under this license.
|
||||
|
||||
The following software modules shipped with Bertini have their own copyright: the
|
||||
GNU Multiple Precision Library (GMP) and the GNU MPFR Library (MPFR). This license covers those parts of Bertini's source code written by the Authors and Developers, excluding these particular modules. Copyrights and licenses for these modules have been included in the directory LICENSES.
|
||||
|
||||
|
||||
|
||||
ADDITIONAL TERMS AND CONDITIONS
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
All specified reasonable legal notices or author attributions in the program and source code must be preserved.
|
||||
|
||||
Misrepresenting the origin of the source code in this program or modified versions is prohibited. Any modified versions of the source code in this program must be marked in a reasonable way as to demonstrate that it is different from the original version. This includes providing a detailed list of the modifications.
|
||||
|
||||
The Authors limit the use of the name Bertini(TM) to the original version and, without written consent of all living Authors or their successors, prohibit the use of this name for any other program. Moreover, without written consent of all living Authors or their successors, the Authors decline to grant rights under trademark law for the use of the name Bertini(TM).
|
||||
|
||||
All programs dependent on this software must indemnify the Authors of this program against any contractual assumptions of liability to the recipient.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
In addition to the stated license, we ask that any publications which made use of any version of Bertini, directly or indirectly via a covered work, include an appropriate citation to Bertini, as described on the website http://bertini.nd.edu/policy.html, or any future Bertini page created by the Authors and/or Development Team.
|
||||
|
||||
Acknowledgements
|
||||
================
|
||||
|
||||
Current members of Bertini2 Development Team:
|
||||
-- Dan Bates, Colorado State University
|
||||
-- Dani Brake, University of Wisconsin Eau Claire
|
||||
-- Jeb Collins, University of Mary Washington
|
||||
-- Jonathan Hauenstein, University of Notre Dame
|
||||
-- Tim Hodges, Colorado State University
|
||||
-- Alan Liddell, Jr., University of Notre Dame
|
||||
-- Francesco Pancaldi, University of Notre Dame
|
||||
-- Hythem Sidkey, University of Notre Dame
|
||||
-- Andrew Sommese, University of Notre Dame
|
||||
-- Charles Wampler, General Motors Research and Development
|
||||
|
||||
The Authors and Development Team would like to express our gratitude for the financial support of the National Science Foundation.
|
||||
|
||||
Any opinions, findings, and conclusions or recommendations expressed in this material are those of the Authors and do not necessarily reflect those of the National Science Foundation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
18
python/AUTHORS
Normal file
18
python/AUTHORS
Normal file
@@ -0,0 +1,18 @@
|
||||
Acknowledgements
|
||||
================
|
||||
|
||||
Current members of Bertini2 Development Team:
|
||||
-- Dan Bates, Colorado State University
|
||||
-- Dani Brake, University of Wisconsin Eau Claire
|
||||
-- Jeb Collins, University of Mary Washington
|
||||
-- Jonathan Hauenstein, University of Notre Dame
|
||||
-- Tim Hodges, Colorado State University
|
||||
-- Alan Liddell, Jr., University of Notre Dame
|
||||
-- Francesco Pancaldi, University of Notre Dame
|
||||
-- Andrew Sommese, University of Notre Dame
|
||||
-- Charles Wampler, General Motors Research and Development
|
||||
|
||||
The Authors and Development Team would like to express our gratitude for the financial support of the National Science Foundation.
|
||||
|
||||
Any opinions, findings, and conclusions or recommendations expressed in this material are those of the Authors and do not necessarily reflect those of the National Science Foundation.
|
||||
|
||||
131
python/CMakeLists.txt
Normal file
131
python/CMakeLists.txt
Normal file
@@ -0,0 +1,131 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
project(pybertini)
|
||||
|
||||
# In order to find conda, run 'conda activate' and then use 'cmake .. -DCMAKE_PREFIX_PATH=$CONDA_PREFIX' when cmaking
|
||||
|
||||
# All source files to be compiled
|
||||
# We can either explicitly list all files or use glob, we chose to explicitly list files and not to glob
|
||||
#file(GLOB SOURCES src/*.cpp)
|
||||
|
||||
include_directories(include)
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
|
||||
|
||||
#Builds a C++ library and the python bindings around it
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
find_package(GMP REQUIRED)
|
||||
find_package(MPFR REQUIRED)
|
||||
find_package(MPC REQUIRED)
|
||||
|
||||
include_directories(${GMP_INCLUDES})
|
||||
include_directories(${MPC_INCLUDES})
|
||||
|
||||
find_package(eigenpy 3.3 REQUIRED CONFIG)
|
||||
|
||||
|
||||
# Find python and Boost - both are required dependencies
|
||||
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module NumPy)
|
||||
|
||||
# Without this, any build libraries automatically have names "lib{x}.so"
|
||||
set(CMAKE_SHARED_MODULE_PREFIX "")
|
||||
|
||||
# this should be OS-specific, as .so is only for macos and unix.
|
||||
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
|
||||
|
||||
|
||||
find_package(Eigen3 3.3 REQUIRED NO_MODULE)
|
||||
|
||||
# Eigenpy finds Boostpython, having our call to find boost libraries before the eigenpy call erases our call, so our call for boost libraries is after this line
|
||||
|
||||
find_package(bertini2 REQUIRED)
|
||||
|
||||
find_package(Boost 1.82 REQUIRED
|
||||
COMPONENTS
|
||||
serialization
|
||||
wserialization
|
||||
unit_test_framework
|
||||
filesystem
|
||||
system
|
||||
chrono
|
||||
regex
|
||||
timer
|
||||
log
|
||||
thread
|
||||
log_setup
|
||||
python${Python_VERSION_MAJOR}${Python_VERSION_MINOR} # uses the versions found by find_package(Python3 ...) above.
|
||||
)
|
||||
|
||||
set(PYBERTINI_HEADERS
|
||||
include/bertini_python.hpp
|
||||
include/eigenpy_interaction.hpp
|
||||
include/function_tree_export.hpp
|
||||
include/mpfr_export.hpp
|
||||
include/random_export.hpp
|
||||
include/node_export.hpp
|
||||
include/symbol_export.hpp
|
||||
include/operator_export.hpp
|
||||
include/root_export.hpp
|
||||
include/system_export.hpp
|
||||
include/tracker_export.hpp
|
||||
include/endgame_export.hpp
|
||||
include/parser_export.hpp
|
||||
include/generic_observer.hpp
|
||||
include/generic_observable.hpp
|
||||
include/tracker_observers.hpp
|
||||
include/endgame_observers.hpp
|
||||
include/detail.hpp
|
||||
include/logging.hpp
|
||||
)
|
||||
|
||||
set(PYBERTINI_SOURCES
|
||||
src/eigenpy_interaction.cpp
|
||||
src/logging.cpp
|
||||
src/detail.cpp
|
||||
src/containers.cpp
|
||||
src/tracker_export.cpp
|
||||
src/endgame_export.cpp
|
||||
src/random_export.cpp
|
||||
src/mpfr_export.cpp
|
||||
src/node_export.cpp
|
||||
src/symbol_export.cpp
|
||||
src/operator_export.cpp
|
||||
src/root_export.cpp
|
||||
src/system_export.cpp
|
||||
src/parser_export.cpp
|
||||
src/generic_observable.cpp
|
||||
src/generic_observer.cpp
|
||||
src/tracker_observers.cpp
|
||||
src/endgame_observers.cpp
|
||||
src/zero_dim_export.cpp
|
||||
src/bertini_python.cpp
|
||||
)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_PHOENIX_STL_TUPLE_H_")
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
add_library(_pybertini SHARED ${PYBERTINI_SOURCES} ${PYBERTINI_HEADERS})
|
||||
set_property(TARGET _pybertini PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
set_target_properties(_pybertini PROPERTIES PREFIX "")
|
||||
install(TARGETS _pybertini
|
||||
DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/pybertini/")
|
||||
|
||||
target_link_libraries(_pybertini ${GMP_LIBRARIES})
|
||||
target_link_libraries(_pybertini ${MPFR_LIBRARIES})
|
||||
target_link_libraries(_pybertini ${MPC_LIBRARIES})
|
||||
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
include_directories(${PYTHON_INCLUDE_DIRS})
|
||||
include_directories(${Python3_NumPy_INCLUDE_DIRS})
|
||||
include_directories(${Bertini2_INCLUDES})
|
||||
|
||||
target_link_libraries(_pybertini Eigen3::Eigen)
|
||||
target_link_libraries(_pybertini eigenpy::eigenpy)
|
||||
target_link_libraries(_pybertini ${Bertini2_LIBRARIES})
|
||||
target_link_libraries(_pybertini ${Boost_LIBRARIES})
|
||||
|
||||
#include(CMakePrintHelpers)
|
||||
674
python/COPYING
Normal file
674
python/COPYING
Normal file
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
0
python/ChangeLog
Normal file
0
python/ChangeLog
Normal file
368
python/INSTALL
Normal file
368
python/INSTALL
Normal file
@@ -0,0 +1,368 @@
|
||||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell command './configure && make && make install'
|
||||
should configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the 'README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
'INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The 'configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a 'Makefile' in each directory of the package.
|
||||
It may also create one or more '.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script 'config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file 'config.log' containing compiler output (useful mainly for
|
||||
debugging 'configure').
|
||||
|
||||
It can also use an optional file (typically called 'config.cache' and
|
||||
enabled with '--cache-file=config.cache' or simply '-C') that saves the
|
||||
results of its tests to speed up reconfiguring. Caching is disabled by
|
||||
default to prevent problems with accidental use of stale cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how 'configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the 'README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point 'config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file 'configure.ac' (or 'configure.in') is used to create
|
||||
'configure' by a program called 'autoconf'. You need 'configure.ac' if
|
||||
you want to change it or regenerate 'configure' using a newer version of
|
||||
'autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. 'cd' to the directory containing the package's source code and type
|
||||
'./configure' to configure the package for your system.
|
||||
|
||||
Running 'configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type 'make' to compile the package.
|
||||
|
||||
3. Optionally, type 'make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type 'make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the 'make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. Optionally, type 'make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior 'make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing 'make clean'. To also remove the
|
||||
files that 'configure' created (so you can compile the package for
|
||||
a different kind of computer), type 'make distclean'. There is
|
||||
also a 'make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type 'make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide 'make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like 'make install' and 'make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the 'configure' script does not know about. Run './configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give 'configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here is
|
||||
an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU 'make'. 'cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the 'configure' script. 'configure' automatically checks for the source
|
||||
code in the directory that 'configure' is in and in '..'. This is known
|
||||
as a "VPATH" build.
|
||||
|
||||
With a non-GNU 'make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use 'make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple '-arch' options to the
|
||||
compiler but only a single '-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the 'lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, 'make install' installs the package's commands under
|
||||
'/usr/local/bin', include files under '/usr/local/include', etc. You
|
||||
can specify an installation prefix other than '/usr/local' by giving
|
||||
'configure' the option '--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like '--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run 'configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the default
|
||||
for these options is expressed in terms of '${prefix}', so that
|
||||
specifying just '--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to 'configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
'make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, 'make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
'${prefix}'. Any directories that were specified during 'configure',
|
||||
but not in terms of '${prefix}', must each be overridden at install time
|
||||
for the entire installation to be relocated. The approach of makefile
|
||||
variable overrides for each directory variable is required by the GNU
|
||||
Coding Standards, and ideally causes no recompilation. However, some
|
||||
platforms have known limitations with the semantics of shared libraries
|
||||
that end up requiring recompilation when using this method, particularly
|
||||
noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the 'DESTDIR' variable. For
|
||||
example, 'make install DESTDIR=/alternate/directory' will prepend
|
||||
'/alternate/directory' before all installation names. The approach of
|
||||
'DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of '${prefix}'
|
||||
at 'configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving 'configure' the
|
||||
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
|
||||
|
||||
Some packages pay attention to '--enable-FEATURE' options to
|
||||
'configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
|
||||
is something like 'gnu-as' or 'x' (for the X Window System). The
|
||||
'README' should mention any '--enable-' and '--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, 'configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the 'configure' options '--x-includes=DIR' and
|
||||
'--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of 'make' will be. For these packages, running './configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with 'make V=1'; while running './configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with 'make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC
|
||||
is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
HP-UX 'make' updates targets which have the same timestamps as their
|
||||
prerequisites, which makes it generally unusable when shipped generated
|
||||
files such as 'configure' are involved. Use GNU 'make' instead.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its '<wchar.h>' header file. The option '-nodtk' can be used as a
|
||||
workaround. If GNU CC is not installed, it is therefore recommended to
|
||||
try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
|
||||
in your 'PATH', put it _after_ '/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in '/boot/common',
|
||||
not '/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features 'configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, 'configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
'--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as 'sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file 'config.sub' for the possible values of each field. If
|
||||
'config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option '--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with '--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for 'configure' scripts to share,
|
||||
you can create a site shell script called 'config.site' that gives
|
||||
default values for variables like 'CC', 'cache_file', and 'prefix'.
|
||||
'configure' looks for 'PREFIX/share/config.site' if it exists, then
|
||||
'PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
'CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all 'configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to 'configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the 'configure' command line, using 'VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified 'gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
|
||||
Autoconf limitation. Until the limitation is lifted, you can use this
|
||||
workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
'configure' Invocation
|
||||
======================
|
||||
|
||||
'configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
'--help'
|
||||
'-h'
|
||||
Print a summary of all of the options to 'configure', and exit.
|
||||
|
||||
'--help=short'
|
||||
'--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
'configure', and exit. The 'short' variant lists options used only
|
||||
in the top level, while the 'recursive' variant lists options also
|
||||
present in any nested packages.
|
||||
|
||||
'--version'
|
||||
'-V'
|
||||
Print the version of Autoconf used to generate the 'configure'
|
||||
script, and exit.
|
||||
|
||||
'--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally 'config.cache'. FILE defaults to '/dev/null' to
|
||||
disable caching.
|
||||
|
||||
'--config-cache'
|
||||
'-C'
|
||||
Alias for '--cache-file=config.cache'.
|
||||
|
||||
'--quiet'
|
||||
'--silent'
|
||||
'-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to '/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
'--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
'configure' can determine that directory automatically.
|
||||
|
||||
'--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names:: for
|
||||
more details, including other options available for fine-tuning the
|
||||
installation locations.
|
||||
|
||||
'--no-create'
|
||||
'-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
'configure' also accepts some other, not widely useful, options. Run
|
||||
'configure --help' for more details.
|
||||
0
python/NEWS
Normal file
0
python/NEWS
Normal file
33
python/README
Normal file
33
python/README
Normal file
@@ -0,0 +1,33 @@
|
||||
As a user, skip to step 2. as a developer, to compile this project, you need to
|
||||
|
||||
1) Regenerate the configure script, and some other m4 macros, etc, so that the build system is complete. This requires the autotools, modern versions. The command for this is
|
||||
|
||||
autoreconf -vfi
|
||||
|
||||
The -vfi flags are for (v)erbose, (f)orce, and (i)nstall. If this step fails, you almost certainly have outdated autotools software, most namely automake, autoconf, and libtool. Update your tools as necessary.
|
||||
|
||||
On Linux machines, you may have to run the command
|
||||
|
||||
libttoolize
|
||||
|
||||
in order to get autoreconf to work.
|
||||
|
||||
--------------
|
||||
|
||||
As a user, or maintainer, engage in the standard build process for any software built using the autotools.
|
||||
|
||||
2) ./configure (with your options)
|
||||
|
||||
3) make
|
||||
|
||||
Then, if you want to, you can run the test programs. So far, there is one: b2_class_test. It is built using the Boost.UnitTest library, and can produce a variety of output files, and be run in a variety of modes. These options are not documented here.
|
||||
|
||||
-------------
|
||||
|
||||
notes:
|
||||
|
||||
If you add files to the project, or wish to add a compiled program, etc, you modify the b2/core/Makefile.am, and a b2/core/path/to/Makemodule.am file, or possibly create a Makemodule.am file at the correct location. If you need help with this, please contact Dani Brake brakeda@uwec.edu
|
||||
|
||||
Please do not commit autotools-built files to the repository, including the configure script, any file in the created b2/core/config/ folder, or the others. There is a chance you may have to add a m4 macro or something, and this is ok. Do what you need, but commit only the source files, not generated files.
|
||||
|
||||
Please maintain this file by editing it as necessary.
|
||||
1
python/cmake/FindGMP.cmake
Symbolic link
1
python/cmake/FindGMP.cmake
Symbolic link
@@ -0,0 +1 @@
|
||||
../../core/cmake/FindGMP.cmake
|
||||
1
python/cmake/FindMPC.cmake
Symbolic link
1
python/cmake/FindMPC.cmake
Symbolic link
@@ -0,0 +1 @@
|
||||
../../core/cmake/FindMPC.cmake
|
||||
1
python/cmake/FindMPFR.cmake
Symbolic link
1
python/cmake/FindMPFR.cmake
Symbolic link
@@ -0,0 +1 @@
|
||||
../../core/cmake/FindMPFR.cmake
|
||||
17
python/cmake/Findbertini2.cmake
Normal file
17
python/cmake/Findbertini2.cmake
Normal file
@@ -0,0 +1,17 @@
|
||||
if(WIN32)
|
||||
find_path(Bertini2_INCLUDE_DIR
|
||||
NAMES bertini2
|
||||
PATHS "$ENV{BERTINI2_DIR}/Include")
|
||||
find_library(Bertini2_LIBRARY
|
||||
NAMES bertini2
|
||||
PATHS "$ENV{BERTINI2_DIR}/Lib")
|
||||
elseif(UNIX)
|
||||
find_path(Bertini2_INCLUDE_DIR
|
||||
NAMES bertini2/bertini.hpp
|
||||
PATHS "$ENV{BERTINI2_DIR}/include" ${INCLUDE_INSTALL_DIR})
|
||||
find_library(Bertini2_LIBRARY
|
||||
NAMES bertini2
|
||||
PATHS "$ENV{BERTINI2_DIR}/lib" ${LIB_INSTALL_DIR})
|
||||
endif()
|
||||
set(Bertini2_INCLUDES ${Bertini2_INCLUDE_DIR})
|
||||
set(Bertini2_LIBRARIES ${Bertini2_LIBRARY})
|
||||
20
python/docs/Makefile
Normal file
20
python/docs/Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
# Minimal makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
SPHINXPROJ = pybertini
|
||||
SOURCEDIR = source
|
||||
BUILDDIR = build
|
||||
|
||||
# Put it first so that "make" without argument is like "make help".
|
||||
help:
|
||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
.PHONY: help Makefile
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%: Makefile
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
1
python/docs/source/_static/.gitignore
vendored
Normal file
1
python/docs/source/_static/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# for _static
|
||||
6
python/docs/source/building.rst
Normal file
6
python/docs/source/building.rst
Normal file
@@ -0,0 +1,6 @@
|
||||
🛠 Building PyBertini
|
||||
****************************
|
||||
|
||||
This part is unsatisfactory to me. I really wish the package would just detect dependencies, and build itself. However, since there is a C++ library behind it, this is not yet implemented. For now, you have to configure, compile, and install yourself.
|
||||
|
||||
Please see `the b2 wiki entry for compilation <https://github.com/bertiniteam/b2/wiki/Compilation-Guide>`_
|
||||
190
python/docs/source/conf.py
Normal file
190
python/docs/source/conf.py
Normal file
@@ -0,0 +1,190 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# PyBertini documentation build configuration file, created by
|
||||
# sphinx-quickstart on Wed Oct 4 23:28:46 2017.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#
|
||||
# import os
|
||||
# import sys
|
||||
# sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# stuff to get autodoc to work. silviana amethyst
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0,os.path.abspath('../../.libs'))
|
||||
sys.path.insert(0, os.path.abspath('../..'))
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#
|
||||
# needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = ['sphinx.ext.autodoc',
|
||||
'sphinx.ext.doctest',
|
||||
'sphinx.ext.todo',
|
||||
'sphinx.ext.coverage',
|
||||
'sphinx.ext.mathjax',
|
||||
'sphinx.ext.githubpages',
|
||||
'sphinx.ext.autosectionlabel',
|
||||
'sphinxcontrib.bibtex']
|
||||
|
||||
bibtex_bibfiles = ['../../../doc_resources/bertini2.bib']
|
||||
|
||||
# 'sphinx.ext.autosectionlabel_prefix_document',
|
||||
autodoc_default_flags = ['members', 'undoc-members','show-inheritance']
|
||||
#, 'special-members'
|
||||
#, , 'inherited-members'
|
||||
|
||||
# see http://www.sphinx-doc.org/en/stable/ext/autodoc.html#confval-autoclass_content
|
||||
autoclass_content = 'both'
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix(es) of source filenames.
|
||||
# You can specify multiple suffix as a list of string:
|
||||
#
|
||||
# source_suffix = ['.rst', '.md']
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = 'PyBertini'
|
||||
copyright = '2015-2021, Bertini Team'
|
||||
author = 'Bertini Team'
|
||||
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
try:
|
||||
import git #package gitpython
|
||||
repo = git.Repo(search_parent_directories=True)
|
||||
last_commit = str(repo.head.commit)
|
||||
version = last_commit[:7]
|
||||
release = last_commit # full version
|
||||
except:
|
||||
last_commit = 'gitpython not installed'
|
||||
version = last_commit # The short X.Y version.
|
||||
release = version # The full version, including alpha/beta/rc tags.
|
||||
|
||||
|
||||
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#
|
||||
# This is also used if you do content translation via gettext catalogs.
|
||||
# Usually you set "language" from the command line for these cases.
|
||||
language = None
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
# This patterns also effect to html_static_path and html_extra_path
|
||||
exclude_patterns = ['test']
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||
todo_include_todos = True
|
||||
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
#
|
||||
html_theme = 'bizstyle'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#
|
||||
# html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
|
||||
# -- Options for HTMLHelp output ------------------------------------------
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'PyBertinidoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#
|
||||
# 'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#
|
||||
# 'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#
|
||||
# 'preamble': '',
|
||||
|
||||
# Latex figure (float) alignment
|
||||
#
|
||||
# 'figure_align': 'htbp',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'PyBertini.tex', 'PyBertini Documentation',
|
||||
'Bertini Team', 'manual'),
|
||||
]
|
||||
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'pybertini', 'PyBertini Documentation',
|
||||
[author], 1)
|
||||
]
|
||||
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'PyBertini', 'PyBertini Documentation',
|
||||
author, 'PyBertini', 'Software for Numerical Algebraic Geometry.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
|
||||
|
||||
html_logo = "images/bpy_icon_.svg"
|
||||
|
||||
4
python/docs/source/detailed/common_doc_nav.incl
Normal file
4
python/docs/source/detailed/common_doc_nav.incl
Normal file
@@ -0,0 +1,4 @@
|
||||
quick nav links:
|
||||
|
||||
* jump to :ref:`👩🔧 Detailed`
|
||||
* jump to :ref:`🔦 Tutorials`
|
||||
30
python/docs/source/detailed/configs.rst
Normal file
30
python/docs/source/detailed/configs.rst
Normal file
@@ -0,0 +1,30 @@
|
||||
🎛 Configurations for algorithms, trackers, endgames, etc
|
||||
===================================================================
|
||||
|
||||
.. include:: common_doc_nav.incl
|
||||
|
||||
🛤 Tracking configs
|
||||
---------------------------
|
||||
|
||||
* :class:`pybertini.tracking.config.SteppingConfig`
|
||||
* :class:`pybertini.tracking.config.NewtonConfig`
|
||||
* :class:`pybertini.tracking.config.AMPConfig`
|
||||
* :class:`pybertini.tracking.config.FixedPrecisionConfig`
|
||||
|
||||
.. autoclass:: pybertini.tracking.config.SteppingConfig
|
||||
|
||||
.. autoclass:: pybertini.tracking.config.NewtonConfig
|
||||
|
||||
.. autoclass:: pybertini.tracking.config.AMPConfig
|
||||
|
||||
.. autoclass:: pybertini.tracking.config.FixedPrecisionConfig
|
||||
|
||||
|
||||
🎮 Endgame configs
|
||||
-------------------------
|
||||
|
||||
.. autoclass:: pybertini.endgame.config.Endgame
|
||||
|
||||
Algorithm configs
|
||||
---------------------------
|
||||
|
||||
15
python/docs/source/detailed/containers.rst
Normal file
15
python/docs/source/detailed/containers.rst
Normal file
@@ -0,0 +1,15 @@
|
||||
🕳 pybertini.list
|
||||
=====================
|
||||
|
||||
.. include:: common_doc_nav.incl
|
||||
|
||||
Notes
|
||||
--------
|
||||
|
||||
These types are exposed to Python, because they are returned types from some function or another. They should be fully interoperable with regular lists, except they can't contain arbitrary things.
|
||||
|
||||
|
||||
Auto-generated docs
|
||||
--------------------
|
||||
|
||||
.. automodule:: pybertini.list
|
||||
31
python/docs/source/detailed/cpp_side.rst
Normal file
31
python/docs/source/detailed/cpp_side.rst
Normal file
@@ -0,0 +1,31 @@
|
||||
🗡 C++-flavored gory-detail documentation
|
||||
===============================================
|
||||
|
||||
.. include:: common_doc_nav.incl
|
||||
|
||||
_pybertini
|
||||
-------------------
|
||||
|
||||
.. automodule:: _pybertini
|
||||
|
||||
|
||||
_pybertini.function_tree
|
||||
----------------------------
|
||||
|
||||
.. automodule:: _pybertini.function_tree
|
||||
|
||||
|
||||
|
||||
_pybertini.tracking
|
||||
----------------------
|
||||
|
||||
.. automodule:: _pybertini.tracking
|
||||
|
||||
|
||||
|
||||
_pybertini.endgames
|
||||
----------------------
|
||||
|
||||
.. automodule:: _pybertini.endgame
|
||||
|
||||
|
||||
49
python/docs/source/detailed/detailed.rst
Normal file
49
python/docs/source/detailed/detailed.rst
Normal file
@@ -0,0 +1,49 @@
|
||||
👩🔧 Detailed
|
||||
*******************
|
||||
|
||||
.. include:: common_doc_nav.incl
|
||||
|
||||
This is a stub page, which merely acts to point you to more specific places in the documentation. Table of contents below 🔽.
|
||||
|
||||
🖍 Highlights
|
||||
--------------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
configs
|
||||
|
||||
⚙️ Modules
|
||||
-------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
top_level
|
||||
doubleprec
|
||||
multiprec
|
||||
function_tree
|
||||
system
|
||||
start_system
|
||||
tracking
|
||||
endgame
|
||||
parse
|
||||
containers
|
||||
logging
|
||||
|
||||
|
||||
🎱 Things you probably don't need
|
||||
----------------------------------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
cpp_side
|
||||
🕸 PyBertini doc archives <https://doc.bertini2.org/pybertini_archives>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
12
python/docs/source/detailed/doubleprec.rst
Normal file
12
python/docs/source/detailed/doubleprec.rst
Normal file
@@ -0,0 +1,12 @@
|
||||
2️⃣ pybertini.doubleprec
|
||||
==============================
|
||||
|
||||
.. include:: common_doc_nav.incl
|
||||
|
||||
Notes
|
||||
--------
|
||||
|
||||
Auto-generated docs
|
||||
--------------------
|
||||
|
||||
.. automodule:: pybertini.doubleprec
|
||||
21
python/docs/source/detailed/endgame.rst
Normal file
21
python/docs/source/detailed/endgame.rst
Normal file
@@ -0,0 +1,21 @@
|
||||
🎮 pybertini.endgame
|
||||
==========================
|
||||
|
||||
.. include:: common_doc_nav.incl
|
||||
|
||||
Notes
|
||||
--------
|
||||
|
||||
Auto-generated docs
|
||||
--------------------
|
||||
|
||||
|
||||
.. automodule:: pybertini.endgame
|
||||
|
||||
|
||||
🎮 pybertini.endgame.config
|
||||
=====================================
|
||||
|
||||
.. automodule:: pybertini.endgame.config
|
||||
|
||||
|
||||
26
python/docs/source/detailed/function_tree.rst
Normal file
26
python/docs/source/detailed/function_tree.rst
Normal file
@@ -0,0 +1,26 @@
|
||||
🌳 pybertini.function_tree
|
||||
===================================
|
||||
|
||||
.. include:: common_doc_nav.incl
|
||||
|
||||
Notes
|
||||
--------
|
||||
|
||||
Auto-generated docs
|
||||
--------------------
|
||||
|
||||
.. automodule:: pybertini.function_tree
|
||||
:members:
|
||||
|
||||
🌳 pybertini.function_tree.symbol
|
||||
======================================
|
||||
|
||||
.. automodule:: pybertini.function_tree.symbol
|
||||
:members:
|
||||
|
||||
|
||||
🌳 pybertini.function_tree.root
|
||||
==================================
|
||||
|
||||
.. automodule:: pybertini.function_tree.root
|
||||
:members:
|
||||
18
python/docs/source/detailed/logging.rst
Normal file
18
python/docs/source/detailed/logging.rst
Normal file
@@ -0,0 +1,18 @@
|
||||
📋 pybertini.logging
|
||||
=====================
|
||||
|
||||
.. include:: common_doc_nav.incl
|
||||
|
||||
Notes
|
||||
--------
|
||||
|
||||
Logging is enabled for PyBertini through Bertini2's core logging facilities, in turn powered by Boost.Log.
|
||||
|
||||
They currently aren't fancy, but you have a few things you can do.
|
||||
|
||||
#. Adjust the level. See :class:`~pybertini.logging.severity_level` and :func:`~pybertini.logging.set_level`
|
||||
|
||||
Auto-generated docs
|
||||
--------------------
|
||||
|
||||
.. automodule:: pybertini.logging
|
||||
12
python/docs/source/detailed/multiprec.rst
Normal file
12
python/docs/source/detailed/multiprec.rst
Normal file
@@ -0,0 +1,12 @@
|
||||
🃏 pybertini.multiprec
|
||||
============================
|
||||
|
||||
.. include:: common_doc_nav.incl
|
||||
|
||||
Notes
|
||||
--------
|
||||
|
||||
Auto-generated docs
|
||||
--------------------
|
||||
|
||||
.. automodule:: pybertini.multiprec
|
||||
12
python/docs/source/detailed/parse.rst
Normal file
12
python/docs/source/detailed/parse.rst
Normal file
@@ -0,0 +1,12 @@
|
||||
💬 pybertini.parse
|
||||
=====================
|
||||
|
||||
.. include:: common_doc_nav.incl
|
||||
|
||||
Notes
|
||||
--------
|
||||
|
||||
Auto-generated docs
|
||||
--------------------
|
||||
|
||||
.. automodule:: pybertini.parse
|
||||
12
python/docs/source/detailed/start_system.rst
Normal file
12
python/docs/source/detailed/start_system.rst
Normal file
@@ -0,0 +1,12 @@
|
||||
🚦 pybertini.system.start_system
|
||||
==================================
|
||||
|
||||
.. include:: common_doc_nav.incl
|
||||
|
||||
Notes
|
||||
--------
|
||||
|
||||
Auto-generated docs
|
||||
--------------------
|
||||
|
||||
.. automodule:: pybertini.system.start_system
|
||||
12
python/docs/source/detailed/system.rst
Normal file
12
python/docs/source/detailed/system.rst
Normal file
@@ -0,0 +1,12 @@
|
||||
🏙 pybertini.system
|
||||
==========================
|
||||
|
||||
.. include:: common_doc_nav.incl
|
||||
|
||||
Notes
|
||||
--------
|
||||
|
||||
Auto-generated docs
|
||||
--------------------
|
||||
|
||||
.. automodule:: pybertini.system
|
||||
29
python/docs/source/detailed/top_level.rst
Normal file
29
python/docs/source/detailed/top_level.rst
Normal file
@@ -0,0 +1,29 @@
|
||||
🔝 pybertini
|
||||
==================
|
||||
|
||||
.. include:: common_doc_nav.incl
|
||||
|
||||
Namespaces
|
||||
-------------
|
||||
|
||||
* :py:mod:`~pybertini.multiprec`
|
||||
* :py:mod:`~pybertini.system`
|
||||
* :py:mod:`~pybertini.function_tree`
|
||||
* :py:mod:`~pybertini.tracking`
|
||||
* :py:mod:`~pybertini.endgame`
|
||||
|
||||
|
||||
|
||||
Convenience
|
||||
------------
|
||||
|
||||
For your convenience, these things have been placed in the root level `pybertini` namespace:
|
||||
|
||||
* :class:`~pybertini.system.System`
|
||||
* :class:`~pybertini.function_tree.symbol.Variable`
|
||||
* :class:`~pybertini.function_tree.VariableGroup`
|
||||
|
||||
There's not a whole lot else at this level. Pybertini mostly exists in submodules, to help things be organized.
|
||||
|
||||
|
||||
|
||||
54
python/docs/source/detailed/tracking.rst
Normal file
54
python/docs/source/detailed/tracking.rst
Normal file
@@ -0,0 +1,54 @@
|
||||
🛤 pybertini.tracking
|
||||
===========================
|
||||
|
||||
.. include:: common_doc_nav.incl
|
||||
|
||||
Notes
|
||||
--------
|
||||
|
||||
Trackers in Bertini2 are stateful objects, that refer to a system they are tracking, hold their specific settings, and have a notion of current time and space value.
|
||||
|
||||
Here are some particular classes and functions to pay attention to:
|
||||
|
||||
* :class:`pybertini.tracking.AMPTracker`
|
||||
* :class:`pybertini.tracking.DoublePrecisionTracker`
|
||||
* :class:`pybertini.tracking.MultiplePrecisionTracker`
|
||||
|
||||
Here are the implemented ODE predictors you can choose from:
|
||||
|
||||
* :class:`pybertini.tracking.Predictor`
|
||||
|
||||
Calls to :meth:`track_path` return a :class:`pybertini.tracking.SuccessCode`.
|
||||
|
||||
And, trackers are implemented using observer pattern. They live in the ``pybertini.tracking.observers`` namespace, with provisions for each tracker type available under a submodule thereof: ``amp``, ``multiple``, and ``double``. They are also conveniently available using the ``tr.observers``, where ``tr`` is a tracker you already made. See :mod:`pybertini.tracking.observers.amp`
|
||||
|
||||
|
||||
Auto-generated docs
|
||||
--------------------
|
||||
|
||||
.. automodule:: pybertini.tracking
|
||||
|
||||
|
||||
🛤 pybertini.tracking.config
|
||||
=====================================
|
||||
|
||||
.. automodule:: pybertini.tracking.config
|
||||
|
||||
|
||||
🛤 pybertini.tracking.observers
|
||||
===================================
|
||||
|
||||
📝 All of these are available for all trackers, though you should use the ones for your tracker type. Look in ``pybertini.tracking.AMPTracker.observers``, etc.
|
||||
|
||||
.. automodule:: pybertini.tracking.observers
|
||||
|
||||
#. ``pybertini.tracking.observers.amp``
|
||||
#. ``pybertini.tracking.observers.double``
|
||||
#. ``pybertini.tracking.observers.multiple``
|
||||
|
||||
📝 Symmetrically, there are the same observers in all three.
|
||||
|
||||
.. automodule:: pybertini.tracking.observers.amp
|
||||
|
||||
|
||||
Know that you are loved and appreciated, dear reader. 💟
|
||||
140
python/docs/source/images/bpy_icon_.svg
Normal file
140
python/docs/source/images/bpy_icon_.svg
Normal file
@@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
viewBox="0 0 54 46"
|
||||
height="46pt"
|
||||
width="54pt">
|
||||
<metadata
|
||||
id="metadata43">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<!--latexit:AAAFvXjadVRdbFRFFJ5hpqV0Kd22UEqh7WK3glrKtoILQmtb2q1YulR2t912d7vO
|
||||
3ju7vfT+ee8sstxsMvEHH/BfYwwRpSX+lBhFo8agD8aEGG1MtCW+kvjiky+++Orc
|
||||
3RWpwTu5mTNnzpzznTPfmYypKjYLBG7CDQhXVT91Nu4/Qy1bMfS438icphKzZ/zE
|
||||
kuYVoY76mWE2Anj+8ife3Rtrdt/T6e+6d8/e++5/oPfQ4f6hsUfDJ6fjybQkz6uG
|
||||
zWJ+Pa+qa5tqPZubfdPhSM8CLdizYq74nfJLKrHt5bot9d6Gxqat2/gGjjjmVbya
|
||||
b+Q1fBOvXd7esqN156629g7u4Zv5Fl7PG3gr38nbeDv3xTPEpqqi05hkqIYV1QyZ
|
||||
xpjCVBo3LUq0jEpTGsnpSlaRCBMpRWXCaNpbnyHSQs4y8rp8zD04axt5S6JRepZ1
|
||||
gsq31r3P07M/EAtHTo0NJ8ORkmHEJBINBXxiAC/kdat9Dx44OFtOQycajZdFak9X
|
||||
Diw9FPxHjIcjJ0t5e/Gq5+EjR2dEIWxmKXqOeyeFo4FHBLBwZCLPiMAdKe1cGRgM
|
||||
inPlxdqw59jIaOj2WoAaYkLK5Bm1eSPfwZvSDdBJyoaU16jOSlASvQGTpRxiMUVS
|
||||
abE2mbepSGKB5GhCiC5oO+WUylf0dQmN7Msalvh15itp7zzhEM22C1pGWGqEzdv/
|
||||
3XOVd9tL5Fn2UMpRdFNA1aVyoGxe9THDxwom9cmKJQqjFoRAJEsRWH3SPLGIxAQV
|
||||
13kiB0xiUqtbI1ZO0ft7Fb1bJbpsS0KbcnLU0CizCsXaddBcQMwwVFvkP0JFXSw6
|
||||
SURIeUSwR1NEkKREFdVJqu5UdJJWaf5f46xqGJawLs2ueVmodal+fHxi8TG+dfEE
|
||||
38ZbpsKRkKjkzcnHT3ki0diUWEeUc1RcYTakkpwt1mFxA52De8uk83p5M98+NWHo
|
||||
RDIEJ2ZmKx6WEsGKJLSpOXH1I4rkMppYhaVUUCifIGlv4x2MkMskWcoE76rvHBwu
|
||||
h1ylnmzObU6mCCBD31Z/vfJ7vobvEi6V0yLmiOiYpYVgRXK7QtsfCPX6xAC8zuWk
|
||||
ORriHSX2eduTbqkzGWe4mHaSTPSTblgaUR2zUCzO9Qmf+TNpb9Ntlv+bxJV8Klji
|
||||
/zgtUHmo8t78UjgXtQyDcQhqQANoBZ1gH+gDQZAABMwDEzjgafACeAm8Al4Db4A3
|
||||
wVvgIngbvAM+BFfBR+BjcA18Bj4HX4KvwHXwDbgBVsDP4FdwC/wB/oQY1sMW2AG7
|
||||
YB88DI/AfjgMJ+AUnIMEKtCCDBbgM/A5eB5egJfgIrwKP4XX4ffwB7gCf0InUATF
|
||||
0DSaQQmUQjLSEENF9Cx6Eb2MXkWvo4voXfQ+WkbX0BfoO3QD/Yhuod/QXxjgKlyH
|
||||
m3ELbsN+vAf34IP4KB7Ao3gMH8fjWMVP4ufxBXwJX8bvla9oA6y8SQ5Y9+EP/gbj
|
||||
f94X
|
||||
-->
|
||||
<defs
|
||||
id="defs4">
|
||||
<g
|
||||
id="g6">
|
||||
<symbol
|
||||
id="glyph0-0"
|
||||
overflow="visible">
|
||||
<path
|
||||
id="path9"
|
||||
d=""
|
||||
style="stroke:none;" />
|
||||
</symbol>
|
||||
<symbol
|
||||
id="glyph0-1"
|
||||
overflow="visible">
|
||||
<path
|
||||
id="path12"
|
||||
d="M 5.015625 -21.296875 C 5.015625 -21.765625 5.015625 -22.65625 4.703125 -23.3125 L 8.609375 -23.3125 C 8.140625 -22.734375 8.140625 -22.015625 8.140625 -21.484375 L 8.140625 -3.078125 C 8.140625 -2.546875 8.140625 -1.828125 8.609375 -1.25 L 4.703125 -1.25 C 5.015625 -1.90625 5.015625 -2.796875 5.015625 -3.265625 Z M 14.78125 -13.765625 C 15.953125 -14.921875 16.25 -16.75 16.25 -18.28125 C 16.25 -20.765625 15.453125 -22.296875 14.625 -23.171875 C 17.109375 -22.875 19.65625 -21.984375 19.65625 -18.4375 C 19.65625 -16.140625 17.140625 -14.265625 14.78125 -13.765625 Z M 9.390625 -21.375 C 9.390625 -22.09375 9.390625 -22.484375 9.890625 -22.875 C 10.046875 -22.953125 10.578125 -23.3125 11.4375 -23.3125 C 13.015625 -23.3125 14.984375 -22.046875 14.984375 -18.28125 C 14.984375 -14.265625 12.9375 -13.40625 9.390625 -13.34375 Z M 16.921875 -13.15625 C 18.9375 -14.203125 20.90625 -16 20.90625 -18.4375 C 20.90625 -23.421875 16.78125 -24.5625 12.40625 -24.5625 L 1.546875 -24.5625 C 0.890625 -24.5625 0.328125 -24.5625 0.328125 -23.921875 C 0.328125 -23.3125 0.9375 -23.3125 1.5 -23.3125 C 3.65625 -23.3125 3.765625 -22.953125 3.765625 -21.234375 L 3.765625 -3.328125 C 3.765625 -1.546875 3.625 -1.25 1.359375 -1.25 C 0.96875 -1.25 0.328125 -1.25 0.328125 -0.640625 C 0.328125 0 0.890625 0 1.546875 0 L 12.1875 0 C 16.609375 0 22.265625 -1.71875 22.265625 -6.703125 C 22.265625 -10.4375 19.546875 -12.4375 16.921875 -13.15625 Z M 9.390625 -3.1875 L 9.390625 -12.078125 C 12.265625 -12.078125 13.484375 -12.078125 14.59375 -11.265625 C 16 -10.1875 16.09375 -7.859375 16.09375 -6.703125 C 16.09375 -5.3125 16 -1.25 11.515625 -1.25 C 9.390625 -1.25 9.390625 -2.515625 9.390625 -3.1875 Z M 15.78125 -1.6875 C 17.109375 -3.1875 17.359375 -5.09375 17.359375 -6.703125 C 17.359375 -9.1875 16.8125 -11.046875 15.390625 -12.234375 C 18.6875 -11.6875 21.015625 -9.828125 21.015625 -6.703125 C 21.015625 -3.984375 18.859375 -2.40625 15.78125 -1.6875 Z M 15.78125 -1.6875 "
|
||||
style="stroke:none;" />
|
||||
</symbol>
|
||||
<symbol
|
||||
id="glyph1-0"
|
||||
overflow="visible">
|
||||
<path
|
||||
id="path15"
|
||||
d=""
|
||||
style="stroke:none;" />
|
||||
</symbol>
|
||||
<symbol
|
||||
id="glyph1-1"
|
||||
overflow="visible">
|
||||
<path
|
||||
id="path18"
|
||||
d="M 12.6875 -4.5625 L 11.828125 -4.5625 C 11.75 -4.015625 11.5 -2.53125 11.171875 -2.28125 C 10.96875 -2.140625 9.046875 -2.140625 8.6875 -2.140625 L 4.0625 -2.140625 C 6.703125 -4.46875 7.578125 -5.171875 9.09375 -6.359375 C 10.953125 -7.828125 12.6875 -9.390625 12.6875 -11.78125 C 12.6875 -14.8125 10.015625 -16.671875 6.796875 -16.671875 C 3.6875 -16.671875 1.578125 -14.484375 1.578125 -12.171875 C 1.578125 -10.890625 2.65625 -10.765625 2.90625 -10.765625 C 3.515625 -10.765625 4.25 -11.203125 4.25 -12.109375 C 4.25 -12.546875 4.0625 -13.4375 2.765625 -13.4375 C 3.546875 -15.21875 5.25 -15.765625 6.421875 -15.765625 C 8.9375 -15.765625 10.25 -13.8125 10.25 -11.78125 C 10.25 -9.59375 8.6875 -7.859375 7.890625 -6.953125 L 1.828125 -0.984375 C 1.578125 -0.75 1.578125 -0.703125 1.578125 0 L 11.921875 0 Z M 12.6875 -4.5625 "
|
||||
style="stroke:none;" />
|
||||
</symbol>
|
||||
<symbol
|
||||
id="glyph1-2"
|
||||
overflow="visible">
|
||||
<path
|
||||
id="path21"
|
||||
d="M 6.984375 3.96875 C 5.34375 3.96875 5.09375 3.96875 5.09375 2.890625 L 5.09375 -1.203125 C 5.21875 -1.078125 6.40625 0.25 8.515625 0.25 C 11.828125 0.25 14.65625 -2.234375 14.65625 -5.421875 C 14.65625 -8.515625 12.109375 -11.078125 8.90625 -11.078125 C 7.484375 -11.078125 6.03125 -10.546875 5 -9.546875 L 5 -11.078125 L 1.234375 -10.796875 L 1.234375 -9.890625 C 2.984375 -9.890625 3.109375 -9.765625 3.109375 -8.71875 L 3.109375 2.890625 C 3.109375 3.96875 2.859375 3.96875 1.234375 3.96875 L 1.234375 4.875 C 1.28125 4.875 3.03125 4.765625 4.09375 4.765625 C 5.015625 4.765625 6.75 4.84375 6.984375 4.875 Z M 5.09375 -8.359375 C 5.84375 -9.609375 7.3125 -10.265625 8.640625 -10.265625 C 10.75 -10.265625 12.375 -8.0625 12.375 -5.421875 C 12.375 -2.5625 10.5 -0.453125 8.359375 -0.453125 C 6.15625 -0.453125 5.171875 -2.390625 5.09375 -2.53125 Z M 5.09375 -8.359375 "
|
||||
style="stroke:none;" />
|
||||
</symbol>
|
||||
<symbol
|
||||
id="glyph1-3"
|
||||
overflow="visible">
|
||||
<path
|
||||
id="path24"
|
||||
d="M 11.875 -8.359375 C 12.578125 -9.890625 13.859375 -9.921875 14.265625 -9.921875 L 14.265625 -10.828125 C 13.5625 -10.765625 13.078125 -10.71875 12.359375 -10.71875 C 11.671875 -10.71875 10.75 -10.75 10.0625 -10.828125 L 10.0625 -9.921875 C 10.890625 -9.875 11.09375 -9.359375 11.09375 -8.96875 C 11.09375 -8.65625 10.96875 -8.4375 10.875 -8.1875 L 8.078125 -2.234375 L 5 -8.859375 C 4.921875 -9.015625 4.84375 -9.171875 4.84375 -9.34375 C 4.84375 -9.921875 5.703125 -9.921875 6.125 -9.921875 L 6.125 -10.828125 C 5.75 -10.796875 3.9375 -10.71875 3.234375 -10.71875 C 2.484375 -10.71875 1.5 -10.75 0.78125 -10.828125 L 0.78125 -9.921875 C 2.1875 -9.921875 2.453125 -9.84375 2.84375 -9.046875 L 7.0625 0 C 6.828125 0.5 6.578125 0.984375 6.359375 1.484375 C 5.796875 2.6875 5 4.421875 3.296875 4.421875 C 2.65625 4.421875 2.453125 4.296875 2.203125 4.125 C 2.234375 4.125 2.9375 3.859375 2.9375 3.03125 C 2.9375 2.40625 2.484375 1.953125 1.859375 1.953125 C 1.203125 1.953125 0.75 2.40625 0.75 3.0625 C 0.75 4.25 1.9375 5.125 3.296875 5.125 C 5.421875 5.125 6.65625 2.890625 7 2.140625 Z M 11.875 -8.359375 "
|
||||
style="stroke:none;" />
|
||||
</symbol>
|
||||
</g>
|
||||
</defs>
|
||||
<g
|
||||
id="surface1">
|
||||
<g
|
||||
id="g27"
|
||||
style="fill:rgb(0%,0%,0%);fill-opacity:1;">
|
||||
<use
|
||||
id="use29"
|
||||
y="31.574"
|
||||
x="0.6284"
|
||||
xlink:href="#glyph0-1" />
|
||||
</g>
|
||||
<g
|
||||
id="g31"
|
||||
style="fill:rgb(0%,0%,0%);fill-opacity:1;">
|
||||
<use
|
||||
id="use33"
|
||||
y="16.7636"
|
||||
x="24.5396"
|
||||
xlink:href="#glyph1-1" />
|
||||
</g>
|
||||
<g
|
||||
id="g35"
|
||||
style="fill:rgb(0%,0%,0%);fill-opacity:1;">
|
||||
<use
|
||||
id="use37"
|
||||
y="40.4408"
|
||||
x="24.5396"
|
||||
xlink:href="#glyph1-2" />
|
||||
<use
|
||||
id="use39"
|
||||
y="40.4408"
|
||||
x="39.603008"
|
||||
xlink:href="#glyph1-3" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.6 KiB |
BIN
python/docs/source/images/bpy_icon_96_96.png
Normal file
BIN
python/docs/source/images/bpy_icon_96_96.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
1
python/docs/source/images_common
Symbolic link
1
python/docs/source/images_common
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../doc_resources/images/
|
||||
35
python/docs/source/index.rst
Normal file
35
python/docs/source/index.rst
Normal file
@@ -0,0 +1,35 @@
|
||||
.. PyBertini documentation master file, created by
|
||||
sphinx-quickstart on Wed Oct 4 23:28:46 2017.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
PyBertini -- the Python bindings for Bertini
|
||||
*************************************************
|
||||
|
||||
|
||||
1️⃣ Introductory materials
|
||||
==================================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
intro
|
||||
tutorials/tutorials
|
||||
|
||||
🏛 Reference materials
|
||||
============================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
|
||||
detailed/detailed
|
||||
building
|
||||
zbib
|
||||
|
||||
🔀 Indices and tables
|
||||
=============================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* 🔍 :ref:`search`
|
||||
|
||||
33
python/docs/source/intro.rst
Normal file
33
python/docs/source/intro.rst
Normal file
@@ -0,0 +1,33 @@
|
||||
👋 Welcome to PyBertini
|
||||
====================================
|
||||
|
||||
Bertini is software for numerically solving systems of polynomials. PyBertini is the Python provided for running Bertini.
|
||||
|
||||
🗺 Mathematical overview
|
||||
----------------------------------
|
||||
|
||||
The main algorithm for numerical algebraic geometry implemented in Bertini is homotopy continuation. A homotopy is formed, and the solutions to the start system are continued into the solutions for the target system.
|
||||
|
||||
|
||||
.. figure:: images_common/homotopycontinuation_generic_40ppi.png
|
||||
:scale: 100 %
|
||||
:alt: Homotopy continuation
|
||||
|
||||
Predictor-corrector methods with optional adaptive precision track paths from 1 to 0, solving :math:`f`.
|
||||
|
||||
The definitive resource for Bertini 1 is the book :cite:`bertinibook`. While the way we interact with Bertini changes from version 1 to version 2, particularly when using PyBertini, the algorithms remain fundamentally the same. So do most of the ways to change settings for the path trackers, etc. We believe that embracing the flexibility of Python3 with PyBertini allows for much greater flexibility. It also will relieve the user from the burden of input and output file writing and parsing. Instead, computed results are returned directly to the user.
|
||||
|
||||
Consider checking out the :ref:`🔦 Tutorials`.
|
||||
|
||||
|
||||
⛲️ Source code
|
||||
---------------------------
|
||||
|
||||
PyBertini is distributed with Bertini2, available at `its GitHub repo <https://github.com/bertiniteam/b2>`_.
|
||||
|
||||
The core is written in template-heavy C++, and is exposed to Python through Boost.Python.
|
||||
|
||||
⚖️ Licenses
|
||||
------------------
|
||||
|
||||
Bertini2 and its direct components are available under GPL3, with additional clauses in section 7 to protect the Bertini name. Bertini2 also uses open source softwares, with their own licenses, which may be found in the Bertini2 repository, in the licenses folder.
|
||||
91
python/docs/source/tutorials/evaluation_cyclic.rst
Normal file
91
python/docs/source/tutorials/evaluation_cyclic.rst
Normal file
@@ -0,0 +1,91 @@
|
||||
♻️ Evaluation of cyclic-:math:`n` polynomials
|
||||
*******************************************************
|
||||
|
||||
Bertini is software for algebraic geometry. This means we work with systems of polynomials, a critical component of which is system and function evaluation.
|
||||
|
||||
Bertini2 allows us to set up many kinds of functions, and thus systems, by exploting operator overloading.
|
||||
|
||||
Make some symbols
|
||||
==================
|
||||
|
||||
Let's start by making some variables, programmatically [1]_.
|
||||
|
||||
::
|
||||
|
||||
import pybertini
|
||||
import numpy
|
||||
|
||||
num_vars = 10
|
||||
x = [None] * num_vars # preallocate the list
|
||||
for ii in range(num_vars):
|
||||
x[ii] = pybertini.Variable('x' + str(ii))
|
||||
|
||||
Huzzah, we have `num_vars` variables! This was hard to do in Bertini 1's classic style input files. Now we can do it directly! 🎯
|
||||
|
||||
Write a function to produce the cyclic :math:`n` polynomials :cite:`cyclic_n`.
|
||||
|
||||
::
|
||||
|
||||
def cyclic(vars):
|
||||
n = len(vars)
|
||||
f = [None] * len(vars)
|
||||
y = []
|
||||
for ii in range(2):
|
||||
for x in vars:
|
||||
y.append(x)
|
||||
|
||||
for ii in range(n-1):
|
||||
f[ii] = numpy.sum( [numpy.prod(y[jj:jj+ii+1]) for jj in range(n)] )
|
||||
|
||||
# the last one is minus one
|
||||
f[-1] = numpy.prod(vars)-1
|
||||
return f
|
||||
|
||||
Now we will make a System, and put the cyclic polynomials into it.
|
||||
|
||||
::
|
||||
|
||||
sys = pybertini.System()
|
||||
|
||||
for f in cyclic(x):
|
||||
sys.add_function(f)
|
||||
|
||||
print(sys) # long screen output, i know
|
||||
|
||||
We also need to associate the variables with the system. Unassociated variables are left unknown, and retain their value until elsewhere set.
|
||||
|
||||
::
|
||||
|
||||
vg = pybertini.VariableGroup()
|
||||
for var in x:
|
||||
vg.append(var)
|
||||
sys.add_variable_group(vg)
|
||||
|
||||
Let's simplify this. It will modify elements of the constructed function tree, even those held externally -- Bertini uses shared pointers under the hood, so pay attention to where you re-use parts of your functions, because later modification of them without deep cloning will cause ... modification elsewhere, too.
|
||||
|
||||
::
|
||||
|
||||
pybertini.system.simplify(sys)
|
||||
|
||||
Now, let's evaluate it at the origin -- all zero's (0 is the default value for multiprecision complex numbers in Bertini2). The returned value should be all zero's except the last entry, which should be -1.
|
||||
|
||||
::
|
||||
|
||||
s = pybertini.multiprec.Vector()
|
||||
s.resize(num_vars)
|
||||
sys.eval(s)
|
||||
|
||||
Yay, all zeros, except the last one is -1. Huzzah.
|
||||
|
||||
Let's change the values of our vector, and re-evaluate.
|
||||
|
||||
::
|
||||
|
||||
for ii in range(num_vars):
|
||||
s[ii] = pybertini.multiprec.Complex(ii)
|
||||
sys.eval(s)
|
||||
|
||||
|
||||
There is much more one can do, too! Please write the authors, particularly Dani Brake, for more.
|
||||
|
||||
.. [1] This is one of the reasons we wrote Bertini2's symbolic C++ core and exposed it to Python.
|
||||
164
python/docs/source/tutorials/manual_endgame_usage.rst
Normal file
164
python/docs/source/tutorials/manual_endgame_usage.rst
Normal file
@@ -0,0 +1,164 @@
|
||||
🎮 Using an endgame to compute singular endpoints
|
||||
*********************************************************
|
||||
|
||||
|
||||
|
||||
Background
|
||||
==============
|
||||
|
||||
Polynomial systems often have singular solutions. In numerical algebraic geometry, we want to compute all solutions, even the challenging singular ones. The normal method of homotopy continuation with straight-line tracking fails to compute such roots, because tracking to a place where the Jacobian is non-invertible using methods that require inverting the Jacobian is doomed to fail [#]_.
|
||||
|
||||
So, if we can't track to a singular solution, but we still want to track to compute them, what are we to do? We track around them, or near them, but not actually to them. These methods are collectively called *endgames*, a term coined to evoke a sense of chess :cite:`morgan1990computing` :cite:`morgan1992computing` :cite:`morgan1992power`. Thanks, Andrew Sommese, Charles Wampler, and Alexander Morgan, for everything you have given our community.
|
||||
|
||||
Endgames represent a way to finish a tracking of a path, when the endpoint is possibly singular. Rather than track all the way to the endtime, you instead run an endgame that uses mathematical theory to compute the root.
|
||||
|
||||
Endgames in PyBertini
|
||||
==========================
|
||||
|
||||
An endgame is a computational tool that one does in the final stage of a path track to a possibly singular root. There are two implemented endgames in Bertini:
|
||||
|
||||
#. Power series (PSEG) -- uses `Hermite interpolation <https://en.wikipedia.org/wiki/Hermite_interpolation>`_ across a sequence of geometrically-spaced points (in time) to extrapolate to a target time :cite:`morgan1992power`.
|
||||
#. Cauchy (CauchyEG)-- uses `Cauchy's integral formula <https://en.wikipedia.org/wiki/Cauchy's_integral_formula>`_ in a sequence of circles about the root you are computing.
|
||||
|
||||
Both try to compute the cycle number :math:`c` for the root. In PSEG, :math:`c` is used as the degree of a Hermite interpolant used to extrapolate to 0. In CauchyEG, it is used for the number of cycles to walk before doing a trapezoid-rule integral.
|
||||
|
||||
Each is provided in the three precision modes, double, fixed multiple, and adaptive. Since we are using the :class:`~pybertini.tracking.AMPTracker` in this tutorial, we will of course use the adaptive endgame. I really like the Cauchy endgame, so we're in the land of the :class:`~pybertini.endgame.AMPCauchyEG`.
|
||||
|
||||
|
||||
Example
|
||||
----------
|
||||
|
||||
|
||||
Form a system
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
The Griewank-Osborne system has one multiplicity-three singular solution at the origin :cite:`griewank1983analysis`. It comes pre-built for us as part of Bertini2's C++ core, and is accessible by peeking into the `precon` module.
|
||||
|
||||
.. todo::
|
||||
|
||||
expose the precon namespace. it's a 1-hour task, and danielle 😈 should do it.
|
||||
|
||||
Let's build it from scratch, for the practice.
|
||||
|
||||
::
|
||||
|
||||
import pybertini
|
||||
|
||||
gw = pybertini.System()
|
||||
|
||||
x = pybertini.Variable("x")
|
||||
y = pybertini.Variable("y")
|
||||
|
||||
vg = pybertini.VariableGroup()
|
||||
vg.append(x)
|
||||
vg.append(y)
|
||||
gw.add_variable_group(vg)
|
||||
|
||||
gw.add_function(pybertini.multiprec.Rational(29,16)*x**3 - 2*x*y)
|
||||
gw.add_function(y - x**2)
|
||||
|
||||
|
||||
Form a start system and homotopy
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Next, we make the total degree start system for `gw`, and couple it using the gamma trick :cite:`morgan1987homotopy` and a path variable.
|
||||
|
||||
::
|
||||
|
||||
t = pybertini.Variable('t')
|
||||
td = pybertini.system.start_system.TotalDegree(gw)
|
||||
gamma = pybertini.function_tree.symbol.Rational.rand()
|
||||
hom = (1-t)*gw + t*gamma*td
|
||||
hom.add_path_variable(t)
|
||||
|
||||
|
||||
|
||||
🛤 Track to the endgame boundary
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Make a tracker. I use adaptive precision a lot, so we'll roll with that. There are also double and fixed-multiple versions. See the other tutorials or the detailed documentation.
|
||||
|
||||
::
|
||||
|
||||
tr = pybertini.tracking.AMPTracker(hom)
|
||||
|
||||
start_time = pybertini.multiprec.Complex("1")
|
||||
eg_boundary = pybertini.multiprec.Complex("0.1")
|
||||
|
||||
midpath_points = [None]*td.num_start_points()
|
||||
for ii in range(td.num_start_points()):
|
||||
midpath_points[ii] = pybertini.multiprec.Vector()
|
||||
code = tr.track_path(result=midpath_points[ii], start_time=start_time, end_time=eg_boundary, start_point=td.start_point_mp(ii))
|
||||
if code != pybertini.tracking.SuccessCode.Success:
|
||||
print('uh oh, tracking a path before the endgame boundary failed, successcode ' + code)
|
||||
|
||||
|
||||
|
||||
|
||||
🎮 Use the endgame
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
To make an endgame, we need to feed it the tracker that is used to run. There are also config structs to play with, that control the way things are computed.
|
||||
|
||||
::
|
||||
|
||||
eg = pybertini.endgame.AMPCauchyEG(tr)
|
||||
|
||||
# make an observer to be able to see what's going on inside
|
||||
ob = pybertini.endgame.observers.amp_cauchy.GoryDetailLogger()
|
||||
|
||||
eg.add_observer(ob)
|
||||
|
||||
Since the endgame hasn't been run yet things are empty and default::
|
||||
|
||||
assert(eg.cycle_number()==0)
|
||||
assert(eg.final_approximation()==np.array([]))
|
||||
|
||||
The endgames are used by invoking ``run``, feeding it the point we are tracking on, the time we are at, and the time we want to track to. ::
|
||||
|
||||
final_points = []
|
||||
|
||||
|
||||
target_time = pybertini.multiprec.Complex(0)
|
||||
codes = []
|
||||
for ii in range(td.num_start_points()):
|
||||
eg_boundary.precision( midpath_points[ii][0].precision())
|
||||
target_time.precision( midpath_points[ii][0].precision())
|
||||
print('before {} {} {}'.format(eg_boundary.precision(), target_time.precision(), midpath_points[ii][0].precision()))
|
||||
codes.append(eg.run(start_time=eg_boundary, target_time=target_time, start_point=midpath_points[ii]))
|
||||
print('path {} -- code {}'.format(ii,codes[-1]))
|
||||
print(eg.final_approximation())
|
||||
# final_points.append(copy.deep_copy(eg.final_approximation()))
|
||||
print('after {} {} {}'.format(eg_boundary.precision(), target_time.precision(), midpath_points[ii][0].precision()))
|
||||
|
||||
.. todo::
|
||||
|
||||
the endgame returns its `final_approximation` by reference, so capturing its value into a list makes many references to this internal variable, not copies of the point. so, one should take deepcopy's of the vector, but they are not currently pickleable due to the complex multiprecision class. an issue has been filed (#148) and this issue will be solved shortly (danielle, 20180227)
|
||||
|
||||
Conclusion
|
||||
============
|
||||
|
||||
|
||||
Using a singular endgame, we can compute singular endpoints of homotopy paths. What an age to live in! 🌌
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
📚 Further reading
|
||||
========================
|
||||
|
||||
The following three papers (cited above) laid the foundation for endgames and computation of singular endpoints:
|
||||
|
||||
* Computing singular solutions to nonlinear analytic systems :cite:`morgan1990computing`
|
||||
* Computing singular solutions to polynomial systems :cite:`morgan1992computing`
|
||||
* A power series method for computing singular solutions to nonlinear analytic systems :cite:`morgan1992power`.
|
||||
|
||||
👣 Footnotes
|
||||
-------------
|
||||
|
||||
.. [#] No, we don't actually invert the Jacobian in practice while solving the Davidenko differential equation, but numerical issues exist no matter which method you use to solve the system.
|
||||
|
||||
|
||||
|
||||
264
python/docs/source/tutorials/tracking_nonsingular.rst
Normal file
264
python/docs/source/tutorials/tracking_nonsingular.rst
Normal file
@@ -0,0 +1,264 @@
|
||||
🛤 Tracking to nonsingular endpoints
|
||||
**********************************************
|
||||
|
||||
.. testsetup:: *
|
||||
|
||||
import pybertini
|
||||
|
||||
PyBertini works by setting up systems, setting up algorithms to use those systems, and doing something with the output.
|
||||
|
||||
Forming a system
|
||||
=================
|
||||
|
||||
First, gain access to pybertini::
|
||||
|
||||
import pybertini
|
||||
|
||||
Let's make a couple of :class:`~pybertini.function_tree.symbol.Variable`'s::
|
||||
|
||||
x = pybertini.function_tree.symbol.Variable("x") #yes, you can make a variable not match its name...
|
||||
y = pybertini.function_tree.symbol.Variable("y")
|
||||
|
||||
Now, make a few symbolic expressions out of them::
|
||||
|
||||
f = x**2 + y**2 -1 # ** is exponentiation in Python.
|
||||
g = x+y
|
||||
|
||||
There's no need to "set them equal to 0" -- expressions used as functions in a system in Bertini are taken to be equal to zero. If you have an equality that's not zero, move one side to the other.
|
||||
|
||||
Let's make an empty :class:`~pybertini.system.System`, then build into it::
|
||||
|
||||
sys = pybertini.System()
|
||||
sys.add_function(f, 'f') # name the function
|
||||
sys.add_function(g) # or not...
|
||||
|
||||
``sys`` doesn't know its variables yet, so let's group them into an affine :class:`~pybertini.container.ListOfVariableGroup` [#]_, and stuff it into ``sys``::
|
||||
|
||||
grp = pybertini.VariableGroup()
|
||||
grp.append(x)
|
||||
grp.append(y)
|
||||
sys.add_variable_group(grp)
|
||||
|
||||
Let's check that the degrees of our functions are correct::
|
||||
|
||||
d = sys.degrees()
|
||||
assert(d[0]==2) # f is degree 2 (highest power in any term is 2)
|
||||
assert(d[1]==1) # g is degree 1 (highest power in any term is 2)
|
||||
|
||||
|
||||
Aside -- a brief exploration into non-algebraic things
|
||||
---------------------------------------------------------
|
||||
|
||||
|
||||
What happens if we add a non-polynomial function to our system?
|
||||
|
||||
::
|
||||
|
||||
sys.add_function(x**-1) # happily accepts a non-polynomial function.
|
||||
sys.add_function( pybertini.function_tree.sin(x) )
|
||||
d = sys.degrees()
|
||||
assert(d[2]==-1) # unsurprising, but actually a coincidence
|
||||
assert(d[3]==-1) # also -1. anything non-polynomial is a negative number.
|
||||
# sin has no well-defined degree
|
||||
|
||||
# bertini uses negative degree to indicate non-polynomial
|
||||
|
||||
|
||||
correcting our system -- a return to algebraicness
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
We can indeed do homotopy continuation with a non-algebraic systems. What we cannot do is form a start system that we can guarantee will track to all solutions of the target system. (because of things like :math:`\sin(x)` having infinitely many solutions, etc)
|
||||
|
||||
::
|
||||
|
||||
del sys #we mal-formed our system above by adding too many functions, and non-polynomial functions to it.
|
||||
# so, we start over
|
||||
sys = pybertini.System()
|
||||
sys.add_variable_group(grp)
|
||||
sys.add_function(f, 'f') #name the function in the system
|
||||
sys.add_function(g) # default name
|
||||
|
||||
|
||||
|
||||
Forming a start system
|
||||
=========================
|
||||
|
||||
To solve our algebraic system ``sys``, we need a corresponding start system -- one with related structure, but that is actually solvable without too much trouble. Bertini2 has several implemented options. The most basic (easiest to form and solve) start system is the Total Degree (TD) start system. It is implemented as a first-class object in Bertini and PyBertini. It takes in a polynomial system as its argument, and self-forms.
|
||||
|
||||
|
||||
Above, we formed a target system, ``sys``. Now, let's make a start system ``td``. Later, we will couple it to ``sys``.
|
||||
It's trivial to make a total degree start system (:class:`~pybertini.system.start_system.TotalDegree`): ::
|
||||
|
||||
td = pybertini.system.start_system.TotalDegree(sys)
|
||||
|
||||
Note that you have to pass in the target system into the constructor of the total degree, or you get an error.
|
||||
|
||||
|
||||
Wonderful, now we have an easy-to-solve system ``td``, the structure of which mirrors that of our target system. Every start system comes with a method ``start_point_*`` for generating its start points, by integer index.
|
||||
|
||||
::
|
||||
|
||||
# generate the 1th (0-based offsets in python) start point
|
||||
sp_d = td.start_point_d(1)# at double precision
|
||||
|
||||
sp_mp = td.start_point_mp(1) # generate the 1th point at current default multiple precision
|
||||
assert(pybertini.default_precision() == sp_mp[1].precision())
|
||||
|
||||
|
||||
Forming a homotopy
|
||||
==================
|
||||
|
||||
|
||||
We turn next to the act of path tracking. This is the core computational method of numerical algebraic geometry, and it requires a continuous deformation between systems, called a "homotopy".
|
||||
|
||||
A homotopy in Numerical Algebraic Geometry glues together a start system and a target system, such that we can later "continue" from one into the other. Observe:
|
||||
|
||||
|
||||
We couple ``sys`` and ``td``::
|
||||
|
||||
t = pybertini.Variable("t") # make a path variable
|
||||
homotopy = (1-t)*sys + t*td # glue
|
||||
homotopy.add_path_variable(t) # indicate the path var
|
||||
|
||||
Now, we have the minimum theoretical ingredients for solving a polynomial system using Numerical Algebraic Geometry:
|
||||
|
||||
#. a homotopy ``homotopy``,
|
||||
#. a target system ``sys``,
|
||||
#. and a start system ``td``.
|
||||
|
||||
as well as a few other incidentals which will be implicitly used, such as a path variable ``t``.
|
||||
|
||||
|
||||
Tracking a single path
|
||||
======================
|
||||
|
||||
There are three basic trackers available in PyBertini:
|
||||
|
||||
|
||||
#. Fixed double precision: :class:`~pybertini.tracking.DoublePrecisionTracker`
|
||||
#. Fixed multiple precision: :class:`~pybertini.tracking.MultiplePrecisionTracker`
|
||||
#. Adaptive precision: :class:`~pybertini.tracking.AMPTracker`
|
||||
|
||||
Each brings its own advantages and disadvantages. And, each has its ambient numeric type.
|
||||
|
||||
Let's use the adaptive one, since adaptivity is generally a good trait to have. ``AMPTracker`` uses variable-precision vectors and matrices in its ambient work -- that is, you feed it multiprecisions, and get back multiprecisions. Internally, it will use double precision when it can, and higher when it has to.
|
||||
|
||||
We associate a system with a tracker when we make it. You cannot make a tracker without telling the tracker which system it will be tracking...
|
||||
|
||||
::
|
||||
|
||||
tr = pybertini.tracking.AMPTracker(homotopy)
|
||||
tr.tracking_tolerance(1e-5) # track the path to 5 digits or so
|
||||
|
||||
# adjust some stepping settings
|
||||
stepping = pybertini.tracking.config.SteppingConfig()
|
||||
stepping.max_step_size = pybertini.multiprec.Rational(1,13)
|
||||
|
||||
#then, set the config into the tracker.
|
||||
tr.set_stepping(stepping)
|
||||
|
||||
|
||||
Once we feel comfortable with the configs (of which there are many, see the book or elsewhere in this site, perhaps), we can track a path.
|
||||
|
||||
::
|
||||
|
||||
result = pybertini.multiprec.Vector()
|
||||
tr.track_path(result, pybertini.multiprec.Complex(1), pybertini.multiprec.Complex(0), td.start_point_mp(0))
|
||||
|
||||
Logging to inspect the path that was tracked
|
||||
---------------------------------------------
|
||||
|
||||
|
||||
Let's generate a log of what was computed along the way, first making an :mod:`observer <pybertini.tracking.observers>`, and then attaching it to the tracker.
|
||||
|
||||
::
|
||||
|
||||
#make observer
|
||||
g = pybertini.tracking.observers.amp.GoryDetailLogger()
|
||||
|
||||
#attach
|
||||
tr.add_observer(g)
|
||||
|
||||
Re-running it, you should find a ton of stuff printed to the screen.
|
||||
|
||||
::
|
||||
|
||||
result = pybertini.multiprec.Vector()
|
||||
tr.track_path(result, pybertini.multiprec.Complex(1), pybertini.multiprec.Complex(0), td.start_point_mp(0))
|
||||
|
||||
If you are going to keep tracking, but want to turn off the logging, remove the observer.::
|
||||
|
||||
tr.remove_observer(g)
|
||||
|
||||
|
||||
A complete tracking of paths
|
||||
=============================
|
||||
|
||||
|
||||
Now that we've tracked a single path, you might want to loop over all start points. Awesome! The next blob takes all the above, and puts it into a single blob. Enjoy!
|
||||
|
||||
|
||||
.. testcode:: tracking_nonsingular_main
|
||||
|
||||
import pybertini
|
||||
|
||||
x = pybertini.function_tree.symbol.Variable("x") #yes, you can make a variable not match its name...
|
||||
y = pybertini.function_tree.symbol.Variable("y")
|
||||
f = x**2 + y**2 -1
|
||||
g = x+y
|
||||
|
||||
sys = pybertini.System()
|
||||
sys.add_function(f, 'f')
|
||||
sys.add_function(g)
|
||||
|
||||
grp = pybertini.VariableGroup()
|
||||
grp.append(x)
|
||||
grp.append(y)
|
||||
sys.add_variable_group(grp)
|
||||
|
||||
td = pybertini.system.start_system.TotalDegree(sys)
|
||||
|
||||
t = pybertini.Variable("t")
|
||||
homotopy = (1-t)*sys + t*td
|
||||
homotopy.add_path_variable(t)
|
||||
|
||||
tr = pybertini.tracking.AMPTracker(homotopy)
|
||||
|
||||
#commented out for screen-saving.
|
||||
#g = pybertini.tracking.observers.amp.GoryDetailLogger()
|
||||
#tr.add_observer(g)
|
||||
# one could also pybertini.logging.init() and set a file name,
|
||||
# so it gets piped there instead of wherever Boost.Log goes by default.
|
||||
|
||||
tr.tracking_tolerance(1e-5) # track the path to 5 digits or so
|
||||
tr.infinite_truncation_tolerance(1e5)
|
||||
tr.predictor(pybertini.tracking.Predictor.RK4)
|
||||
stepping = pybertini.tracking.config.SteppingConfig()
|
||||
stepping.max_step_size = pybertini.multiprec.Rational(1,13)
|
||||
|
||||
# set the config into the tracker
|
||||
tr.set_stepping(stepping)
|
||||
|
||||
results = [] # make an empty list into which to put the results
|
||||
expected_code = pybertini.tracking.SuccessCode.Success
|
||||
codes = []
|
||||
for ii in range(td.num_start_points()):
|
||||
results.append(pybertini.multiprec.Vector())
|
||||
codes.append(tr.track_path(result=results[-1], start_time=pybertini.multiprec.Complex(1), end_time=pybertini.multiprec.Complex(0), start_point=td.start_point_mp(ii)))
|
||||
|
||||
tr.remove_observer(g)
|
||||
|
||||
print(codes == [expected_code]*2)
|
||||
|
||||
.. testoutput:: tracking_nonsingular_main
|
||||
|
||||
True
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Footnotes
|
||||
---------
|
||||
|
||||
.. [#] Affinely-grouped variables live together in the same complex space, :math:`\mathbb{C}^N`. The alternative is projectively-grouped variables, which live in a copy of :math:`\mathbb{P}^N`.
|
||||
13
python/docs/source/tutorials/tutorials.rst
Normal file
13
python/docs/source/tutorials/tutorials.rst
Normal file
@@ -0,0 +1,13 @@
|
||||
🔦 Tutorials
|
||||
*****************
|
||||
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Available tutorials
|
||||
|
||||
|
||||
evaluation_cyclic
|
||||
tracking_nonsingular
|
||||
manual_endgame_usage
|
||||
|
||||
4
python/docs/source/zbib.rst
Normal file
4
python/docs/source/zbib.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
📚 Bibliography
|
||||
********************
|
||||
|
||||
.. bibliography:: ../../../doc_resources/bertini2.bib
|
||||
7
python/examples/eigen_in_python.py
Normal file
7
python/examples/eigen_in_python.py
Normal file
@@ -0,0 +1,7 @@
|
||||
import pybertini as pb
|
||||
import numpy as np
|
||||
|
||||
mpfr_complex = pb.multiprec.Complex
|
||||
|
||||
|
||||
np.empty(dtype=mpfr_complex, shape=(3,))
|
||||
141
python/examples/endgame.py
Normal file
141
python/examples/endgame.py
Normal file
@@ -0,0 +1,141 @@
|
||||
import pybertini as pb
|
||||
|
||||
from pybertini import Variable, VariableGroup, System
|
||||
import pybertini.system.start_system as ss
|
||||
|
||||
from pybertini.function_tree.symbol import Rational
|
||||
|
||||
from pybertini.endgame import *
|
||||
from pybertini.endgame.config import *
|
||||
|
||||
from pybertini.tracking import *
|
||||
from pybertini.tracking.config import *
|
||||
|
||||
from pybertini.multiprec import Float as mpfr_float
|
||||
from pybertini.multiprec import Complex as mpfr_complex
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
|
||||
ambient_precision = 50;
|
||||
|
||||
|
||||
|
||||
x = Variable("x");
|
||||
y = Variable("y");
|
||||
t = Variable("t");
|
||||
#
|
||||
sys = System();
|
||||
#
|
||||
var_grp = VariableGroup();
|
||||
var_grp.append(x);
|
||||
var_grp.append(y);
|
||||
|
||||
sys.add_variable_group(var_grp);
|
||||
|
||||
sys.add_function((x-1)**3)
|
||||
sys.add_function((y-1)**2)
|
||||
|
||||
sys.homogenize();
|
||||
sys.auto_patch();
|
||||
|
||||
assert (sys.is_patched() == 1)
|
||||
assert (sys.is_homogeneous() == 1)
|
||||
|
||||
td = ss.TotalDegree(sys);
|
||||
|
||||
assert (td.is_patched() == 1)
|
||||
assert (td.is_homogeneous() == 1)
|
||||
|
||||
gamma = Rational.rand();
|
||||
|
||||
|
||||
final_system = (1-t)*sys + gamma*t*td;
|
||||
final_system.add_path_variable(t);
|
||||
|
||||
print(final_system)
|
||||
prec_config = AMPConfig(final_system);
|
||||
|
||||
stepping_pref = SteppingConfig();
|
||||
newton_pref = NewtonConfig();
|
||||
|
||||
|
||||
|
||||
tracker = AMPTracker(final_system);
|
||||
|
||||
tracker.setup(Predictor.RK4, 1e-5, 1e5, stepping_pref, newton_pref);
|
||||
tracker.precision_setup(prec_config);
|
||||
|
||||
num_paths_to_track = td.num_start_points();
|
||||
n = int(str(num_paths_to_track));
|
||||
|
||||
t_start = mpfr_complex(1);
|
||||
t_endgame_boundary = mpfr_complex("0.1");
|
||||
t_final = mpfr_complex(0);
|
||||
|
||||
|
||||
print('tracking to the endgame boundary')
|
||||
|
||||
|
||||
bdry_points = [np.empty(dtype=mpfr_complex, shape=(3,)) for i in range(n)]
|
||||
|
||||
for i in range(n):
|
||||
|
||||
pb.default_precision(ambient_precision);
|
||||
final_system.precision(ambient_precision);
|
||||
|
||||
print('here')
|
||||
|
||||
td.precision(ambient_precision)
|
||||
start_point = td.start_point_mp(i);
|
||||
|
||||
print('there')
|
||||
print(pb.multiprec.precision(start_point))
|
||||
|
||||
|
||||
bdry_pt = np.zeros(dtype=mpfr_complex, shape=(3));
|
||||
track_success_code = tracker.track_path(bdry_pt,t_start, t_endgame_boundary, start_point);
|
||||
print(bdry_pt.flags)
|
||||
bdry_points[i] = bdry_pt;
|
||||
|
||||
assert (track_success_code == SuccessCode.Success)
|
||||
|
||||
|
||||
|
||||
tracker.setup(Predictor.HeunEuler, 1e-6, 1e5, stepping_pref, newton_pref);
|
||||
my_endgame = AMPCauchyEG(tracker);
|
||||
|
||||
|
||||
print('running the endgame')
|
||||
|
||||
final_homogenized_solutions = [np.empty(dtype=mpfr_complex, shape=(3,)) for i in range(n)]
|
||||
for i in range(n):
|
||||
p = bdry_points[i]
|
||||
|
||||
print("RIGHT HERE V")
|
||||
|
||||
print(p[0].precision())
|
||||
|
||||
|
||||
print('moving to precision {} to match precision of boundary point'.format(pb.multiprec.precision(p)))
|
||||
|
||||
|
||||
pb.default_precision(p[0].precision());
|
||||
final_system.precision(p[0].precision());
|
||||
|
||||
print(p.flags)
|
||||
|
||||
t = mpfr_complex(0)
|
||||
t = t_endgame_boundary
|
||||
t.precision(p[0].precision())
|
||||
|
||||
q = np.zeros(dtype=mpfr_complex, shape=(3));
|
||||
print(p.flags)
|
||||
track_success_code = my_endgame.run(t,p);
|
||||
print(track_success_code)
|
||||
|
||||
|
||||
final_homogenized_solutions[i] = my_endgame.final_approximation();
|
||||
print(final_system.dehomogenize_point(final_homogenized_solutions[i]));
|
||||
assert (track_success_code == SuccessCode.Success)
|
||||
28
python/examples/evaluate_system.py
Normal file
28
python/examples/evaluate_system.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import pybertini as pb
|
||||
import numpy as np
|
||||
|
||||
pb.default_precision(500)
|
||||
|
||||
x = pb.Variable('x')
|
||||
y = pb.Variable('y')
|
||||
z = pb.Variable('z')
|
||||
|
||||
vg = pb.VariableGroup([x,y,z])
|
||||
|
||||
sys = pb.System()
|
||||
|
||||
sys.add_function(x-y)
|
||||
sys.add_function(x**2 + y**2 - 1)
|
||||
sys.add_function(5*x**3 + 16*x*y**4 - 17*x*y*z - z**3)
|
||||
|
||||
sys.add_variable_group(vg)
|
||||
|
||||
random_complex = lambda : pb.random.complex_in_minus_one_to_one()
|
||||
|
||||
n_iterations = 10000
|
||||
print(f'evaluating system at random complex point {n_iterations} times at precision {pb.default_precision()}')
|
||||
for ii in range(n_iterations):
|
||||
variable_values = np.array([random_complex(), random_complex(), random_complex()])
|
||||
result = sys.eval(variable_values)
|
||||
|
||||
|
||||
22
python/examples/finding_issue.py
Normal file
22
python/examples/finding_issue.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# finding issue
|
||||
|
||||
import pybertini as pb
|
||||
|
||||
x = pb.Variable('x')
|
||||
y = pb.Variable('y')
|
||||
|
||||
f = pb.function_tree.root.Function(x)
|
||||
f.name = 'f'
|
||||
x.set_current_value(1)
|
||||
|
||||
print(f.eval_d())
|
||||
|
||||
vg = pb.VariableGroup([x,y])
|
||||
|
||||
sys = pb.System()
|
||||
sys.add_function(f)
|
||||
|
||||
print(sys)
|
||||
# sys.add_function(x**2 + y**2 - 1)
|
||||
|
||||
sys.add_variable_group(vg)
|
||||
6
python/examples/make_and_print.py
Normal file
6
python/examples/make_and_print.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import numpy as np
|
||||
import pybertini as pb
|
||||
|
||||
v = np.zeros(shape=(3,), dtype=pb.multiprec.Complex)
|
||||
|
||||
print(v[0])
|
||||
33
python/examples/solve_system.py
Normal file
33
python/examples/solve_system.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import pybertini as pb
|
||||
import numpy as np
|
||||
|
||||
x = pb.Variable('x')
|
||||
y = pb.Variable('y')
|
||||
|
||||
vg = pb.VariableGroup([x,y])
|
||||
|
||||
sys = pb.System()
|
||||
|
||||
sys.add_function(x-y)
|
||||
sys.add_function(x**2 + y**2 - 1)
|
||||
|
||||
sys.add_variable_group(vg)
|
||||
|
||||
C = pb.multiprec.Complex
|
||||
|
||||
variable_values = np.array([C(0), C(0)])
|
||||
|
||||
result = sys.eval(variable_values)
|
||||
print(result)
|
||||
|
||||
sys.homogenize()
|
||||
sys.auto_patch()
|
||||
|
||||
|
||||
solver = pb.nag_algorithm.ZeroDimCauchyAdaptivePrecisionTotalDegree(sys)
|
||||
|
||||
solver.solve()
|
||||
|
||||
for soln in solver.solutions():
|
||||
|
||||
print(sys.dehomogenize_point(soln))
|
||||
46
python/examples/track_path_constructed_homotopy.py
Normal file
46
python/examples/track_path_constructed_homotopy.py
Normal file
@@ -0,0 +1,46 @@
|
||||
import pybertini as pb
|
||||
|
||||
pb.logging.init()
|
||||
# pb.logging.add_file('asdf.txt')
|
||||
|
||||
import numpy as np
|
||||
|
||||
x = pb.Variable('x')
|
||||
y = pb.Variable('y')
|
||||
z = pb.Variable('z')
|
||||
|
||||
t = pb.Variable('t')
|
||||
|
||||
vg = pb.VariableGroup([x,y,z])
|
||||
|
||||
f = pb.System()
|
||||
|
||||
f.add_function(x-y)
|
||||
f.add_function(x**2 + y**2 - 1)
|
||||
f.add_function(5*x**3 + 16*x*y**4 - 17*x*y*z - z**3)
|
||||
|
||||
f.add_variable_group(vg)
|
||||
|
||||
g = pb.system.start_system.TotalDegree(f)
|
||||
|
||||
homotopy = t*g + (1-t)*f
|
||||
|
||||
homotopy.add_path_variable(t);
|
||||
|
||||
|
||||
print(homotopy)
|
||||
|
||||
C = pb.multiprec.Complex
|
||||
|
||||
tracker = pb.tracking.AMPTracker(homotopy);
|
||||
|
||||
print(tracker)
|
||||
|
||||
result = np.empty((3,),dtype=C) # right now, if i don't preset to the correct size, i get abort traps.
|
||||
# there's something deeper wrong with the wrapper i wrote, cuz it should allow resizing, but it's not.
|
||||
|
||||
start_point = g.start_point_mp(0)
|
||||
|
||||
print(start_point)
|
||||
|
||||
tracker.track_path(result, C(1) , C(0), start_point)
|
||||
58
python/include/bertini_python.hpp
Normal file
58
python/include/bertini_python.hpp
Normal file
@@ -0,0 +1,58 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//bertini_python.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//bertini_python.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with bertini_python.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2016-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// James Collins
|
||||
// West Texas A&M University
|
||||
// Spring 2016
|
||||
//
|
||||
// silviana amethyst
|
||||
// University of Wisconsin - Eau Claire
|
||||
// Spring 2018
|
||||
//
|
||||
//
|
||||
// python/bertini_python.hpp: the main header file for the python interface for bertini.
|
||||
|
||||
#pragma once
|
||||
#ifndef BERTINI_PYTHON_HPP
|
||||
#define BERTINI_PYTHON_HPP
|
||||
|
||||
#include "python_common.hpp"
|
||||
#include "containers_export.hpp"
|
||||
#include "mpfr_export.hpp"
|
||||
#include "random_export.hpp"
|
||||
#include "eigenpy_interaction.hpp"
|
||||
#include "function_tree_export.hpp"
|
||||
#include "system_export.hpp"
|
||||
#include "parser_export.hpp"
|
||||
#include "tracker_export.hpp"
|
||||
#include "tracker_observers.hpp"
|
||||
#include "endgame_export.hpp"
|
||||
#include "tracker_observers.hpp"
|
||||
#include "endgame_observers.hpp"
|
||||
#include "detail.hpp"
|
||||
#include "logging.hpp"
|
||||
#include "zero_dim_export.hpp"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
214
python/include/containers_export.hpp
Normal file
214
python/include/containers_export.hpp
Normal file
@@ -0,0 +1,214 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/containers_export.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/containers_export.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/containers_export.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2016-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// James Collins
|
||||
// West Texas A&M University
|
||||
// Spring 2016
|
||||
//
|
||||
// silviana amethyst
|
||||
// UWEC
|
||||
// Spring 2018
|
||||
//
|
||||
// python/containers_export.hpp: Exports all needed containers from Bertini 2.0 to python.
|
||||
|
||||
#pragma once
|
||||
#ifndef BERTINI_PYTHON_CONTAINERS_EXPORT_HPP
|
||||
#define BERTINI_PYTHON_CONTAINERS_EXPORT_HPP
|
||||
|
||||
#include <deque>
|
||||
#include "python_common.hpp"
|
||||
|
||||
#include <bertini2/nag_algorithms/zero_dim_solve.hpp>
|
||||
#include <bertini2/function_tree.hpp>
|
||||
#include <boost/python/stl_iterator.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
namespace bertini{ namespace python{
|
||||
|
||||
template< typename T>
|
||||
inline std::ostream& operator<<(std::ostream & out, const std::vector<T> & t)
|
||||
{
|
||||
out << "[";
|
||||
for (int ii = 0; ii < t.size(); ++ii)
|
||||
{
|
||||
out << t[ii];
|
||||
if (ii!=t.size()-1)
|
||||
{
|
||||
out << ", ";
|
||||
}
|
||||
}
|
||||
out << "]";
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
template< typename T>
|
||||
inline std::ostream& operator<<(std::ostream & out, const std::deque<T> & t)
|
||||
{
|
||||
out << "[";
|
||||
for (int ii = 0; ii < t.size(); ++ii)
|
||||
{
|
||||
out << t[ii];
|
||||
if (ii!=t.size()-1)
|
||||
{
|
||||
out << ", ";
|
||||
}
|
||||
}
|
||||
out << "]";
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Adds functionality to iterable types
|
||||
*/
|
||||
template<typename ContT>
|
||||
class ListVisitor: public def_visitor<ListVisitor<ContT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
static std::string __str__(const object& obj)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
const ContT& self=extract<ContT>(obj)();
|
||||
std::stringstream ss;
|
||||
ss << "[";
|
||||
for (int ii = 0; ii < self.size(); ++ii)
|
||||
{
|
||||
ss << self[ii];
|
||||
if (ii!=self.size()-1)
|
||||
{
|
||||
ss << ", ";
|
||||
}
|
||||
}
|
||||
ss << "]";
|
||||
return ss.str();
|
||||
};
|
||||
|
||||
static std::string __repr__(const object& obj)
|
||||
{
|
||||
return __str__(obj);
|
||||
// std::ostringstream oss;
|
||||
// const ContT& self=extract<ContT>(obj)();
|
||||
// std::stringstream ss;
|
||||
// ss << self.str(0,std::ios::scientific);
|
||||
// return ss.str();
|
||||
};
|
||||
|
||||
};// ListVisitor class
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// This block of code lets us construct a container in C++ from a list of things in Python.
|
||||
// i found this problem difficult.
|
||||
//
|
||||
// fortunately, there were a number of questions and answers of varying quality about it, and the below
|
||||
// worked readily.
|
||||
//
|
||||
// derived from https://stackoverflow.com/questions/56290774/boost-python-exposing-c-class-with-constructor-taking-a-stdlist
|
||||
|
||||
template<typename ContT>
|
||||
std::shared_ptr<ContT> create_MyClass(boost::python::list const& l)
|
||||
{
|
||||
using ContainedT = typename ContT::value_type;
|
||||
|
||||
ContT temp{ boost::python::stl_input_iterator<ContainedT>(l)
|
||||
, boost::python::stl_input_iterator<ContainedT>() };
|
||||
return std::make_shared<ContT>(temp);
|
||||
}
|
||||
|
||||
|
||||
template<typename ContT>
|
||||
struct std_list_to_python
|
||||
{
|
||||
static PyObject* convert(ContT const& l)
|
||||
{
|
||||
boost::python::list result;
|
||||
for (auto const& value : l) {
|
||||
result.append(value);
|
||||
}
|
||||
return boost::python::incref(result.ptr());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<typename ContT>
|
||||
struct pylist_converter
|
||||
{
|
||||
using ContainedT = typename ContT::value_type;
|
||||
|
||||
static void* convertible(PyObject* object)
|
||||
{
|
||||
if (!PyList_Check(object)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int sz = PySequence_Size(object);
|
||||
for (int i = 0; i < sz; ++i) {
|
||||
if (!(PyList_GetItem(object, i))) { // silviana sez: i removed a string checking call here.
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
static void construct(PyObject* object, boost::python::converter::rvalue_from_python_stage1_data* data)
|
||||
{
|
||||
typedef boost::python::converter::rvalue_from_python_storage<ContT> storage_type;
|
||||
void* storage = reinterpret_cast<storage_type*>(data)->storage.bytes;
|
||||
|
||||
data->convertible = new (storage) ContT();
|
||||
|
||||
ContT* l = (ContT*)(storage);
|
||||
|
||||
int sz = PySequence_Size(object);
|
||||
for (int i = 0; i < sz; ++i) {
|
||||
l->push_back(boost::python::extract<ContainedT>(PyList_GetItem(object, i)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ExportContainers();
|
||||
|
||||
}} // namespaces
|
||||
#endif
|
||||
39
python/include/detail.hpp
Normal file
39
python/include/detail.hpp
Normal file
@@ -0,0 +1,39 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/detail.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/detail.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/detail.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2017-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// silviana amethyst
|
||||
// UWEC
|
||||
// Fall 2017, Spring 2018
|
||||
//
|
||||
//
|
||||
// python/detail.hpp: source file for exposing b2 c++ details to python
|
||||
|
||||
#pragma once
|
||||
#include "generic_observer.hpp"
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
void ExportDetails();
|
||||
|
||||
}} // namespaces
|
||||
158
python/include/eigenpy_interaction.hpp
Normal file
158
python/include/eigenpy_interaction.hpp
Normal file
@@ -0,0 +1,158 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#ifndef BERTINI_PYTHON_EIGENPY_INTERACTION_HPP
|
||||
#define BERTINI_PYTHON_EIGENPY_INTERACTION_HPP
|
||||
|
||||
|
||||
#include "python_common.hpp"
|
||||
|
||||
#include <eigenpy/eigenpy.hpp>
|
||||
#include <eigenpy/user-type.hpp>
|
||||
#include <eigenpy/ufunc.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// this code derived from
|
||||
// https://github.com/stack-of-tasks/eigenpy/issues/365
|
||||
// where I asked about using custom types, and @jcarpent responded with a discussion
|
||||
// of an application of this in Pinnochio, a library for rigid body dynamics.
|
||||
namespace eigenpy
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
|
||||
|
||||
// template specialization for real numbers
|
||||
template <>
|
||||
struct getitem<bertini::mpfr_float>
|
||||
{
|
||||
using NumT = bertini::mpfr_float;
|
||||
|
||||
static PyObject* run(void* data, void* /* arr */) {
|
||||
NumT & mpfr_scalar = *static_cast<NumT*>(data);
|
||||
auto & backend = mpfr_scalar.backend();
|
||||
|
||||
if(backend.data()[0]._mpfr_d == 0) // If the mpfr_scalar is not initialized, we have to init it.
|
||||
{
|
||||
mpfr_scalar = NumT(0);
|
||||
}
|
||||
boost::python::object m(boost::ref(mpfr_scalar));
|
||||
Py_INCREF(m.ptr());
|
||||
return m.ptr();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// a template specialization for complex numbers
|
||||
template <>
|
||||
struct getitem<bertini::mpfr_complex>
|
||||
{
|
||||
using NumT = bertini::mpfr_complex;
|
||||
|
||||
static PyObject* run(void* data, void* /* arr */) {
|
||||
NumT & mpfr_scalar = *static_cast<NumT*>(data);
|
||||
auto & backend = mpfr_scalar.backend();
|
||||
|
||||
if(backend.data()[0].re->_mpfr_d == 0) // If the mpfr_scalar is not initialized, we have to init it.
|
||||
{
|
||||
mpfr_scalar = NumT(0);
|
||||
}
|
||||
boost::python::object m(boost::ref(mpfr_scalar));
|
||||
Py_INCREF(m.ptr());
|
||||
return m.ptr();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
} // namespace internal
|
||||
|
||||
|
||||
|
||||
// i lifted this from EigenPy and adapted it, basically removing the calls for the comparitors.
|
||||
template <typename Scalar>
|
||||
void registerUfunct_without_comparitors(){
|
||||
const int type_code = Register::getTypeCode<Scalar>();
|
||||
|
||||
PyObject *numpy_str;
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
numpy_str = PyUnicode_FromString("numpy");
|
||||
#else
|
||||
numpy_str = PyString_FromString("numpy");
|
||||
#endif
|
||||
PyObject *numpy;
|
||||
numpy = PyImport_Import(numpy_str);
|
||||
Py_DECREF(numpy_str);
|
||||
|
||||
import_ufunc();
|
||||
|
||||
// Matrix multiply
|
||||
{
|
||||
int types[3] = {type_code, type_code, type_code};
|
||||
|
||||
std::stringstream ss;
|
||||
ss << "return result of multiplying two matrices of ";
|
||||
ss << bp::type_info(typeid(Scalar)).name();
|
||||
PyUFuncObject *ufunc =
|
||||
(PyUFuncObject *)PyObject_GetAttrString(numpy, "matmul");
|
||||
if (!ufunc) {
|
||||
std::stringstream ss;
|
||||
ss << "Impossible to define matrix_multiply for given type "
|
||||
<< bp::type_info(typeid(Scalar)).name() << std::endl;
|
||||
eigenpy::Exception(ss.str());
|
||||
}
|
||||
if (PyUFunc_RegisterLoopForType((PyUFuncObject *)ufunc, type_code,
|
||||
&internal::gufunc_matrix_multiply<Scalar>,
|
||||
types, 0) < 0) {
|
||||
std::stringstream ss;
|
||||
ss << "Impossible to register matrix_multiply for given type "
|
||||
<< bp::type_info(typeid(Scalar)).name() << std::endl;
|
||||
eigenpy::Exception(ss.str());
|
||||
}
|
||||
|
||||
Py_DECREF(ufunc);
|
||||
}
|
||||
|
||||
// Binary operators
|
||||
EIGENPY_REGISTER_BINARY_UFUNC(add, type_code, Scalar, Scalar, Scalar);
|
||||
EIGENPY_REGISTER_BINARY_UFUNC(subtract, type_code, Scalar, Scalar, Scalar);
|
||||
EIGENPY_REGISTER_BINARY_UFUNC(multiply, type_code, Scalar, Scalar, Scalar);
|
||||
EIGENPY_REGISTER_BINARY_UFUNC(divide, type_code, Scalar, Scalar, Scalar);
|
||||
|
||||
// Comparison operators
|
||||
EIGENPY_REGISTER_BINARY_UFUNC(equal, type_code, Scalar, Scalar, bool);
|
||||
EIGENPY_REGISTER_BINARY_UFUNC(not_equal, type_code, Scalar, Scalar, bool);
|
||||
|
||||
//these are commented out because the comparisons are NOT defined for complex types!!
|
||||
// EIGENPY_REGISTER_BINARY_UFUNC(greater, type_code, Scalar, Scalar, bool);
|
||||
// EIGENPY_REGISTER_BINARY_UFUNC(less, type_code, Scalar, Scalar, bool);
|
||||
// EIGENPY_REGISTER_BINARY_UFUNC(greater_equal, type_code, Scalar, Scalar, bool);
|
||||
// EIGENPY_REGISTER_BINARY_UFUNC(less_equal, type_code, Scalar, Scalar, bool);
|
||||
|
||||
// Unary operators
|
||||
EIGENPY_REGISTER_UNARY_UFUNC(negative, type_code, Scalar, Scalar);
|
||||
|
||||
Py_DECREF(numpy);
|
||||
}
|
||||
|
||||
} // namespace eigenpy
|
||||
|
||||
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
void EnableEigenPy();
|
||||
|
||||
}} // namespaces
|
||||
|
||||
|
||||
#endif // include guard
|
||||
|
||||
162
python/include/endgame_export.hpp
Normal file
162
python/include/endgame_export.hpp
Normal file
@@ -0,0 +1,162 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/endgame_export.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/endgame_export.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/endgame_export.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2016-2024 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// silviana amethyst
|
||||
// University of Notre Dame
|
||||
// Summer 2016, Summer 2023, Fall 2024
|
||||
//
|
||||
//
|
||||
// python/endgame_export.hpp: Header file for exposing endgames to python.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "python_common.hpp"
|
||||
|
||||
#include <bertini2/endgames.hpp>
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
using namespace bertini::tracking;
|
||||
|
||||
/**
|
||||
Abstract Endgame class
|
||||
*/
|
||||
template<typename EndgameT>
|
||||
class EndgameBaseVisitor: public def_visitor<EndgameBaseVisitor<EndgameT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
private:
|
||||
|
||||
using BCT = typename TrackerTraits<typename EndgameT::TrackerType>::BaseComplexType;
|
||||
using BRT = typename TrackerTraits<typename EndgameT::TrackerType>::BaseRealType;
|
||||
using BaseEGT = typename EndgameT::BaseEGT;
|
||||
|
||||
static
|
||||
SuccessCode WrapRunDefaultTime(EndgameT & self, BCT const& t, const Eigen::Ref<const Vec<BCT>> s){
|
||||
return self.Run(t, s);
|
||||
}
|
||||
|
||||
static
|
||||
SuccessCode WrapRunCustomTime(EndgameT & self, BCT const& t, const Eigen::Ref<const Vec<BCT>> s, BCT const& u){
|
||||
return self.Run(t, s, u);
|
||||
}
|
||||
|
||||
|
||||
using unsigned_of_void = unsigned (BaseEGT::*)() const;
|
||||
static unsigned_of_void GetCycleNumberFn()
|
||||
{
|
||||
return &BaseEGT::CycleNumber;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
static
|
||||
Vec<T> return_final_approximation(EndgameT const& self)
|
||||
{
|
||||
return self.template FinalApproximation<T>();
|
||||
}
|
||||
|
||||
};// EndgameVisitor class
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Particulars for the PowerSeries endgame.
|
||||
*/
|
||||
template<typename PowerSeriesT>
|
||||
class PowerSeriesVisitor: public def_visitor<PowerSeriesVisitor<PowerSeriesT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
private:
|
||||
|
||||
using BCT = typename TrackerTraits<typename PowerSeriesT::TrackerType>::BaseComplexType;
|
||||
using BRT = typename TrackerTraits<typename PowerSeriesT::TrackerType>::BaseRealType;
|
||||
|
||||
|
||||
};// CauchyVisitor class
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Particulars for the Cauchy endgame.
|
||||
*/
|
||||
template<typename CauchyT>
|
||||
class CauchyVisitor: public def_visitor<CauchyVisitor<CauchyT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
private:
|
||||
|
||||
using BCT = typename TrackerTraits<typename CauchyT::TrackerType>::BaseComplexType;
|
||||
using BRT = typename TrackerTraits<typename CauchyT::TrackerType>::BaseRealType;
|
||||
|
||||
|
||||
};// CauchyVisitor class
|
||||
|
||||
|
||||
|
||||
|
||||
// now prototypes for expose functions defined in the .cpp files for the python bindings.
|
||||
|
||||
/**
|
||||
The main function for exporting the bound endgames to Python.
|
||||
|
||||
This should be the only function called from the main function defining the module, and should call all those functions exposing particular endgames.
|
||||
*/
|
||||
void ExportEndgames();
|
||||
|
||||
|
||||
/**
|
||||
export the power series endgame incarnations
|
||||
*/
|
||||
void ExportAMPPSEG();
|
||||
void ExportFDPSEG();
|
||||
void ExportFMPSEG();
|
||||
|
||||
|
||||
/**
|
||||
export the cauchy endgame incarnations
|
||||
*/
|
||||
void ExportAMPCauchyEG();
|
||||
void ExportFDCauchyEG();
|
||||
void ExportFMCauchyEG();
|
||||
|
||||
|
||||
|
||||
}}// re: namespaces
|
||||
|
||||
62
python/include/endgame_observers.hpp
Normal file
62
python/include/endgame_observers.hpp
Normal file
@@ -0,0 +1,62 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/endgame_observers.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/endgame_observers.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/endgame_observers.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2017-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// silviana amethyst
|
||||
// UWEC
|
||||
// Fall 2017, Spring 2018
|
||||
//
|
||||
//
|
||||
// python/endgame_observers.hpp: source file for exposing endgame observers to python.
|
||||
|
||||
#pragma once
|
||||
#include "python_common.hpp"
|
||||
#include "endgame_export.hpp"
|
||||
|
||||
#include <bertini2/endgames/observers.hpp>
|
||||
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
|
||||
void ExportEndgameObservers();
|
||||
|
||||
|
||||
using namespace bertini::endgame;
|
||||
|
||||
|
||||
template<typename ObsT>
|
||||
struct EndgameObserverVisitor: public def_visitor<EndgameObserverVisitor<ObsT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
}} // namespaces
|
||||
96
python/include/function_tree_export.hpp
Normal file
96
python/include/function_tree_export.hpp
Normal file
@@ -0,0 +1,96 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/function_tree.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/function_tree.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/function_tree.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2016-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// James Collins
|
||||
// West Texas A&M University
|
||||
// Spring 2016
|
||||
//
|
||||
//
|
||||
// python/function_tree.hpp: Header file for all node types.
|
||||
|
||||
#pragma once
|
||||
#ifndef BERTINI_PYTHON_FUNCTION_TREE_HPP
|
||||
#define BERTINI_PYTHON_FUNCTION_TREE_HPP
|
||||
|
||||
#include "python_common.hpp"
|
||||
#include <bertini2/function_tree.hpp>
|
||||
|
||||
#include "node_export.hpp"
|
||||
#include "symbol_export.hpp"
|
||||
#include "operator_export.hpp"
|
||||
#include "root_export.hpp"
|
||||
|
||||
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
using namespace bertini::node;
|
||||
using Node = Node;
|
||||
using Nodeptr = std::shared_ptr<Node>;
|
||||
|
||||
|
||||
|
||||
|
||||
void SetupFunctionTree()
|
||||
{
|
||||
// Tell Python that pointers to derived Nodes can be used as Node pointers when passed to methods
|
||||
implicitly_convertible<std::shared_ptr<Float>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<special_number::Pi>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<special_number::E>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<Integer>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<Rational>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<Variable>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<Differential>, Nodeptr>();
|
||||
|
||||
implicitly_convertible<std::shared_ptr<SumOperator>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<MultOperator>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<PowerOperator>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<NegateOperator>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<IntegerPowerOperator>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<SqrtOperator>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<ExpOperator>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<LogOperator>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<TrigOperator>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<SinOperator>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<CosOperator>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<TanOperator>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<ArcSinOperator>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<ArcCosOperator>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<ArcTanOperator>, Nodeptr>();
|
||||
|
||||
implicitly_convertible<std::shared_ptr<Function>, Nodeptr>();
|
||||
implicitly_convertible<std::shared_ptr<Jacobian>, Nodeptr>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
69
python/include/generic_observable.hpp
Normal file
69
python/include/generic_observable.hpp
Normal file
@@ -0,0 +1,69 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/generic_observable.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/generic_observable.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/generic_observable.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2017-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// silviana amethyst
|
||||
// UWEC
|
||||
// Fall 2017, Spring 2018
|
||||
//
|
||||
//
|
||||
// python/generic_observable.hpp: source file for exposing trackers to python.
|
||||
|
||||
#pragma once
|
||||
#include "python_common.hpp"
|
||||
#include <bertini2/detail/observable.hpp>
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
template <typename ObsT>
|
||||
class ObservableVisitor : public def_visitor<ObservableVisitor<ObsT>>
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
static void AddObserver(object& obj, object& obs)
|
||||
{
|
||||
ObsT& self=extract<ObsT&>(obj)();
|
||||
AnyObserver& observer=extract<AnyObserver&>(obs)();
|
||||
self.AddObserver(observer);
|
||||
};
|
||||
|
||||
static void RemoveObserver(object& obj, object& obs)
|
||||
{
|
||||
ObsT& self=extract<ObsT&>(obj)();
|
||||
AnyObserver& observer=extract<AnyObserver&>(obs)();
|
||||
self.RemoveObserver(observer);
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const{
|
||||
cl
|
||||
.def("add_observer", &ObservableVisitor::AddObserver)
|
||||
.def("remove_observer", &ObservableVisitor::RemoveObserver)
|
||||
;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}} // namespaces
|
||||
49
python/include/generic_observer.hpp
Normal file
49
python/include/generic_observer.hpp
Normal file
@@ -0,0 +1,49 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/generic_observer.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/generic_observer.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/generic_observer.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2017-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// silviana amethyst
|
||||
// UWEC
|
||||
// Fall 2017, Spring 2018
|
||||
//
|
||||
//
|
||||
// python/generic_observer.hpp: source file for exposing trackers to python.
|
||||
|
||||
#pragma once
|
||||
#include "python_common.hpp"
|
||||
#include <bertini2/detail/observer.hpp>
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
// Wrapper struct to allow derived classes to overide methods in python
|
||||
template<typename ObsT>
|
||||
struct ObserverWrapper : ObsT, wrapper<ObsT>
|
||||
{
|
||||
|
||||
void Observe(AnyEvent const& e) { this->get_override("Observe")(e);}
|
||||
|
||||
}; // re: ObserverWrapper
|
||||
|
||||
void ExportObserver();
|
||||
|
||||
}} // namespaces
|
||||
43
python/include/logging.hpp
Normal file
43
python/include/logging.hpp
Normal file
@@ -0,0 +1,43 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/include/logging.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/include/logging.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/include/logging.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// silviana amethyst
|
||||
// UWEC
|
||||
// Spring 2018
|
||||
//
|
||||
//
|
||||
// python/include/logging.hpp: header file for exposing logging to python.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "python_common.hpp"
|
||||
#include <bertini2/logging.hpp>
|
||||
|
||||
namespace bertini{ namespace python{
|
||||
|
||||
|
||||
void ExportLogging();
|
||||
|
||||
|
||||
|
||||
}} // namespaces
|
||||
353
python/include/mpfr_export.hpp
Normal file
353
python/include/mpfr_export.hpp
Normal file
@@ -0,0 +1,353 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/mpfr_export.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/mpfr_export.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/mpfr_export.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2016-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
//
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// silviana amethyst
|
||||
// University of Wisconsin - Eau Claire
|
||||
// Fall 2017, Spring 2018
|
||||
//
|
||||
// James Collins
|
||||
// West Texas A&M University
|
||||
// Spring 2016
|
||||
//
|
||||
//
|
||||
// python/mpfr_export.hpp: Header file for exposing all multiprecision data types, those from boost and bertini::complex.
|
||||
|
||||
#pragma once
|
||||
#ifndef BERTINI_PYTHON_MPFR_EXPORT_HPP
|
||||
#define BERTINI_PYTHON_MPFR_EXPORT_HPP
|
||||
|
||||
#include "python_common.hpp"
|
||||
#include "eigenpy_interaction.hpp"
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
|
||||
void ExportMpfr();
|
||||
|
||||
/**
|
||||
\brief Exposes precision
|
||||
*/
|
||||
template<typename T>
|
||||
class PrecisionVisitor: public def_visitor<PrecisionVisitor<T>>
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
private:
|
||||
|
||||
unsigned (T::*get_prec)() const= &T::precision; // return type needs to be PrecT
|
||||
void (T::*set_prec)(unsigned) = &T::precision;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
\brief Exposes str, repr, and precision
|
||||
*/
|
||||
template<typename T>
|
||||
class RealStrVisitor: public def_visitor<RealStrVisitor<T>>
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
private:
|
||||
|
||||
static std::string __str__(const object& obj)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
const T& self=extract<T>(obj)();
|
||||
std::stringstream ss;
|
||||
ss << self;
|
||||
return ss.str();
|
||||
};
|
||||
|
||||
static std::string __repr__(const object& obj)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
const T& self=extract<T>(obj)();
|
||||
std::stringstream ss;
|
||||
ss << self.str(0,std::ios::scientific);
|
||||
return ss.str();
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
\brief Exposes == and != for homogeneous comparison
|
||||
*/
|
||||
template<typename T>
|
||||
class EqualitySelfVisitor: public def_visitor<EqualitySelfVisitor<T>>
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
private:
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Exposes == and != for inhomogeneous comparison
|
||||
*/
|
||||
template<typename T, typename S>
|
||||
class EqualityVisitor: public def_visitor<EqualityVisitor<T,S>>
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
private:
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Exposes +, - and *
|
||||
*/
|
||||
template<typename T, typename S>
|
||||
class RingVisitor: public def_visitor<RingVisitor<T, S> >
|
||||
{
|
||||
static_assert(!std::is_same<T,S>::value, "RingVisitor is to define T-S operations. for T-T operations, use RingSelfVisitor");
|
||||
friend class def_visitor_access;
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
|
||||
private:
|
||||
static T __add__(const T& a, const S& b){ return a+b; };
|
||||
static T __radd__(const T& b, const S& a){ return a+b; };
|
||||
static T __iadd__(T& a, const S& b){ a+=b; return a; };
|
||||
|
||||
static T __sub__(const T& a, const S& b){ return a-b; };
|
||||
static T __rsub__(const T& b, const S& a){ return a-b; };
|
||||
static T __isub__(T& a, const S& b){ a-=b; return a; };
|
||||
|
||||
static T __mul__(const T& a, const S& b){ return a*b; };
|
||||
static T __rmul__(const T& b, const S& a){ return a*b; };
|
||||
static T __imul__(T& a, const S& b){ a*=b; return a; };
|
||||
}; // RingVisitor
|
||||
|
||||
/**
|
||||
\brief Exposes +, - and *
|
||||
*/
|
||||
template<typename T>
|
||||
class RingSelfVisitor: public def_visitor<RingSelfVisitor<T> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
|
||||
private:
|
||||
static T __add__(const T& a, const T& b){ return a+b; };
|
||||
static T __iadd__(T& a, const T& b){ a+=b; return a; };
|
||||
|
||||
static T __sub__(const T& a, const T& b){ return a-b; };
|
||||
static T __isub__(T& a, const T& b){ a-=b; return a; };
|
||||
|
||||
static T __mul__(const T& a, const T& b){ return a*b; };
|
||||
static T __imul__(T& a, const T& b){ a*=b; return a; };
|
||||
|
||||
static T __neg__(const T& a){ return -a; };
|
||||
}; // RingSelfVisitor
|
||||
|
||||
/**
|
||||
\brief Exposes +, - and *
|
||||
*/
|
||||
template<typename T>
|
||||
class RealFreeVisitor: public def_visitor<RealFreeVisitor<T> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
|
||||
private:
|
||||
static T __abs__(T const& x){ return abs(x);}
|
||||
}; // RingSelfVisitor
|
||||
|
||||
|
||||
|
||||
/**
|
||||
\brief Exposes +,-,*,/
|
||||
*/
|
||||
template<typename T, typename S>
|
||||
class FieldVisitor: public def_visitor<FieldVisitor<T, S> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
|
||||
private:
|
||||
static T __div__(const T& a, const S& b){ return a/b; };
|
||||
static T __rdiv__(const T& b, const S& a){ return a/b; };
|
||||
static T __idiv__(T& a, const S& b){ a/=b; return a; };
|
||||
}; // FieldVisitor
|
||||
|
||||
template<typename T>
|
||||
class FieldSelfVisitor: public def_visitor<FieldSelfVisitor<T> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
|
||||
private:
|
||||
static T div(const T& a, const T& b){ return a/b; };
|
||||
static T idiv(T& a, const T& b){ a/=b; return a; };
|
||||
}; // FieldSelfVisitor
|
||||
|
||||
|
||||
|
||||
template<typename T, typename S>
|
||||
class PowVisitor: public def_visitor<PowVisitor<T,S>>
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
private:
|
||||
static T __pow__(const T& a, const S& b){using std::pow; using boost::multiprecision::pow; return pow(a,b); };
|
||||
};
|
||||
|
||||
|
||||
template<typename T, typename S>
|
||||
class GreatLessVisitor: public def_visitor<GreatLessVisitor<T,S>>
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
template<typename T>
|
||||
class GreatLessSelfVisitor: public def_visitor<GreatLessSelfVisitor<T>>
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
class TranscendentalVisitor: public def_visitor<TranscendentalVisitor<T>>
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
private:
|
||||
|
||||
static T __log__(T const& x){ return log(x);}
|
||||
static T __exp__(T const& x){ return exp(x);}
|
||||
static T __sqrt__(T const& x){ return sqrt(x);}
|
||||
|
||||
static T __sin__(T const& x){ return sin(x);}
|
||||
static T __cos__(T const& x){ return cos(x);}
|
||||
static T __tan__(T const& x){ return tan(x);}
|
||||
|
||||
static T __asin__(T const& x){ return asin(x);}
|
||||
static T __acos__(T const& x){ return acos(x);}
|
||||
static T __atan__(T const& x){ return atan(x);}
|
||||
|
||||
static T __sinh__(T const& x){ return sinh(x);}
|
||||
static T __cosh__(T const& x){ return cosh(x);}
|
||||
static T __tanh__(T const& x){ return tanh(x);}
|
||||
|
||||
static T __asinh__(T const& x){ return asinh(x);}
|
||||
static T __acosh__(T const& x){ return acosh(x);}
|
||||
static T __atanh__(T const& x){ return atanh(x);}
|
||||
};
|
||||
|
||||
/**
|
||||
\brief Exposes complex-specific things
|
||||
*/
|
||||
template<typename T>
|
||||
class ComplexVisitor: public def_visitor<ComplexVisitor<T>>
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
using RealT = typename NumTraits<T>::Real;
|
||||
|
||||
private:
|
||||
static void set_real(T &c, mpfr_float const& r) { c.real(r);}
|
||||
static RealT get_real(T const&c) { return c.real();}
|
||||
|
||||
static void set_imag(T &c, RealT const& r) { c.imag(r);}
|
||||
static RealT get_imag(T const&c) { return c.imag();}
|
||||
|
||||
static RealT __abs__(T const& x){ return abs(x);}
|
||||
|
||||
static T conj(T const& x){ return conj(x);}
|
||||
|
||||
static std::string __str__(const object& obj)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
const T& self=extract<T>(obj)();
|
||||
std::stringstream ss;
|
||||
ss << self;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
static std::string __repr__(const object& obj)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
const T& self=extract<T>(obj)();
|
||||
std::stringstream ss;
|
||||
ss << "(" << real(self).str(0,std::ios::scientific) << ", " << imag(self).str(0,std::ios::scientific) << ")";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
267
python/include/node_export.hpp
Normal file
267
python/include/node_export.hpp
Normal file
@@ -0,0 +1,267 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/node_export.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/node_export.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/node_export.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2016-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// James Collins
|
||||
// West Texas A&M University
|
||||
// Spring 2016
|
||||
//
|
||||
// silviana amethyst
|
||||
// UWEC
|
||||
// Spring 2018
|
||||
//
|
||||
// python/node_export.hpp: Header file for exposing Node class to python.
|
||||
|
||||
#pragma once
|
||||
#ifndef BERTINI_PYTHON_NODE_EXPORT_HPP
|
||||
#define BERTINI_PYTHON_NODE_EXPORT_HPP
|
||||
|
||||
#include <bertini2/function_tree.hpp>
|
||||
#include <bertini2/function_tree/node.hpp>
|
||||
|
||||
|
||||
#include "python_common.hpp"
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
|
||||
using namespace bertini::node;
|
||||
|
||||
using Nodeptr = std::shared_ptr<Node>;
|
||||
|
||||
void ExportNode();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename NodeBaseT>
|
||||
class NodeVisitor: public def_visitor<NodeVisitor<NodeBaseT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
private:
|
||||
static unsigned GetPrecision(NodeBaseT const& self) {return self.precision();}
|
||||
static void SetPrecision(NodeBaseT & self, unsigned p){self.precision(p);}
|
||||
|
||||
static Nodeptr Diff0(NodeBaseT& self) { return self.Differentiate();}
|
||||
Nodeptr (NodeBaseT::*Diff1)(std::shared_ptr<Variable> const&) const= &NodeBaseT::Differentiate;
|
||||
|
||||
static int Deg0(NodeBaseT& self) { return self.Degree();}
|
||||
int (NodeBaseT::*Deg1)(std::shared_ptr<Variable> const&) const= &NodeBaseT::Degree;
|
||||
int (NodeBaseT::*Deg2)(VariableGroup const&) const = &NodeBaseT::Degree;
|
||||
|
||||
static bool IsHom0(NodeBaseT& self) { return self.IsHomogeneous();}
|
||||
bool (NodeBaseT::*IsHom1)(std::shared_ptr<Variable> const&) const= &NodeBaseT::IsHomogeneous;
|
||||
bool (NodeBaseT::*IsHom2)(VariableGroup const& vars) const= &NodeBaseT::IsHomogeneous;
|
||||
|
||||
static bool IsPoly0(NodeBaseT& self) { return self.IsPolynomial();}
|
||||
bool (NodeBaseT::*IsPoly1)(std::shared_ptr<Variable> const&) const= &NodeBaseT::IsPolynomial;
|
||||
bool (NodeBaseT::*IsPoly2)(VariableGroup const& vars) const= &NodeBaseT::IsPolynomial;
|
||||
|
||||
// Can't create member function pointer to Eval with zero arguments because implementation
|
||||
// uses default arguments
|
||||
template <typename T>
|
||||
static T Eval0(NodeBaseT& self) { return self.template Eval<T>();}
|
||||
|
||||
// Use templating to return member function pointer to Eval<T>
|
||||
template <typename T>
|
||||
using Eval1_ptr = T (NodeBaseT::*)(std::shared_ptr<Variable> const&) const;
|
||||
|
||||
template <typename T>
|
||||
static Eval1_ptr<T> return_Eval1_ptr()
|
||||
{
|
||||
return &NodeBaseT::template Eval<T>;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Addition operators
|
||||
Nodeptr(*addNodeNode)(Nodeptr, const Nodeptr&) = &(operator+);
|
||||
Nodeptr(*addNodeMpfr)(Nodeptr, const mpfr_complex&) = &(operator+);
|
||||
|
||||
static Nodeptr raddNodeMpfr(Nodeptr y, const mpfr_complex & x)
|
||||
{
|
||||
return x+y;
|
||||
}
|
||||
|
||||
|
||||
Nodeptr(*addNodeRat)(Nodeptr, const bertini::mpq_rational&) = &(operator+);
|
||||
static Nodeptr raddNodeRat(Nodeptr y, const bertini::mpq_rational& x)
|
||||
{ return x+y; }
|
||||
|
||||
|
||||
static Nodeptr raddNodeInt(Nodeptr y, const int & x)
|
||||
{
|
||||
return x+y;
|
||||
}
|
||||
|
||||
Nodeptr(*addNodeInt)(Nodeptr, int) = &(operator+);
|
||||
static Nodeptr iaddNodeNode(Nodeptr lhs, const Nodeptr & rhs)
|
||||
{
|
||||
return lhs += rhs;
|
||||
}
|
||||
// static Nodeptr iaddNodeDouble(Nodeptr lhs, double rhs)
|
||||
// {
|
||||
// return lhs += rhs;
|
||||
// }
|
||||
static SumOperator iaddSumNode(SumOperator lhs, const Nodeptr & rhs)
|
||||
{
|
||||
return lhs += rhs;
|
||||
}
|
||||
|
||||
// Subtraction operators
|
||||
Nodeptr(*subNodeNode)(Nodeptr, const Nodeptr&) = &(operator-);
|
||||
Nodeptr(*subNodeMpfr)(Nodeptr, mpfr_complex) = &(operator-);
|
||||
Nodeptr(*subNodeInt)(Nodeptr, int) = &(operator-);
|
||||
static Nodeptr isubNodeNode(Nodeptr lhs, const Nodeptr & rhs)
|
||||
{
|
||||
return lhs -= rhs;
|
||||
}
|
||||
|
||||
static SumOperator isubSumNode(SumOperator lhs, const Nodeptr & rhs)
|
||||
{
|
||||
return lhs -= rhs;
|
||||
}
|
||||
|
||||
|
||||
static Nodeptr rsubNodeMpfr(Nodeptr y, const mpfr_complex & x)
|
||||
{
|
||||
return x-y;
|
||||
}
|
||||
|
||||
Nodeptr(*subNodeRat)(Nodeptr, const bertini::mpq_rational&) = &(operator-);
|
||||
static Nodeptr rsubNodeRat(Nodeptr y, const bertini::mpq_rational& x)
|
||||
{ return x-y; }
|
||||
|
||||
static Nodeptr rsubNodeInt(Nodeptr y, const int & x)
|
||||
{
|
||||
return x-y;
|
||||
}
|
||||
|
||||
// Negate operator
|
||||
Nodeptr(*negNode)(const Nodeptr &) = &(operator-);
|
||||
|
||||
|
||||
|
||||
|
||||
// Multiplication operators
|
||||
Nodeptr(*multNodeNode)(Nodeptr, const Nodeptr&) = &(operator*);
|
||||
Nodeptr(*multNodeMpfr)(Nodeptr, mpfr_complex) = &(operator*);
|
||||
Nodeptr(*multNodeRat)(Nodeptr, const mpq_rational&) = &(operator*);
|
||||
Nodeptr(*multNodeInt)(Nodeptr, int) = &(operator*);
|
||||
static Nodeptr imultNodeNode(Nodeptr lhs, const Nodeptr & rhs)
|
||||
{
|
||||
return lhs *= rhs;
|
||||
}
|
||||
|
||||
Nodeptr(*imultMultNode)(std::shared_ptr<node::MultOperator> &, const Nodeptr &) = &(operator*=);
|
||||
|
||||
|
||||
static Nodeptr rmultNodeMpfr(Nodeptr y, const mpfr_complex & x)
|
||||
{
|
||||
return x*y;
|
||||
}
|
||||
|
||||
static Nodeptr rmultNodeRat(Nodeptr y, const mpq_rational & x)
|
||||
{
|
||||
return x*y;
|
||||
}
|
||||
|
||||
static Nodeptr rmultNodeInt(Nodeptr y, const int & x)
|
||||
{
|
||||
return x*y;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Division operators
|
||||
Nodeptr(*divNodeNode)(Nodeptr, const Nodeptr&) = &(operator/);
|
||||
Nodeptr(*divNodeRat)(Nodeptr, const mpq_rational&) = &(operator/);
|
||||
Nodeptr(*divNodeMpfr)(Nodeptr, mpfr_complex) = &(operator/);
|
||||
Nodeptr(*divNodeInt)(Nodeptr, int) = &(operator/);
|
||||
static Nodeptr idivNodeNode(Nodeptr lhs, const Nodeptr & rhs)
|
||||
{
|
||||
return lhs /= rhs;
|
||||
}
|
||||
|
||||
Nodeptr(*idivMultNode)(std::shared_ptr<node::MultOperator> &, const Nodeptr &) = &(operator/=);
|
||||
|
||||
|
||||
static Nodeptr rdivNodeMpfr(Nodeptr y, const mpfr_complex & x)
|
||||
{
|
||||
return x/y;
|
||||
}
|
||||
|
||||
static Nodeptr rdivNodeRat(Nodeptr y, const mpq_rational & x)
|
||||
{
|
||||
return x/y;
|
||||
}
|
||||
|
||||
static Nodeptr rdivNodeInt(Nodeptr y, const int & x)
|
||||
{
|
||||
return x/y;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Power operators
|
||||
Nodeptr(*powNodeNode)(const Nodeptr &, const Nodeptr&) = &pow;
|
||||
Nodeptr(*powNodeMpfr)(const Nodeptr&, mpfr_complex) = &pow;
|
||||
Nodeptr(*powNodeRat)(const Nodeptr&, const mpq_rational&) = &pow;
|
||||
Nodeptr(*powNodeInt)( Nodeptr const&, int) = &pow;
|
||||
|
||||
// Transcendental operators
|
||||
Nodeptr(*expNodeNode)(const Nodeptr &) = &exp;
|
||||
Nodeptr(*logNodeNode)(const Nodeptr &) = &log;
|
||||
Nodeptr(*sinNodeNode)(const Nodeptr &) = &sin;
|
||||
Nodeptr(*asinNodeNode)(const Nodeptr &) = &asin;
|
||||
Nodeptr(*cosNodeNode)(const Nodeptr &) = &cos;
|
||||
Nodeptr(*acosNodeNode)(const Nodeptr &) = &acos;
|
||||
Nodeptr(*tanNodeNode)(const Nodeptr &) = &tan;
|
||||
Nodeptr(*atanNodeNode)(const Nodeptr &) = &atan;
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
164
python/include/operator_export.hpp
Normal file
164
python/include/operator_export.hpp
Normal file
@@ -0,0 +1,164 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/operator_export.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/operator_export.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/operator_export.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2016-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// James Collins
|
||||
// West Texas A&M University
|
||||
// Spring 2016
|
||||
//
|
||||
// silviana amethyst
|
||||
// UWEC
|
||||
// Spring 2018
|
||||
//
|
||||
//
|
||||
// python/operator_export.hpp: Header file for exposing operator nodes to python.
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
#ifndef BERTINI_PYTHON_OPERATOR_EXPORT_HPP
|
||||
#define BERTINI_PYTHON_OPERATOR_EXPORT_HPP
|
||||
|
||||
#include <bertini2/function_tree/operators/operator.hpp>
|
||||
#include <bertini2/function_tree/operators/arithmetic.hpp>
|
||||
#include <bertini2/function_tree/operators/trig.hpp>
|
||||
|
||||
#include "python_common.hpp"
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
using namespace boost::python;
|
||||
using namespace bertini::node;
|
||||
|
||||
using Node = Node;
|
||||
using Nodeptr = std::shared_ptr<Node>;
|
||||
|
||||
|
||||
|
||||
|
||||
void ExportOperators();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
UnaryOperator class(abstract)
|
||||
*/
|
||||
template<typename NodeBaseT>
|
||||
class UnaryOpVisitor: public def_visitor<UnaryOpVisitor<NodeBaseT> >
|
||||
{
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/** NaryOperator class(abstract)
|
||||
*/
|
||||
template<typename NodeBaseT>
|
||||
class NaryOpVisitor: public def_visitor<NaryOpVisitor<NodeBaseT> >
|
||||
{
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
SumOperator and MultOperator classes
|
||||
*/
|
||||
template<typename NodeBaseT>
|
||||
class SumMultOpVisitor: public def_visitor<SumMultOpVisitor<NodeBaseT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
void (NodeBaseT::*AddOperand2)(std::shared_ptr<Node> child, bool) = &NodeBaseT::AddOperand;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
PowerOperator class
|
||||
*/
|
||||
template<typename NodeBaseT>
|
||||
class PowerOpVisitor: public def_visitor<PowerOpVisitor<NodeBaseT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
IntegerPowerOperator class
|
||||
*/
|
||||
template<typename NodeBaseT>
|
||||
class IntPowOpVisitor: public def_visitor<IntPowOpVisitor<NodeBaseT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
private:
|
||||
std::string (NodeBaseT::*getexp)() const = &NodeBaseT::exponent;
|
||||
void (NodeBaseT::*setexp)(const std::string &) = &NodeBaseT::set_exponent;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
} //re: namespace python
|
||||
}//re: namespace bertini
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
72
python/include/parser_export.hpp
Normal file
72
python/include/parser_export.hpp
Normal file
@@ -0,0 +1,72 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/include/parser_export.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/include/parser_export.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/include/parser_export.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2016-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// James Collins
|
||||
// West Texas A&M University
|
||||
// Spring 2016
|
||||
//
|
||||
// silviana amethyst
|
||||
// University of Wisconsin - Eau Claire
|
||||
// Spring 2018
|
||||
//
|
||||
// python/include/parser_export.hpp: Header file for exposing a method for parsing an input file to a system to python.
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
#ifndef BERTINI_PYTHON_PARSER_EXPORT_HPP
|
||||
#define BERTINI_PYTHON_PARSER_EXPORT_HPP
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
|
||||
|
||||
#include <bertini2/io/parsing/function_parsers.hpp>
|
||||
#include <bertini2/io/parsing/system_parsers.hpp>
|
||||
|
||||
|
||||
#include "python_common.hpp"
|
||||
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
using namespace bertini;
|
||||
|
||||
///////////// Parser Exposure /////////////////////
|
||||
template <typename ResultT, typename ParserT>
|
||||
ResultT Parser(std::string str)
|
||||
{
|
||||
ResultT res;
|
||||
std::string::const_iterator iter = str.begin();
|
||||
std::string::const_iterator end = str.end();
|
||||
ParserT P;
|
||||
phrase_parse(iter, end, P, boost::spirit::ascii::space, res);
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
|
||||
void ExportParsers();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
65
python/include/python_common.hpp
Normal file
65
python/include/python_common.hpp
Normal file
@@ -0,0 +1,65 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/python_common.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/python_common.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/python_common.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2016-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// James Collins
|
||||
// West Texas A&M University
|
||||
// Spring 2016
|
||||
//
|
||||
//
|
||||
// python/python_common.hpp: A common header file for all python exposure files
|
||||
|
||||
#pragma once
|
||||
#ifndef BERTINI_PYTHON_COMMON_HPP
|
||||
#define BERTINI_PYTHON_COMMON_HPP
|
||||
|
||||
#include <boost/python.hpp>
|
||||
|
||||
#include <boost/python/module.hpp>
|
||||
#include <boost/python/def.hpp>
|
||||
#include <boost/python/args.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
#include <boost/python/overloads.hpp>
|
||||
#include <boost/python/return_internal_reference.hpp>
|
||||
#include <boost/python/register_ptr_to_python.hpp>
|
||||
|
||||
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
|
||||
|
||||
#include <boost/python/wrapper.hpp>
|
||||
|
||||
#include <boost/python/operators.hpp>
|
||||
#include <boost/operators.hpp>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
#include <bertini2/mpfr_complex.hpp>
|
||||
#include <bertini2/mpfr_extensions.hpp>
|
||||
#include <bertini2/eigen_extensions.hpp>
|
||||
|
||||
|
||||
|
||||
using namespace boost::python;
|
||||
using mpfr_float = bertini::mpfr_float;
|
||||
using mpfr_complex = bertini::mpfr_complex;
|
||||
|
||||
#endif
|
||||
48
python/include/random_export.hpp
Normal file
48
python/include/random_export.hpp
Normal file
@@ -0,0 +1,48 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/random_export.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/random_export.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/random_export.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2023 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// silviana amethyst, summer 2023
|
||||
//
|
||||
//
|
||||
// python/random_export.hpp: Header file for exposing root nodes to python.
|
||||
|
||||
#pragma once
|
||||
#ifndef BERTINI_PYTHON_RANDOM_EXPORT_HPP
|
||||
#define BERTINI_PYTHON_RANDOM_EXPORT_HPP
|
||||
|
||||
#include "python_common.hpp"
|
||||
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
using namespace boost::python;
|
||||
|
||||
|
||||
void ExportRandom();
|
||||
|
||||
}} // namespaces
|
||||
|
||||
|
||||
|
||||
#endif // include guard
|
||||
92
python/include/root_export.hpp
Normal file
92
python/include/root_export.hpp
Normal file
@@ -0,0 +1,92 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/root_export.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/root_export.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/root_export.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2016-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// James Collins
|
||||
// West Texas A&M University
|
||||
// Spring 2016
|
||||
//
|
||||
//
|
||||
// python/root_export.hpp: Header file for exposing root nodes to python.
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef BERTINI_PYTHON_ROOT_EXPORT_HPP
|
||||
#define BERTINI_PYTHON_ROOT_EXPORT_HPP
|
||||
#include <bertini2/function_tree/roots/function.hpp>
|
||||
#include <bertini2/function_tree/roots/jacobian.hpp>
|
||||
|
||||
#include "python_common.hpp"
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
using namespace boost::python;
|
||||
using namespace bertini::node;
|
||||
|
||||
using Node = Node;
|
||||
using Nodeptr = std::shared_ptr<Node>;
|
||||
|
||||
void ExportRoots();
|
||||
|
||||
/**
|
||||
Function class
|
||||
*/
|
||||
template<typename NodeBaseT>
|
||||
class HandleVisitor: public def_visitor<HandleVisitor<NodeBaseT> >
|
||||
{
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Function class
|
||||
*/
|
||||
template<typename NodeBaseT>
|
||||
class FunctionVisitor: public def_visitor<FunctionVisitor<NodeBaseT> >
|
||||
{
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Jacobian class
|
||||
*/
|
||||
template<typename NodeBaseT>
|
||||
class JacobianVisitor: public def_visitor<JacobianVisitor<NodeBaseT> >
|
||||
{
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
146
python/include/symbol_export.hpp
Normal file
146
python/include/symbol_export.hpp
Normal file
@@ -0,0 +1,146 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/symbol_export.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/symbol_export.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/symbol_export.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2016-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// James Collins
|
||||
// West Texas A&M University
|
||||
// Spring 2016
|
||||
//
|
||||
//
|
||||
// python/symbol_export.hpp: Header file for exposing symbol nodes to python.
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef BERTINI_PYTHON_SYMBOLS_EXPORT_HPP
|
||||
#define BERTINI_PYTHON_SYMBOLS_EXPORT_HPP
|
||||
#include <bertini2/function_tree/symbols/symbol.hpp>
|
||||
#include <bertini2/function_tree/symbols/number.hpp>
|
||||
#include <bertini2/function_tree/symbols/special_number.hpp>
|
||||
#include <bertini2/function_tree/symbols/variable.hpp>
|
||||
#include <bertini2/function_tree/symbols/differential.hpp>
|
||||
|
||||
|
||||
|
||||
#include "python_common.hpp"
|
||||
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
using namespace bertini::node;
|
||||
|
||||
|
||||
|
||||
// the main function for exporting symbols into python.
|
||||
void ExportSymbols();
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
NamedSymbol class(abstract)
|
||||
*/
|
||||
template<typename NodeBaseT>
|
||||
class NamedSymbolVisitor: public def_visitor<NamedSymbolVisitor<NodeBaseT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
private:
|
||||
std::string (NodeBaseT::*getname)() const = &NodeBaseT::name;
|
||||
void (NodeBaseT::*setname)(const std::string &) = &NodeBaseT::name;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Integer class
|
||||
*/
|
||||
template<typename NodeBaseT>
|
||||
class IntegerVisitor: public def_visitor<IntegerVisitor<NodeBaseT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Rational class
|
||||
*/
|
||||
template<typename NodeBaseT>
|
||||
class RationalVisitor: public def_visitor<RationalVisitor<NodeBaseT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Variable class
|
||||
*/
|
||||
template<typename NodeBaseT>
|
||||
class VariableVisitor: public def_visitor<VariableVisitor<NodeBaseT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Differential class
|
||||
*/
|
||||
template<typename NodeBaseT>
|
||||
class DifferentialVisitor: public def_visitor<DifferentialVisitor<NodeBaseT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
};
|
||||
|
||||
}//namespace python
|
||||
} // namespace bertini
|
||||
|
||||
#endif
|
||||
218
python/include/system_export.hpp
Normal file
218
python/include/system_export.hpp
Normal file
@@ -0,0 +1,218 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/system_export.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/system_export.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/system_export.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2016-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// James Collins
|
||||
// West Texas A&M University
|
||||
// Spring 2016
|
||||
//
|
||||
// silviana amethyst
|
||||
// UWEC
|
||||
// Spring 2018
|
||||
//
|
||||
//
|
||||
// python/system_export.hpp: Header file for exposing systems to python, including start systems.
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#ifndef BERTINI_PYTHON_SYSTEM_EXPORT_HPP
|
||||
#define BERTINI_PYTHON_SYSTEM_EXPORT_HPP
|
||||
#include <bertini2/system/system.hpp>
|
||||
#include <bertini2/system/start_systems.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "python_common.hpp"
|
||||
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
using namespace bertini;
|
||||
|
||||
template<typename T> using Vec = Eigen::Matrix<T, Eigen::Dynamic, 1>;
|
||||
template<typename T> using Mat = Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>;
|
||||
|
||||
using dbl = std::complex<double>;
|
||||
using mpfr = bertini::mpfr_complex;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ExportAllSystems();
|
||||
|
||||
// some useful subfunctions used in ExportAllSystems
|
||||
void ExportSystem();
|
||||
void ExportStartSystems();
|
||||
void ExportStartSystemBase();
|
||||
void ExportTotalDegree();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
System class
|
||||
*/
|
||||
template<typename SystemBaseT>
|
||||
class SystemVisitor: public def_visitor<SystemVisitor<SystemBaseT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
private:
|
||||
|
||||
// precision functions
|
||||
void (bertini::System::*set_prec_)(unsigned) const = &bertini::System::precision;
|
||||
unsigned (bertini::System::*get_prec_)(void) const = &bertini::System::precision;
|
||||
|
||||
|
||||
|
||||
// using just_fn = void (bertini::System::*)(std::shared_ptr<node::Node> const&);
|
||||
using fn_and_name = void (bertini::System::*)(std::shared_ptr<node::Node> const&, std::string const&);
|
||||
|
||||
|
||||
static fn_and_name AddFnAndName()
|
||||
{
|
||||
return &System::AddFunction;
|
||||
};
|
||||
|
||||
static void AddJustFn(bertini::System& self, std::shared_ptr<node::Node> const& f) { return self.AddFunction(f);}
|
||||
void (bertini::System::*sysAddFunc1)(std::shared_ptr<node::Function> const&) = &bertini::System::AddFunction;
|
||||
// void (bertini::System::*sysAddFunc2)(std::shared_ptr<node::Node> const&, std::string const&) = &bertini::System::AddFunction;
|
||||
|
||||
|
||||
// Vec<dbl> (System::*sysEval1)(const Vec<dbl> &) = &System::template Eval<dbl>;
|
||||
// Vec<dbl> (System::*sysEval1)(const Vec<dbl> &) = &System::template Eval<dbl>;
|
||||
|
||||
std::vector<int> (bertini::System::*sysDeg1)() const = &bertini::System::Degrees;
|
||||
std::vector<int> (bertini::System::*sysDeg2)(VariableGroup const&) const = &bertini::System::Degrees;
|
||||
|
||||
// Eval functions
|
||||
template <typename T>
|
||||
using Eval0_ptr = Vec<T> (SystemBaseT::*)() const;
|
||||
template <typename T>
|
||||
static Eval0_ptr<T> return_Eval0_ptr()
|
||||
{
|
||||
return &SystemBaseT::template Eval<T>;
|
||||
};
|
||||
|
||||
|
||||
// evaluate at arguments passed in, return a vector
|
||||
// in case you wondered how it's done, this is how you enable wrapping of in-place using a Ref.
|
||||
// this ended up being unnecessary, lol. but i kept it because it might be useful
|
||||
// for future reference.
|
||||
template<typename T>
|
||||
static
|
||||
Vec<T> eval_wrap_1(SystemBaseT const& self, Eigen::Ref< Vec<T>> x){
|
||||
return self.template Eval<T>(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
using Eval1_ptr = Vec<T> (SystemBaseT::*)(const Vec<T>&) const;
|
||||
template <typename T>
|
||||
static Eval1_ptr<T> return_Eval1_ptr()
|
||||
{
|
||||
return &SystemBaseT::template Eval<T>;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using Eval2_ptr = Vec<T> (SystemBaseT::*)(const Vec<T>&, const T &) const;
|
||||
template <typename T>
|
||||
static Eval2_ptr<T> return_Eval2_ptr()
|
||||
{
|
||||
return &SystemBaseT::template Eval<T>;
|
||||
};
|
||||
|
||||
|
||||
// Jacobian Eval functions
|
||||
template <typename T>
|
||||
using Jac0_ptr = Mat<T> (SystemBaseT::*)() const;
|
||||
template <typename T>
|
||||
static Jac0_ptr<T> return_Jac0_ptr()
|
||||
{
|
||||
return &SystemBaseT::template Jacobian<T>;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using Jac1_ptr = Mat<T> (SystemBaseT::*)(const Vec<T>&) const;
|
||||
template <typename T>
|
||||
static Jac1_ptr<T> return_Jac1_ptr()
|
||||
{
|
||||
return &SystemBaseT::template Jacobian<T>;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using Jac2_ptr = Mat<T> (SystemBaseT::*)(const Vec<T>&, const T &) const;
|
||||
template <typename T>
|
||||
static Jac2_ptr<T> return_Jac2_ptr()
|
||||
{
|
||||
return &SystemBaseT::template Jacobian<T>;
|
||||
};
|
||||
|
||||
static
|
||||
void rescale_wrap_inplace_mpfr(SystemBaseT const& self, Eigen::Ref<Vec<mpfr>> x){
|
||||
Vec<mpfr> result(x);
|
||||
self.RescalePointToFitPatchInPlace(result);
|
||||
x = result;}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
StartSystem class
|
||||
*/
|
||||
template<typename SystemBaseT>
|
||||
class StartSystemVisitor: public def_visitor<StartSystemVisitor<SystemBaseT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
using GenStart_ptr = Vec<T> (SystemBaseT::*)(unsigned long long) const;
|
||||
template <typename T>
|
||||
static GenStart_ptr<T> return_GenStart_ptr()
|
||||
{
|
||||
return &SystemBaseT::template StartPoint<T>;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
245
python/include/tracker_export.hpp
Normal file
245
python/include/tracker_export.hpp
Normal file
@@ -0,0 +1,245 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/tracker.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/tracker.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/tracker.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2016-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// silviana amethyst
|
||||
// University of Notre Dame
|
||||
// Summer 2016, Spring 2018
|
||||
//
|
||||
// James Collins
|
||||
// West Texas A&M University
|
||||
// Summer 2016
|
||||
//
|
||||
//
|
||||
//
|
||||
// python/tracker.hpp: Header file for exposing trackers to python.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "python_common.hpp"
|
||||
#include "generic_observable.hpp"
|
||||
|
||||
#include <bertini2/trackers/tracker.hpp>
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
|
||||
using namespace bertini::tracking;
|
||||
|
||||
/**
|
||||
Abstract Tracker class
|
||||
*/
|
||||
template<typename TrackerT>
|
||||
class TrackerVisitor: public def_visitor<TrackerVisitor<TrackerT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
private:
|
||||
|
||||
using CT = typename TrackerTraits<TrackerT>::BaseComplexType;
|
||||
using RT = typename TrackerTraits<TrackerT>::BaseRealType;
|
||||
|
||||
|
||||
// resolve overloads for getting and setting predictor method.
|
||||
void (TrackerT::*set_predictor_)(Predictor)= &TrackerT::SetPredictor;
|
||||
Predictor (TrackerT::*get_predictor_)(void) const = &TrackerT::GetPredictor;
|
||||
|
||||
static
|
||||
SuccessCode track_path_wrap(TrackerT const& self, Eigen::Ref<Vec<CT>> result, CT const& start_time, CT const& end_time, Vec<CT> const& start_point)
|
||||
{
|
||||
Vec<CT> temp_result(self.GetSystem().NumVariables());
|
||||
auto code = self.TrackPath(temp_result, start_time, end_time, start_point);
|
||||
result = temp_result;
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
|
||||
};// TrackerVisitor class
|
||||
|
||||
|
||||
/**
|
||||
AMP Tracker class
|
||||
*/
|
||||
template<typename TrackerT>
|
||||
class AMPTrackerVisitor: public def_visitor<AMPTrackerVisitor<TrackerT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
|
||||
private:
|
||||
// resolve overloads for refining a point.
|
||||
template <typename T>
|
||||
using Refine3_ptr = SuccessCode (TrackerT::*)(Vec<T>&, Vec<T> const&, T const&) const;
|
||||
template <typename T>
|
||||
static Refine3_ptr<T> return_Refine3_ptr()
|
||||
{
|
||||
return &TrackerT::template Refine<T>;
|
||||
};
|
||||
|
||||
template <typename ComplexT>
|
||||
using Refine4_ptr = SuccessCode (TrackerT::*)(Vec<ComplexT>&, Vec<ComplexT> const&, ComplexT const&, double const&, unsigned) const;
|
||||
template <typename ComplexT>
|
||||
static Refine4_ptr<ComplexT> return_Refine4_ptr()
|
||||
{
|
||||
return &TrackerT::template Refine<ComplexT>;
|
||||
};
|
||||
|
||||
|
||||
};// AMPTrackerVisitor class
|
||||
|
||||
|
||||
/**
|
||||
Fixed Double Tracker class
|
||||
*/
|
||||
template<typename TrackerT>
|
||||
class FixedDoubleTrackerVisitor: public def_visitor<FixedDoubleTrackerVisitor<TrackerT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
|
||||
private:
|
||||
// resolve overloads for refining a point.
|
||||
template <typename T>
|
||||
using Refine3_ptr = SuccessCode (TrackerT::*)(Vec<T>&, Vec<T> const&, T const&) const;
|
||||
template <typename T>
|
||||
static Refine3_ptr<T> return_Refine3_ptr()
|
||||
{
|
||||
return &TrackerT::template Refine<T>;
|
||||
};
|
||||
|
||||
template <typename ComplexT>
|
||||
using Refine4_ptr = SuccessCode (TrackerT::*)(Vec<ComplexT>&, Vec<ComplexT> const&, ComplexT const&, double const&, unsigned) const;
|
||||
template <typename ComplexT>
|
||||
static Refine4_ptr<ComplexT> return_Refine4_ptr()
|
||||
{
|
||||
return &TrackerT::template Refine<ComplexT>;
|
||||
};
|
||||
|
||||
|
||||
};// FixedDoubleTrackerVisitor class
|
||||
|
||||
|
||||
/**
|
||||
Fixed Multiple Tracker class
|
||||
*/
|
||||
template<typename TrackerT>
|
||||
class FixedMultipleTrackerVisitor: public def_visitor<FixedMultipleTrackerVisitor<TrackerT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
|
||||
private:
|
||||
// resolve overloads for refining a point.
|
||||
template <typename T>
|
||||
using Refine3_ptr = SuccessCode (TrackerT::*)(Vec<T>&, Vec<T> const&, T const&) const;
|
||||
template <typename T>
|
||||
static Refine3_ptr<T> return_Refine3_ptr()
|
||||
{
|
||||
return &TrackerT::template Refine<T>;
|
||||
};
|
||||
|
||||
template <typename ComplexT>
|
||||
using Refine4_ptr = SuccessCode (TrackerT::*)(Vec<ComplexT>&, Vec<ComplexT> const&, ComplexT const&, double const&, unsigned) const;
|
||||
template <typename ComplexT>
|
||||
static Refine4_ptr<ComplexT> return_Refine4_ptr()
|
||||
{
|
||||
return &TrackerT::template Refine<ComplexT>;
|
||||
};
|
||||
|
||||
|
||||
};// FixedMultipleTrackerVisitor class
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Stepping struct
|
||||
*/
|
||||
template<typename T>
|
||||
class SteppingVisitor: public def_visitor<SteppingVisitor<T> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
};// SteppingVisitor class
|
||||
|
||||
|
||||
|
||||
|
||||
// template<typename NumT>
|
||||
// class TolerancesVisitor: public def_visitor<TolerancesVisitor<NumT> >
|
||||
// {
|
||||
// friend class def_visitor_access;
|
||||
|
||||
// public:
|
||||
// template<class PyClass>
|
||||
// void visit(PyClass& cl) const
|
||||
// {
|
||||
// cl
|
||||
// .def_readwrite("newton_before_endgame", &Tolerances<NumT>::newton_before_endgame)
|
||||
// .def_readwrite("newton_during_endgame", &Tolerances<NumT>::newton_during_endgame)
|
||||
// .def_readwrite("final_tolerance", &Tolerances<NumT>::final_tolerance)
|
||||
// .def_readwrite("final_tolerance_multiplier", &Tolerances<NumT>::final_tolerance_multiplier)
|
||||
// .def_readwrite("path_truncation_threshold", &Tolerances<NumT>::path_truncation_threshold)
|
||||
// .def_readwrite("final_tolerance_times_final_tolerance_multiplier", &Tolerances<NumT>::final_tolerance_times_final_tolerance_multiplier)
|
||||
// ;
|
||||
// }
|
||||
|
||||
// };
|
||||
|
||||
|
||||
// now prototypes for expose functions defined in the .cpp files for the python bindings.
|
||||
void ExportTrackers();
|
||||
void ExportAMPTracker();
|
||||
void ExportFixedTrackers();
|
||||
void ExportFixedDoubleTracker();
|
||||
void ExportFixedMultipleTracker();
|
||||
|
||||
void ExportConfigSettings();
|
||||
|
||||
}}// re: namespaces
|
||||
|
||||
|
||||
|
||||
|
||||
62
python/include/tracker_observers.hpp
Normal file
62
python/include/tracker_observers.hpp
Normal file
@@ -0,0 +1,62 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/tracker_observers.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/tracker_observers.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/tracker_observers.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2017-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// silviana amethyst
|
||||
// UWEC
|
||||
// Fall 2017, Spring 2018
|
||||
//
|
||||
//
|
||||
// python/tracker_observers.hpp: source file for exposing trackers to python.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "python_common.hpp"
|
||||
#include <bertini2/trackers/observers.hpp>
|
||||
#include <bertini2/trackers/amp_tracker.hpp>
|
||||
#include <bertini2/trackers/fixed_precision_tracker.hpp>
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
|
||||
void ExportTrackerObservers();
|
||||
|
||||
|
||||
using namespace bertini::tracking;
|
||||
|
||||
|
||||
template<typename ObsT>
|
||||
struct TrackingObserverVisitor: public def_visitor<TrackingObserverVisitor<ObsT> >
|
||||
{
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
}} // namespaces
|
||||
111
python/include/zero_dim_export.hpp
Normal file
111
python/include/zero_dim_export.hpp
Normal file
@@ -0,0 +1,111 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/zero_dim_export.hpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/zero_dim_export.hpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/zero_dim_export.hpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2023 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// silviana amethyst
|
||||
// University of Wisconsin-Eau Claire
|
||||
// 2023
|
||||
//
|
||||
//
|
||||
// python/zero_dim_export.hpp: Header file for exposing the zero dim solve algorithm to Python
|
||||
|
||||
|
||||
#ifndef BERTINI2_PYBERTINI_NAG_ALGORITHMS_ZERO_DIM
|
||||
#define BERTINI2_PYBERTINI_NAG_ALGORITHMS_ZERO_DIM
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "python_common.hpp"
|
||||
|
||||
#include <bertini2/endgames.hpp>
|
||||
#include <bertini2/nag_algorithms/zero_dim_solve.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
using namespace bertini;
|
||||
|
||||
|
||||
|
||||
|
||||
void ExportZeroDim();
|
||||
|
||||
|
||||
|
||||
// some sub-functions to help
|
||||
void ExportZDAlgorithms();
|
||||
void ExportZDConfigs();
|
||||
void ExposeZDMetaData();
|
||||
|
||||
|
||||
template<typename AlgoT>
|
||||
class ZDVisitor: public def_visitor<ZDVisitor<AlgoT> >
|
||||
{
|
||||
|
||||
|
||||
|
||||
friend class def_visitor_access;
|
||||
|
||||
public:
|
||||
template<class PyClass>
|
||||
void visit(PyClass& cl) const;
|
||||
|
||||
private:
|
||||
|
||||
using MutableTrackerGetter = typename AlgoT::TrackerT& (AlgoT::*)();
|
||||
static MutableTrackerGetter GetTrackerMutable()
|
||||
{
|
||||
return &AlgoT::GetTracker;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
using MutableEndgameGetter = typename AlgoT::EndgameT& (AlgoT::*)();
|
||||
static MutableEndgameGetter GetEndgameMutable()
|
||||
{
|
||||
return &AlgoT::GetEndgame;
|
||||
};
|
||||
|
||||
|
||||
// pattern:
|
||||
// returned type. name. argument types.
|
||||
|
||||
// typename AlgoT::TrackerT& (*GetTrackerMutable)() = &AlgoT::GetTracker;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}} // namespaces
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // the include guards
|
||||
77
python/plain_testing_scripts/multiprec.py
Normal file
77
python/plain_testing_scripts/multiprec.py
Normal file
@@ -0,0 +1,77 @@
|
||||
import pybertini
|
||||
|
||||
|
||||
def exercise_ring(a, b):
|
||||
c1 = a+b
|
||||
c2 = b+a
|
||||
|
||||
d1 = a*b
|
||||
d2 = b*a
|
||||
|
||||
e1 = a-b
|
||||
e2 = b-a
|
||||
|
||||
print('{} {} passed ring checks'.format(type(a),type(b)))
|
||||
|
||||
def exercise_field(a,b):
|
||||
exercise_ring(a,b)
|
||||
|
||||
f1 = a/b
|
||||
f2 = b/a
|
||||
|
||||
print('{} {} passed field checks'.format(type(a),type(b)))
|
||||
|
||||
def compare(a, b):
|
||||
a < b
|
||||
a <= b
|
||||
b < a
|
||||
b <= a
|
||||
|
||||
a > b
|
||||
a >= b
|
||||
b > a
|
||||
b >= a
|
||||
|
||||
print('{} {} passed compare checks'.format(type(a),type(b)))
|
||||
|
||||
def eq(a,b):
|
||||
a == b
|
||||
a != b
|
||||
b == a
|
||||
b != a
|
||||
a == a
|
||||
a != a
|
||||
b == b
|
||||
b != b
|
||||
|
||||
print('{} {} passed eq checks'.format(type(a),type(b)))
|
||||
|
||||
rings = [pybertini.multiprec.Int(2)]
|
||||
|
||||
fields = [pybertini.multiprec.Float(3),pybertini.multiprec.Rational(3,4),pybertini.multiprec.Complex(5,6)]
|
||||
|
||||
ordereds = [pybertini.multiprec.Int(2), pybertini.multiprec.Float(3),pybertini.multiprec.Rational(3,4)]
|
||||
|
||||
all_types = [pybertini.multiprec.Int(2), pybertini.multiprec.Float(3),pybertini.multiprec.Rational(3,4), pybertini.multiprec.Complex(5,6)]
|
||||
|
||||
|
||||
for ii in rings:
|
||||
for jj in rings:
|
||||
exercise_ring(ii,jj)
|
||||
|
||||
for ii in fields:
|
||||
for jj in fields:
|
||||
exercise_field(ii,jj)
|
||||
|
||||
# then mixed products
|
||||
for ii in rings:
|
||||
for jj in fields:
|
||||
exercise_field(ii,jj)
|
||||
|
||||
|
||||
for ii in ordereds:
|
||||
compare(ii, 1)
|
||||
|
||||
for ii in all_types:
|
||||
eq(ii,ii)
|
||||
|
||||
83
python/pybertini/__init__.py
Normal file
83
python/pybertini/__init__.py
Normal file
@@ -0,0 +1,83 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
PyBertini -- Python bindings for Bertini2.
|
||||
|
||||
This code is licensed under the GNU Public License, Version 3, with
|
||||
additional clauses under section 7 as permitted, to protect the
|
||||
Bertini name. See b2/licenses/ for a complete copy of the license,
|
||||
and the licenses of software upon which Bertini depends.
|
||||
|
||||
See the source at https://github.com/bertiniteam/b2
|
||||
"""
|
||||
|
||||
|
||||
### this __init__.py is strongly inspired by that for GalSim
|
||||
### https://github.com/GalSim-developers/GalSim
|
||||
|
||||
from ._version import __version__, __version_info__
|
||||
version = __version__
|
||||
|
||||
|
||||
# put stuff in the pybertini namespace
|
||||
|
||||
import pybertini.function_tree as function_tree
|
||||
|
||||
import pybertini.system as system
|
||||
import pybertini.tracking as tracking
|
||||
import pybertini.endgame as endgame
|
||||
import pybertini.parse as parse
|
||||
import pybertini.container as container
|
||||
import pybertini.logging as logging
|
||||
import pybertini.nag_algorithm as nag_algorithm
|
||||
import pybertini.random as random
|
||||
|
||||
|
||||
import pybertini.multiprec as multiprec
|
||||
|
||||
# some convenience assignments
|
||||
Variable = function_tree.symbol.Variable
|
||||
VariableGroup = function_tree.VariableGroup
|
||||
System = system.System
|
||||
default_precision = multiprec.default_precision
|
||||
|
||||
|
||||
|
||||
# https://stackoverflow.com/questions/44834/what-does-all-mean-in-python
|
||||
# "a list of strings defining what symbols in a module will be exported when from <module> import * is used on the module"
|
||||
__all__ = ['Variable','VariableGroup','system','System',
|
||||
'nag_algorithm','container','default_precision',
|
||||
'tracking','endgame','logging','function_tree','parse','multiprec','random']
|
||||
|
||||
|
||||
|
||||
|
||||
33
python/pybertini/_version.py
Normal file
33
python/pybertini/_version.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/_version.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/_version.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/_version.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018-2023 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018-2023
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
__version__ = '1.0.5'
|
||||
__version_info__ = tuple(map(int, __version__.split('.')))
|
||||
32
python/pybertini/algorithms/__init__.py
Normal file
32
python/pybertini/algorithms/__init__.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/algorithms/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/algorithms/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/algorithms/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
"""
|
||||
Various algorithms for numerical algebraic geometry, notable the zero dimensional algorithm, which is used all over the place.
|
||||
"""
|
||||
|
||||
27
python/pybertini/algorithms/zerodim.py
Normal file
27
python/pybertini/algorithms/zerodim.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/algorithms/zerodim.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/algorithms/zerodim.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/algorithms/zerodim.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
51
python/pybertini/container/__init__.py
Normal file
51
python/pybertini/container/__init__.py
Normal file
@@ -0,0 +1,51 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/container/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/container/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/container/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018-2023 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018, 2023
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
container types, coming from C++
|
||||
|
||||
|
||||
"""
|
||||
|
||||
import pybertini._pybertini.container
|
||||
|
||||
from pybertini._pybertini.container import *
|
||||
|
||||
__all__ = dir(pybertini._pybertini.container)
|
||||
|
||||
|
||||
vector_types = (ListOfVectorComplexVariablePrecision, ListOfVectorComplexDoublePrecision)
|
||||
|
||||
|
||||
# for v in vector_types:
|
||||
# v.Zero = lambda n: v( (0,)*n )
|
||||
|
||||
87
python/pybertini/endgame/__init__.py
Normal file
87
python/pybertini/endgame/__init__.py
Normal file
@@ -0,0 +1,87 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/endgame/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/endgame/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/endgame/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
"""
|
||||
Endgame-specific things -- endgames, configs
|
||||
***********************************************
|
||||
|
||||
Endgames allow the computation of singular endpoints.
|
||||
|
||||
Flavors
|
||||
=========
|
||||
|
||||
There are two basic flavors of endgame implemented:
|
||||
|
||||
1. Power Series, commonly written PS or PSEG
|
||||
2. Cauchy
|
||||
|
||||
Both estimate the cycle number and use it to compute a root at a time which is never tracked to. PSEG uses Hermite interpolation and extrapolation, and Cauchy uses loops around the target time coupled with the `Cauchy integral formula <https://en.wikipedia.org/wiki/Cauchy%27s_integral_formula>`_. Both continue until two successive approximations of the root match to a given tolerance (:py:attr:`pybertini.endgame.config.Endgame.final_tolerance`).
|
||||
|
||||
The implementations of the endgames go with a particular tracker, hence there are six provided endgame types. Choose the one that goes with your selected tracker type. Adaptive Multiple Precision is a good choice.
|
||||
|
||||
|
||||
Implementation reference
|
||||
=========================
|
||||
|
||||
AMP Endgames
|
||||
-------------
|
||||
|
||||
* :class:`~pybertini.endgame.AMPCauchyEG`
|
||||
* :class:`~pybertini.endgame.AMPPSEG`
|
||||
|
||||
Fixed Double Precision Endgames
|
||||
---------------------------------
|
||||
|
||||
* :class:`~pybertini.endgame.FixedDoublePSEG`
|
||||
* :class:`~pybertini.endgame.FixedDoublePSEG`
|
||||
|
||||
Fixed Multiple Precision Endgames
|
||||
-------------------------------------
|
||||
|
||||
* :class:`~pybertini.endgame.FixedMultiplePSEG`
|
||||
* :class:`~pybertini.endgame.FixedMultiplePSEG`
|
||||
|
||||
"""
|
||||
|
||||
import pybertini._pybertini.endgame
|
||||
|
||||
from pybertini._pybertini.endgame import *
|
||||
|
||||
__all__ = ['AMPCauchyEG',
|
||||
'AMPPSEG',
|
||||
'FixedDoubleCauchyEG',
|
||||
'FixedDoublePSEG',
|
||||
'FixedMultipleCauchyEG',
|
||||
'FixedMultiplePSEG',
|
||||
'__doc__',
|
||||
'__loader__',
|
||||
'__name__',
|
||||
'__package__',
|
||||
'__spec__',
|
||||
'config',
|
||||
'observers']
|
||||
41
python/pybertini/endgame/config/__init__.py
Normal file
41
python/pybertini/endgame/config/__init__.py
Normal file
@@ -0,0 +1,41 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/endgame/config/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/endgame/config/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/endgame/config/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
|
||||
|
||||
"""
|
||||
|
||||
Configs for endgames
|
||||
|
||||
"""
|
||||
|
||||
import pybertini._pybertini.endgame.config
|
||||
|
||||
from pybertini._pybertini.endgame.config import *
|
||||
|
||||
__all__ = dir(pybertini._pybertini.endgame.config)
|
||||
43
python/pybertini/function_tree/__init__.py
Normal file
43
python/pybertini/function_tree/__init__.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/function_tree/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/function_tree/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/function_tree/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
|
||||
|
||||
import pybertini._pybertini
|
||||
import pybertini._pybertini.function_tree
|
||||
|
||||
# from pybertini._pybertini import function_tree
|
||||
from pybertini._pybertini.container import VariableGroup
|
||||
|
||||
from pybertini._pybertini.function_tree import *
|
||||
|
||||
|
||||
VariableGroup.__str__ = lambda vg: '[{}]'.format( ','.join([str(v) for v in vg]) )
|
||||
|
||||
__all__ = dir(pybertini._pybertini.function_tree)
|
||||
|
||||
37
python/pybertini/function_tree/root/__init__.py
Normal file
37
python/pybertini/function_tree/root/__init__.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/function_tree/root/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/function_tree/root/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/function_tree/root/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
|
||||
|
||||
import pybertini._pybertini
|
||||
import pybertini._pybertini.function_tree.root
|
||||
|
||||
from pybertini._pybertini.function_tree.root import *
|
||||
|
||||
__all__ = dir(pybertini._pybertini.function_tree.root)
|
||||
|
||||
37
python/pybertini/function_tree/symbol/__init__.py
Normal file
37
python/pybertini/function_tree/symbol/__init__.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/function_tree/symbol/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/function_tree/symbol/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/function_tree/symbol/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
|
||||
|
||||
import pybertini._pybertini
|
||||
import pybertini._pybertini.function_tree.symbol
|
||||
|
||||
from pybertini._pybertini.function_tree.symbol import *
|
||||
|
||||
__all__ = dir(pybertini._pybertini.function_tree.symbol)
|
||||
|
||||
42
python/pybertini/logging/__init__.py
Normal file
42
python/pybertini/logging/__init__.py
Normal file
@@ -0,0 +1,42 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/logging/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/logging/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/logging/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Parsing functions, taking strings and producing various other things
|
||||
"""
|
||||
|
||||
|
||||
import pybertini._pybertini.logging
|
||||
from pybertini._pybertini.logging import *
|
||||
|
||||
__all__ = dir(pybertini._pybertini.logging)
|
||||
|
||||
44
python/pybertini/multiprec/__init__.py
Normal file
44
python/pybertini/multiprec/__init__.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/multiprec/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/multiprec/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/multiprec/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018-2023 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018, summer 2023
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Multiprecision types
|
||||
|
||||
|
||||
"""
|
||||
|
||||
import pybertini._pybertini.multiprec
|
||||
|
||||
from pybertini._pybertini.multiprec import *
|
||||
|
||||
|
||||
__all__ = dir(pybertini._pybertini.multiprec)
|
||||
44
python/pybertini/nag_algorithm/__init__.py
Normal file
44
python/pybertini/nag_algorithm/__init__.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/nag_algorithms/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/nag_algorithms/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/nag_algorithms/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2023 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2023
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
nag_algorithms
|
||||
"""
|
||||
|
||||
|
||||
import pybertini._pybertini.nag_algorithms
|
||||
from pybertini._pybertini.nag_algorithms import *
|
||||
|
||||
__all__ = dir(pybertini._pybertini.nag_algorithms)
|
||||
|
||||
|
||||
# DoublePrecisionTotalDegree = pybertini._pybertini.nag_algorithms.ZeroDimCauchyDoublePrecisionTotalDegree
|
||||
42
python/pybertini/parse/__init__.py
Normal file
42
python/pybertini/parse/__init__.py
Normal file
@@ -0,0 +1,42 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/parse/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/parse/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/parse/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Parsing functions, taking strings and producing various other things
|
||||
"""
|
||||
|
||||
|
||||
import pybertini._pybertini.parse
|
||||
from pybertini._pybertini.parse import *
|
||||
|
||||
__all__ = dir(pybertini._pybertini.parse)
|
||||
|
||||
4
python/pybertini/random/__init__.py
Normal file
4
python/pybertini/random/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
import pybertini._pybertini.random
|
||||
from pybertini._pybertini.random import *
|
||||
|
||||
__all__ = dir(pybertini._pybertini.random)
|
||||
56
python/pybertini/system/__init__.py
Normal file
56
python/pybertini/system/__init__.py
Normal file
@@ -0,0 +1,56 @@
|
||||
# coding : utf-8
|
||||
#
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/system/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/system/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/system/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Provides utilities for working with systems of functions -- polynomials are intended, although you can work with functions involving things like trig functions, arbitrary powers, etc.
|
||||
|
||||
Making a new `System` is the starting point you want, probably:
|
||||
|
||||
::
|
||||
|
||||
sys = pybertini.system.System()
|
||||
|
||||
-----------
|
||||
|
||||
There are also things available in the `start_system` submodule.
|
||||
|
||||
"""
|
||||
|
||||
import pybertini._pybertini.system
|
||||
|
||||
from pybertini._pybertini.system import * # brings the type System
|
||||
from pybertini._pybertini.system import start_system
|
||||
|
||||
__all__ = dir(pybertini._pybertini.system)
|
||||
__all__.extend(['start_system'])
|
||||
41
python/pybertini/system/start_system/__init__.py
Normal file
41
python/pybertini/system/start_system/__init__.py
Normal file
@@ -0,0 +1,41 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/start_system/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/start_system/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/start_system/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Start systems
|
||||
|
||||
"""
|
||||
import pybertini._pybertini.system.start_system
|
||||
from pybertini._pybertini.system.start_system import *
|
||||
|
||||
__all__ = dir(pybertini._pybertini.system.start_system)
|
||||
|
||||
44
python/pybertini/tracking/__init__.py
Normal file
44
python/pybertini/tracking/__init__.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/tracking/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/tracking/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/tracking/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Tracking-specific things -- trackers, configs
|
||||
"""
|
||||
import pybertini._pybertini.tracking
|
||||
from pybertini._pybertini.tracking import *
|
||||
|
||||
__all__ = dir(pybertini._pybertini.tracking)
|
||||
|
||||
|
||||
AMPTracker.observers = pybertini._pybertini.tracking.observers.amp
|
||||
DoublePrecisionTracker.observers = pybertini._pybertini.tracking.observers.double
|
||||
MultiplePrecisionTracker.observers = pybertini._pybertini.tracking.observers.multiple
|
||||
39
python/pybertini/tracking/config/__init__.py
Normal file
39
python/pybertini/tracking/config/__init__.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/tracking/config/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/tracking/config/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/tracking/config/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Tracking-specific configs
|
||||
"""
|
||||
import pybertini._pybertini.tracking.config
|
||||
from pybertini._pybertini.tracking.config import *
|
||||
|
||||
__all__ = dir(pybertini._pybertini.tracking.config)
|
||||
|
||||
39
python/pybertini/tracking/observers/__init__.py
Normal file
39
python/pybertini/tracking/observers/__init__.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/tracking/observers/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/tracking/observers/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/tracking/observers/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Observers built to watch a tracker
|
||||
"""
|
||||
import pybertini._pybertini.tracking.observers
|
||||
from pybertini._pybertini.tracking.observers import *
|
||||
|
||||
__all__ = dir(pybertini._pybertini.tracking.observers)
|
||||
|
||||
39
python/pybertini/tracking/observers/amp/__init__.py
Normal file
39
python/pybertini/tracking/observers/amp/__init__.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/tracking/observers/amp/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/tracking/observers/amp/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/tracking/observers/amp/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Observers built to watch an adaptive precision tracker
|
||||
"""
|
||||
import pybertini._pybertini.tracking.observers.amp
|
||||
from pybertini._pybertini.tracking.observers.amp import *
|
||||
|
||||
__all__ = dir(pybertini._pybertini.tracking.observers.amp)
|
||||
|
||||
39
python/pybertini/tracking/observers/double/__init__.py
Normal file
39
python/pybertini/tracking/observers/double/__init__.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/tracking/observers/double/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/tracking/observers/double/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/tracking/observers/double/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Observers built to watch a pure-double precision tracker
|
||||
"""
|
||||
import pybertini._pybertini.tracking.observers.double
|
||||
from pybertini._pybertini.tracking.observers.double import *
|
||||
|
||||
__all__ = dir(pybertini._pybertini.tracking.observers.double)
|
||||
|
||||
39
python/pybertini/tracking/observers/multiple/__init__.py
Normal file
39
python/pybertini/tracking/observers/multiple/__init__.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# This file is part of Bertini 2.
|
||||
#
|
||||
# python/pybertini/tracking/observers/multiple/__init__.py is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# python/pybertini/tracking/observers/multiple/__init__.py is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with python/pybertini/tracking/observers/multiple/__init__.py. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright(C) 2018 by Bertini2 Development Team
|
||||
#
|
||||
# See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
# as well as COPYING. Bertini2 is provided with permitted
|
||||
# additional terms in the b2/licenses/ directory.
|
||||
|
||||
# individual authors of this file include:
|
||||
#
|
||||
# silviana amethyst
|
||||
# UWEC
|
||||
# Spring 2018
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
"""
|
||||
Observers built to watch a fixed-multiple precision tracker
|
||||
"""
|
||||
import pybertini._pybertini.tracking.observers.multiple
|
||||
from pybertini._pybertini.tracking.observers.multiple import *
|
||||
|
||||
__all__ = dir(pybertini._pybertini.tracking.observers.multiple)
|
||||
|
||||
35
python/python.sublime-project
Normal file
35
python/python.sublime-project
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"folders":
|
||||
[
|
||||
{
|
||||
"path": ".",
|
||||
"file_exclude_patterns": ["serialization_test*",
|
||||
"Makefile.in",
|
||||
"*.la",
|
||||
"libtool",
|
||||
"stamp-h1",
|
||||
".dirstamp",
|
||||
"*.lo",
|
||||
"*~",
|
||||
"aclocal.m4",
|
||||
"ltoptions.m4",
|
||||
"ltsugar.m4",
|
||||
"ltversion.m4",
|
||||
"lt~obsolete.m4",
|
||||
"libtool.m4",
|
||||
"bertini_*.log",
|
||||
"config.status",
|
||||
"configure",
|
||||
"*.trs"],
|
||||
"folder_exclude_patterns": [
|
||||
".deps",
|
||||
".libs",
|
||||
"autom4te.cache",
|
||||
"__pycache__",
|
||||
"pybertini.egg-info",
|
||||
"_static",
|
||||
"_templates"]
|
||||
}
|
||||
],
|
||||
|
||||
}
|
||||
50
python/setup.py
Normal file
50
python/setup.py
Normal file
@@ -0,0 +1,50 @@
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
|
||||
import os
|
||||
|
||||
SRC_PATH = os.path.relpath(os.path.join(os.path.dirname(__file__), "pybertini"))
|
||||
|
||||
|
||||
EXCLUDE_FROM_PACKAGES = []
|
||||
|
||||
setup(name='pybertini',
|
||||
version='1.0.alpha5',
|
||||
description='Software for numerical algebraic geometry',
|
||||
url='http://github.com/bertiniteam/b2',
|
||||
author='Bertini Team',
|
||||
author_email='amethyst@uwec.edu',
|
||||
license='GPL3 with permitted additional clauses',
|
||||
packages=find_packages(exclude=EXCLUDE_FROM_PACKAGES),
|
||||
package_dir = {'pybertini': SRC_PATH},
|
||||
include_package_data=True,
|
||||
package_data= {"":["_pybertini.so"]},
|
||||
zip_safe=False
|
||||
)
|
||||
|
||||
# dependencies to add
|
||||
# sphinxcontrib-bibtex
|
||||
|
||||
|
||||
# from setuptools.command.egg_info import egg_info
|
||||
|
||||
# class EggInfoCommand(egg_info):
|
||||
|
||||
# def run(self):
|
||||
# if "build" in self.distribution.command_obj:
|
||||
# build_command = self.distribution.command_obj["build"]
|
||||
|
||||
# self.egg_base = build_command.build_base
|
||||
|
||||
# self.egg_info = os.path.join(self.egg_base, os.path.basename(self.egg_info))
|
||||
|
||||
# egg_info.run(self)
|
||||
|
||||
# setup(
|
||||
# # ...
|
||||
# cmdclass={
|
||||
# "egg_info": EggInfoCommand,
|
||||
# },
|
||||
# #...
|
||||
# )
|
||||
|
||||
107
python/src/bertini_python.cpp
Normal file
107
python/src/bertini_python.cpp
Normal file
@@ -0,0 +1,107 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/bertini_python.cpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/bertini_python.cpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/bertini_python.cpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2016-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// James Collins
|
||||
// West Texas A&M University
|
||||
// Spring 2016
|
||||
//
|
||||
// silviana amethyst
|
||||
// UWEC
|
||||
// Spring 2018, Summer 2023
|
||||
//
|
||||
//
|
||||
// python/bertini_python.cpp: the main source file for the python interface for bertini.
|
||||
|
||||
|
||||
#include "bertini_python.hpp"
|
||||
|
||||
|
||||
namespace bertini
|
||||
{
|
||||
namespace python
|
||||
{
|
||||
|
||||
|
||||
|
||||
BOOST_PYTHON_MODULE(_pybertini) // this name must match the name of the generated .so file.
|
||||
{
|
||||
// see https://stackoverflow.com/questions/6114462/how-to-override-the-automatically-created-docstring-data-for-boostpython
|
||||
// docstring_options d(true, true, false); // local_
|
||||
docstring_options docopt;
|
||||
docopt.enable_all();
|
||||
docopt.disable_cpp_signatures();
|
||||
|
||||
object package = scope();
|
||||
package.attr("__path__") = "_pybertini";
|
||||
|
||||
// do this one first, so that the later calls into EigenPy work :)
|
||||
EnableEigenPy();
|
||||
|
||||
|
||||
ExportContainers();
|
||||
|
||||
ExportDetails();
|
||||
|
||||
ExportMpfr();
|
||||
|
||||
ExportRandom();
|
||||
|
||||
SetupFunctionTree();
|
||||
|
||||
{
|
||||
scope current_scope;
|
||||
|
||||
|
||||
std::string new_submodule_name(extract<const char*>(current_scope.attr("__name__")));
|
||||
new_submodule_name.append(".function_tree");
|
||||
object new_submodule(borrowed(PyImport_AddModule(new_submodule_name.c_str())));
|
||||
current_scope.attr("function_tree") = new_submodule;
|
||||
|
||||
|
||||
scope new_submodule_scope = new_submodule;
|
||||
new_submodule_scope.attr("__doc__") = "The symbolics for Bertini2. Operator overloads let you write arithmetic do form your system, after making variables, etc.";
|
||||
ExportNode();
|
||||
ExportSymbols();
|
||||
ExportOperators();
|
||||
ExportRoots();
|
||||
}
|
||||
|
||||
ExportAllSystems();
|
||||
|
||||
ExportParsers();
|
||||
|
||||
ExportTrackers();
|
||||
ExportTrackerObservers();
|
||||
|
||||
ExportEndgames();
|
||||
ExportEndgameObservers();
|
||||
|
||||
ExportLogging();
|
||||
|
||||
ExportZeroDim();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
150
python/src/containers.cpp
Normal file
150
python/src/containers.cpp
Normal file
@@ -0,0 +1,150 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/src/containers.cpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/src/containers.cpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/src/containers.cpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2017-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// James Collins
|
||||
// West Texas A&M University
|
||||
// Spring 2016
|
||||
//
|
||||
// silviana amethyst
|
||||
// UWEC
|
||||
// Spring 2018
|
||||
//
|
||||
//
|
||||
// python/src/containers.cpp: source file for exposing trackers to python.
|
||||
|
||||
|
||||
#include "containers_export.hpp"
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
template<typename T>
|
||||
template<typename PyClass>
|
||||
void ListVisitor<T>::visit(PyClass& cl) const
|
||||
{
|
||||
cl
|
||||
|
||||
.def(vector_indexing_suite< T , true >())
|
||||
// By default indexed elements are returned by proxy. This can be
|
||||
// disabled by supplying *true* in the NoProxy template parameter.
|
||||
|
||||
.def("__str__", &ListVisitor::__str__)
|
||||
.def("__repr__", &ListVisitor::__repr__)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
void ExportContainers()
|
||||
{
|
||||
scope current_scope;
|
||||
std::string new_submodule_name(extract<const char*>(current_scope.attr("__name__")));
|
||||
new_submodule_name.append(".container");
|
||||
object new_submodule(borrowed(PyImport_AddModule(new_submodule_name.c_str())));
|
||||
current_scope.attr("container") = new_submodule;
|
||||
|
||||
scope new_submodule_scope = new_submodule;
|
||||
new_submodule_scope.attr("__doc__") = "Various container types for PyBertini";
|
||||
|
||||
|
||||
boost::python::converter::registry::push_back(&pylist_converter<bertini::VariableGroup>::convertible
|
||||
, &pylist_converter<bertini::VariableGroup>::construct
|
||||
, boost::python::type_id<bertini::VariableGroup>());
|
||||
|
||||
|
||||
|
||||
// std::vector of Rational Node ptrs
|
||||
using T1 = std::vector<std::shared_ptr< bertini::node::Rational > >;
|
||||
class_< T1 >("ListOfRational")
|
||||
.def(ListVisitor<T1>())
|
||||
;
|
||||
|
||||
// The VariableGroup vector container
|
||||
using T2 = bertini::VariableGroup;
|
||||
class_< T2 >("VariableGroup")
|
||||
.def(ListVisitor<T2>())
|
||||
.def("__init__", boost::python::make_constructor(&create_MyClass<T2>))
|
||||
;
|
||||
|
||||
// std::vector of ints
|
||||
using T3 = std::vector<int>;
|
||||
class_< T3 >("ListOfInt")
|
||||
.def(ListVisitor<T3>())
|
||||
;
|
||||
|
||||
|
||||
// std::vector of VariableGroups
|
||||
using T4 = std::vector<bertini::VariableGroup>;
|
||||
class_< T4 >("ListOfVariableGroup")
|
||||
.def(ListVisitor<T4>())
|
||||
;
|
||||
|
||||
|
||||
// std::vector of Function Node ptrs
|
||||
using T5 = std::vector<std::shared_ptr< bertini::node::Function > >;
|
||||
class_< T5 >("ListOfFunction")
|
||||
.def(ListVisitor<T5>())
|
||||
;
|
||||
|
||||
|
||||
// std::vector of Jacobian Node ptrs
|
||||
using T6 = std::vector<std::shared_ptr< bertini::node::Jacobian > >;
|
||||
class_< T6 >("ListOfJacobian")
|
||||
.def(ListVisitor<T6>())
|
||||
;
|
||||
|
||||
|
||||
// std::vector of Eigen::matrix
|
||||
using T7 = std::vector<bertini::Vec<dbl_complex>>;
|
||||
class_< T7 >("ListOfVectorComplexDoublePrecision")
|
||||
.def(ListVisitor<T7>())
|
||||
;
|
||||
|
||||
// std::vector of Eigen::matrix
|
||||
using T8 = std::vector<bertini::Vec<mpfr_complex>>;
|
||||
class_< T8 >("ListOfVectorComplexVariablePrecision")
|
||||
.def(ListVisitor<T8>())
|
||||
;
|
||||
|
||||
using T9 = std::vector<bertini::algorithm::SolutionMetaData<dbl_complex>>;
|
||||
class_< T9 >("ListOfSolutionMetaData_DoublePrec")
|
||||
.def(ListVisitor<T9>())
|
||||
;
|
||||
|
||||
using T10 = std::vector<bertini::algorithm::SolutionMetaData<mpfr_complex>>;
|
||||
class_< T10 >("ListOfSolutionMetaData_MultiPrec")
|
||||
.def(ListVisitor<T10>())
|
||||
;
|
||||
|
||||
using T11 = std::vector<bertini::algorithm::EGBoundaryMetaData<dbl_complex>>;
|
||||
class_< T11 >("ListOfEGBoundaryMetaData_DoublePrec")
|
||||
.def(ListVisitor<T11>())
|
||||
;
|
||||
|
||||
using T12 = std::vector<bertini::algorithm::EGBoundaryMetaData<mpfr_complex>>;
|
||||
class_< T12 >("ListOfEGBoundaryMetaData_MultiPrec")
|
||||
.def(ListVisitor<T12>())
|
||||
;
|
||||
}; // export containers
|
||||
|
||||
}
|
||||
}
|
||||
51
python/src/detail.cpp
Normal file
51
python/src/detail.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
//This file is part of Bertini 2.
|
||||
//
|
||||
//python/generic_observers.cpp is free software: you can redistribute it and/or modify
|
||||
//it under the terms of the GNU General Public License as published by
|
||||
//the Free Software Foundation, either version 3 of the License, or
|
||||
//(at your option) any later version.
|
||||
//
|
||||
//python/generic_observers.cpp is distributed in the hope that it will be useful,
|
||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
//GNU General Public License for more details.
|
||||
//
|
||||
//You should have received a copy of the GNU General Public License
|
||||
//along with python/generic_observers.cpp. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// Copyright(C) 2017-2018 by Bertini2 Development Team
|
||||
//
|
||||
// See <http://www.gnu.org/licenses/> for a copy of the license,
|
||||
// as well as COPYING. Bertini2 is provided with permitted
|
||||
// additional terms in the b2/licenses/ directory.
|
||||
|
||||
// individual authors of this file include:
|
||||
//
|
||||
// silviana amethyst
|
||||
// UWEC
|
||||
// Fall 2017, Spring 2018
|
||||
//
|
||||
//
|
||||
// python/generic_observers.cpp: source file for exposing trackers to python.
|
||||
|
||||
|
||||
#include "detail.hpp"
|
||||
|
||||
namespace bertini{
|
||||
namespace python{
|
||||
|
||||
void ExportDetails()
|
||||
{
|
||||
scope current_scope;
|
||||
std::string new_submodule_name(extract<const char*>(current_scope.attr("__name__")));
|
||||
new_submodule_name.append(".detail");
|
||||
object new_submodule(borrowed(PyImport_AddModule(new_submodule_name.c_str())));
|
||||
current_scope.attr("detail") = new_submodule;
|
||||
|
||||
scope new_submodule_scope = new_submodule;
|
||||
new_submodule_scope.attr("__doc__") = "Hidden things. Keep them secret. Keep them safe...";
|
||||
|
||||
ExportObserver();
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user