Skip to content
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 examples(ZZ) to see examples for the doc nodes from "about" #3483

Merged
merged 11 commits into from
Sep 30, 2024

Conversation

d-torrance
Copy link
Member

We also add some informative comments to the output. For example:

i1 : about rank

o1 = {0 => Chordal :: rank(ChordalNetNode)                   }
     {1 => DiffAlg :: rank(DiffAlgDistribution)              }
     {2 => HyperplaneArrangements :: rank(CentralArrangement)}
     {3 => HyperplaneArrangements :: rank(Flat)              }
     {4 => InvariantRing :: rank(DiagonalAction)             }
     {5 => LieTypes :: rank(LieAlgebra)                      }
     {6 => Macaulay2Doc :: rank                              }
     {7 => Macaulay2Doc :: rank of a matrix                  }
     {8 => Macaulay2Doc :: rank(GradedModule)                }
     {9 => Macaulay2Doc :: rank(Matrix)                      }
     {10 => Macaulay2Doc :: rank(Module)                     }
     {11 => Macaulay2Doc :: rank(MutableMatrix)              }
     {12 => Matroids :: rank(Matroid)                        }
     {13 => Matroids :: rank(Matroid,List)                   }
     {14 => Matroids :: rank(Matroid,Set)                    }
     {15 => OldToricVectorBundles :: rank(ToricVectorBundle) }
     {16 => Posets :: rank(Poset)                            }
     {17 => Schubert2 :: rank(AbstractSheaf)                 }
     {18 => SparseResultants :: rank(MultidimensionalMatrix) }
     {19 => ToricVectorBundles :: rank(ToricVectorBundle)    }
     {20 => WeylGroups :: rank(DynkinDiagram)                }
     {21 => WeylGroups :: rank(RootSystem)                   }

o1 : NumberedVerticalList

i2 : examples 6

o2 = -- examples for tag: rank
     -- ../src/macaulay2/M2/M2/Macaulay2/packages/Macaulay2Doc/functions/rank-doc.m2:32:0
     R = ZZ/101[x,y,z]
     p = vars R;
     rank kernel p
     rank cokernel p
     C = res cokernel p
     rank C

Copy link
Member

@mahrud mahrud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add examples List so examples methods rankand examples about rank can work?

@d-torrance
Copy link
Member Author

I'd added examples(List), e.g.,:

i1 : examples about rank
 -- warning: symbol "isSimple" in Graphs.Dictionary is shadowed by a symbol in LieTypes.Dictionary
 --   use the synonym Graphs$isSimple
 -- tons of other similar warnings we should probably deal with at some point...

o1 = -- examples for tag: rank(ChordalNetNode)
     -- M2/Macaulay2/packages/Chordal/ChordalDoc.m2:343:0
     -- no examples
     ---------------------------------------------------------------------------------
     -- examples for tag: rank(DiffAlgDistribution)
     -- M2/Macaulay2/packages/DiffAlg.m2:833:0
     X = random newField(2,2,"a")
     Y = random newField(2,2,"a")
     rank dist {X,Y}
     rank dist {X,Y,X+Y,X-Y}
     rank dist {X,Y,X|Y}
     ---------------------------------------------------------------------------------
     -- examples for tag: rank(CentralArrangement)
     -- M2/Macaulay2/packages/HyperplaneArrangements.m2:1571:0
     R = QQ[x,y,z];
     B = arrangement("braid", R)
     rank B
     assert(rank B === rank matroid B)
     rank typeA 4
     M = arrangement("MacLane")
     rank M
     trivial = arrangement(map(R^(numgens R),R^0,0),R)
     rank trivial
     assert(rank trivial === 0)
     ---------------------------------------------------------------------------------
     -- examples for tag: rank(Flat)
     -- M2/Macaulay2/packages/HyperplaneArrangements.m2:1595:0
     A3 = typeA 3
     F = flat(A3, {3,4,5})
     assert(rank F == 2)
     ---------------------------------------------------------------------------------
     -- examples for tag: rank(DiagonalAction)
     -- M2/Macaulay2/packages/InvariantRing/AbelianGroupsDoc.m2:352:0
     R = QQ[x_1..x_4]
     W = matrix{{0,1,-1,1},{1,0,-1,-1}}
     T = diagonalAction(W, R)
     rank T
     ---------------------------------------------------------------------------------
     -- examples for tag: rank
     -- examples for tag: rank(MutableMatrix)
     -- examples for tag: rank(Module)
     -- examples for tag: rank(Matrix)
     -- examples for tag: rank(GradedModule)
     -- M2/Macaulay2/packages/Macaulay2Doc/functions/rank-doc.m2:32:0
     R = ZZ/101[x,y,z]
     p = vars R;
     rank kernel p
     rank cokernel p
     C = res cokernel p
     rank C
     ---------------------------------------------------------------------------------
     -- examples for tag: rank of a matrix
     -- M2/Macaulay2/packages/Macaulay2Doc/ov_matrices.m2:428:0
     -- no examples
     ---------------------------------------------------------------------------------
     -- examples for tag: rank(Matroid)
     -- M2/Macaulay2/packages/Matroids/doc-Matroids.m2:989:0
     M = matroid({a,b,c,d},{{a,b},{a,c}})
     rank M
     ---------------------------------------------------------------------------------
     -- examples for tag: rank(Matroid,Set)
     -- examples for tag: rank(Matroid,List)
     -- M2/Macaulay2/packages/Matroids/doc-Matroids.m2:1028:0
     M = matroid({a,b,c,d},{{a,b},{a,c}})
     for s in subsets M_* do print(toString s | " has rank " | rank_M s)
     ---------------------------------------------------------------------------------
     -- examples for tag: rank(ToricVectorBundle)
     -- M2/Macaulay2/packages/OldToricVectorBundles.m2:3397:0
     E = tangentBundle projectiveSpaceFan 3
     rank E
     ---------------------------------------------------------------------------------
     -- examples for tag: rank(Poset)
     -- M2/Macaulay2/packages/Posets.m2:4613:0
     rankPoset chain 5
     rankPoset booleanLattice 3
     ---------------------------------------------------------------------------------
     -- examples for tag: rank(AbstractSheaf)
     -- M2/Macaulay2/packages/Schubert2.m2:1855:0
     rank tangentBundle abstractProjectiveSpace 4
     ---------------------------------------------------------------------------------
     -- examples for tag: rank(MultidimensionalMatrix)
     -- M2/Macaulay2/packages/SparseResultants.m2:1658:0
     M = randomMultidimensionalMatrix(2,4,3,2,MaximalRank=>2)
     rank M
     M' = randomMultidimensionalMatrix(2,4,2,1,3,CoefficientRing=>ZZ/65521,MaximalRank=>4)
     rank M'
     ---------------------------------------------------------------------------------
     -- examples for tag: rank(ToricVectorBundle)
     -- M2/Macaulay2/packages/ToricVectorBundles.m2:3464:0
     E = tangentBundle projectiveSpaceFan 3
     rank E
     ---------------------------------------------------------------------------------
     -- examples for tag: rank(RootSystem)
     -- M2/Macaulay2/packages/WeylGroups.m2:1626:0
     R = rootSystemA(5)
     rank R
     ---------------------------------------------------------------------------------
     -- examples for tag: rank(DynkinDiagram)
     -- M2/Macaulay2/packages/WeylGroups.m2:4212:0
     R=rootSystemE(6)
     D=dynkinDiagram(R);
     rank(D)

I'm getting a weird "example results terminate prematurely" error for ofClass when installing Macaulay2Doc after these changes that I haven't figured out yet.

M2/Macaulay2/m2/examples.m2 Outdated Show resolved Hide resolved
M2/Macaulay2/m2/examples.m2 Outdated Show resolved Hide resolved
@mahrud
Copy link
Member

mahrud commented Sep 18, 2024

i1 : examples about rank
 -- warning: symbol "isSimple" in Graphs.Dictionary is shadowed by a symbol in LieTypes.Dictionary
 --   use the synonym Graphs$isSimple
 -- tons of other similar warnings we should probably deal with at some point...

I agree ... Maybe during installPackage we could check if the exported packages appear in any other packages, and if so give a warning? about essentially does this, so we could literally run about on every symbol and just print the warnings and throw away the output!

o1 = -- examples for tag: rank(ChordalNetNode)
     -- M2/Macaulay2/packages/Chordal/ChordalDoc.m2:343:0
     -- no examples

Not a fan of this. Can we just say this?

-- no examples for tag: rank(ChordalNetNode)

@d-torrance d-torrance marked this pull request as draft September 19, 2024 03:32
@d-torrance d-torrance marked this pull request as draft September 19, 2024 03:32
@d-torrance
Copy link
Member Author

Can we just say this?

-- no examples for tag: rank(ChordalNetNode)

Done!

@d-torrance d-torrance marked this pull request as ready for review September 20, 2024 01:09
@d-torrance d-torrance force-pushed the examples-zz branch 2 times, most recently from 0caed42 to ed37308 Compare September 20, 2024 04:04
@d-torrance
Copy link
Member Author

@mahrud -- You've approved this, but I think there was some discussion and further changes afterwards. Is this good to merge?

M2/Macaulay2/m2/examples.m2 Outdated Show resolved Hide resolved
M2/Macaulay2/m2/document.m2 Outdated Show resolved Hide resolved
M2/Macaulay2/m2/examples.m2 Outdated Show resolved Hide resolved
So this doesn't mess up the internal use of "examples" by
getExampleOutput for generating examples for documentation on the fly,
we rename the original lower-level method as examples'.
Similar to code(List), we deduplicate nodes with the same location
Method no longer exists; replaced w/ unexported examples'(Hypertext)
@mahrud
Copy link
Member

mahrud commented Sep 29, 2024

Can I push a commit?

This fixes locate(DocumentTag) for documentation created on the
standard input.  Previously, it would give something like
/usr/share/Macaulay2/Core/stdio:2:0
@d-torrance
Copy link
Member Author

Can I push a commit?

Sure. I just force-pushed a couple changes addressing your comments, so you may need to rebase first.

@mahrud
Copy link
Member

mahrud commented Sep 29, 2024

Feel free to merge once the tests pass.

@d-torrance d-torrance merged commit dba0f0e into Macaulay2:development Sep 30, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants