-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add part
for graded objects and other improvements
#3522
Open
mahrud
wants to merge
15
commits into
Macaulay2:development
Choose a base branch
from
mahrud:quickfix/part
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5075a72
added part for modules, matrices, ideals, and rings
mahrud b0d6259
added basis(ZZ, Complex)
mahrud 2338830
added basis(ZZ, ComplexMap)
mahrud fea5130
simplified part(ZZ, Complex)
mahrud 64c1f7e
simplified part(ZZ, ComplexMap)
mahrud 0562c3a
added internal cover' for Complex and ComplexMap
mahrud 0147cea
simplified part using cover'
mahrud de5fb54
added better algorithm for basis(ZZ, Complex)
mahrud 0519b2c
added better algorithm for truncate(ZZ, Complex)
mahrud 318cbe6
added better algorithm for truncate(ZZ, ComplexMap)
mahrud daab1aa
added tests for basis of Complex and ComplexMap
mahrud c2f7a79
added method for truncating source of map more than target
mahrud 0f0684c
cached subquotient gens in M.cache.Monomial
mahrud 189442f
optimized basis(ZZ, Matrix)
mahrud 64b85b4
added ways to avoid gb calls in inducedMap
mahrud File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -717,30 +717,64 @@ canonicalTruncation(Complex,InfiniteNumber,InfiniteNumber) := | |
canonicalTruncation(Complex,ZZ,Nothing) := | ||
canonicalTruncation(Complex,Nothing,ZZ) := Complex => (C,lo,hi) -> canonicalTruncation(C, (lo,hi)) | ||
|
||
part(List, Complex) := Complex => (deg, C) -> ( | ||
-- return a Complex over the coefficient ring | ||
R := ring C; | ||
A := coefficientRing R; | ||
psi := map(A,R, DegreeMap => degR -> take(degR, - degreeLength A)); | ||
(lo, hi) := concentration C; | ||
if lo === hi | ||
then complex(psi source basis(deg, C_lo), Base => lo) | ||
importFrom_Truncations { "inducedTruncationMap" } | ||
|
||
truncateModuleOpts := options(truncate, List, Module) | ||
truncate(ZZ, Complex) := | ||
truncate(List, Complex) := Complex => truncateModuleOpts >> opts -> (degs, C) -> ( | ||
(lo, hi) := C.concentration; | ||
if lo == hi | ||
then complex(truncate(degs, C_lo, opts), Base => lo) | ||
-- this is the simplest way to truncate the whole complex: | ||
-- else complex applyValues(C.dd.map, f -> truncate(degs, f, opts))) | ||
else ( | ||
maps := hashTable for i from lo+1 to hi list ( | ||
f := psi matrix basis(deg, dd^C_i); | ||
if source f == 0 then continue else i => f | ||
); | ||
if # keys maps === 0 then complex(psi source basis(deg, C_lo), Base => lo) else complex maps | ||
) | ||
) | ||
part(ZZ, Complex) := Complex => (deg, C) -> part({deg}, C) | ||
-- this construction requires ~half as many truncations | ||
f := truncate(degs, dd^C_lo, opts); | ||
complex hashTable for i from lo+1 to hi list i => ( | ||
f = inducedTruncationMap(source f, truncate(degs, C_i, opts), dd^C_i)) | ||
)) | ||
|
||
truncate(List, Complex) := Complex => {} >> opts -> (e, C) -> ( | ||
-------------------------------------------------------------------- | ||
-- basis ----------------------------------------------------------- | ||
-------------------------------------------------------------------- | ||
importFrom_Core { "inducedBasisMap" } | ||
|
||
-- returns the graded component of the complex in the given degree | ||
-- as a complex over the same ring (as opposed to the coefficient ring) | ||
-- TODO: also define basis given a degree range and infinite ranges | ||
basis(ZZ, Complex) := | ||
basis(List, Complex) := Complex => opts -> (deg, C) -> ( | ||
(lo, hi) := C.concentration; | ||
if lo == hi | ||
then complex(image basis(deg, C_lo, opts), Base => lo) | ||
-- this is the simplest way to take the basis of the whole complex: | ||
-- else complex applyValues(C.dd.map, f -> basis(deg, f, opts))) | ||
else ( | ||
-- this construction requires ~half as many basis computations | ||
f := basis(deg, dd^C_lo, opts); | ||
complex hashTable for i from lo+1 to hi list i => ( | ||
f = inducedBasisMap(source f, image basis(deg, C_i, opts), dd^C_i)) | ||
)) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The phrase |
||
-------------------------------------------------------------------- | ||
-- part ------------------------------------------------------------ | ||
-------------------------------------------------------------------- | ||
importFrom_Core "residueMap" -- gives a map back to the coefficient ring | ||
|
||
-- this may not always be well-defined, so it is not exported | ||
cover' = method() | ||
cover' Complex := Complex => C -> ( | ||
(lo, hi) := concentration C; | ||
if lo === hi then return complex truncate(e, C_lo); | ||
complex hashTable for i from lo+1 to hi list i => truncate(e, dd^C_i) | ||
) | ||
truncate(ZZ, Complex) := Complex => {} >> opts -> (e, C) -> truncate({e}, C) | ||
if lo == hi | ||
then complex(cover C_lo, Base => lo) | ||
else complex applyValues(C.dd.map, cover)) | ||
cover' ComplexMap := ComplexMap => f -> ( | ||
map(cover' target f, cover' source f, i -> cover f_i, Degree => degree f)) | ||
|
||
-- returns the graded component of the complex in the given degree | ||
-- but as a complex over the coefficient ring instead | ||
part(ZZ, Complex) := | ||
part(List, Complex) := Complex => (deg, C) -> (residueMap ring C) cover' basis(deg, C) | ||
|
||
-------------------------------------------------------------------- | ||
-- homology -------------------------------------------------------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid calling
Truncation
withinpart
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not call truncate within part. We do however call basis.