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

improved the manual of the GAP package JuliaInterface #353

Merged

Conversation

ThomasBreuer
Copy link
Member

  • added documentation for many GAP functions
  • reordered some GAP code such that the ordering fits to the documentation
  • added a few JuliaToGAP conversions (which were marked as "TODO")

@codecov
Copy link

codecov bot commented Mar 4, 2020

Codecov Report

Merging #353 into master will decrease coverage by 0.06%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #353      +/-   ##
==========================================
- Coverage   76.65%   76.58%   -0.07%     
==========================================
  Files          62       61       -1     
  Lines        4467     4480      +13     
==========================================
+ Hits         3424     3431       +7     
- Misses       1043     1049       +6     

- added documentation for many GAP functions
- reordered some GAP code such that the ordering fits to the documentation
- added a few `JuliaToGAP` conversions (which were marked as "TODO")
@ThomasBreuer ThomasBreuer force-pushed the TB_JuliaInterface_manual branch from 112c0f2 to 5f09ff1 Compare March 4, 2020 10:48
Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Looks good to me. Some minor comments; but I'd also be fine with merging this right now. We can fill in the TODOs and incomplete parts later, but it is already now a nice improvement. Thanks!

Comment on lines +412 to +430
#! <Example>
#! gap> GAPToJulia( 1 );
#! 1
#! gap> GAPToJulia( JuliaEvalString( "Rational{Int64}" ), 1 );
#! &lt;Julia: 1//1>
#! gap> l:= [ 1, 3, 4 ];;
#! gap> GAPToJulia( l );
#! &lt;Julia: Any[1, 3, 4]>
#! gap> GAPToJulia( JuliaEvalString( "Array{Int,1}" ), l );
#! &lt;Julia: [1, 3, 4]>
#! gap> m:= [ [ 1, 2 ], [ 3, 4 ] ];;
#! gap> GAPToJulia( m );
#! &lt;Julia: Any[Any[1, 2], Any[3, 4]]>
#! gap> GAPToJulia( JuliaEvalString( "Array{Int,2}" ), m );
#! &lt;Julia: [1 2; 3 4]>
#! gap> r:= rec( a:= 1, b:= [ 1, 2, 3 ] );;
#! gap> GAPToJulia( r );
#! &lt;Julia: Dict{Symbol,Any}(:a => 1,:b => Any[1, 2, 3])>
#! </Example>
Copy link
Member

Choose a reason for hiding this comment

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

How about this (and similar in other exampels)

Suggested change
#! <Example>
#! gap> GAPToJulia( 1 );
#! 1
#! gap> GAPToJulia( JuliaEvalString( "Rational{Int64}" ), 1 );
#! &lt;Julia: 1//1>
#! gap> l:= [ 1, 3, 4 ];;
#! gap> GAPToJulia( l );
#! &lt;Julia: Any[1, 3, 4]>
#! gap> GAPToJulia( JuliaEvalString( "Array{Int,1}" ), l );
#! &lt;Julia: [1, 3, 4]>
#! gap> m:= [ [ 1, 2 ], [ 3, 4 ] ];;
#! gap> GAPToJulia( m );
#! &lt;Julia: Any[Any[1, 2], Any[3, 4]]>
#! gap> GAPToJulia( JuliaEvalString( "Array{Int,2}" ), m );
#! &lt;Julia: [1 2; 3 4]>
#! gap> r:= rec( a:= 1, b:= [ 1, 2, 3 ] );;
#! gap> GAPToJulia( r );
#! &lt;Julia: Dict{Symbol,Any}(:a => 1,:b => Any[1, 2, 3])>
#! </Example>
#! <Example><![CDATA[
#! gap> GAPToJulia( 1 );
#! 1
#! gap> GAPToJulia( JuliaEvalString( "Rational{Int64}" ), 1 );
#! <Julia: 1//1>
#! gap> l:= [ 1, 3, 4 ];;
#! gap> GAPToJulia( l );
#! <Julia: Any[1, 3, 4]>
#! gap> GAPToJulia( JuliaEvalString( "Array{Int,1}" ), l );
#! <Julia: [1, 3, 4]>
#! gap> m:= [ [ 1, 2 ], [ 3, 4 ] ];;
#! gap> GAPToJulia( m );
#! <Julia: Any[Any[1, 2], Any[3, 4]]>
#! gap> GAPToJulia( JuliaEvalString( "Array{Int,2}" ), m );
#! <Julia: [1 2; 3 4]>
#! gap> r:= rec( a:= 1, b:= [ 1, 2, 3 ] );;
#! gap> GAPToJulia( r );
#! <Julia: Dict{Symbol,Any}(:a => 1,:b => Any[1, 2, 3])>
#! ]]></Example>

#! implemented by calling <C>gap_to_julia</C> or vice versa.
#! (Pro constructors: <C>BigInt(x)</C> is shorter than
#! <C>gap_to_julia(BigInt, x)</C>.
#! Con constructors: symmetry perhaps?)
Copy link
Member

Choose a reason for hiding this comment

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

Also: not (yet?) clear how to deal with recursive conversions that preserve identity. I.e. converting the GAP list [ ~ ] which contains itself, or something like [ "x", ~[1] ] which contains the same (identical) string twice. Of course for many applications this is irrelevant, but maybe not for some others.

That said, I absolutely think we should offer these constructors, but retain gap_to_julia (at least for now, as people are using it, and it has the above mentioned recursive feature)

#! </Item>
#! <Item>
#! Add conversions from &Julia; bigints and rationals over
#! various integer types, including bigints, to &GAP;.
Copy link
Member

Choose a reason for hiding this comment

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

We also want to be able to efficiently convert between GAP integers and fmpz. See also https://github.com/oscar-system/GAPGroups.jl/issues/3

@ThomasBreuer ThomasBreuer merged commit a4ac700 into oscar-system:master Mar 4, 2020
@ThomasBreuer ThomasBreuer deleted the TB_JuliaInterface_manual branch March 4, 2020 12:47
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