\n",
"The &Utils; package 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 2 of the License, or (at your option) ",
"any later version.\n"
),
Abstract := Concatenation(
"The &Utils; package provides a space for utility functions ",
"in a variety of ⪆ packages to be collected together ",
"into a single package. In this way it is hoped that they will ",
"become more visible to package authors.\n",
"\n",
"Any package author who transfers a function to &Utils; ",
"will become an author of &Utils;.\n",
"\n",
"If deemed appropriate, functions may also be transferred ",
"from the main library.\n",
"\n",
"Bug reports, suggestions and comments are, of course, welcome.\n",
"Please contact the last author at ",
"cdwensley.maths@btinternet.com ",
"or submit an issue at the GitHub repository ",
"https://github.com/gap-packages/utils/issues/.\n"
),
Acknowledgements := Concatenation(
"This documentation was prepared using the ",
"&GAPDoc; and ",
"&AutoDoc; packages.\n",
"The procedure used to produce new releases uses the package ",
"GitHubPagesForGAP ",
" ",
"and the package ReleaseTools."
),
)
),
));
utils-0.85/README.md 000644 000765 000024 00000003471 14554003563 017203 0 ustar 00christopherwensley staff 000000 000000 [](https://github.com/gap-packages/utils/actions?query=workflow%3ACI+branch%3Amaster)
[](https://codecov.io/gh/gap-packages/utils)
# The GAP 4 package `Utils`
## Introduction
This package collects together utility functions from a selection of GAP
packages in order to make them more widely visible to other package authors.
Other generally useful functions, which are not deemed suitable for the main library, and also welcome. For example, recent additions are functions to convert certain types of group to Magma format.
## Distribution
* The GitHub package repository is at
* and the latest release is available at
## Copyright
The `Utils` package is Copyright {\copyright} The GAP Group, 2015-2024.
`Utils` 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 2 of the License, or
(at your option) any later version.
For details, see
## Installation
* unpack `utils-.tar.gz` in the `pkg` subdirectory
of the GAP root directory.
* From within GAP load the package with:
gap> LoadPackage("utils");
* The file `manual.pdf` is in the `doc` subdirectory.
## Contact
If you have a question relating to `Utils`, encounter any problems,
or wish to suggest other functions to be transferred to the package, please
* email
* or report an issue on the GitHub issue tracker at:
utils-0.85/makedoc.g 000644 000765 000024 00000002261 14554003563 017473 0 ustar 00christopherwensley staff 000000 000000 ## makedoc.g for the package Utils
## This builds the documentation of the Utils package.
## Needs: GAPDoc & AutoDoc packages, latex, pdflatex, mkindex
## call this with GAP from within the package root directory
##
LoadPackage( "GAPDoc" );
LoadPackage( "AutoDoc" );
AutoDoc( rec(
scaffold := rec(
## MainPage := false,
includes := [ "intro.xml",
"print.xml",
"lists.xml",
"number.xml",
"groups.xml",
"matrix.xml",
"iterator.xml",
"record.xml",
"download.xml",
"others.xml",
"obsolete.xml",
"transfer.xml" ],
bib := "bib.xml",
entities := rec(
AutoDoc := "AutoDoc",
ResClasses := "ResClasses",
RCWA := "RCWA",
XMod := "XMod",
Home := "Home",
Magma := "{\\sf Magma}",
MathJax := "{\\sf MathJax}"
)
)
));
utils-0.85/lib/ 000755 000765 000024 00000000000 14554003563 016465 5 ustar 00christopherwensley staff 000000 000000 utils-0.85/CHANGES.md 000644 000765 000024 00000016127 14554003563 017320 0 ustar 00christopherwensley staff 000000 000000 # CHANGES log for the 'Utils' package
## Version 0.85 for GAP 4.12.2 (23/01/24)
* (08/01/24) avoid trivial function wrappers in List and ForAll
## Version 0.84 for GAP 4.12.2 (11/09/23)
* (11/09/23) changed manual and test for DirectSumDecompositionMatrices
## Version 0.83 for GAP 4.12.2 (29/06/23)
* (29/06/23) added DirectSumDecompositionMatrices
## Version 0.82 for GAP 4.12.2 (09/02/23)
* (23/12/22) changed email address, deleted institution
## Version 0.81 for GAP 4.12.1 (04/12/22)
* (17/11/22) removed (the dead) pcp option from PcGroupToMagmaFormat
so that the dependency on Polycyclic could be removed
* (21/10/22) added OptionRecordWithDefaults in 7.2 from Christopher Jefferson
* (04/10/22) declared PreImagesRepresentativeNC in init.g
## Version 0.77 for GAP 4.12.0 (25/09/22)
* (25/09/22) added Download operation by Thomas Breuer - new Chapter 8
## Version 0.76 for GAP 4.12.0 (06/08/22)
* (06/08/22) added LeftCoset operations
## Version 0.74 for GAP 4.11.1 (09/07/22)
* (07/07/22) Max Horn replaced BIND_GLOBAL with BindGlobal (transfer process)
* (05/07/22) CentralProduct added by Thomas Breuer
## Version 0.72 for GAP 4.10.1 (16/11/21)
* (06/04/21) Switch CI to use GitHub Actions: PR#37
## Version 0.69 for GAP 4.10.2 (29/11/19)
* (22/11/19) added DirectProductOfAutomorphismGroups
* (19/11/19) added DirectProductOfFunctions
## Version 0.67 for GAP 4.10.2 (04/09/19)
* (04/09/19) accepted PR34 - changed example in 6.2.1
* (25/08/19) fixed typos with UnorderedPairsIterator in manual
## Version 0.65 for GAP 4.10.2 (11/07/19)
* (11/07/19) groups.tst fails in gapdev - temporary(?) fix
## Version 0.64 for GAP 4.10.1 (17/06/19)
* (14/06/19) added Iterators chapter: AllSubgroupsIterator
CartesianIterator, UnorderedPairsIterator
## Version 0.63 for GAP 4.10.1 (29/05/19)
* (28/05/19) added IdempotentEndomorphisms, IdempotentEndomorphismsData
* (17/05/19) + AllIsomorphismsIterator, AllIsomorphismsNumber, AllIsomorphisms
* (16/02/19) added License field in PackageInfo.g
## Version 0.61 for GAP 4.10.0 (28/11/18)
* (28/11/18) made ExponentOfPrime obsolete
* (27/11/18) made several AutoDoc functions obsolete (they remain in AutoDoc):
FindMatchingFiles; CreateDirIfMissing; StringDotSuffix; SetIfMissing
## Version 0.59 for GAP 4.9.3 (04/10/18)
* (04/10/18) made PrintApplicableMethod obsolete
## Version 0.58 for GAP 4.9.3 (12/09/18)
* (08/09/18) marked PrintOneItemPerLine as obsolete: use Perform(L,Display);
* (07/09/18) marked ExponentOfPrime as obsolete: use PValuation
* (05/09/18) transferred code in combinat.g{d,i} to end of lists.g{d,i}
* (04/09/18) removed all "if OKtoReadFomUtils( "RCWA" / "ResClasses" )"
## Version 0.57 for GAP 4.9.1 (02/06/18)
* (02/06/18) new PrintSelection example due to diff with all packages loaded
removed XMod from list of packages to be loaded
* (27/03/18) revised file tst/testing.g
## Version 0.54 for GAP 4.9.0 (12/02/18)
* (22/01/18) PrintOneItemPerLine plus alternative method for iterators; added
function PrintSelection(L,first,step,last) for lists/iterators
* (06/01/18) rebuilt the manual using the AutoDoc package
* (22/12/17) removed examples/ folder
## Version 0.49 for GAP 4.8.8 (05/12/17)
* (05/12/17) removed QPA functions PositionsNonzero and NullList
* (21/11/17) changed record.tst so that 4r8 and dev give the same result
## Version 0.48 for GAP 4.8.8 (14/09/17)
* (14/09/17) fixes to the gh-pages folder so that README.md is displayed
* (12/09/17) corrected web addresses for Stefan and Frank
* (04/07/17) README and CHANGES converted to README.md and CHANGES.md
## Version 0.46 for GAP 4.8.6 (08/02/17)
* (08/02/17) added Polycyclic as a needed package
* (07/02/17) added code for converting matrix groups to Magma strings
* (03/02/17) added code for converting perm- and pc-groups to Magma strings
* (02/02/17) copied `gaplog.css` to `utils/doc/` from RCWA archive
## Version 0.44 for GAP 4.8.6 (17/01/17)
* (08/12/16) added PositionsNonzero and NullList from QPA
* (05/12/16) added `tst/loadall.g` and adjusted `tst/testall.g`, `tst/*.tst`
* (14/11/16) issue #2 reopened by Max: EpimorphismByGeneratorsNC removed
## Version 0.43 for GAP 4.8.5 (20/10/16)
* (18/10/16) now using bibliography file `bib.xml` of type `bibxmlext.dtd`
## Version 0.41 for GAP 4.8.3 (25/05/16)
* (25/05/16) fixed issue #8 : `git rm doc/appendix.xml`
* (17/03/16) added function PrintApplicableMethod
## Version 0.40 for GAP 4.8.3 (17/03/16)
* (17/03/16) moved transfer procedure to a new chapter in the manual
* (15/03/16) added fix to QuotientList requested by Stefan
added many manual examples supplied by Stefan
## Version 0.39 for GAP 4.8.2 (04/03/16)
* (04/03/16) corrected repeated "//" in `PackageInfo.g`
* (03/03/16) updated transfers from RCWA and ResClasses (Stefan's input)
* (26/02/16) updated README to show the release URL
* (25/02/16) New release to GitHub using ReleaseTools (GitHubPagesForGAP)
`makedocrel.g` renamed `makedoc.g`
* (17/02/16) Removed date/version information from file headers.
* (16/02/16) Moved PackageWWWHome to GitHub;
added OKtoReadFromUtilsSpec to deal with fns taken out early
* (12/02/16) Added warning to manual about the need to load packages.
* (11/02/16) BindInRecordIfMissing -> SetIfMissing (from AutoDoc)
moved a number of functions to `pending.g{d,i}`
* (10/02/16) adjustments due to new RCWA 4.0.0 and ResClasses 4.1.1
## Version 0.22 for GAP 4.8.1 (04/02/16)
* (04/02/16) repository moved to gap-packages
## Version 0.21 for GAP 4.8.1 (03/02/16)
* (03/02/16) added several more functions from RCWA
* (29/01/16) switching to a protocol based on Frank's suggestion:
if TestPackageAvailability("Bla", ">=x.(y+1)") = fail then ...
## Version 0.17 for GAP 4.8.1 (12/01/16)
* (12/01/16) more edits to `oper.g` and `global.g` suggested by Chris J.
## Version 0.15 for GAP 4.8.0 (18/12/15)
* (17/12/15) added more documentation to `global.g` and `oper.g`
## Version 0.14 for GAP 4.8.0 (16/12/15)
* (16/12/15) changed global lists in oper.g to GLOBAL_REDECLARATION_LIST,
GLOBAL_REDECLARATION_COUNT and GLOBAL_REINSTALLATION_LIST;
added functions (in `oper.g`) AllowGlobalRedeclaration and
AllowGlobalReinstallation; added GLOBAL_REBINDING_LIST and
AllowGlobalRebinding (in `global.g`) to cope with BIND_GLOBAL.
## Version 0.13 for GAP 4.8.0 (15/12/15)
* (15/12/15) added some functions from AutoDoc; packed up version 0.13
* (14/12/15) library file `oper.g` edited to prevent repeat declarations etc.
* (14/12/15) `names.g{d,i}` now `first.g{d,i}` with `last.gd` added,
containing UTILS_FUNCTION_NAMES and UTILS_FUNCTION_OPERS
## Version 0.11 for GAP 4.8.0 (30/11/15)
* (30/11/15) added tests and documentation for ResClasses functions
* (25/11/15) added `names.g{d,i}`, `tests.g{d,i}`
* (25/11/15) added `sebastian.gi` to `lib/`
* (24/11/15) added `rwca.g{d,i}` and `resclasses.g{d,i}` to `lib/`
* (24/11/15) added `combinat.g{d,i}` to `lib/`
utils-0.85/doc/ 000755 000765 000024 00000000000 14554003712 016460 5 ustar 00christopherwensley staff 000000 000000 utils-0.85/tst/ 000755 000765 000024 00000000000 14554003563 016531 5 ustar 00christopherwensley staff 000000 000000 utils-0.85/init.g 000644 000765 000024 00000002373 14554003563 017037 0 ustar 00christopherwensley staff 000000 000000 #############################################################################
##
#W init.g GAP package `Utils' Chris Wensley
##
#Y Copyright (C) 2015-2023, The GAP Group,
##
if not IsBound( PreImagesRepresentativeNC ) then
BindGlobal( "PreImagesRepresentativeNC", PreImagesRepresentative );
fi;
if not IsBound( IsMatrixOrMatrixObj ) then
BindGlobal( "IsMatrixOrMatrixObj", IsMatrix );
fi;
if not IsBound( MutableCopyMatrix ) then
BindGlobal( "MutableCopyMatrix", ShallowCopy );
fi;
## read the function declarations
ReadPackage( "utils", "lib/start.gd" );
ReadPackage( "utils", "lib/files.gd" );
ReadPackage( "utils", "lib/groups.gd" );
ReadPackage( "utils", "lib/iterator.gd" );
ReadPackage( "utils", "lib/latex.gd" );
ReadPackage( "utils", "lib/lcset.gd" );
ReadPackage( "utils", "lib/lists.gd" );
ReadPackage( "utils", "lib/magma.gd" );
ReadPackage( "utils", "lib/maps.gd" );
ReadPackage( "utils", "lib/matrix.gd" );
ReadPackage( "utils", "lib/number.gd" );
ReadPackage( "utils", "lib/print.gd" );
ReadPackage( "utils", "lib/record.gd" );
ReadPackage( "utils", "lib/string.gd" );
if not IsBound( Download ) then
ReadPackage( "utils", "lib/download.gd" );
BindGlobal("DOWNLOAD_FROM_UTILS", true);
fi;
utils-0.85/LICENSE.txt 000644 000765 000024 00000043103 14554003563 017543 0 ustar 00christopherwensley staff 000000 000000 GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) 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
this service 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 make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. 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.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the 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 a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE 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.
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
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
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 2 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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision 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, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
, 1 April 1989
Ty Coon, President of Vice
This 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.
utils-0.85/read.g 000644 000765 000024 00000001526 14554003563 017006 0 ustar 00christopherwensley staff 000000 000000 #############################################################################
##
#W read.g The Utils package Chris Wensley
##
#Y Copyright (C) 2015-2023, The GAP Group,
##
## read the actual code
ReadPackage( "utils", "lib/files.gi" );
ReadPackage( "utils", "lib/groups.gi" );
ReadPackage( "utils", "lib/iterator.gi" );
ReadPackage( "utils", "lib/latex.gi" );
ReadPackage( "utils", "lib/lcset.gi" );
ReadPackage( "utils", "lib/lists.gi" );
ReadPackage( "utils", "lib/magma.gi" );
ReadPackage( "utils", "lib/maps.gi" );
ReadPackage( "utils", "lib/matrix.gi" );
ReadPackage( "utils", "lib/number.gi" );
ReadPackage( "utils", "lib/print.gi" );
ReadPackage( "utils", "lib/record.gi" );
ReadPackage( "utils", "lib/string.gi" );
if IsBound(DOWNLOAD_FROM_UTILS) then
ReadPackage( "utils", "lib/download.gi" );
fi;
utils-0.85/tst/lists.tst 000644 000765 000024 00000007676 14554003563 020443 0 ustar 00christopherwensley staff 000000 000000 #@local C, c4, d16, gens, i, J, K, L, n, P, trans
##############################################################################
##
#W lists.tst Utils Package
##
#Y Copyright (C) 2015-2022, The GAP Group
##
gap> ReadPackage( "utils", "tst/loadall.g" );;
gap> UtilsLoadingComplete;
true
## SubSection 3.1.1
gap> List( [1..12], n->n^3 );
[ 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000, 1331, 1728 ]
gap> DifferencesList( last );
[ 7, 19, 37, 61, 91, 127, 169, 217, 271, 331, 397 ]
gap> DifferencesList( last );
[ 12, 18, 24, 30, 36, 42, 48, 54, 60, 66 ]
gap> DifferencesList( last );
[ 6, 6, 6, 6, 6, 6, 6, 6, 6 ]
gap> L := [ 0 ];;
gap> DifferencesList( L );
[ ]
gap> L := [ ];;
gap> DifferencesList( L );
[ ]
## SubSection 3.1.2
gap> List( [0..10], n -> Factorial(n) );
[ 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800 ]
gap> QuotientsList( last );
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
gap> L := [ 1, 3, 5, -1, -3, -5 ];;
gap> QuotientsList( L );
[ 3, 5/3, -1/5, 3, 5/3 ]
gap> FloatQuotientsList( L );
[ 3., 1.66667, -0.2, 3., 1.66667 ]
gap> QuotientsList( [ 2, 1, 0, -1, -2 ] );
[ 1/2, 0, fail, 2 ]
gap> FloatQuotientsList( [1..10] );
[ 2., 1.5, 1.33333, 1.25, 1.2, 1.16667, 1.14286, 1.125, 1.11111 ]
gap> Product( last );
10.
## SubSection 3.1.3
gap> L := [1..20];; L[1]:=13;;
gap> for i in [1..19] do
> if IsOddInt(L[i]) then L[i+1]:=3*L[i]+1; else L[i+1]:=L[i]/2; fi;
> od;
gap> L;
[ 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4 ]
gap> SearchCycle( L );
[ 1, 4, 2 ]
gap> n := 1;; L := [n];;
gap> for i in [1..100] do n:=(n^2+1) mod 1093; Add(L,n); od;
gap> L;
[ 1, 2, 5, 26, 677, 363, 610, 481, 739, 715, 795, 272, 754, 157, 604, 848,
1004, 271, 211, 802, 521, 378, 795, 272, 754, 157, 604, 848, 1004, 271,
211, 802, 521, 378, 795, 272, 754, 157, 604, 848, 1004, 271, 211, 802, 521,
378, 795, 272, 754, 157, 604, 848, 1004, 271, 211, 802, 521, 378, 795, 272,
754, 157, 604, 848, 1004, 271, 211, 802, 521, 378, 795, 272, 754, 157, 604,
848, 1004, 271, 211, 802, 521, 378, 795, 272, 754, 157, 604, 848, 1004,
271, 211, 802, 521, 378, 795, 272, 754, 157, 604, 848, 1004 ]
gap> C := SearchCycle( L );
[ 157, 604, 848, 1004, 271, 211, 802, 521, 378, 795, 272, 754 ]
gap> P := Positions( L, 157 );
[ 14, 26, 38, 50, 62, 74, 86, 98 ]
gap> Length( C ); DifferencesList( P );
12
[ 12, 12, 12, 12, 12, 12, 12 ]
## SubSection 3.1.4
## this manual example not tested as answers vary from run to run
## gap> RandomCombination( [1..49], 6 );
## [ 3, 5, 21, 24, 27, 31 ]
## SubSection 3.2.1
gap> J := [ [1,2,3], [3,4], [3,4], [1,2,4] ];;
gap> DistinctRepresentatives( J );
[ 1, 3, 4, 2 ]
gap> K := [ [3,4], [1,2], [2,3], [2,3,4] ];;
gap> CommonRepresentatives( J, K );
[ [ 3, 3, 3, 1 ], [ 1, 3, 4, 2 ] ]
gap> d16 := DihedralGroup( IsPermGroup, 16 ); SetName( d16, "d16" );
Group([ (1,2,3,4,5,6,7,8), (2,8)(3,7)(4,6) ])
gap> c4 := Subgroup( d16, [ d16.1^2 ] ); SetName( c4, "c4" );
Group([ (1,3,5,7)(2,4,6,8) ])
gap> RightCosets( d16, c4 );
[ RightCoset(c4,()), RightCoset(c4,(2,8)(3,7)(4,6)), RightCoset(c4,(1,8,7,6,5,
4,3,2)), RightCoset(c4,(1,8)(2,7)(3,6)(4,5)) ]
gap> trans := CommonTransversal( d16, c4 );
[ (), (2,8)(3,7)(4,6), (1,2,3,4,5,6,7,8), (1,2)(3,8)(4,7)(5,6) ]
gap> IsCommonTransversal( d16, c4, trans );
true
## SubSection 3.3.1
gap> gens := GeneratorsOfGroup( DihedralGroup(12) );
[ f1, f2, f3 ]
gap> String( gens );
"[ f1, f2, f3 ]"
gap> BlankFreeString( gens );
"[f1,f2,f3]"
#############################################################################
##
#E lists.tst . . . . . . . . . . . . . . . . . . . . . . . . . . . ends here
utils-0.85/tst/print.tst 000644 000765 000024 00000002027 14554003563 020422 0 ustar 00christopherwensley staff 000000 000000 #@local L, s5
##############################################################################
##
#W print.tst Utils Package
##
#Y Copyright (C) 2015-2022, The GAP Group
##
gap> ReadPackage( "utils", "tst/loadall.g" );;
gap> UtilsLoadingComplete;
true
## SubSection 2.1.1
gap> L := List( [1..20], n -> n^5 );;
gap> PrintSelection( L, [18..20] );
18 : 1889568
19 : 2476099
20 : 3200000
gap> PrintSelection( L, 2, 9 );
2 : 32
11 : 161051
20 : 3200000
gap> PrintSelection( L, 2, 3, 11 );
2 : 32
5 : 3125
8 : 32768
11 : 161051
gap> s5 := SymmetricGroup( 5 );;
gap> PrintSelection( s5, [30,31,100,101] );
30 : (1,5)(3,4)
31 : (1,5,2)
100 : (1,4,3)
101 : (1,4)(3,5)
gap> PrintSelection( s5, 1, 30 );
1 : ()
31 : (1,5,2)
61 : (1,2,3)
91 : (1,3,5,2,4)
gap> PrintSelection( s5, 9, 11, 43 );
9 : (2,5,3)
20 : (2,4)
31 : (1,5,2)
42 : (1,5,2,3,4)
#############################################################################
##
#E print.tst . . . . . . . . . . . . . . . . . . . . . . . . . . . ends here
utils-0.85/tst/iterator.tst 000644 000765 000024 00000005250 14554003563 021120 0 ustar 00christopherwensley staff 000000 000000 #@local c3c3, cart, G, h, it1, it2, iter, iter0, iter4, iterL
#@local L, n, pairs0, pairs4, pairsL, s3, s4
##############################################################################
##
#W iterator.tst Utils Package
##
#Y Copyright (C) 2015-2022, The GAP Group
##
gap> ReadPackage( "utils", "tst/loadall.g" );;
gap> UtilsLoadingComplete;
true
## SubSection 7.1.1
gap> G := SmallGroup( 6,1);;
gap> s3 := Group( (5,6), (6,7) );;
gap> iter := AllIsomorphismsIterator( G, s3 );;
gap> NextIterator( iter );
[ f1, f2 ] -> [ (6,7), (5,6,7) ]
gap> n := AllIsomorphismsNumber( G, s3 );
6
gap> AllIsomorphisms( G, s3 );
[ [ f1, f2 ] -> [ (6,7), (5,6,7) ], [ f1, f2 ] -> [ (5,7), (5,6,7) ],
[ f1, f2 ] -> [ (5,6), (5,7,6) ], [ f1, f2 ] -> [ (6,7), (5,7,6) ],
[ f1, f2 ] -> [ (5,7), (5,7,6) ], [ f1, f2 ] -> [ (5,6), (5,6,7) ] ]
gap> iter := AllIsomorphismsIterator( G, s3 );;
gap> for h in iter do Print( ImageElm( h, G.1 ) = (6,7), ", " ); od;
true, false, false, true, false, false,
gap> s4 := Group( (1,2),(2,3),(3,4) );;
gap> AllIsomorphismsNumber( s3, s4 );
0
gap> AllIsomorphisms( s3, s4 );
[ ]
## SubSection 7.1.2
gap> c3c3 := Group( (1,2,3), (4,5,6) );;
gap> iter := AllSubgroupsIterator( c3c3 );
gap> while not IsDoneIterator(iter) do Print(NextIterator(iter),"\n"); od;
Group( () )
Group( [ (4,5,6) ] )
Group( [ (1,2,3) ] )
Group( [ (1,2,3)(4,5,6) ] )
Group( [ (1,3,2)(4,5,6) ] )
Group( [ (4,5,6), (1,2,3) ] )
## Subsection 7.2.1
gap> it1 := Iterator( [ 1, 2, 3 ] );;
gap> it2 := Iterator( [ 4, 5, 6 ] );;
gap> iter := CartesianIterator( it1, it2 );;
gap> while not IsDoneIterator(iter) do Print(NextIterator(iter),"\n"); od;
[ 1, 4 ]
[ 1, 5 ]
[ 1, 6 ]
[ 2, 4 ]
[ 2, 5 ]
[ 2, 6 ]
[ 3, 4 ]
[ 3, 5 ]
[ 3, 6 ]
gap> ## try some trivial cases
gap> iter0 := IteratorList( [ ] );;
gap> iter4 := IteratorList( [ 4 ] );;
gap> cart := CartesianIterator( iter0, iter0 );;
gap> IsDoneIterator( cart );
true
gap> cart := CartesianIterator( iter0, iter4 );;
gap> IsDoneIterator( cart );
true
gap> cart := CartesianIterator( iter4, iter0 );;
gap> IsDoneIterator( cart );
true
## Subsection 6.2.2
gap> L := [6,7,8,9];;
gap> iterL := IteratorList( L );;
gap> pairsL := UnorderedPairsIterator( iterL );;
gap> while not IsDoneIterator(pairsL) do Print(NextIterator(pairsL),"\n"); od;
[ 6, 6 ]
[ 6, 7 ]
[ 7, 7 ]
[ 6, 8 ]
[ 7, 8 ]
[ 8, 8 ]
[ 6, 9 ]
[ 7, 9 ]
[ 8, 9 ]
[ 9, 9 ]
gap> iter4 := IteratorList( [ 4 ] );
gap> pairs4 := UnorderedPairsIterator(iter4);
gap> NextIterator( pairs4 );
[ 4, 4 ]
gap> IsDoneIterator( pairs4 );
true
gap> pairs0 := UnorderedPairsIterator( iter0 );;
gap> IsDoneIterator( pairs0 );
true
utils-0.85/tst/groups.tst 000644 000765 000024 00000021266 14554003563 020613 0 ustar 00christopherwensley staff 000000 000000 #@local A, a, ac9, aq8, b, c, c1, c2, c2c6, c3, c4, c4c3, c6, c9
#@local cp1, cp2, cp3, d, D12, d8, data, dp, epi, f, f1, f2, G, g
#@local g1, g2, g3, genA, gens, i, idcopy, idem, idemc2, idemim, idemim2
#@local im2, image2, images, imi, info, info2, info3, lc1, lc2, lc3, lc4
#@local len, lfs, ok, Pfi, phi, q8, rc1, rc4, s3, S4, s4, UFS, ufs
##############################################################################
##
#W groups.tst Utils Package
##
#Y Copyright (C) 2015-2022, The GAP Group
##
gap> ReadPackage( "utils", "tst/loadall.g" );;
gap> UtilsLoadingComplete;
true
## SubSection 5.1.1
gap> Comm( [ (1,2), (2,3) ] );
(1,2,3)
gap> Comm( [(1,2),(2,3),(3,4),(4,5),(5,6)] );
(1,5,6)
gap> Comm(Comm(Comm(Comm((1,2),(2,3)),(3,4)),(4,5)),(5,6)); ## the same
(1,5,6)
## SubSection 5.1.2
gap> D12 := DihedralGroup( 12 );
gap> SetName( D12, "D12" );
gap> a := D12.1;; b := D12.2;;
gap> IsCommuting( a, b );
false
## SubSection 5.1.3
gap> ListOfPowers( 2, 20 );
[ 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768,
65536, 131072, 262144, 524288, 1048576 ]
gap> ListOfPowers( (1,2,3)(4,5), 12 );
[ (1,2,3)(4,5), (1,3,2), (4,5), (1,2,3), (1,3,2)(4,5), (), (1,2,3)(4,5),
(1,3,2), (4,5), (1,2,3), (1,3,2)(4,5), () ]
gap> ListOfPowers( D12.2, 6 );
[ f2, f3, f2*f3, f3^2, f2*f3^2, of ... ]
## SubSection 5.1.4
gap> GeneratorsAndInverses( D12 );
[ f1, f2, f3, f1, f2*f3^2, f3^2 ]
gap> GeneratorsAndInverses( SymmetricGroup(5) );
[ (1,2,3,4,5), (1,2), (1,5,4,3,2), (1,2) ]
## SubSection 5.1.5
gap> UFS := UpperFittingSeries( D12 );;
gap> Set( GeneratorsOfGroup( UFS[2] ) );
[ f3, f2*f3 ]
gap> Set( GeneratorsOfGroup( UFS[3] ) );
[ f1, f3, f2*f3 ]
gap> LowerFittingSeries( D12 );
[ D12, Group([ f3 ]), Group([ ]) ]
gap> FittingLength( D12 );
2
gap> S4 := SymmetricGroup( 4 );;
gap> ufs := UpperFittingSeries( S4 );;
gap> List( ufs, StructureDescription );
[ "1", "C2 x C2", "A4", "S4" ]
gap> lfs := LowerFittingSeries( S4 );;
gap> List( lfs, StructureDescription );
[ "S4", "A4", "C2 x C2", "1" ]
gap> FittingLength( S4);
3
## SubSection 5.2.1
gap> lc1 := LeftCoset( (1,2,3), Group( [ (1,2), (3,4) ] ) );
LeftCoset((1,2,3),Group([ (1,2), (3,4) ]))
gap> Representative( lc1 );
(1,2,3)
gap> ActingDomain( lc1 );
Group([ (1,2), (3,4) ])
gap> AsSet( lc1 );
[ (2,3), (2,4,3), (1,2,3), (1,2,4,3) ]
gap> (1,2,3) in lc1;
true
gap> lc2 := (2,4,3) * lc1;
LeftCoset((1,2,4),Group([ (1,2), (3,4) ]))
gap> lc3 := lc1^(2,3,4);;
gap> lc2 = lc3;
true
## SubSection 5.2.2
gap> rc1 := Inverse( lc1 );
RightCoset(Group([ (1,2), (3,4) ]),(1,3,2))
gap> rc4 := RightCoset( Group( (1,2), (2,3) ), (3,4) );
RightCoset(Group([ (1,2), (2,3) ]),(3,4))
gap> lc4 := Inverse( rc4 );
LeftCoset((3,4),Group([ (1,2), (2,3) ]))
gap> Intersection( lc2, lc4 );
[ (2,3,4), (1,2,3,4) ]
## SubSection 5.3.1
gap> G := Group( (1,2,3), (3,4,5), (5,6,7), (7,8,9) );;
gap> phi := EpimorphismByGenerators( FreeGroup("a","b","c","d"), G );
[ a, b, c, d ] -> [ (1,2,3), (3,4,5), (5,6,7), (7,8,9) ]
gap> PreImagesRepresentativeNC( phi, (1,2,3,4,5,6,7,8,9) );
d*c*b*a
gap> a := G.1;; b := G.2;; c := G.3;; d := G.4;;
gap> d*c*b*a;
(1,2,3,4,5,6,7,8,9)
gap> ## note that it is easy to produce nonsense:
gap> epi := EpimorphismByGenerators( Group((1,2,3)), Group((8,9)) );
Warning: calling GroupHomomorphismByImagesNC without checks
[ (1,2,3) ] -> [ (8,9) ]
gap> IsGroupHomomorphism( epi );
true
gap> Image(epi,(1,2,3));
()
gap> Image(epi,(1,3,2));
(8,9)
## SubSection 5.3.2
gap> s4 := Group( (1,2),(2,3),(3,4) );;
gap> s3 := Group( (5,6),(6,7) );;
gap> c3 := Subgroup( s3, [ (5,6,7) ] );;
gap> f := GroupHomomorphismByImages( s4, s3,
> [(1,2),(2,3),(3,4)], [(5,6),(6,7),(5,6)] );;
gap> i := GroupHomomorphismByImages( c3, s3, [(5,6,7)], [(5,6,7)] );;
gap> Pfi := Pullback( f, i );
Group([ (2,3,4)(5,7,6), (1,2)(3,4) ])
gap> StructureDescription( Pfi );
"A4"
gap> info := PullbackInfo( Pfi );
rec( directProduct := Group([ (1,2), (2,3), (3,4), (5,6,7) ]),
projections := [ [ (2,3,4)(5,7,6), (1,2)(3,4) ] -> [ (2,3,4), (1,2)(3,4) ],
[ (2,3,4)(5,7,6), (1,2)(3,4) ] -> [ (5,7,6), () ] ] )
gap> g := (1,2,3)(5,6,7);;
gap> ImageElm( info!.projections[1], g );
(1,2,3)
gap> ImageElm( info!.projections[2], g );
(5,6,7)
gap> dp := info!.directProduct;;
gap> a := ImageElm( Embedding( dp, 1 ), (1,4,3) );;
gap> b := ImageElm( Embedding( dp, 2 ), (5,7,6) );;
gap> a*b in Pfi;
true
## SubSection 5.3.3
gap> g1 := DihedralGroup( 8 );
gap> c1 := Centre( g1 );
Group([ f3 ])
gap> cp1 := CentralProduct( g1, g1, c1, IdentityMapping( c1 ) );
Group([ f1, f2, f5, f3, f4, f5 ])
gap> IdGroup( cp1 ) = IdGroup( ExtraspecialGroup( 2^5, "+" ) );
true
gap> g2 := QuaternionGroup( 8 );
gap> c2 := Centre( g2 );
Group([ y2 ])
gap> cp2 := CentralProduct( g2, g2, c2, IdentityMapping( c2 ) );
Group([ f1, f2, f5, f3, f4, f5 ])
gap> IdGroup( cp2 ) = IdGroup( ExtraspecialGroup( 2^5, "+" ) );
true
gap> info2 := CentralProductInfo( cp2 );
rec( phi := IdentityMapping( Group([ y2 ]) ),
projection := [ f1, f2, f3, f4, f5, f6 ] -> [ f1, f2, f5, f3, f4, f5 ] )
gap> Source( Embedding( Source( info2.projection ), 1 ) ) = g2;
true
gap> g3 := SymmetricGroup( 3 );
Sym( [ 1 .. 3 ] )
gap> c3 := TrivialSubgroup( g3 );
Group(())
gap> cp3 := CentralProduct( g3, g3, c3, IdentityMapping( c3 ) );
Group([ (1,2,3), (1,2), (4,5,6), (4,5) ])
gap> info3 := CentralProductInfo( cp3 );
rec( phi := IdentityMapping( Group(()) ),
projection := IdentityMapping( Group([ (1,2,3), (1,2), (4,5,6), (4,5) ]) ) )
gap> Source( Embedding( Source( info3.projection ), 1 ) ) = g3;
true
## SubSection 5.3.4
gap> gens := [ (1,2,3,4), (1,2)(3,4) ];;
gap> d8 := Group( gens );;
gap> SetName( d8, "d8" );
gap> c2 := Subgroup( d8, [ (2,4) ] );;
gap> idemc2 := IdempotentEndomorphismsWithImage( gens, c2 );;
gap> idcopy := [ [ (), (2,4) ], [ (2,4), () ] ];;
gap> Sort( idemc2 );
gap> Sort( idcopy );
gap> idemc2 = idcopy;
true
gap> ## depending on packages loaded, the order of images can vary
gap> ## so we introduce a convoluted way of checking the images
gap> data := IdempotentEndomorphismsData( d8 );;
gap> data!.gens;
[ (1,2,3,4), (1,2)(3,4) ]
gap> images := data!.images;;
gap> len := Length( images );
6
gap> image2 := [ [ [ (), () ] ], [ [ (), (2,4) ], [ (2,4), () ] ],
> [ [ (), (1,3) ], [ (1,3), () ] ],
> [ [ (), (1,2)(3,4) ], [ (1,2)(3,4), (1,2)(3,4) ] ],
> [ [ (), (1,4)(2,3) ], [ (1,4)(2,3), (1,4)(2,3) ] ],
> [ [ (1,2,3,4), (1,2)(3,4) ] ] ];;
gap> ok := true;;
gap> ## new in gapdev - the test 'im in im2' is parsed before the for loop
gap> ## so that im2 is an 'unbound global variable' if not declared first
gap> im2 := [ ];;
gap> for i in [1..len] do
> imi := images[i];
> im2 := image2[i];
> if not ForAll( imi, im -> ( im in im2 ) ) then
> ok := false;
> fi;
> od;
gap> ok;
true
gap> List( images, L -> Length(L) );
[ 1, 2, 2, 2, 2, 1 ]
gap> idem := IdempotentEndomorphisms( d8 );;
gap> idemim := List( idem, m -> MappingGeneratorsImages(m)[2] );;
gap> idemim2 :=
> [ [ (), () ], [ (), (2,4) ], [ (2,4), () ], [ (), (1,3) ], [ (1,3), () ],
> [ (), (1,2)(3,4) ], [ (1,2)(3,4), (1,2)(3,4) ], [ (), (1,4)(2,3) ],
> [ (1,4)(2,3), (1,4)(2,3) ], [ (1,2,3,4), (1,2)(3,4) ] ];;
gap> ForAll( idemim, m -> ( m in idemim2 ) );
true
## SubSection 5.3.5
gap> c4 := Group( (1,2,3,4) );;
gap> c2 := Group( (5,6) );;
gap> f1 := GroupHomomorphismByImages( c4, c2, [(1,2,3,4)], [(5,6)] );;
gap> c3 := Group( (1,2,3) );;
gap> c6 := Group( (1,2,3,4,5,6) );;
gap> f2 := GroupHomomorphismByImages( c3, c6, [(1,2,3)], [(1,3,5)(2,4,6)] );;
gap> c4c3 := DirectProduct( c4, c3 );
Group([ (1,2,3,4), (5,6,7) ])
gap> c2c6 := DirectProduct( c2, c6 );
Group([ (1,2), (3,4,5,6,7,8) ])
gap> f := DirectProductOfFunctions( c4c3, c2c6, f1, f2 );
[ (1,2,3,4), (5,6,7) ] -> [ (1,2), (3,5,7)(4,6,8) ]
gap> ImageElm( f, (1,4,3,2)(5,7,6) );
(1,2)(3,7,5)(4,8,6)
## SubSection 5.3.6
gap> c9 := Group( (1,2,3,4,5,6,7,8,9) );;
gap> ac9 := AutomorphismGroup( c9 );;
gap> q8 := QuaternionGroup( IsPermGroup, 8 );;
gap> aq8 := AutomorphismGroup( q8 );;
gap> A := DirectProductOfAutomorphismGroups( ac9, aq8 );
gap> genA := GeneratorsOfGroup( A );;
gap> G := Source( genA[1] );
Group([ (1,2,3,4,5,6,7,8,9), (10,14,12,16)(11,17,13,15), (10,11,12,13)
(14,15,16,17) ])
gap> a := genA[1]*genA[5];
[ (1,2,3,4,5,6,7,8,9), (10,14,12,16)(11,17,13,15), (10,11,12,13)(14,15,16,17)
] -> [ (1,3,5,7,9,2,4,6,8), (10,16,12,14)(11,15,13,17),
(10,11,12,13)(14,15,16,17) ]
gap> ImageElm( a, (1,9,8,7,6,5,4,3,2)(10,14,12,16)(11,17,13,15) );
(1,8,6,4,2,9,7,5,3)(10,16,12,14)(11,15,13,17)
utils-0.85/tst/loadall.g 000755 000765 000024 00000001236 14554003563 020316 0 ustar 00christopherwensley staff 000000 000000 ##############################################################################
##
#W loadall.g Utils Package Chris Wensley
##
#Y Copyright (C) 2015-2016, The GAP Group
##
## first make sure that, if the transferred code has not been read,
## then the appropriate packages are loaded.
if not UtilsLoadingComplete then
len := Length( UtilsPackageVersions );
j := 0;
while ( j < len ) do
j := j+1;
name := UtilsPackageVersions[j];
if not OKtoReadFromUtils( name ) then
LoadPackage( name );
fi;
j := j+1;
od;
UtilsLoadingComplete := true;
fi;
utils-0.85/tst/download.tst 000644 000765 000024 00000006232 14554003563 021077 0 ustar 00christopherwensley staff 000000 000000 #@local meths, i, urls, pair, url, expected, res1, good1, n, file, res2, good2, contents, r;
############################################################################
##
#W download.tst Utils Package Thomas Breuer
##
#Y Copyright (C) 2022, The GAP Group
##
gap> ReadPackage( "utils", "tst/loadall.g" );;
gap> UtilsLoadingComplete;
true
## Test the available Download methods
gap> meths:= List( Filtered( Download_Methods, r -> r.isAvailable() ),
> ShallowCopy );;
gap> for i in [ 1 .. Length( meths ) ] do
> meths[i].position:= String( i );
> od;
gap> urls:= [ # a http url that gets redirected to https
> [ "http://www.gap-system.org/Packages/utils.html", true ],
> # a http url that works as such
> [ "http://www.math.rwth-aachen.de/index.html", true ],
> # a https url that exists
> [ "https://www.gap-system.org/Packages/utils.html", true ],
> # a https url that does not exist
> [ "https://www.gap-system.org/Packages/utilsxxx.html", false ],
> ];;
## The problem is that the methods do not behave consistently
## in the case of failure.
## (Well, they even do not agree what failure means.)
## The test results depend on which methods are available at runtime,
## which makes them useless as automatic tests.
## Thus we test only working http and https urls.
gap> urls:= urls{ [ 2, 3 ] };;
gap> for pair in urls do
> url:= pair[1];
> expected:= pair[2];
> res1:= List( meths, r -> [ r.download( url, rec() ), r.position ] );;
> good1:= Filtered( res1, r -> r[1].success = true );;
> if expected = false and Length( good1 ) > 0 then
> Print( "success for url ", url, "?\n" );
> fi;
> n:= Length( Set( good1, r -> r[1].result ) );
> if n > 1 then
> Print( "different results (", n, ") for url ", url, "\n" );
> fi;
> file:= Filename( DirectoryTemporary(), "test" );
> res2:= List( meths,
> r -> [ r.download( url,
> rec( target:= Concatenation( file, r.position ) ) ),
> r.position ] );;
> good2:= Filtered( res2, r -> r[1].success = true );;
> if expected = false and Length( good2 ) > 0 then
> Print( "success for url ", url, "?\n" );
> fi;
> if Length( good1 ) <> Length( good2 ) then
> Print( "different success cases for url ", url, "\n" );
> fi;
> if Length( good1 ) > 0 then
> contents:= good1[1][1].result;
> for r in good2 do
> if contents <> StringFile( Concatenation( file, r[2] ) ) then
> Print( "different files and contents for url ", url, "\n" );
> fi;
> od;
> fi;
> od;
## the example 9.1.1 from the manual
gap> url:= "https://www.gap-system.org/Packages/utils.html";;
gap> res1:= Download( url );;
gap> res1.success;
true
gap> IsBound( res1.result ) and IsString( res1.result );
true
gap> res2:= Download( Concatenation( url, "xxx" ) );;
gap> res2.success;
false
gap> IsBound( res2.error ) and IsString( res2.error );
true
#############################################################################
##
#E
utils-0.85/tst/number.tst 000644 000765 000024 00000005423 14554003563 020561 0 ustar 00christopherwensley staff 000000 000000 #@local i, iter, n, p, sum
##############################################################################
##
#W number.tst Utils Package Stefan Kohl
##
#Y Copyright (C) 2015-2022, The GAP Group
##
gap> ReadPackage( "utils", "tst/loadall.g" );;
gap> UtilsLoadingComplete;
true
## SubSection 4.1.1
gap> AllSmoothIntegers( 3, 1000 );
[ 1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 27, 32, 36, 48, 54, 64, 72, 81, 96,
108, 128, 144, 162, 192, 216, 243, 256, 288, 324, 384, 432, 486, 512, 576,
648, 729, 768, 864, 972 ]
gap> AllSmoothIntegers( [5,11,17], 1000 );
[ 1, 5, 11, 17, 25, 55, 85, 121, 125, 187, 275, 289, 425, 605, 625, 935 ]
gap> Length( last );
16
gap> List( [3..20], n -> Length( AllSmoothIntegers( [5,11,17], 10^n ) ) );
[ 16, 29, 50, 78, 114, 155, 212, 282, 359, 452, 565, 691, 831, 992, 1173,
1374, 1595, 1843 ]
## SubSection 4.1.2
gap> AllProducts([1..4],3);
[ 1, 2, 3, 4, 2, 4, 6, 8, 3, 6, 9, 12, 4, 8, 12, 16, 2, 4, 6, 8, 4, 8, 12,
16, 6, 12, 18, 24, 8, 16, 24, 32, 3, 6, 9, 12, 6, 12, 18, 24, 9, 18, 27,
36, 12, 24, 36, 48, 4, 8, 12, 16, 8, 16, 24, 32, 12, 24, 36, 48, 16, 32,
48, 64 ]
gap> Set(last);
[ 1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 27, 32, 36, 48, 64 ]
gap> AllProducts( [(1,2,3),(2,3,4)], 2 );
[ (2,4,3), (1,2)(3,4), (1,3)(2,4), (1,3,2) ]
## SubSection 4.1.3
gap> RestrictedPartitions( 20, [4..10] );
[ [ 4, 4, 4, 4, 4 ], [ 5, 5, 5, 5 ], [ 6, 5, 5, 4 ], [ 6, 6, 4, 4 ],
[ 7, 5, 4, 4 ], [ 7, 7, 6 ], [ 8, 4, 4, 4 ], [ 8, 6, 6 ], [ 8, 7, 5 ],
[ 8, 8, 4 ], [ 9, 6, 5 ], [ 9, 7, 4 ], [ 10, 5, 5 ], [ 10, 6, 4 ],
[ 10, 10 ] ]
gap> RestrictedPartitionsWithoutRepetitions( 20, [4..10] );
[ [ 10, 6, 4 ], [ 9, 7, 4 ], [ 9, 6, 5 ], [ 8, 7, 5 ] ]
gap> RestrictedPartitionsWithoutRepetitions( 10^2, List([1..10], n->n^2 ) );
[ [ 100 ], [ 64, 36 ], [ 49, 25, 16, 9, 1 ] ]
## SubSection 4.1.4
gap> n := 2^251;;
gap> NextProbablyPrimeInt( n );
3618502788666131106986593281521497120414687020801267626233049500247285301313
## SubSection 4.1.6
gap> iter := PrimeNumbersIterator();;
gap> for i in [1..100] do p := NextIterator(iter); od;
gap> p;
541
gap> sum := 0;;
gap> ## "prime number race" 1 vs. 3 mod 4
gap> for p in PrimeNumbersIterator() do
> if p <> 2 then sum := sum + E(4)^(p-1); fi;
> if sum > 0 then break; fi;
> od;
gap> p;
26861
## this final example takes quite a while: use examples/number.g
## gap> sum := 0;;
## gap> ## "prime number race" 1 vs. 5 mod 8
## gap> for p in PrimeNumbersIterator() do
## > if p mod 8 in [1,5] then sum := sum + E(4)^((p-1)/2); fi;
## > if sum > 0 then break; fi;
## > od;
## gap> p;
## 588067889
#############################################################################
##
#E number.tst . . . . . . . . . . . . . . . . . . . . . . . . . . ends here
utils-0.85/tst/record.tst 000644 000765 000024 00000004541 14554003563 020547 0 ustar 00christopherwensley staff 000000 000000 #@local r, defaults, PrintDimensions, mydim
##############################################################################
##
#W record.tst Utils Package
##
#Y Copyright (C) 2015-2022, The GAP Group
##
gap> ReadPackage( "utils", "tst/loadall.g" );;
gap> UtilsLoadingComplete;
true
## SubSection 8.1.1
gap> r := rec( a := 1, b := 2, c := 3 );;
gap> AssignGlobals( r );
The following global variables have been assigned:
[ "a", "b", "c" ]
gap> [ a, b, c ];
[ 1, 2, 3 ]
## SubSection 8.2.1
gap> defaults := rec( a := 1, b := 2, c := 3 );;
gap> OptionRecordWithDefaults( defaults, rec( a := 6) );
rec( a := 6, b := 2, c := 3 )
gap> OptionRecordWithDefaults( defaults, rec( b := 7, c := 8 ) );
rec( a := 1, b := 7, c := 8 )
gap> OptionRecordWithDefaults( defaults, [ ] );
rec( a := 1, b := 2, c := 3 )
gap> OptionRecordWithDefaults( defaults, [ rec( c := 8 ) ] );
rec( a := 1, b := 2, c := 8 )
gap> OptionRecordWithDefaults( defaults, rec( d := 9 ) );
Error, Unknown option: d
gap> OptionRecordWithDefaults( defaults, [ rec( b := 7 ), rec( c := 8 ) ] );
Error, Too many arguments for function
gap> OptionRecordWithDefaults( defaults, 5 );
Error, Options should be a record
gap> OptionRecordWithDefaults( defaults, [6,7,8] );
Error, Too many arguments for function
gap> PrintDimensions := function( arg )
> local nargs, dim, order, V, L, len, K, i;
> nargs := Length( arg );
> dim := [ arg[1]!.height, arg[1]!.width, arg[1]!.depth ];
> order := rec( h := 1, w := 2, d := 3 );
> V := [ "height", "width", "depth" ];
> if ( nargs > 1 ) and IsRecord( arg[2] ) then
> order := OptionRecordWithDefaults( order, arg[2] );
> fi;
> L := [ order!.h, order!.w, order!.d ];
> len := Length( L );
> K := [ 1..len ];
> SortParallel( L, K );
> Print( "dimensions: " );
> Print( V[K[1]], " = ", dim[K[1]], ", " );
> Print( V[K[2]], " = ", dim[K[2]], ", " );
> Print( V[K[3]], " = ", dim[K[3]], "\n" );
> end;;
gap> mydim := rec( height := 45, width := 31, depth := 17 );
rec( depth := 17, height := 45, width := 31 )
gap> PrintDimensions( mydim );
dimensions: height = 45, width = 31, depth = 17
gap> PrintDimensions( mydim, rec( h:=3, w:=1, d:=2 ) );
dimensions: width = 31, depth = 17, height = 45
utils-0.85/tst/matrix.tst 000644 000765 000024 00000005130 14554003563 020570 0 ustar 00christopherwensley staff 000000 000000 #@local M6, L6, M4, L4, M8, L8, L, A, M3, L3, M5, L5;
##############################################################################
##
#W matrix.tst Utils Package
##
#Y Copyright (C) 2015-2023, The GAP Group
##
gap> ReadPackage( "utils", "tst/loadall.g" );;
gap> UtilsLoadingComplete;
true
## SubSection 9.1.1
gap> M6 := [ [1,2,0,0,0,0], [3,4,0,0,0,0], [5,6,0,0,0,0],
> [0,0,9,0,0,0], [0,0,0,1,2,3], [0,0,0,4,5,6] ];;
gap> Display( M6 );
[ [ 1, 2, 0, 0, 0, 0 ],
[ 3, 4, 0, 0, 0, 0 ],
[ 5, 6, 0, 0, 0, 0 ],
[ 0, 0, 9, 0, 0, 0 ],
[ 0, 0, 0, 1, 2, 3 ],
[ 0, 0, 0, 4, 5, 6 ] ]
gap> L6 := DirectSumDecompositionMatrices( M6 );
[ [ [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ], [ [ 9 ] ], [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]
] ]
gap> M4 := [ [0,3,0,0], [0,0,0,0], [0,0,0,0], [0,0,4,0] ];;
gap> Display( M4 );
[ [ 0, 3, 0, 0 ],
[ 0, 0, 0, 0 ],
[ 0, 0, 0, 0 ],
[ 0, 0, 4, 0 ] ]
gap> L4 := DirectSumDecompositionMatrices( M4 );
[ [ [ [ 0, 3 ] ], [ [ 0, 0 ], [ 0, 0 ], [ 4, 0 ] ] ],
[ [ [ 0, 3 ], [ 0, 0 ] ], [ [ 0, 0 ], [ 4, 0 ] ] ],
[ [ [ 0, 3 ], [ 0, 0 ], [ 0, 0 ] ], [ [ 4, 0 ] ] ] ]
gap> for L in L4 do
> A := DirectSumMat( L );;
> if ( A = M4 ) then Print( "yes, A = M4\n" ); fi;
> od;
yes, A = M4
yes, A = M4
yes, A = M4
gap> M8 := DirectSumMat( M4, M4 );;
gap> Display( M8 );
[ [ 0, 3, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 4, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 3, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 0, 0, 0, 4, 0 ] ]
gap> L8 := DirectSumDecompositionMatrices( M8 );;
gap> Length( L8 );
16
gap> M3 := [ [0,0,0,7,0,0,0], [0,0,0,0,8,0,0], [0,0,0,0,0,9,0] ];;
gap> Display( M3 );
[ [ 0, 0, 0, 7, 0, 0, 0 ],
[ 0, 0, 0, 0, 8, 0, 0 ],
[ 0, 0, 0, 0, 0, 9, 0 ] ]
gap> L3 := DirectSumDecompositionMatrices( M3 );
[ [ [ [ 0, 0, 0, 7 ] ], [ [ 8 ] ], [ [ 9, 0 ] ] ] ]
gap> M5 := [ [1,2,0,0,0], [3,4,0,0,0], [0,0,0,0,0],
> [0,0,0,6,7], [0,0,0,8,9] ];;
gap> Display(M5);
[ [ 1, 2, 0, 0, 0 ],
[ 3, 4, 0, 0, 0 ],
[ 0, 0, 0, 0, 0 ],
[ 0, 0, 0, 6, 7 ],
[ 0, 0, 0, 8, 9 ] ]
gap> L5 := DirectSumDecompositionMatrices( M5 );
[ [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 0 ] ], [ [ 6, 7 ], [ 8, 9 ] ] ] ]
#############################################################################
##
#E matrix.tst . . . . . . . . . . . . . . . . . . . . . . . . . . ends here
utils-0.85/tst/testall.g 000755 000765 000024 00000001145 14554003563 020355 0 ustar 00christopherwensley staff 000000 000000 ############################################################################
##
#W testall.g Utils Package Chris Wensley
##
#Y Copyright (C) 2015-2023, The GAP Group
##
LoadPackage( "utils" );
## first make sure that, if the transferred code has not been read,
## then the appropriate packages are loaded.
if not UtilsLoadingComplete then
ReadPackage( "utils", "tst/loadall.g" );
fi;
dir := DirectoriesPackageLibrary( "utils", "tst" );
TestDirectory(dir, rec(exitGAP := true,
testOptions:=rec(compareFunction := "uptowhitespace")));
FORCE_QUIT_GAP(1);
utils-0.85/tst/others.tst 000644 000765 000024 00000003546 14554003563 020601 0 ustar 00christopherwensley staff 000000 000000 #@local M, s1, n1, n2, N, s2;
############################################################################
##
#W others.tst Utils Package
##
#Y Copyright (C) 2015-2022, The GAP Group
##
gap> ReadPackage( "utils", "tst/loadall.g" );;
gap> UtilsLoadingComplete;
true
## SubSection 10.1.1
## this manual example is not tested to avoid creating files triv.*
## gap> LogTo( "triv.log" );
## gap> a := 33^5;
## 39135393
## gap> LogTo();
## gap> Log2HTML( "triv.log" );
## SubSection 10.2.1
gap> IntOrInfinityToLaTeX( 10^3 );
"1000"
gap> IntOrInfinityToLaTeX( infinity );
"\\infty"
## SubSection 10.2.2
gap> LaTeXStringFactorsInt( Factorial(12) );
"2^{10} \\cdot 3^5 \\cdot 5^2 \\cdot 7 \\cdot 11"
## SubSection 10.3.1
gap> ConvertToMagmaInputString( Group( (1,2,3,4,5), (3,4,5) ) );
"PermutationGroup<5|(1,2,3,4,5),\n(3,4,5)>;\n"
gap> ConvertToMagmaInputString( Group( (1,2,3,4,5) ), "c5" );
"c5 := PermutationGroup<5|(1,2,3,4,5)>;\n"
gap> ConvertToMagmaInputString( DihedralGroup( IsPcGroup, 10 ) );
"PolycyclicGroup< f1,f2 |\nf1^2,\nf2^5,\nf2^f1 = f2^4\n>;\n"
gap> M := GL(2,5);; Size(M);
480
gap> s1 := ConvertToMagmaInputString( M );
"F := GF(5);\nP := GL(2,F);\ngens := [\nP![2,0,0,1],\nP![4,1,4,0]\n];\nsub
;\n"
gap> Print( s1 );
F := GF(5);
P := GL(2,F);
gens := [
P![2,0,0,1],
P![4,1,4,0]
];
sub