Initial commit

This commit is contained in:
Mickaël Montessinos 2024-02-26 18:48:12 +02:00
commit 807d7f936e
38 changed files with 5074 additions and 0 deletions

93
.gitignore vendored Normal file
View File

@ -0,0 +1,93 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# IPython Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# dotenv
.env
# virtualenv
venv/
ENV/
# Spyder project settings
.spyderproject
# Rope project settings
.ropeproject
/.travis_ci_gh_pages_deploy_key
/.travis_ci_gh_pages_deploy_key.pub
/gh-pages

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
# Dockerfile for binder
# Reference: https://mybinder.readthedocs.io/en/latest/dockerfile.html#preparing-your-dockerfile
FROM sagemath/sagemath:latest
# Copy the contents of the repo in ${HOME}
COPY --chown=sage:sage . ${HOME}
# Install this package and dependencies
RUN sage -pip install .

674
LICENSE Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://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 <https://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
<https://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
<https://www.gnu.org/licenses/why-not-lgpl.html>.

64
README.rst Normal file
View File

@ -0,0 +1,64 @@
==============
Vector Bundles
==============
This is a `SageMath <http://www.sagemath.org>`_ implementing algorithms for creating and
manipulating Vector Bundles over algebraic curves on finite field. All manipulations are
done using algebra on function fields.
Installation
------------
Local install from source
^^^^^^^^^^^^^^^^^^^^^^^^^
Download the source from the git repository::
$ git clone https://github.com/sagemath/sage_sample.git
Change to the root directory and run::
$ sage -pip install --upgrade --no-index -v .
For convenience this package contains a `makefile <makefile>`_ with this
and other often used commands. Should you wish too, you can use the
shorthand::
$ make install
Usage
-----
Once the package is installed, you can use it in Sage with::
sage: from vector_bundle import *
See also the `demo notebook <demo.ipynb>`_ and the documentation.
Documentation
-------------
The documentation of the package can be generated using Sage's
``Sphinx`` installation::
$ cd docs
$ sage -sh -c "make html"
Shorthand::
$ make doc
TEST
----
To run the test suite of the package, simply run the command::
$make test
from the root of the repository.
CONTACT
-------
Mickaël Montessinos: mickael.montessinos@mif.vu.lt

1
VERSION Normal file
View File

@ -0,0 +1 @@
0.1.0

234
demo.ipynb Normal file
View File

@ -0,0 +1,234 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# A demo of the vector_bundle package."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from vector_bundle import *\n",
"F.<x> = FunctionField(GF(101))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Constructing an indecomposable bundle on an elliptic curve\n",
"We construct an indecomposable vector bundle of rank 5 and degree 3 on a function field of genus 1. \n",
"This construction may be done automatically using the ```atiyah_bundle``` function but we break it down step by step."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[Ideal (1) of Maximal order of Function field in y defined by y^2 + 100*x^3 + 100*x]\n",
"[(1)]\n",
"[((x/(x^2 + 1))*y)]\n"
]
}
],
"source": [
"R.<y> = F[]\n",
"K.<y> = F.extension(y^2 - x^3 - x)\n",
"deg_1_bundle = VectorBundle(K, K.places_infinite()[0].divisor())\n",
"E = deg_1_bundle\n",
"print(E.coefficient_ideals())\n",
"print(E.basis_finite())\n",
"print(E.basis_infinite())"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[Ideal (x^2/(x^2 + 3)) of Maximal order of Function field in y defined by y^2 + 100*x^3 + 100*x, Ideal (1) of Maximal order of Function field in y defined by y^2 + 100*x^3 + 100*x]\n",
"[(1, 0), (0, 1)]\n",
"[(1, 0), (100*x^3/(x^2 + 1), (x/(x^2 + 1))*y)]\n"
]
}
],
"source": [
"E = E.extension_by_global_sections()\n",
"print(E.coefficient_ideals())\n",
"print(E.basis_finite())\n",
"print(E.basis_infinite())"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[Ideal (x^2/(x^2 + 3)) of Maximal order of Function field in y defined by y^2 + 100*x^3 + 100*x, Ideal (1) of Maximal order of Function field in y defined by y^2 + 100*x^3 + 100*x]\n",
"[(1, 0), (0, 1)]\n",
"[((x/(x^2 + 1))*y, 0), ((100*x^4/(x^4 + 2*x^2 + 1))*y, x^3/(x^2 + 1))]\n"
]
}
],
"source": [
"E = E.tensor_product(deg_1_bundle)\n",
"print(E.coefficient_ideals())\n",
"print(E.basis_finite())\n",
"print(E.basis_infinite())"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[Ideal (x^2/(x^2 + 3)) of Maximal order of Function field in y defined by y^2 + 100*x^3 + 100*x, Ideal (x^2/(x^2 + 3)) of Maximal order of Function field in y defined by y^2 + 100*x^3 + 100*x, Ideal (x^2/(x^2 + 3)) of Maximal order of Function field in y defined by y^2 + 100*x^3 + 100*x, Ideal (x^2/(x^2 + 3)) of Maximal order of Function field in y defined by y^2 + 100*x^3 + 100*x, Ideal (1) of Maximal order of Function field in y defined by y^2 + 100*x^3 + 100*x]\n",
"[(1, 0, 0, 0, 0), (0, 1, 0, 0, 0), (0, 0, 1, 0, 0), (0, 0, 0, 1, 0), (0, 0, 0, 0, 1)]\n",
"[(1, 0, 0, 0, 0), (0, 1, 0, 0, 0), (0, 0, 1, 0, 0), (100*x^3/(x^2 + 1), 0, 100/x^2*y, (x/(x^2 + 1))*y, 0), (x^6/(x^4 + 2*x^2 + 1), (100*x^4/(x^4 + 2*x^2 + 1))*y, (x/(x^2 + 1))*y, (100*x^4/(x^4 + 2*x^2 + 1))*y, x^3/(x^2 + 1))]\n"
]
}
],
"source": [
"E = E.extension_by_global_sections()\n",
"print(E.coefficient_ideals())\n",
"print(E.basis_finite())\n",
"print(E.basis_infinite())"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"5\n",
"3\n"
]
}
],
"source": [
"print(E.rank())\n",
"print(E.degree())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We check the algebra of global endomorphisms of E to ensure that it is indecomposable."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[\n",
"[1 0 0 0 0]\n",
"[0 1 0 0 0]\n",
"[0 0 1 0 0]\n",
"[0 0 0 1 0]\n",
"[0 0 0 0 1]\n",
"]"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"E.end().h0()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Constructing a weakly stable vector bundle following Savin's method\n",
"We construct a weakly stable vector bundle of rank 3 and degree 5 by successive extensions by line bundles. \n",
"See [Sav07] in the references for details. \n",
"This, again, may be achieved directly using the ```savin_bundle``` function."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3\n",
"5\n",
"[Ideal (1, 1/x*y) of Maximal order of Function field in y defined by y^2 + 100*x^3 + 100*x, Ideal (1) of Maximal order of Function field in y defined by y^2 + 100*x^3 + 100*x, Ideal (1) of Maximal order of Function field in y defined by y^2 + 100*x^3 + 100*x]\n",
"[(1, 0, 0), (0, 1, 0), (0, 0, 1)]\n",
"[(1, 0, 0), ((100*x/(x^2 + 1))*y, x^3/(x^2 + 1), 0), (0, (100*x^4/(x^4 + 2*x^2 + 1))*y, x^3/(x^2 + 1))]\n"
]
}
],
"source": [
"F = VectorBundle(K, 2*K.places_infinite()[0].divisor())\n",
"F1 = VectorBundle(K, K.places_finite()[0].divisor())\n",
"E1 = F1\n",
"E2 = F.non_trivial_extension(E1)\n",
"E3 = F.non_trivial_extension(E2)\n",
"print(E3.rank())\n",
"print(E3.degree())\n",
"print(E3.coefficient_ideals())\n",
"print(E3.basis_finite())\n",
"print(E3.basis_infinite())"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "SageMath 10.3.beta8",
"language": "sage",
"name": "sagemath"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

177
docs/Makefile Normal file
View File

@ -0,0 +1,177 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/slabbe.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/slabbe.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/slabbe"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/slabbe"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

445
docs/source/conf.py Normal file
View File

@ -0,0 +1,445 @@
# -*- coding: utf-8 -*-
#
# sample documentation build configuration file,
# inspried by slabbe configuration file created sphinx-quickstart
#
# 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.
# General information about the project.
project = u"A SageMath package implementing vector bundles on algebraic curves using only function fields"
copyright = u'2024, Mickaël Montessinos'
package_name = 'vector_bundle'
package_folder = "../../"
authors = u"Mickaël Montessinos"
import six
import sys
import os
from sage.env import SAGE_DOC_SRC, SAGE_DOC, SAGE_SRC
try:
import sage.all
except ImportError:
raise RuntimeError("to build the documentation you need to be inside a Sage shell (run first the command 'sage -sh' in a shell")
# 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.
sys.path.insert(0, os.path.abspath(package_folder))
#sys.path.append(os.path.join(SAGE_SRC, "sage_setup", "docbuild", "ext"))
print("Using sys.path = {}".format(sys.path))
# -- 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',
#'sage_autodoc', ## Not available on conda-forge sage!
#'sage_package.sphinx',
'sphinx.ext.doctest',
'sphinx.ext.coverage',
'sphinx.ext.extlinks',
'matplotlib.sphinxext.plot_directive',
#'sphinxcontrib.bibtex'
]
### from Sage src/doc/common/conf.py
# This code is executed before each ".. PLOT::" directive in the Sphinx
# documentation. It defines a 'sphinx_plot' function that displays a Sage object
# through matplotlib, so that it will be displayed in the HTML doc.
plot_html_show_source_link = False
plot_pre_code = """
def sphinx_plot(graphics, **kwds):
import matplotlib.image as mpimg
from sage.misc.temporary_file import tmp_filename
import matplotlib.pyplot as plt
## Option handling is taken from Graphics.save
try:
from sage.plot.multigraphics import GraphicsArray
except ImportError:
from sage.plot.graphics import GraphicsArray
options = dict()
if not isinstance(graphics, GraphicsArray):
options.update(graphics.SHOW_OPTIONS)
options.update(graphics._extra_kwds)
options.update(kwds)
dpi = options.pop('dpi', None)
transparent = options.pop('transparent', None)
fig_tight = options.pop('fig_tight', None)
figsize = options.pop('figsize', None)
## figsize handling is taken from Graphics.matplotlib()
if figsize is not None and not isinstance(figsize, (list, tuple)):
# in this case, figsize is a number and should be positive
try:
figsize = float(figsize) # to pass to mpl
except TypeError:
raise TypeError("figsize should be a positive number, not {0}".format(figsize))
if figsize > 0:
default_width, default_height=rcParams['figure.figsize']
figsize=(figsize, default_height*figsize/default_width)
else:
raise ValueError("figsize should be positive, not {0}".format(figsize))
if figsize is not None:
# then the figsize should be two positive numbers
if len(figsize) != 2:
raise ValueError("figsize should be a positive number "
"or a list of two positive numbers, not {0}".format(figsize))
figsize = (float(figsize[0]),float(figsize[1])) # floats for mpl
if not (figsize[0] > 0 and figsize[1] > 0):
raise ValueError("figsize should be positive numbers, "
"not {0} and {1}".format(figsize[0],figsize[1]))
plt.figure(figsize=figsize)
if isinstance(graphics, GraphicsArray):
## from GraphicsArray.save
figure = plt.gcf()
rows = graphics.nrows()
cols = graphics.ncols()
for i, g in enumerate(graphics):
subplot = figure.add_subplot(rows, cols, i + 1)
g_options = copy(options)
g_options.update(g.SHOW_OPTIONS)
g_options.update(g._extra_kwds)
g_options.pop('dpi', None)
g_options.pop('transparent', None)
g_options.pop('fig_tight', None)
g.matplotlib(figure=figure, sub=subplot, **g_options)
else:
figure = graphics.matplotlib(figure=plt.gcf(), figsize=figsize, **options)
plt.tight_layout(pad=0)
plt.margins(0)
plt.show()
from sage.all_cmdline import *
"""
plot_html_show_formats = False
plot_formats = ['svg', 'pdf', 'png']
# Add any paths that contain templates here, relative to this directory.
# templates_path = ['_templates']
templates_path = [os.path.join(SAGE_DOC_SRC, 'common', 'templates'), '_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
# 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.
#
from pkg_resources import get_distribution, DistributionNotFound
# The full version, including alpha/beta/rc tags.
try:
release = get_distribution('sage-numerical-interactive-mip').version
except DistributionNotFound:
release = "0.2"
#print("############# release reported: {} ##################".format(release))
# The short X.Y version.
version = '.'.join(release.split('.')[:2])
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []
# The reST default role (used for this markup: `text`) to use for all
# documents.
default_role = 'math'
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# -- 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 = 'sage-classic'
html_theme_path = ['../themes']
# 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 = {}
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
# 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']
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = package_name + "doc"
# -- 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': '',
}
# 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 = [
('index', package_name + '.tex', u'Documentation of ' + six.text_type(package_name),
authors, 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', package_name, six.text_type(package_name) + u" documentation",
[authors], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- 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 = [
('index', package_name, six.text_type(package_name) + u" documentation",
authors, package_name, project,
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
# -- Options copied from Sagemath conf.py file -------------------------------
# We use MathJax to build the documentation unless the environment
# variable SAGE_DOC_MATHJAX is set to "no" or "False". (Note that if
# the user does not set this variable, then the script sage-env sets
# it to "True".)
if (os.environ.get('SAGE_DOC_MATHJAX', 'no') != 'no'
and os.environ.get('SAGE_DOC_MATHJAX', 'no') != 'False'):
extensions.append('sphinx.ext.mathjax')
mathjax_path = 'MathJax.js?config=TeX-AMS_HTML-full,../mathjax_sage.js'
from sage.misc.latex_macros import sage_mathjax_macros
# this is broken for now
# html_theme_options['mathjax_macros'] = sage_mathjax_macros()
## from pkg_resources import Requirement, working_set
## sagenb_path = working_set.find(Requirement.parse('sagenb')).location
## mathjax_relative = os.path.join('sagenb','data','mathjax')
## # It would be really nice if sphinx would copy the entire mathjax directory,
## # (so we could have a _static/mathjax directory), rather than the contents of the directory
## mathjax_static = os.path.join(sagenb_path, mathjax_relative)
## html_static_path.append(mathjax_static)
## exclude_patterns=['**/'+os.path.join(mathjax_relative, i) for i in ('docs', 'README*', 'test',
## 'unpacked', 'LICENSE')]
from sage.env import SAGE_LOCAL, SAGE_SHARE
html_static_path.append(SAGE_LOCAL + "/lib/mathjax") # conda
html_static_path.append(SAGE_SHARE + "/mathjax") # sage distribution
else:
extensions.append('sphinx.ext.imgmath')
# This is to make the verbatim font smaller;
# Verbatim environment is not breaking long lines
from sphinx.highlighting import PygmentsBridge
from pygments.formatters.latex import LatexFormatter
class CustomLatexFormatter(LatexFormatter):
def __init__(self, **options):
super(CustomLatexFormatter, self).__init__(**options)
self.verboptions = r"formatcom=\footnotesize"
PygmentsBridge.latex_formatter = CustomLatexFormatter
latex_elements['preamble'] += r'''
% One-column index
\makeatletter
\renewenvironment{theindex}{
\chapter*{\indexname}
\markboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}
\setlength{\parskip}{0.1em}
\relax
\let\item\@idxitem
}{}
\makeatother
\renewcommand{\ttdefault}{txtt}
'''
#####################################################
# add LaTeX macros for Sage
from sage.misc.latex_macros import sage_latex_macros
try:
pngmath_latex_preamble # check whether this is already defined
except NameError:
pngmath_latex_preamble = ""
for macro in sage_latex_macros():
# used when building latex and pdf versions
latex_elements['preamble'] += macro + '\n'
# used when building html version
pngmath_latex_preamble += macro + '\n'
## The following is needed on conda-forge sagemath
from sage.repl.user_globals import initialize_globals
import sage.all
my_globs = dict()
initialize_globals(sage.all, my_globs)

View File

@ -0,0 +1,10 @@
.. nodoctest
Constructions
=============
.. automodule:: vector_bundle.constructions
:members:
:undoc-members:
:show-inheritance:

10
docs/source/ext_group.rst Normal file
View File

@ -0,0 +1,10 @@
.. nodoctest
Ext group
=========
.. automodule:: vector_bundle.ext_group
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,9 @@
.. nodoctest
Hom bundle
==========
.. automodule:: vector_bundle.hom_bundle
:members:
:undoc-members:
:show-inheritance:

36
docs/source/index.rst Normal file
View File

@ -0,0 +1,36 @@
==========================
Sage Vector Bundle Package
==========================
This is a SageMath package implementing vector bundles on algebraic curves
To use this module, you need to import it::
from vector_bundle import *
This work is licensed under a `Creative Commons Attribution-Share Alike
3.0 License`__.
The source code for building this documentation and its theme are taken from
the `sage_sample`__ github repository.
__ https://creativecommons.org/licenses/by-sa/3.0/
__ https://github.com/sagemath/sage_sample
Vector Bundle
=============
.. toctree::
:maxdepth: 1
vector_bundle
hom_bundle
ext_group
constructions
Indices and Tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -0,0 +1,9 @@
.. nodoctest
Vector bundle
=================
.. automodule:: vector_bundle.vector_bundle
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,69 @@
{#
This is a customized version for Sage documentation theme.
Changes: at line 42, "slice(2)" -> "slice(1)"
#}
{#
basic/genindex-single.html
~~~~~~~~~~~~~~~~~~~~~~~~~~
Template for a "single" page of a split index.
:copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
#}
{% macro indexentries(firstname, links) %}
{%- if links -%}
<a href="{{ links[0][1] }}">
{%- if links[0][0] %}<strong>{% endif -%}
{{ firstname|e }}
{%- if links[0][0] %}</strong>{% endif -%}
</a>
{%- for ismain, link in links[1:] -%}
, <a href="{{ link }}">{% if ismain %}<strong>{% endif -%}
[{{ loop.index }}]
{%- if ismain %}</strong>{% endif -%}
</a>
{%- endfor %}
{%- else %}
{{ firstname|e }}
{%- endif %}
{% endmacro %}
{%- extends "layout.html" %}
{% set title = _('Index') %}
{% block body %}
<h1 id="index">{% trans key=key %}Index &ndash; {{ key }}{% endtrans %}</h1>
<table style="width: 100%" class="indextable"><tr>
{%- for column in entries|slice(1) if column %}
<td style="width: 33%; vertical-align: top;"><ul>
{%- for entryname, (links, subitems, _) in column %}
<li>{{ indexentries(entryname, links) }}
{%- if subitems %}
<ul>
{%- for subentryname, subentrylinks in subitems %}
<li>{{ indexentries(subentryname, subentrylinks) }}</li>
{%- endfor %}
</ul>
{%- endif -%}</li>
{%- endfor %}
</ul></td>
{%- endfor %}
</tr></table>
{% endblock %}
{% block sidebarrel %}
<h4>{{ _('Index') }}</h4>
<p>{% for key, dummy in genindexentries -%}
<a href="{{ pathto('genindex-' + key) }}"><strong>{{ key }}</strong></a>
{% if not loop.last %}| {% endif %}
{%- endfor %}</p>
<p><a href="{{ pathto('genindex-all') }}"><strong>{{ _('Full index on one page') }}</strong></a></p>
{{ super() }}
{% endblock %}

View File

@ -0,0 +1,47 @@
{#
This is a customized version for Sage documentation theme.
Changes: no change
#}
{#
basic/genindex-split.html
~~~~~~~~~~~~~~~~~~~~~~~~~
Template for a "split" index overview page.
:copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
#}
{%- extends "layout.html" %}
{% set title = _('Index') %}
{% block body %}
<h1 id="index">{{ _('Index') }}</h1>
<p>{{ _('Index pages by letter') }}:</p>
<div class="genindex-jumpbox">
<p>{% for key, dummy in genindexentries -%}
<a href="{{ pathto('genindex-' + key) }}"><strong>{{ key }}</strong></a>
{% if not loop.last %}| {% endif %}
{%- endfor %}</p>
<p><a href="{{ pathto('genindex-all') }}"><strong>{{ _('Full index on one page') }}</strong>
({{ _('can be huge') }})</a></p>
</div>
{% endblock %}
{% block sidebarrel %}
{% if split_index %}
<h4>Index</h4>
<p>{% for key, dummy in genindexentries -%}
<a href="{{ pathto('genindex-' + key) }}"><strong>{{ key }}</strong></a>
{% if not loop.last %}| {% endif %}
{%- endfor %}</p>
<p><a href="{{ pathto('genindex-all') }}"><strong>{{ _('Full index on one page') }}</strong></a></p>
{% endif %}
{{ super() }}
{% endblock %}

82
docs/themes/sage-classic/genindex.html vendored Normal file
View File

@ -0,0 +1,82 @@
{#
This is a customized version for Sage documentation theme.
Changes: at line 52, "slice(2)" -> "slice(1)"
#}
{#
basic/genindex.html
~~~~~~~~~~~~~~~~~~~
Template for an "all-in-one" index.
:copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
#}
{%- extends "layout.html" %}
{% set title = _('Index') %}
{% macro indexentries(firstname, links) %}
{%- if links -%}
<a href="{{ links[0][1] }}">
{%- if links[0][0] %}<strong>{% endif -%}
{{ firstname|e }}
{%- if links[0][0] %}</strong>{% endif -%}
</a>
{%- for ismain, link in links[1:] -%}
, <a href="{{ link }}">{% if ismain %}<strong>{% endif -%}
[{{ loop.index }}]
{%- if ismain %}</strong>{% endif -%}
</a>
{%- endfor %}
{%- else %}
{{ firstname|e }}
{%- endif %}
{% endmacro %}
{% block body %}
<h1 id="index">{{ _('Index') }}</h1>
<div class="genindex-jumpbox">
{% for key, dummy in genindexentries -%}
<a href="#{{ key }}"><strong>{{ key }}</strong></a>
{% if not loop.last %}| {% endif %}
{%- endfor %}
</div>
{%- for key, entries in genindexentries %}
<h2 id="{{ key }}">{{ key }}</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
{%- for column in entries|slice_index(1) if column %}
<td style="width: 33%; vertical-align: top;"><ul>
{%- for entryname, (links, subitems, _) in column %}
<li>{{ indexentries(entryname, links) }}
{%- if subitems %}
<ul>
{%- for subentryname, subentrylinks in subitems %}
<li>{{ indexentries(subentryname, subentrylinks) }}</li>
{%- endfor %}
</ul>
{%- endif -%}</li>
{%- endfor %}
</ul></td>
{%- endfor %}
</tr></table>
{% endfor %}
{% endblock %}
{% block sidebarrel %}
{% if split_index %}
<h4>{{ _('Index') }}</h4>
<p>{% for key, dummy in genindexentries -%}
<a href="{{ pathto('genindex-' + key) }}"><strong>{{ key }}</strong></a>
{% if not loop.last %}| {% endif %}
{%- endfor %}</p>
<p><a href="{{ pathto('genindex-all') }}"><strong>{{ _('Full index on one page') }}</strong></a></p>
{% endif %}
{{ super() }}
{% endblock %}

181
docs/themes/sage-classic/layout.html vendored Normal file
View File

@ -0,0 +1,181 @@
{% extends "classic/layout.html" %}
{% block rootrellink %}
<li class="nav-item nav-item-0">
<a href="http://www.sagemath.org"><img src="{{ pathto('_static/logo_sagemath_black.svg', 1) }}" class="sage-logo" title="Sage Logo"></a>
{% if website %}
<a href="index.html">{{ documentation_title|e }}</a>{{ reldelim1 }}
{% else %}
<a href="{{ documentation_root }}">{{ documentation_title|e }}</a>{{ reldelim1 }}
{% if refsub %}
<a href="{{ reference_root }}">{{ reference_title|e }}</a>{{ reldelim1 }}
{% endif %}
<a href="{{ pathto(root_doc)|e }}">{{ shorttitle|e }}</a>{{ reldelim1 }}
{% endif %}
</li>
{% endblock %}
{% block extrahead %}
<link rel="icon" href="{{ pathto('_static/sageicon.png', 1) }}" type="image/x-icon" />
{% endblock %}
{%- block footer %}
{{ super() }}
<script type="text/javascript">
/*global jQuery, window */
/* Sphinx sidebar toggle. Putting this code at the end of the body
* enables the toggle for the live, static, and offline docs. Note:
* sage.misc.html.math_parse() eats jQuery's dollar-sign shortcut. */
var jq = jQuery;
jq(document).ready(function () {
var bar, bod, bg, fg, key, tog, wid_old, wid_new, get_state, set_state;
bod = jq('div.bodywrapper');
bar = jq('div.sphinxsidebar');
tog = jq('<div class="sphinxsidebartoggle"></div>');
/* The sidebar toggle adapts its height to the bodywrapper height. */
const resizeObserver = new ResizeObserver(entries => {
tog.height(bod.height());
});
resizeObserver.observe(bod[0]);
/* Setup and add the toggle. See Sphinx v0.5.1 default.css. */
fg = jq('div.sphinxsidebar p a').css('color') || 'rgb(152, 219, 204)';
bg = jq('div.document').css('background-color') || 'rgb(28, 78, 99)';
wid_old = '230px';
wid_new = '5px';
tog.css('background-color', bg)
.css('border-width', '0px')
.css('border-right', wid_new + ' ridge ' + bg)
.css('cursor', 'pointer')
.css('position', 'absolute')
.css('left', '-' + wid_new)
.css('top', '0px')
.css('width', wid_new);
bod.css('position', 'relative');
bod.prepend(tog);
/* Cookie helpers. */
key = 'sphinxsidebar=';
set_state = function (s) {
var date = new Date();
/* Expiry in 7 days. */
date.setTime(date.getTime() + (7 * 24 * 3600 * 1000));
document.cookie = key + encodeURIComponent(s) + '; expires=' +
date.toUTCString() + '; path=/';
};
get_state = function () {
var i, c, crumbs = document.cookie.split(';');
for (i = 0; i < crumbs.length; i += 1) {
c = crumbs[i].replace(/^\s+/, '');
if (c.indexOf(key) === 0) {
return decodeURIComponent(c.substring(key.length, c.length));
}
}
return null;
};
/* Event handlers. */
tog.mouseover(function (ev) {
tog.css('border-right-color', fg);
}).mouseout(function (ev) {
tog.css('border-right-color', bg);
}).click(function (ev) {
if (bod.hasClass('wide')) {
bod.removeClass('wide');
bod.css('margin-left', wid_old);
bar.css('width', wid_old);
bar.show();
set_state('visible');
} else {
set_state('hidden');
bar.hide();
bar.css('width', '0px');
bod.css('margin-left', wid_new);
bod.addClass('wide');
}
});
/* Hide the normally visible sidebar? */
if (get_state() === 'hidden') {
tog.trigger('click');
} else {
set_state('visible');
}
});
</script>
<script type="text/javascript">
/* detex the document title by removing "\(", "\)", "\", "$" */
document.title = document.title.replace(/\\\(/g, '').replace(/\\\)/g, '').replace(/\\/g, '').replace(/\$/g, '');
</script>
{%- endblock %}
<!-- This macro block for the sidebar is heavily borrowed from the basic -->
<!-- theme of Sphinx. In particular, we borrowed from the file -->
<!-- themes/basic/layout.html distributed with Sphinx. -->
{%- macro sidebar() %}
{%- if not embedded %}{% if not theme_nosidebar|tobool %}
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
{%- block sidebarlogo %}
{%- if logo %}
<p class="logo"><a href="{{ pathto(master_doc) }}">
<img class="logo" src="{{ pathto('_static/' + logo, 1) }}" alt="Logo"/>
</a></p>
{%- endif %}
{%- endblock %}
{%- block sidebartoc %}
{%- if display_toc %}
<h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3>
{{ toc }}
{%- endif %}
{%- endblock %}
{%- block sidebarrel %}
{%- if prev %}
<h4>{{ _('Previous topic') }}</h4>
<p class="topless"><a href="{{ prev.link|e }}"
title="{{ _('previous chapter') }}">{{ prev.title }}</a></p>
{%- endif %}
{%- if next %}
<h4>{{ _('Next topic') }}</h4>
<p class="topless"><a href="{{ next.link|e }}"
title="{{ _('next chapter') }}">{{ next.title }}</a></p>
{%- endif %}
{%- endblock %}
{%- block sidebarsourcelink %}
{%- if show_source and has_source and sourcename %}
<h3>{{ _('This Page') }}</h3>
<ul class="this-page-menu">
<li><a href="{{ pathto('_sources/' + sourcename, true)|e }}"
rel="nofollow">{{ _('Show Source') }}</a></li>
</ul>
{%- endif %}
{%- endblock %}
{%- if customsidebar %}
{% include customsidebar %}
{%- endif %}
{%- block sidebarsearch %}
{%- if pagename != "search" and builder != "singlehtml" %}
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">{{ _('Quick search') }}</h3>
<div class="searchformwrapper">
<form class="search" action="{{ pathto('search') }}" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<!-- The shading of the "Go" button should be consistent -->
<!-- with the colour of the header and footer. See the file -->
<!-- doc/common/themes/sage/theme.conf for colours used by -->
<!-- the Sage theme. -->
<input type="submit" style="background-color: #B8B9F6" value="{{ _('Go') }}" />
</form>
<p class="searchtip" style="font-size: 90%">
{{ _('Enter search terms or a module, class or function name.') }}
</p>
</div>
</div>
<script>$('#searchbox').show(0);</script>
{%- endif %}
{%- endblock %}
</div>
</div>
{%- endif %}{% endif %}
{%- endmacro %}

70
docs/themes/sage-classic/search.html vendored Normal file
View File

@ -0,0 +1,70 @@
{#
basic/search.html
~~~~~~~~~~~~~~~~~
Template for the search page.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
#}
{%- extends "layout.html" %}
{% set title = _('Search') %}
{%- block scripts %}
{{ super() }}
<script src="{{ pathto('_static/searchtools.js', 1) }}"></script>
<script src="{{ pathto('_static/language_data.js', 1) }}"></script>
{%- endblock %}
{% block extrahead %}
<script src="{{ pathto('searchindex.js', 1) }}" defer></script>
{{ super() }}
{% endblock %}
{% block body %}
<h1 id="search-documentation">{{ _('Search') }}</h1>
{% block scriptwarning %}
<noscript>
<div class="admonition warning">
<p>
{% trans %}Please activate JavaScript to enable the search
functionality.{% endtrans %}
</p>
</div>
</noscript>
{% endblock %}
{% block searchtext %}
<p>
{% trans %}Searching for multiple words only shows matches that contain
all words.{% endtrans %}
</p>
<p>
{% trans %}Note also that you can also call "search_src(...)"
while running Sage to search Sage's source code.{% endtrans %}
</p>
{% endblock %}
{% block searchbox %}
<form action="" method="get">
<input type="text" name="q" aria-labelledby="search-documentation" value="" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="{{ _('search') }}" />
<span id="search-progress" style="padding-left: 10px"></span>
</form>
{% endblock %}
{% block searchresults %}
{% if search_performed %}
<h2>{{ _('Search Results') }}</h2>
{% if not search_results %}
<p>{{ _('Your search did not match any documents.') }}</p>
{% endif %}
{% endif %}
<div id="search-results">
{% if search_results %}
<ul>
{% for href, caption, context in search_results %}
<li><a href="{{ pathto(item.href) }}">{{ caption }}</a>
<div class="context">{{ context|e }}</div>
</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endblock %}
{% endblock %}

View File

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-check" width="44" height="44" viewBox="0 0 24 24" stroke-width="2" stroke="#22863a" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M5 12l5 5l10 -10" />
</svg>

After

Width:  |  Height:  |  Size: 313 B

View File

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-copy" width="44" height="44" viewBox="0 0 24 24" stroke-width="1.5" stroke="#000000" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<rect x="8" y="8" width="12" height="12" rx="2" />
<path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2" />
</svg>

After

Width:  |  Height:  |  Size: 411 B

BIN
docs/themes/sage-classic/static/file.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" width="570" height="230" viewBox="23 2 114 46"><g style="stroke-width:4;stroke-linejoin:round;stroke:#000;fill:none"><rect x="0" y="0" width="150" height="50" style="fill:none"/><polyline points="55,10 38,10 38,20 53,20 53,30 28,30"/><polyline points="97,30 85,30 75,10 60,10 60,30 75,30 85,10 100,10 100,40 80,40"/><polyline points="132,30 107,30 107,10 122,10 122,20 110,20"/></g></svg>

After

Width:  |  Height:  |  Size: 564 B

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" width="570" height="230" viewBox="23 2 114 46"><g style="stroke-width:4;stroke-linejoin:round;stroke:#fff;fill:none"><rect x="0" y="0" width="150" height="50" style="fill:blue;fill-opacity:0.0"/><polyline points="55,10 38,10 38,20 53,20 53,30 28,30"/><polyline points="97,30 85,30 75,10 60,10 60,30 75,30 85,10 100,10 100,40 80,40"/><polyline points="132,30 107,30 107,10 122,10 122,20 110,20"/></g></svg>

After

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

BIN
docs/themes/sage-classic/static/pdf.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 B

BIN
docs/themes/sage-classic/static/plus.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

View File

@ -0,0 +1,382 @@
/*
* This style sheet is borrowed from the Sphinx classic theme style sheet
* distributed as the file themes/classic/static/classic.css_t in Sphinx 4.4.0.
*
* Customizations for Sage follow from the end of the original style sheet.
*
*/
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
html {
/* CSS hack for macOS's scrollbar */
background-color: #FFFFFF;
}
body {
font-family: {{ theme_bodyfont }};
font-size: 100%;
background-color: {{ theme_footerbgcolor }};
color: #000;
margin: 0;
padding: 0;
}
div.document {
background-color: {{ theme_sidebarbgcolor }};
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 0 0 0 {{ theme_sidebarwidth|todim }};
}
div.body {
background-color: {{ theme_bgcolor }};
color: {{ theme_textcolor }};
padding: 0 20px 30px 20px;
}
{%- if theme_rightsidebar|tobool %}
div.bodywrapper {
margin: 0 {{ theme_sidebarwidth|todim }} 0 0;
}
{%- endif %}
div.footer {
color: {{ theme_footertextcolor }};
width: 100%;
padding: 9px 0 9px 0;
text-align: center;
font-size: 75%;
}
div.footer a {
color: {{ theme_footertextcolor }};
text-decoration: underline;
}
div.related {
background-color: {{ theme_relbarbgcolor }};
line-height: 30px;
color: {{ theme_relbartextcolor }};
}
div.related a {
color: {{ theme_relbarlinkcolor }};
}
div.sphinxsidebar {
{%- if theme_stickysidebar|tobool %}
top: 30px;
bottom: 0;
margin: 0;
position: fixed;
overflow: auto;
height: auto;
{%- endif %}
{%- if theme_rightsidebar|tobool %}
float: right;
{%- if theme_stickysidebar|tobool %}
right: 0;
{%- endif %}
{%- endif %}
}
{%- if theme_stickysidebar|tobool %}
/* this is nice, but it leads to hidden headings when jumping
to an anchor */
/*
div.related {
position: fixed;
}
div.documentwrapper {
margin-top: 30px;
}
*/
{%- endif %}
div.sphinxsidebar h3 {
font-family: {{ theme_headfont }};
color: {{ theme_sidebartextcolor }};
font-size: 1.4em;
font-weight: normal;
margin: 0;
padding: 0;
}
div.sphinxsidebar h3 a {
color: {{ theme_sidebartextcolor }};
}
div.sphinxsidebar h4 {
font-family: {{ theme_headfont }};
color: {{ theme_sidebartextcolor }};
font-size: 1.3em;
font-weight: normal;
margin: 5px 0 0 0;
padding: 0;
}
div.sphinxsidebar p {
color: {{ theme_sidebartextcolor }};
}
div.sphinxsidebar p.topless {
margin: 5px 10px 10px 10px;
}
div.sphinxsidebar ul {
margin: 10px;
padding: 0;
color: {{ theme_sidebartextcolor }};
}
div.sphinxsidebar a {
color: {{ theme_sidebarlinkcolor }};
}
div.sphinxsidebar input {
border: 1px solid {{ theme_sidebarlinkcolor }};
font-family: sans-serif;
font-size: 1em;
}
{% if theme_collapsiblesidebar|tobool %}
/* for collapsible sidebar */
div#sidebarbutton {
background-color: {{ theme_sidebarbtncolor }};
}
{% endif %}
/* -- hyperlink styles ------------------------------------------------------ */
a {
color: {{ theme_linkcolor }};
text-decoration: none;
}
a:visited {
color: {{ theme_visitedlinkcolor }};
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
{% if theme_externalrefs|tobool %}
a.external {
text-decoration: none;
border-bottom: 1px dashed {{ theme_linkcolor }};
}
a.external:hover {
text-decoration: none;
border-bottom: none;
}
a.external:visited {
text-decoration: none;
border-bottom: 1px dashed {{ theme_visitedlinkcolor }};
}
{% endif %}
/* -- body styles ----------------------------------------------------------- */
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: {{ theme_headfont }};
background-color: {{ theme_headbgcolor }};
font-weight: normal;
color: {{ theme_headtextcolor }};
border-bottom: 1px solid #ccc;
margin: 20px -20px 10px -20px;
padding: 3px 0 3px 10px;
}
div.body h1 { margin-top: 0; font-size: 200%; }
div.body h2 { font-size: 160%; }
div.body h3 { font-size: 140%; }
div.body h4 { font-size: 120%; }
div.body h5 { font-size: 110%; }
div.body h6 { font-size: 100%; }
a.headerlink {
color: {{ theme_headlinkcolor }};
font-size: 0.8em;
padding: 0 4px 0 4px;
text-decoration: none;
}
a.headerlink:hover {
background-color: {{ theme_headlinkcolor }};
color: white;
}
div.body p, div.body dd, div.body li, div.body blockquote {
text-align: justify;
line-height: 130%;
}
div.admonition p.admonition-title + p {
display: inline;
}
div.admonition p {
margin-bottom: 5px;
}
div.admonition pre {
margin-bottom: 5px;
}
div.admonition ul, div.admonition ol {
margin-bottom: 5px;
}
div.note {
background-color: #eee;
border: 1px solid #ccc;
}
div.seealso {
background-color: #ffc;
border: 1px solid #ff6;
}
div.topic {
background-color: #eee;
}
div.warning {
background-color: #ffe4e4;
border: 1px solid #f66;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ":";
}
pre {
padding: 5px;
background-color: {{ theme_codebgcolor }};
color: {{ theme_codetextcolor }};
line-height: 120%;
border: 1px solid #ac9;
border-left: none;
border-right: none;
}
code {
background-color: #ecf0f3;
padding: 0 1px 0 1px;
font-size: 0.95em;
}
th, dl.field-list > dt {
background-color: #ede;
}
.warning code {
background: #efc2c2;
}
.note code {
background: #d6d6d6;
}
.viewcode-back {
font-family: {{ theme_bodyfont }};
}
div.viewcode-block:target {
background-color: #f4debf;
border-top: 1px solid #ac9;
border-bottom: 1px solid #ac9;
}
div.code-block-caption {
color: #efefef;
background-color: #1c4e63;
}
/*
* Customizations for Sage
*
*/
/* -- sage logo -------------------------- */
img.sage-logo {
height: 28px;
vertical-align: middle;
}
/* -- hyperlink styles ------------------- */
a,
a:visited {
color: {{ theme_linkcolor }};
text-decoration: none;
}
/* -- commands or code within text ------- */
tt {
background-color: #EAEAF8;
padding: 0 1px 0 1px;
font-size: 0.95em;
}
/* -- class and method headlines --------- */
dl.py.class > dt,
dl.py.method > dt {
overflow-x: scroll;
text-align: left;
}
dl.py.class > dd > p:first-child {
overflow-x: scroll;
white-space: nowrap;
}
/* -- search page ------------------------ */
ul.search li {
text-align: left;
}
/* -- references ------------------------- */
dl.citation p {
text-align: left;
}
/* -- jupyter-sphinx ------------------------------------------------------ */
#thebelab-activate-button {
position: fixed;
right: 10px;
bottom: 10px;
}
.jupyter_cell .thebelab-input {
display: none;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

42
docs/themes/sage-classic/theme.conf vendored Normal file
View File

@ -0,0 +1,42 @@
[theme]
inherit = classic
stylesheet = sage.css
pygments_style = sphinx
[options]
# Background color for the footer line: dark blue
footerbgcolor = #8C8DE6
# Text color for the footer line: white
footertextcolor = #FFFFFF
# Background color for the sidebar: light bluish gray
sidebarbgcolor = #EAEAF8
# Text color for the sidebar: black
sidebartextcolor = #000000
# Link color for the sidebar: light dark blue
sidebarlinkcolor = #090999
# Background color for the relation bar: light grayish blue
relbarbgcolor = #B8B9F6
# Text color for the relation bar: light dark blue
relbartextcolor = #090999
# Link color for the relation bar: light dark blue
relbarlinkcolor = #090999
# Body text color: black
textcolor = #000000
# Background color for headings: light gray
headbgcolor = #F2F2F2
# Body link color: dark greenish blue
linkcolor = #45529B
# Background color for code blocks: very pale yellow
codebgcolor = #FFFFE5

37
makefile Normal file
View File

@ -0,0 +1,37 @@
# This Makefile is for convenience as a reminder and shortcut for the most used commands
# Package folder
PACKAGE = vector_bundle
# change to your sage command if needed
SAGE = sage
all: install test
install:
$(SAGE) -pip install --upgrade -v .
uninstall:
$(SAGE) -pip uninstall $(PACKAGE)
develop:
$(SAGE) -pip install --upgrade -e .
test:
$(SAGE) setup.py test
coverage:
$(SAGE) -coverage $(PACKAGE)/*
doc:
cd docs && $(SAGE) -sh -c "make html"
doc-pdf:
cd docs && $(SAGE) -sh -c "make latexpdf"
clean: clean-doc
clean-doc:
cd docs && $(SAGE) -sh -c "make clean"
.PHONY: all install develop test coverage clean clean-doc doc doc-pdf

50
setup.py Normal file
View File

@ -0,0 +1,50 @@
## -*- encoding: utf-8 -*-
import os
import sys
from setuptools import setup
from codecs import open # To open the README file with proper encoding
from setuptools.command.test import test as TestCommand # for tests
# Get information from separate files (README, VERSION)
def readfile(filename):
with open(filename, encoding='utf-8') as f:
return f.read()
# For the tests
class SageTest(TestCommand):
def run_tests(self):
errno = os.system("sage -t --force-lib vector_bundle")
if errno != 0:
sys.exit(1)
setup(
name = "vector_bundle",
version = readfile("VERSION").strip(), # the VERSION file is shared with the documentation
description='A sage package implementing vector bundles on algebraic curves using only function fields',
long_description = readfile("README.rst"), # get the long description from the README
# For a Markdown README replace the above line by the following two lines:
# long_description = readfile("README.md"),
# long_description_content_type="text/markdown",
# url='https://github.com/sagemath/sage_sample',
author='Mickaël Montessinos',
author_email='mickael.montessinos@mif.vu.lt', # choose a main contact email
license='GPLv2+', # This should be consistent with the LICENCE file
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 3 - Alpha',
'Intended Audience :: Science/Research',
'Topic :: Software Development :: Build Tools',
'Topic :: Scientific/Engineering :: Mathematics',
'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
'Programming Language :: Python :: 3.7',
], # classifiers list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
keywords = "Algebraic Geometry Number Theory Curves Vector Bundles",
packages = ['vector_bundle'],
cmdclass = {'test': SageTest}, # adding a special setup command for tests
setup_requires = ['sage-package'],
install_requires = ['sage-package', 'sphinx'],
)

View File

@ -0,0 +1,4 @@
from __future__ import absolute_import
# Add the import for which you want to give a direct access
from .vector_bundle import VectorBundle
from .constructions import *

View File

@ -0,0 +1,229 @@
r"""
This module provides functions for various interesting constructions of vector bundles.
AUTHORS:
_Mickaël Montessinos: initial implementation
"""
###########################################################################
# Copyright (C) 2024 Mickaël Montessinos (mickael.montessinos@mif.vu.lt),#
# #
# Distributed under the terms of the GNU General Public License (GPL) #
# either version 3, or (at your option) any later version #
# #
# http://www.gnu.org/licenses/ #
###########################################################################
from sage.matrix.constructor import matrix
from vector_bundle import VectorBundle
from . import function_field_utility
def trivial_bundle(K):
r"""
Return the structure sheaf of the algebraic curve with function field K.
EXAMPLES ::
sage: from vector_bundle import trivial_bundle
sage: F.<x> = FunctionField(GF(3))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 + x + 2)
sage: O = K.maximal_order()
sage: V = trivial_bundle(K)
sage: V._ideals
[Ideal (1) of Maximal order of Function field in y defined by y^2 + x + 2]
sage: V._g_finite
[1]
sage: V._g_infinite
[1]
"""
return VectorBundle(K, K.one().divisor())
def canonical_bundle(K):
r"""
Return a canonical line bundle over K suitable for explicit Serre duality.
EXAMPLES ::
sage: from vector_bundle import canonical_bundle, trivial_bundle
sage: F.<x> = FunctionField(GF(3))
sage: canonical_bundle(F).degree()
-2
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 - x^3 - x)
sage: L = canonical_bundle(K); L
Vector bundle of rank 1 over Function field in y defined by y^2 + 2*x^3 + 2*x
sage: L == trivial_bundle(K)
True
"""
pi,_ = function_field_utility.safe_uniformizer(K)
return VectorBundle(K, pi.differential().divisor())
def _euclid(a,b):
r"""
The Euclidian algorithm in `N` but outputs intermediate steps.
"""
u1 = a
u2 = b
res = []
while u2 != 0:
q, r = u1.quo_rem(u2)
res.append((u1, u2, q, r))
u1 = u2
u2 = r
return res
def atiyah_bundle(field, rank, degree, base=None):
r"""
Return `\alpha_{r,d}(F_r \otimes base)` in the notation of Theorem 6 [At57]_
, where `r` is ``rank`` and `d` is ``degree``.
INPUT:
- ``field`` - FunctionField; of genus 1 with an infinite place of degree 1
- ``rank`` - integer
- ``degree`` - integer
- ``base`` - line bundle of degree 0 over field ; (default = ``trivial_bundle(field)``)
EXAMPLES ::
sage: from vector_bundle import atiyah_bundle
sage: from vector_bundle import VectorBundle
sage: F.<x> = FunctionField(GF(11))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 - x^3 - x)
sage: base = VectorBundle(K, K.places_finite()[0].divisor())
sage: E = atiyah_bundle(K, 5, 3, base)
sage: E.rank()
5
sage: E.degree()
3
sage: E.hom(E).h0()
[
[1 0 0 0 0]
[0 1 0 0 0]
[0 0 1 0 0]
[0 0 0 1 0]
[0 0 0 0 1]
]
"""
if base is None:
base = trivial_bundle(field)
if rank <= 0 :
raise ValueError('rank must be positive')
if field.genus() != 1:
raise ValueError('field must have genus 1')
if base.function_field() != field:
raise ValueError('base must have field as its function_field.')
if degree < 0:
return atiyah_bundle(field, rank, -degree, base).dual()
divisor = field.places_infinite()[0].divisor()
gcd = _euclid(rank, degree)
plan = [(i % 2,q) for i,(_, _, q, _) in enumerate(gcd)]
a, b = plan[-1]
plan[-1] = (a, b - 1)
starting_rank = gcd[-1][1]
result = trivial_bundle(field)
line_bundle = VectorBundle(field, divisor)
for _ in range(starting_rank - 1):
result = result.extension_by_global_sections()
result = result.tensor_product(line_bundle)
for move, reps in reversed(plan):
for _ in range(reps):
if move == 0:
result = result.extension_by_global_sections()
else:
result = result.tensor_product(line_bundle)
return result
def savin_bundle(field, rank, degree, line, line_1, line_2):
r"""
Return a weakly stable bundle over field of rank ``rank`` and degree
``degree``
ALGORITHM:
Section V of [Sav08]_
INPUT:
- ``field`` -- FunctionField: the base of the bundle. Must have genus at least 2.
- ``rank`` -- Integer: the rank of the output bundle
- ``degree`` -- Integer: the degree of the output bundle
- ``line`` -- VectorBundle: line bundle of degree ``degree//rank + 1`` plays the role of `F` in the algorithm
- ``line_1`` -- VectorBundle: line bundle of degree ``degree // rank`` plays the role of `F_1` in the algorithm
- ``line_2`` -- VectorBundle: line bundle of degree ``degree // rank`` plays the role of `F_2` in the algorithm
EXAMPLE ::
sage: from vector_bundle import VectorBundle, savin_bundle
sage: F.<x> = FunctionField(GF(11))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 - x^5 + x)
sage: line = VectorBundle(K, 3 * K.places_infinite()[0].divisor())
sage: line_1 = VectorBundle(K, 2 * K.places_finite()[0].divisor())
sage: line_2 = VectorBundle(K, 2 * K.places_finite()[1].divisor())
sage: E = savin_bundle(K, 3, 7, line, line_1, line_2)
sage: E.rank()
3
sage: E.degree()
7
"""
if degree < 0:
return savin_bundle(field, rank, -degree, line, line_1, line_2).dual()
q, r = degree.quo_rem(rank)
if line.rank() != 1 or line_1.rank() != 1 or line_2.rank() != 1:
raise ValueError('The input bundles must have rank 1')
if line_1.degree() != q or line_1.degree() != q or line.degree() != q+1:
raise ValueError('At least one of the input line bundles has'
+ 'invalid degree')
E = line_1
for _ in range(rank - r - 1):
E = line_2.non_trivial_extension(E)
for _ in range(r):
E = line.non_trivial_extension(E)
return E
def rank_2_trivial_determinant_semistable_bundle(ksi, ext=None):
r"""
Construct the semi-stable vector bundle of rank 2 and trivial determinant
defined by the extension of ``ksi`` by ``ksi.dual()`` and nonzero extension
class ``ext``.
The fact that this vector bundle is semi-stable is Lemma 5.1 in [NR69]_.
If ``ext`` is None, we default to a default nonzero extension class.
INPUT:
- ``ksi`` -- a degree 1 line bundle over a function field of genus at least 2
- ``ext`` -- an object representing a class of extensions of ``ksi`` by ``ksi.dual()``. (Default: None)
EXAMPLES ::
sage: from vector_bundle import VectorBundle, trivial_bundle, rank_2_trivial_determinant_semistable_bundle
sage: F.<x> = FunctionField(GF(11))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 - x^5 - 1)
sage: ksi = VectorBundle(K, K.places_finite()[0].divisor())
sage: V = rank_2_trivial_determinant_semistable_bundle(ksi)
sage: V.rank()
2
sage: V.determinant() == trivial_bundle(K)
True
"""
if ksi.rank() != 1:
raise ValueError('ksi must have rank one')
if ksi.degree() != 1:
raise ValueError('ksi must have degree one')
if ksi.function_field().genus() < 2:
raise ValueError('The function field of ksi must have genus at least 2')
ext_group = ksi.extension_group(ksi.dual())
return ext_group.extension(ext)

252
vector_bundle/ext_group.py Normal file
View File

@ -0,0 +1,252 @@
r"""
This module implements the ExtGroup and ExtGroupElement classes used for
building extensions of vector bundles.
AUTHORS:
_Mickaël Montessinos: initial implementation
"""
###########################################################################
# Copyright (C) 2024 Mickaël Montessinos (mickael.montessinos@mif.vu.lt),#
# #
# Distributed under the terms of the GNU General Public License (GPL) #
# either version 3, or (at your option) any later version #
# #
# http://www.gnu.org/licenses/ #
###########################################################################
from sage.structure.sage_object import SageObject
from sage.structure.element import is_Matrix
from sage.matrix.special import block_matrix
from sage.modules.free_module_element import vector
class ExtGroup(SageObject):
r"""
The group of extensions of ``left`` by ``right``.
The group `Ext^1(\mathrm{left},\mathrm{right})` is
`H^1(\mathrm{left}^\vee \otimes \mathrm{right})`.
Its elements may be represented as matrices of infinite répartitions
lying in `M_{\mathrm{right}.rank(),\mathrm{left}.rank()}(R)` or as
vectors of length ``self.dim()`` with coefficients in the coefficient
field, representing linear forms on
`H^0(\omega \otimes \mathrm{right}^\vee \otimes \mathrm{left})`, where
`\omega` is the canonical bundle of the function field of ``left`` and
``right``
The two representations are related via Serre duality.
If ``precompute_basis`` is set to ``True``, a basis of répartition
matrices is computed. Its element represent the linear forms
``vector([0,...,0,1,0,...,0])``. Otherwise, linear forms are converted
to elements of the `H^1` on the fly. You should set ``precompute_basis``
to ``True`` only if you plan to create several extensions with this group.
INPUT:
- ``left`` -- VectorBundle
- ``right`` -- VectorBundle; must have the same function field as left
- ``precompute_basis`` -- boolean
EXAMPLES ::
sage: from vector_bundle import VectorBundle, trivial_bundle
sage: F.<x> = FunctionField(GF(3))
sage: triv = trivial_bundle(F)
sage: triv.extension_group(triv)
Extension group of Vector bundle of rank 1 over Rational function field in x over Finite Field of size 3 by Vector bundle of rank 1 over Rational function field in x over Finite Field of size 3.
"""
def __init__(self, left, right, precompute_basis=False):
if not left._function_field == right._function_field:
raise ValueError('left and right should have the same function'
+ 'field')
self._left = left
self._right = right
self._hom = left.hom(right)
self._ext_dual_basis, self._ext_dual_bundle = self._hom.h1_dual()
self._s = len(self._ext_dual_basis)
if precompute_basis:
self._compute_basis()
else:
self._basis = None
def __hash__(self):
return hash((self._left, self._right))
def __eq__(self, other):
return self._left == other._left and self._right == other._right
def _repr_(self):
return "Extension group of %s by %s." % (self._left, self._right)
def _compute_basis(self):
r"""
Compute the representation of basis elements of ``self`` as elements of the `H^1`
"""
if self._basis is None:
self._basis = [self._hom.h1_element(
vector([0] * i + [1] + [0] * (self._s-i-1)))
for i in range(self._s)]
def dim(self):
r"""
Return the dimension of the extension group as a vector space over the
base coefficient field
EXAMPLES ::
sage: from vector_bundle import VectorBundle
sage: F.<x> = FunctionField(GF(11))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 - x^5 - 1)
sage: ksi = VectorBundle(K, K.places_finite()[0].divisor())
sage: ext = ksi.extension_group(ksi.dual()); ext.dim()
3
"""
return self._s
def left(self):
r"""
Return the left vector bundle of ``self``.
EXAMPLES ::
sage: from vector_bundle import VectorBundle
sage: F.<x> = FunctionField(GF(3))
sage: L1 = VectorBundle(F, x.zeros()[0].divisor())
sage: L2 = VectorBundle(F, x.poles()[0].divisor())
sage: ext = L1.extension_group(L2); ext.left() == L1
True
"""
return self._left
def right(self):
r"""
Return the right vector bundle of ``self``.
EXAMPLES ::
sage: from vector_bundle import VectorBundle
sage: F.<x> = FunctionField(GF(3))
sage: L1 = VectorBundle(F, x.zeros()[0].divisor())
sage: L2 = VectorBundle(F, x.poles()[0].divisor())
sage: ext = L1.extension_group(L2); ext.right() == L2
True
"""
return self._right
def dual_basis(self):
r"""
Return a basis of the dual of the `Ext^1` group. This is a basis of
`H^0(\omega \otimes \mathrm{right}^\vee \otimes \mathrm{left})`, where
`\omega` is a canonical line bundle.
EXAMPLES ::
sage: from vector_bundle import VectorBundle
sage: F.<x> = FunctionField(GF(11))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 - x^5 - 1)
sage: ksi = VectorBundle(K, K.places_finite()[0].divisor())
sage: ext = ksi.extension_group(ksi.dual()); ext.dual_basis()
[[x^4/(x^5 + 6)], [x^5/(x^5 + 6)], [(x^2/(x^5 + 6))*y + 10*x^2/(x^5 + 6)]]
"""
return self._ext_dual_basis
def basis(self):
r"""Return a basis of `Ext^1` group. Its element are matrices of
infinite répartitions represented by field elements.
Computes and stores the basis if it was not precomputed yet.
EXAMPLES ::
sage: from vector_bundle import VectorBundle
sage: F.<x> = FunctionField(GF(11))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 - x^5 - 1)
sage: ksi = VectorBundle(K, K.places_finite()[0].divisor())
sage: ext = ksi.extension_group(ksi.dual()); ext.basis()
[[(x^9/(x^10 + 2*x^5 + 1))*y], [(x^3/(x^5 + 1))*y], [x^6/(x^5 + 1)]]
"""
self._compute_basis()
return self._basis
def _extension_from_ext_element(self, ext):
r"""
Return the extension of ``self.left() by ``self.right()`` encoded by
``ext``.
``ext`` is a matrix of elements of ``self._function_field`` which
represents the constant value over the infinite places of a répartition
matrix with support at infinity representing an element of
`H^1(\mathrm{hom}(\mathrm{left},\mathrm{right}))`.
Such an element encodes an extension `V`:
`0 \to \mathrm{other} \to V \to \mathrm{self} \to 0`
INPUT:
- ``ext`` -- a matrix of dimension ``right.rank(),left.rank()``
"""
from vector_bundle import VectorBundle
function_field = self._left._function_field
ideals = self._right._ideals + self._left._ideals
g_finite = block_matrix([[self._right._g_finite, 0],
[0, self._left._g_finite]])
g_infinite = block_matrix([[self._right._g_infinite,
-ext * self._left._g_infinite],
[0, self._left._g_infinite]])
return VectorBundle(function_field, ideals, g_finite, g_infinite)
def _extension_from_linear_form(self, form):
if self._basis is None:
ext = self._hom.h1_element(form)
ext = self._ext_dual_bundle._vector_to_matrix(ext).transpose()
else:
ext = sum([coeff * e for coeff, e in zip(form, self._basis)])
return self._extension_from_ext_element(ext)
def extension(self, ext=None):
r"""
Return the extension of ``self.left()`` by ``self.right()`` encoded by
``ext``.
``ext`` can be a matrix of elements of ``self._function_field``
which represents the constant value over the infinite places of a
répartition matrix with support at infinity representing an element of
`H^1(\mathrm{hom}(\mathrm{left},\mathrm{right}))`.
Such an element encodes an extension `V`:
`0 \to \mathrm{other} \to V \to \mathrm{self} \to 0`
``ext`` can also be a vector of length `self.dim()` representing an
extension in the basis of the Ext vector space.
By default, ``ext`` is chosen as any non trivial extension.
EXAMPLES ::
sage: from vector_bundle import VectorBundle, trivial_bundle
sage: F.<x> = FunctionField(GF(11))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 - x^3 - x)
sage: triv = trivial_bundle(K)
sage: ext = triv.extension_group(triv)
sage: V = ext.extension()
sage: V.rank()
2
sage: V.determinant() == triv
True
sage: V.h0()
[(1, 0)]
sage: V.end().h0()
[
[0 1] [1 0]
[0 0], [0 1]
]
"""
if ext is None:
ext = vector([1] + [0]*(self._s-1))
if is_Matrix(ext):
return self._extension_from_ext_element(ext)
else:
return self._extension_from_linear_form(ext)

View File

@ -0,0 +1,466 @@
###########################################################################
# Copyright (C) 2024 Mickaël Montessinos (mickael.montessinos@mif.vu.lt),#
# #
# Distributed under the terms of the GNU General Public License (GPL) #
# either version 3, or (at your option) any later version #
# #
# http://www.gnu.org/licenses/ #
###########################################################################
from sage.matrix.constructor import matrix
from sage.rings.infinity import Infinity
from copy import copy
from sage.misc.cachefunc import cached_function
from sage.misc.misc_c import prod
from sage.matrix.constructor import matrix
from sage.matrix.special import block_matrix, elementary_matrix,\
identity_matrix
from sage.rings.function_field.function_field_rational\
import RationalFunctionField
from sage.rings.function_field.order_rational\
import FunctionFieldMaximalOrderInfinite_rational
@cached_function
def all_infinite_places(K):
r"""
Return a list of the infinite places of K of all degrees
INPUT:
- ``K`` -- FunctionField
"""
if isinstance(K,RationalFunctionField):
return [K.gen().poles()[0]]
deg = K.degree()
return sum([K.places_infinite(degree = deg) for deg in range(1, deg + 1)],
[])
def infinite_valuation(a):
r"""
Returns the valuation -deg of an element of a rational function field
The degree method returns the "height" of the element.
EXAMPLES:
sage: from vector_bundle.function_field_utility import infinite_valuation
sage: F.<x> = FunctionField(GF(3))
sage: infinite_valuation(x**-1 + x**-2)
1
"""
if a == 0:
return Infinity
return a.denominator().degree() - a.numerator().degree()
def infinite_mod(a,i):
r"""
Returns a mod x**-i
EXAMPLES:
sage: from vector_bundle.function_field_utility import infinite_mod
sage: K.<x> = FunctionField(GF(3))
sage: infinite_mod(x**-1 + x**-3,2)
1/x
"""
x = a.parent().gen()
b = a * x**(i-1)
return x**(1-i) * (b.numerator() // b.denominator())
def infinite_integral_matrix(mat):
r"""
Return an matrix with coefficient in the infinite maximal order and its denominator.
INPUT:
- ``mat`` -- Matrix with coefficients in a rational function field K
OUTPUT:
- ``int_mat`` -- Matrix with coefficients in K.maximal_order_infinite()
- ``den`` -- Element of K.maximal_order_infinite such that mat = int_mat/den
EXAMPLES:
sage: from vector_bundle.function_field_utility import infinite_integral_matrix
sage: F.<x> = FunctionField(GF(11))
sage: mat = matrix([[x, 1], [x**-1, 2]])
sage: infinite_integral_matrix(mat)
(
[ 1 1/x]
[1/x^2 2/x], 1/x
)
"""
K = mat[0,0].parent()
if isinstance(K,FunctionFieldMaximalOrderInfinite_rational):
return mat,1
if not isinstance(K,RationalFunctionField):
raise ValueError('mat must have coefficients in a rational function'
+ 'field or its infinite maximal order')
x = K.gen()
R = K.maximal_order_infinite()
den = x**min([infinite_valuation(e) for e in mat.list()])
int_mat = matrix(R,mat.nrows(),mat.ncols(),(den*mat).list())
return int_mat, den
def infinite_hermite_form(mat,include_zero_cols=True,transformation=False):
r"""
Return the hermite form of a matrix with coefficient in a rational infinite maximal order.
EXAMPLE:
sage: from vector_bundle.function_field_utility import infinite_hermite_form
sage: K.<x> = FunctionField(GF(3))
sage: R = K.maximal_order_infinite()
sage: mat = matrix(R,[[1, x**-1, x**-2, (x**3+1) / x**3], [(2*x+2) / (x**3+2), x**-2, (x**2+2) / (x**4+1), 1]])
sage: H,T = infinite_hermite_form(mat,transformation=True); H
[0 0 1 0]
[0 0 0 1]
sage: mat*T == H
True
TESTS:
sage: F.<x> = FunctionField(GF(3))
sage: R = F.maximal_order_infinite()
sage: mat = matrix(R,[[x**-1, 0, 2, 1], [0, x**-1, 1, 1], [0, 0, 1, 0], [0, 0, 0, 1]])
sage: infinite_hermite_form(mat) == mat
True
"""
R = mat.base_ring()
if not isinstance(R,FunctionFieldMaximalOrderInfinite_rational):
raise ValueError('mat must have base ring a rational infinite maximal'
+ ' order.')
n = mat.nrows()
r = mat.ncols()
x = R.function_field().gen()
H = copy(mat)
T = identity_matrix(R,r)
#First, make mat upper triangular with diagonal coefficient of the form
#x**-k.
for i in range(1,n+1):
degs = [infinite_valuation(H[-i,j]) for j in range(r+1-i)]
d0 = min(degs)
j0 = degs.index(d0)
E = elementary_matrix(R,r,row1=j0,row2=r-i)
T *= E
H *= E
E = elementary_matrix(R,r,row1=r-i,scale=(x**d0 * H[-i,-i])**-1)
T *= E
H *= E
for j in range(r-i):
E = elementary_matrix(R,r,row1=r-i,row2=j,scale=-H[-i,j]/H[-i,-i])
T *= E
H *= E
for i in range(2,n+1):
d = infinite_valuation(H[-i,-i])
for j in range(1,i):
E = elementary_matrix(
R,r,row1=r-i,row2=r-j,
scale=(infinite_mod(H[-i,-j],d)-H[-i,-j])/H[-i,-i])
T *= E
H *= E
if not include_zero_cols:
H = H[:,r-n:]
if transformation:
return H,T
return H
def infinite_ideal_hnf(I,transformation=False):
r"""
Return the Hermite form of an ideal of the infinite maximal order.
"""
O = I.ring()
K = O.function_field()
x = K.gen()
F = K.base_field()
R = F.maximal_order_infinite()
n = K.degree()
order_basis = O.basis()
order_matrix = matrix(R,[gen.list() for gen in O.basis()]).transpose()
ideal_basis = I.gens_over_base();
ideal_matrix = order_matrix**-1 * matrix(F,[gen.list()
for gen in ideal_basis]).transpose()
mat,den = infinite_integral_matrix(ideal_matrix)
#This is awkward but if transformation is False, hnf,U = ().hermite_form()
#will unpack the matrix.
if transformation:
hnf,U = infinite_hermite_form(mat, transformation=True)
return hnf/den,U
hnf = infinite_hermite_form(mat)
return hnf/den
def infinite_order_xgcd(ideals):
r"""
Performs the extended gcd algorithm for ideals in the infinite order.
INPUT:
- ``ideals`` -- list of ideals over the infinite maximal order of a function field
OUTPUT:
- ``coeffs`` --- list of elements of the function field such that as[i] in ideals[i] and sum(as) = 1
ALGORITHM:
Proposition 1.3.7 from [Coh00]
EXAMPLES:
sage: from vector_bundle.function_field_utility import infinite_order_xgcd
sage: F.<x> = FunctionField(GF(3))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y**2 - x**-5 - 1)
sage: primes = [p.prime_ideal() for p in K.places_infinite()]; len(primes)
2
sage: a = infinite_order_xgcd(primes); a
[2*y + 2, y + 2]
sage: sum(a)
1
sage: all([a[i] in primes[i] for i in range(2)])
True
"""
order_basis = ideals[0].ring().basis()
if order_basis[0] != 1:
raise ValueError('The first element of the basis of the order should'
+ ' be 1.')
n = len(order_basis)
k = len(ideals)
y = ideals[0].ring().function_field().gen()
ideals_hnf = [infinite_ideal_hnf(I) for I in ideals]
ideals_bases = [[sum([order_basis[i]*mat[i,j] for i in range(n)])
for j in range(n)]
for mat in ideals_hnf]
C = block_matrix([ideals_hnf])
C, den = infinite_integral_matrix(C)
H,U = infinite_hermite_form(C, include_zero_cols=False, transformation=True)
if not (H/den).is_one():
raise ValueError("The ideals should be coprime.")
v = U[:,-n].list()
return [sum([ideals_bases[i][j]*v[n*i+j] for j in range(n)]) for i in range(k)]
def infinite_approximation(places,valuations,residues):
r"""
Return a in the function field of places such that
(a - residues[i]) has valuation at least valuations[i] at places[i].
INPUT:
- ``places`` -- list of FunctionFieldPlace. Infinite places only.
- ``valuations`` -- list of integers of same length as places.
- ``residues`` -- list of elements of the function field.
ALGORITHM:
Proposition 1.3.11 from [Coh00]
"""
if len(places) == 1:
return residues[0]
valuations = [max(0,val) for val in valuations]
primes = [place.prime_ideal() for place in places]
I = prod([prime**(val+1) for prime, val in zip(primes, valuations)])
ideals = [I * prime**(-val-1)
for prime, val in zip(primes, valuations)]
coefficients = infinite_order_xgcd(ideals)
return sum([c * res for c,res in zip(coefficients,residues)])
@cached_function
def safe_uniformizer(K):
r"""
Return a safe uniformizer and an infinite place of self._function_field
A uniformizer is safe if its valuation at other infinite places is 0.
EXAMPLES:
sage: from vector_bundle.function_field_utility import safe_uniformizer
sage: F.<x> = FunctionField(GF(3))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 - x**-5 - 1)
sage: places = K.places_infinite()
sage: pi, place = safe_uniformizer(K); pi
((2*x + 1)/x)*y + (2*x + 2)/x
sage: place == places[0]
True
sage: pi.valuation(place)
1
sage: pi.valuation(places[1])
0
TESTS:
sage: from vector_bundle.function_field_utility import all_infinite_places
sage: F.<x> = FunctionField(GF(3))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 + x + 2)
sage: places = K.places_infinite()
sage: pi, place = safe_uniformizer(K); pi
1/x*y
sage: place == places[0]
True
sage: pi.valuation(place)
1
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^4 + (2*x^2 + 2)/x^2)
sage: pi, _ = safe_uniformizer(K)
sage: [pi.valuation(place) for place in all_infinite_places(K)]
[1, 0, 0]
sage: safe_uniformizer(F)
(1/x, Place (1/x))
"""
places = all_infinite_places(K)
n = len(places)
return (infinite_approximation(
places,
[2] + ([1]*(n-1)),
[places[0].local_uniformizer()] + ([1]*(n-1))),
places[0])
def local_expansion(place,pi,f):
r"""
Return a function giving the i-th coefficient of the expansion of f.
This uses code from sage.rings.function_field.maps.FunctionFieldCompletion.
While somewhat redundant, it adds the possibility to chose the uniformizer
with respect to which the expansion is computed.
INPUT:
- ``place`` -- FunctionFieldPlace; the place at which to expand
- ``pi`` -- The uniformizer giving variable for the power series
- ``f`` -- The function to expand
OUTPUT:
- a function taking as input an integer i and returning the coefficient of degree i
EXAMPLES:
sage: from vector_bundle.function_field_utility import local_expansion
sage: from vector_bundle.function_field_utility import safe_uniformizer
sage: F.<x> = FunctionField(GF(3))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 - x**-5 - 1)
sage: pi, place = safe_uniformizer(K)
sage: f = 1 / (1-pi)
sage: exp = local_expansion(place, pi, f)
sage: all([exp(i) == 1 for i in range(20)])
True
"""
if f == 0:
return lambda i : 0
K = place.function_field()
der = K.higher_derivation()
k, _, to_k = place.residue_field()
val = f.valuation(place)
e = f * pi**(-val)
return lambda i : to_k(der._derive(e, i - val, pi)) if i >= val else 0
def residue(place,pi,f):
r"""
Return the residue of constant répartition f at place with respect
to local uniformizer pi.
"""
if pi.valuation(place) != 1:
raise ValueError('pi must be a local uniformizer at place')
k, _, _ = place.residue_field()
kc = place.function_field().constant_base_field()
exp = local_expansion(place,pi,f)
high_res = exp(-1)
return k.over(kc)(high_res).trace()
def invert_trace(field,base,target):
r"""
Find an element of trace 1 over base in field.
EXAMPLES:
sage: from vector_bundle.function_field_utility import invert_trace
sage: base = GF(9)
sage: field = GF(9**3)
sage: a = invert_trace(field, base, 1); a
2*z6^4 + 2*z6^3 + z6 + 1
sage: field.over(base)(a).trace()
1
"""
if field == base:
if target not in field:
raise ValueError('Since field = base, target should be an element'
+ ' of field')
return target
as_ext = field.over(base)
d = as_ext.degree(base)
t = as_ext.gen()
i = [(t**j).trace() != 0 for j in range(d)].index(True)
return field(target * t**i/((t**i).trace()))
def insert_row(mat,i,row):
r"""
Return matrix mat with row inserted in ith position.
EXAMPLES:
sage: from vector_bundle.function_field_utility import insert_row
sage: mat = matrix(GF(3), 2, 2, [1, 2, 2, 1])
sage: insert_row(mat, 1, [0, 1])
[1 2]
[0 1]
[2 1]
"""
return matrix([mat[j] for j in range(i)]
+ [row]
+ [mat[j] for j in range(i,mat.nrows())])
def norm(v):
r"""
Return the norm of vector v: the maximal degree of its coefficients.
Input:
- v -- vector with coefficients in a RationalFunctionField
EXAMPLES:
sage: from vector_bundle.function_field_utility import norm
sage: R.<x> = GF(3)[]
sage: v = vector([x^3 + 3 + 1, x^2])
sage: norm(v)
3
"""
return max([c.degree() for c in v.list()])
def smallest_norm_first(mat,i = 0,norms=[]):
r"""
Swap rows of M so that the i-th row has smaller norm than rows below.
INPUT:
``mat`` -- matrix with coefficients in a RationalFunctionField
``i`` -- integer (default: `0`)
EXAMPLES:
sage: from vector_bundle.function_field_utility import smallest_norm_first
sage: R.<x> = GF(3)[]
sage: mat = matrix([[1, 1], [x^2, x^3], [1, x]])
sage: smallest_norm_first(mat, 1)
[0, 1, 3]
sage: mat
[ 1 1]
[ 1 x]
[x^2 x^3]
"""
if norms == []:
norms = [norm(row) for row in mat]
j = norms[i:].index(min(norms[i:]))
mat.swap_rows(i,i+j)
n = norms[i]
norms[i] = norms[j+i]
norms[j+i] = n
return norms

305
vector_bundle/hom_bundle.py Normal file
View File

@ -0,0 +1,305 @@
r"""
This module implements the HomBundle class, for vector bundles constructed
as homomorphism sheaves between two vector bundles.
The class inherits from the VectorBundle class, but sections, either local
or global, are displayed as matrices.
EXAMPLES ::
sage: from vector_bundle import VectorBundle, trivial_bundle, savin_bundle
sage: F.<x> = FunctionField(GF(3))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 - x^5 - 1)
We construct a vector bundle of rank 2 and degree 4::
sage: F = VectorBundle(K, 3 * K.places_infinite()[0].divisor())
sage: F1 = VectorBundle(K, 2 * K.places_finite()[0].divisor())
sage: F2 = VectorBundle(K, 2 * K.places_finite()[1].divisor())
sage: V = savin_bundle(K, 2, 4, F, F1, F2); V.h0()
[(1, 0), (2*x, 1)]
We construct the ``HomBundle`` from `\mathcal{O}_X^2` to ``V``. Its global
sections should represent linear maps from `k^2` to `H^0(V)`, where `k`
is the constant field of `K`::
sage: domain = trivial_bundle(K).direct_sum_repeat(2)
sage: hom_bundle = domain.hom(V); hom_bundle.h0()
[
[1 0] [0 1] [2*x 0] [ 0 2*x]
[0 0], [0 0], [ 1 0], [ 0 1]
]
"""
###########################################################################
# Copyright (C) 2024 Mickaël Montessinos (mickael.montessinos@mif.vu.lt),#
# #
# Distributed under the terms of the GNU General Public License (GPL) #
# either version 3, or (at your option) any later version #
# #
# http://www.gnu.org/licenses/ #
###########################################################################
from sage.matrix.constructor import matrix
from sage.modules.free_module_element import vector
from vector_bundle import VectorBundle
class HomBundle(VectorBundle):
r"""
Vector bundles representing homomorphism sheaves of vector bundles.
EXAMPLES ::
sage: from vector_bundle import VectorBundle
sage: F.<x> = FunctionField(GF(3))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 + x + 2)
sage: ideals = [P.prime_ideal() for P in K.places_finite()[:2]]
sage: g_finite = matrix([[1, x], [2, y]])
sage: g_infinite = matrix([[x, 1], [2, y]])
sage: V1 = VectorBundle(K, ideals, g_finite, g_infinite)
sage: V2 = VectorBundle(K, K.places_infinite()[0].divisor())
sage: V = V1.hom(V2); V
Homomorphism bundle from Vector bundle of rank 2 over Function field in y defined by y^2 + x + 2 to Vector bundle of rank 1 over Function field in y defined by y^2 + x + 2
"""
def __init__(self,domain,codomain):
if (not isinstance(domain,VectorBundle) or
not isinstance(codomain,VectorBundle)):
raise TypeError
if domain._function_field != codomain._function_field:
raise ValueError
self._domain = domain
self._codomain = codomain
ideals = [ideal_domain**-1 * ideal_codomain
for ideal_domain in domain._ideals
for ideal_codomain in codomain._ideals]
g_finite = (domain._g_finite.transpose()**-1)\
.tensor_product(codomain._g_finite)
g_infinite = (domain._g_infinite.transpose()**-1)\
.tensor_product(codomain._g_infinite)
super().__init__(domain._function_field, ideals,g_finite,g_infinite)
def __hash__(self):
return hash((self._domain, self._codomain))
def __eq__(self,other):
return (super().__eq__(other)
and self._domain == other._domain
and self._codomain == other._codomain)
def _repr_(self):
return "Homomorphism bundle from %s to %s" % (
self._domain,
self._codomain,
)
def domain(self):
r"""
Return the domain of self
EXAMPLES ::
sage: from vector_bundle import VectorBundle
sage: F.<x> = FunctionField(GF(3))
sage: L1 = VectorBundle(F, x.poles()[0].divisor())
sage: L2 = VectorBundle(F, x.zeros()[0].divisor())
sage: V = L1.hom(L2); V.domain() == L1
True
"""
return self._domain
def codomain(self):
r"""
Return the codomain of self
EXAMPLES ::
sage: from vector_bundle import VectorBundle
sage: F.<x> = FunctionField(GF(3))
sage: L1 = VectorBundle(F, x.poles()[0].divisor())
sage: L2 = VectorBundle(F, x.zeros()[0].divisor())
sage: V = L1.hom(L2); V.codomain() == L2
True
"""
return self._codomain
def _vector_to_matrix(self,vec):
r"""
Return the matrix of the homomorphism encoded by vector vec.
"""
return matrix(self._domain.rank(),self._codomain.rank(),vec).transpose()
def _matrix_to_vector(self,mat):
r"""
Inverse operation of _vector_to_matrix()
"""
return vector(mat.transpose().list())
def basis_finite(self):
r"""
Return basis of the finite lattice of the hom bundle.
OUTPUT:
- The basis elements are represented as matrices.
EXAMPLES ::
sage: from vector_bundle import VectorBundle
sage: F.<x> = FunctionField(GF(3))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 + x + 2)
sage: ideals = [P.prime_ideal() for P in K.places_finite()[:2]]
sage: g_finite = matrix([[1, x], [2, y]])
sage: g_infinite = matrix([[x, 1], [2, y]])
sage: V1 = VectorBundle(K, ideals, g_finite, g_infinite)
sage: O = K.maximal_order()
sage: V2 = VectorBundle(K, K.places_finite()[2].prime_ideal(),1,x^2)
sage: V = V1.hom(V2)
sage: V.basis_finite()
[[(x/(x^2 + x + 2))*y + (x + 2)/(x^2 + x + 2) (x/(x^2 + x + 2))*y + 2*x^2/(x^2 + x + 2)],
[(2/(x^2 + x + 2))*y + x/(x^2 + x + 2) (2/(x^2 + x + 2))*y + x/(x^2 + x + 2)]]
"""
basis = super().basis_finite()
return [self._vector_to_matrix(v) for v in basis]
def basis_infinite(self):
r"""
Return basis of the infinite lattice of the hom bundle.
OUTPUT:
- The basis elements are represented as matrices.
EXAMPLES ::
sage: from vector_bundle import VectorBundle
sage: F.<x> = FunctionField(GF(3))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 + x + 2)
sage: ideals = [P.prime_ideal() for P in K.places_finite()[:2]]
sage: g_finite = matrix([[1, x], [2, y]])
sage: g_infinite = matrix([[x, 1],[2, y]])
sage: V1 = VectorBundle(K, ideals,g_finite,g_infinite)
sage: O = K.maximal_order()
sage: V2 = VectorBundle(K, K.places_finite()[2].prime_ideal(),1,x^2)
sage: V = V1.hom(V2)
sage: V.basis_infinite()
[[(x^2/(x^3 + 2*x^2 + 1))*y + (x^4 + 2*x^3)/(x^3 + 2*x^2 + 1) (x^3/(x^3 + 2*x^2 + 1))*y + 2*x^2/(x^3 + 2*x^2 + 1)],
[(2*x^3/(x^3 + 2*x^2 + 1))*y + x^2/(x^3 + 2*x^2 + 1) (2*x^4/(x^3 + 2*x^2 + 1))*y + x^3/(x^3 + 2*x^2 + 1)]]
"""
basis = super().basis_infinite()
return [self._vector_to_matrix(v) for v in basis]
def basis_local(self,place):
r"""
Return basis of the infinite lattice of the hom bundle.
OUTPUT:
- The basis elements are represented as matrices.
EXAMPLES ::
sage: from vector_bundle import VectorBundle
sage: F.<x> = FunctionField(GF(3))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 + x + 2)
sage: ideals = [P.prime_ideal() for P in K.places_finite()[:2]]
sage: g_finite = matrix([[1,x],[2,y]])
sage: g_infinite = matrix([[x,1],[2,y]])
sage: V1 = VectorBundle(K, ideals,g_finite,g_infinite)
sage: O = K.maximal_order()
sage: V2 = VectorBundle(K, K.places_finite()[2].prime_ideal(),1,x^2)
sage: V = V1.hom(V2)
sage: place = K.places_finite()[0]
sage: V.basis_local(place)
[[(1/(x^2 + x + 2))*y + (x + 2)/(x^3 + x^2 + 2*x) (1/(x^2 + x + 2))*y + 2*x/(x^2 + x + 2)],
[(2/(x^2 + x + 2))*y + x/(x^2 + x + 2) (2/(x^2 + x + 2))*y + x/(x^2 + x + 2)]]
sage: all([all([(mat * g_finite)[0, j].valuation(place) >= (V2._ideals[0] * V1._ideals[j]**-1).divisor().valuation(place) for j in range(2)]) for mat in V.basis_local(place)])
True
"""
basis = super().basis_local(place)
return [self._vector_to_matrix(v) for v in basis]
def hom(self, other):
r"""
Return the Hom bundle from self to other.
If other is a vector bundle, this is the hom bundle from ``self._codomain``
to ``self._domain.tensor_product(other)``.
If other is also a hom bundle, this is the hom bundle from
``self.codomain().tensor_product(other.domain())``
to ``self.domain().tensor_product(other.codomain()``
"""
if isinstance(other, HomBundle):
return self._codomain.tensor_product(other._domain)\
.hom(self._domain.tensor_product(other._codomain))
return self._codomain.hom(self._domain.tensor_product(other))
def tensor_product(self,other):
r"""
Return the tensor product of a hom bundle and a vector bundle.
This is the same thing as
``self._domain.hom(self._codomain.tensor_product(other))``
"""
return self._domain.hom(self._codomain.tensor_product(other))
def conorm(self,K):
r"""
Return the conorm of a hom bundle.
It is the same thing as the hom bundle of the conorms of its domain and
codomain.
EXAMPLES ::
sage: from vector_bundle import VectorBundle
sage: F.<x> = FunctionField(GF(3))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 + x + 2)
sage: ideals = [P.prime_ideal() for P in F.places_finite()[:2]]
sage: g_finite = matrix([[1, x], [2, x]])
sage: g_infinite = matrix([[x, 1], [2, x]])
sage: V1 = VectorBundle(F, ideals, g_finite, g_infinite)
sage: ideals = [P.prime_ideal() for P in F.places_finite()[1:3]]
sage: g_finite = matrix([[0, x], [1, 1/x]])
sage: g_infinite = matrix([[x, 2*x^2], [2, 1]])
sage: V2 = VectorBundle(F, ideals, g_finite, g_infinite)
sage: V1.conorm(K).hom(V2.conorm(K)) == V1.hom(V2).conorm(K)
True
"""
return self._domain.conorm(K).hom(self._codomain.conorm(K))
def h0(self):
r"""
Returns the 0th cohomology group of the hom bundle.
The global sections are output in matrix form, they are the global
homomorphisms from ``self._domain`` to ``self._codomain``.
EXAMPLES ::
sage: from vector_bundle import VectorBundle
sage: F.<x> = FunctionField(GF(3))
sage: R.<y> = F[]
sage: K.<y> = F.extension(y^2 + x + 2)
sage: ideals = [P.prime_ideal() for P in K.places_finite()[:2]]
sage: g_finite = matrix([[1, x], [2, y]])
sage: g_infinite = matrix([[x, 1], [2, y]])
sage: V1 = VectorBundle(K, ideals, g_finite, g_infinite)
sage: O = K.maximal_order()
sage: V2 = VectorBundle(K, K.places_finite()[2].prime_ideal(),1,x^2)
sage: V = V1.hom(V2)
sage: h0 = V.h0(); len(h0) == V.degree() + (1-K.genus())*V.rank()
True
sage: all([all([(mat * g_finite)[0, j] in V2._ideals[0] * V1._ideals[j]**-1 for j in range(2)]) for mat in h0])
True
sage: O_infinity = K.maximal_order_infinite()
sage: all([all([a in O_infinity for a in (x**-2 * mat * g_infinite).list()]) for mat in h0])
True
"""
h0 = super().h0()
return [self._vector_to_matrix(v) for v in h0]

File diff suppressed because it is too large Load Diff