oscar-system / Singular.jl

Julia package for the Singular library
Other
31 stars 33 forks source link

Passing intmats to Singular library functions #429

Closed jtyard closed 2 years ago

jtyard commented 3 years ago

Describe the bug

I'm trying to use the multigrading libraries in Singular.jl (from within Oscar 0.5.2 in Julia 1.6.1 on Ubuntu 20.04.2 running in WSL2 under Windows) and can't figure out how to pass intmats to the library functions. I don't know if this is because I am doing something wrong or whether certain functionality is missing / incomplete.

To Reproduce

R, (x, y) = Singular.PolynomialRing(Singular.ZZ,["x","y"])
M = Singular.libSingular.jl_array_to_intmat([1 0; 0 1])
Singular.LibMultigrading.setBaseMultigrading(R,M)

gives the following error:

ERROR: type Ptr has no field ptr
Stacktrace:
 [1] getproperty(x::Ptr{Nothing}, f::Symbol)
   @ Base ./Base.jl:33
 [2] prepare_argument(x::Ptr{Nothing})
   @ Singular ~/.julia/packages/Singular/gc8mN/src/caller.jl:196
 [3] low_level_caller_rng(::String, ::String, ::Singular.PolyRing{Singular.n_Z}, ::Ptr{Nothing}, ::Vararg{Ptr{Nothing}, N} where N)
   @ Singular ~/.julia/packages/Singular/gc8mN/src/caller.jl:221
 [4] setBaseMultigrading(::Singular.PolyRing{Singular.n_Z}, ::Ptr{Nothing}, ::Vararg{Ptr{Nothing}, N} where N)
   @ Singular.LibMultigrading ~/.julia/packages/Singular/gc8mN/src/Meta.jl:49
 [5] top-level scope
   @ REPL[64]:1

Expected behavior I might have expected M to be something like "intmat" instead of Ptr{Nothing}

Information about your setup:

julia> versioninfo()
Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = "/home/jyard/.vscode-server/bin/cfa2e218100323074ac1948c885448fdf4de2a7f/node"
  JULIA_NUM_THREADS = 

julia> using Pkg; Pkg.status(mode=PKGMODE_MANIFEST)
      Status `~/.julia/environments/v1.6/Manifest.toml`
  [c3fe647b] AbstractAlgebra v0.16.0
  [79e6a3ab] Adapt v3.3.0
  [b99e7846] BinaryProvider v0.5.10
  [336ed68f] CSV v0.8.4
  [35d6a980] ColorSchemes v3.12.1
  [3da002f7] ColorTypes v0.11.0
  [5ae59095] Colors v0.12.8
  [34da2185] Compat v3.27.0
  [d38c429a] Contour v0.5.7
  [a8cc5b0e] Crayons v4.0.4
  [1f15a43c] CxxWrap v0.11.2
  [9a962f9c] DataAPI v1.6.0
  [a93c6f00] DataFrames v1.0.1
  [864edb3b] DataStructures v0.18.9
  [e2d170a0] DataValueInterfaces v1.0.0
  [ffbed154] DocStringExtensions v0.8.4
  [c87230d0] FFMPEG v0.4.0
  [53c48c17] FixedPointNumbers v0.8.4
  [59287772] Formatting v0.4.2
  [c863536a] GAP v0.5.2
  [28b8d3ca] GR v0.57.4
  [5c1252a2] GeometryBasics v0.3.12
  [42e2da0e] Grisu v1.0.2
  [cd3eb016] HTTP v0.9.7
  [3e1990a7] Hecke v0.10.5
  [83e8ac13] IniFile v0.5.0
  [41ab1584] InvertedIndices v1.0.0
  [c8e1da08] IterTools v1.3.0
  [82899510] IteratorInterfaceExtensions v1.0.0
  [692b3bcd] JLLWrappers v1.3.0
  [682c06a0] JSON v0.21.1
  [b964fa9f] LaTeXStrings v1.2.1
  [23fbe1c1] Latexify v0.15.5
  [472f376f] LoadFlint v0.5.1
  [1914dd2f] MacroTools v0.5.6
  [739be429] MbedTLS v1.0.3
  [442fdcdd] Measures v0.3.1
  [e1d29d7a] Missings v1.0.0
  [4fe8b98c] Mongoc v0.6.2
  [77ba4419] NaNMath v0.3.5
  [2edaba10] Nemo v0.22.1
  [bac558e1] OrderedCollections v1.4.0
  [f1435218] Oscar v0.5.2
  [69de0a69] Parsers v1.1.0
  [ccf2f8ad] PlotThemes v2.0.1
  [995b91a9] PlotUtils v1.0.10
  [91a5bcdd] Plots v1.13.2
  [d720cf60] Polymake v0.5.5
  [2dfb63ee] PooledArrays v1.2.1
  [21216c6a] Preferences v1.2.1
  [08abe8d2] PrettyTables v1.0.1
  [fb686558] RandomExtensions v0.4.3
  [3cdcf5f2] RecipesBase v1.1.1
  [01d81517] RecipesPipeline v0.3.2
  [189a3867] Reexport v1.0.0
  [ae029012] Requires v1.1.3
  [6c6a2e73] Scratch v1.0.3
  [91c51154] SentinelArrays v1.2.16
  [992d4aef] Showoff v1.0.3
  [bcd08a7b] Singular v0.5.2
  [a2af1166] SortingAlgorithms v1.0.0
  [90137ffa] StaticArrays v1.1.2
  [2913bbd2] StatsBase v0.33.7
  [09ab397b] StructArrays v0.5.1
  [ab02a1b2] TableOperations v1.0.0
  [3783bdb8] TableTraits v1.0.1
  [bd369af6] Tables v1.4.2
  [5c2747f8] URIs v1.3.0
  [e21ec000] Antic_jll v0.200.400+0
  [d9960996] Arb_jll v200.1900.1+0
  [6e34b625] Bzip2_jll v1.0.6+5
  [83423d85] Cairo_jll v1.16.0+6
  [5ae413db] EarCut_jll v2.1.5+1
  [2e619515] Expat_jll v2.2.7+6
  [b22a6f82] FFMPEG_jll v4.3.1+4
  [e134572f] FLINT_jll v200.700.100+0
  [a3f928ae] Fontconfig_jll v2.13.1+14
  [d7e528f0] FreeType2_jll v2.10.1+5
  [559328eb] FriBidi_jll v1.0.5+6
  [5cd7a574] GAP_jll v400.1100.1+0
  [de1ad85e] GAP_lib_jll v400.1100.0+0
  [0656b61e] GLFW_jll v3.3.4+0
  [e8aa6df9] GLPK_jll v5.0.0+0
  [d2c73de3] GR_jll v0.57.2+0
  [78b55507] Gettext_jll v0.20.1+7
  [7746bdde] Glib_jll v2.59.0+4
  [aacddb02] JpegTurbo_jll v2.0.1+3
  [c1c5ebd0] LAME_jll v3.100.0+3
  [dd4b983a] LZO_jll v2.10.0+3
  [dd192d2f] LibVPX_jll v1.9.0+1
  [e9f186c6] Libffi_jll v3.2.1+4
  [d4300ac3] Libgcrypt_jll v1.8.5+4
  [7e76a0d4] Libglvnd_jll v1.3.0+3
  [7add5ba3] Libgpg_error_jll v1.36.0+3
  [94ce4f54] Libiconv_jll v1.16.0+7
  [4b2f31a3] Libmount_jll v2.34.0+3
  [89763e89] Libtiff_jll v4.1.0+2
  [38a345b3] Libuuid_jll v2.34.0+7
  [90100e71] MongoC_jll v1.16.2+1
  [68e3532b] Ncurses_jll v6.1.0+5
  [76642167] Ninja_jll v1.10.2+0
  [e7412a2a] Ogg_jll v1.3.4+2
  [458c3c95] OpenSSL_jll v1.1.1+6
  [91d4177d] Opus_jll v1.3.1+3
  [2f80f16e] PCRE_jll v8.42.0+4
  [80dd9cbb] PPL_jll v1.2.0+1
  [83958c19] Perl_jll v5.30.3+2
  [30392449] Pixman_jll v0.40.0+0
  [ea2cea3b] Qt5Base_jll v5.15.2+0
  [05236dd9] Readline_jll v8.0.4+1
  [43d676ae] Singular_jll v402.0.104+0
  [a2964d1f] Wayland_jll v1.17.0+4
  [2381bf8a] Wayland_protocols_jll v1.18.0+4
  [02c8fc9c] XML2_jll v2.9.11+0
  [aed1982a] XSLT_jll v1.1.33+4
  [4f6342f7] Xorg_libX11_jll v1.6.9+4
  [0c0b7dd1] Xorg_libXau_jll v1.0.9+4
  [935fb764] Xorg_libXcursor_jll v1.2.0+4
  [a3789734] Xorg_libXdmcp_jll v1.1.3+4
  [1082639a] Xorg_libXext_jll v1.3.4+4
  [d091e8ba] Xorg_libXfixes_jll v5.0.3+4
  [a51aa0fd] Xorg_libXi_jll v1.7.10+4
  [d1454406] Xorg_libXinerama_jll v1.1.4+4
  [ec84b674] Xorg_libXrandr_jll v1.5.2+4
  [ea2f1a96] Xorg_libXrender_jll v0.9.10+4
  [14d82f49] Xorg_libpthread_stubs_jll v0.1.0+3
  [c7cfdc94] Xorg_libxcb_jll v1.13.0+3
  [cc61e674] Xorg_libxkbfile_jll v1.1.0+4
  [12413925] Xorg_xcb_util_image_jll v0.4.0+1
  [2def613f] Xorg_xcb_util_jll v0.4.0+1
  [975044d2] Xorg_xcb_util_keysyms_jll v0.4.0+1
  [0d47668e] Xorg_xcb_util_renderutil_jll v0.3.9+1
  [c22f9ab0] Xorg_xcb_util_wm_jll v0.4.1+1
  [35661453] Xorg_xkbcomp_jll v1.4.2+4
  [33bec58e] Xorg_xkeyboard_config_jll v2.27.0+4
  [c5fb5394] Xorg_xtrans_jll v1.4.0+3
  [3161d3a3] Zstd_jll v1.4.8+0
  [508c9074] bliss_jll v0.73.0+1
  [28df3c45] boost_jll v1.71.0+3
  [f07e07eb] cddlib_jll v0.94.10+1
  [1493ae25] lib4ti2_jll v1.6.9+2
  [0ac62f75] libass_jll v0.14.0+4
  [3eaa8342] libcxxwrap_julia_jll v0.8.6+0
  [f638f0a6] libfdk_aac_jll v0.1.6+4
  [b53b4c65] libpng_jll v1.6.37+6
  [4d8266f6] libpolymake_julia_jll v0.4.105+0
  [ae4fbd8f] libsingular_julia_jll v0.9.205+0
  [f27f6e37] libvorbis_jll v1.3.6+6
  [3873f7d0] lrslib_jll v0.2.0+0
  [55c6dc9b] nauty_jll v2.6.12+1
  [6690c6e9] normaliz_jll v300.800.901+0
  [7c209550] polymake_jll v400.300.1+0
  [fe1e1685] snappy_jll v1.1.8+1
  [1270edf5] x264_jll v2020.7.14+2
  [dfaa095f] x265_jll v3.0.0+3
  [d8fb68d0] xkbcommon_jll v0.9.1+5
  [0dad84c5] ArgTools
  [56f22d72] Artifacts
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [8bb1440f] DelimitedFiles
  [8ba89e20] Distributed
  [f43a241f] Downloads
  [9fa8497b] Future
  [b77e0a4c] InteractiveUtils
  [b27032c2] LibCURL
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [a63ad114] Mmap
  [ca575930] NetworkOptions
  [44cfe95a] Pkg
  [de0858da] Printf
  [9abbd945] Profile
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA
  [9e88b42a] Serialization
  [1a1011a3] SharedArrays
  [6462fe0b] Sockets
  [2f01184e] SparseArrays
  [10745b16] Statistics
  [fa267f1f] TOML
  [a4e569a6] Tar
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
  [e66e0078] CompilerSupportLibraries_jll
  [781609d7] GMP_jll
  [deac9b47] LibCURL_jll
  [29816b5a] LibSSH2_jll
  [3a97d323] MPFR_jll
  [c8ffd9c3] MbedTLS_jll
  [14a3606d] MozillaCACerts_jll
  [83775a58] Zlib_jll
  [8e850ede] nghttp2_jll
  [3f19e933] p7zip_jll
fieker commented 3 years ago

Hi Jon,

what are you actually trying to do? Reason for the question: as you're already using Oscar, multi gradings are available directly there as well, in fact most of the multigrading.lib is (or should be) natively in Oscar.

julia> R, (x,y) = PolynomialRing(ZZ, ["x", "y"]) (Multivariate Polynomial Ring in x, y over Integer Ring, fmpz_mpoly[x, y])

julia> A = free_abelian_group(2) GrpAb: Z^2

julia> R = grade(R, gens(A)) Multivariate Polynomial Ring in x, y over Integer Ring graded by x -> [1 0] y -> [0 1]

Greetings Claus

On Mon, May 10, 2021 at 11:55:02AM -0700, Jon Yard wrote:

Describe the bug

I'm trying to use the multigrading libraries in Singular.jl (from within Oscar 0.5.2 in Julia 1.6.1 on Ubuntu 20.04.2 running in WSL2 under Windows) and can't figure out how to pass intmats to the library functions. I don't know if this is because I am doing something wrong or whether certain functionality is missing / incomplete.

To Reproduce

R, (x, y) = Singular.PolynomialRing(Singular.ZZ,["x","y"])
M = Singular.libSingular.jl_array_to_intmat([1 0; 0 1])
Singular.LibMultigrading.setBaseMultigrading(R,M)

gives the following error:

ERROR: type Ptr has no field ptr
Stacktrace:
 [1] getproperty(x::Ptr{Nothing}, f::Symbol)
   @ Base ./Base.jl:33
 [2] prepare_argument(x::Ptr{Nothing})
   @ Singular ~/.julia/packages/Singular/gc8mN/src/caller.jl:196
 [3] low_level_caller_rng(::String, ::String, ::Singular.PolyRing{Singular.n_Z}, ::Ptr{Nothing}, ::Vararg{Ptr{Nothing}, N} where N)
   @ Singular ~/.julia/packages/Singular/gc8mN/src/caller.jl:221
 [4] setBaseMultigrading(::Singular.PolyRing{Singular.n_Z}, ::Ptr{Nothing}, ::Vararg{Ptr{Nothing}, N} where N)
   @ Singular.LibMultigrading ~/.julia/packages/Singular/gc8mN/src/Meta.jl:49
 [5] top-level scope
   @ REPL[64]:1

Expected behavior I might have expected M to be something like "intmat" instead of Ptr{Nothing}

Information about your setup:

julia> versioninfo()
Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = "/home/jyard/.vscode-server/bin/cfa2e218100323074ac1948c885448fdf4de2a7f/node"
  JULIA_NUM_THREADS = 

julia> using Pkg; Pkg.status(mode=PKGMODE_MANIFEST)
      Status `~/.julia/environments/v1.6/Manifest.toml`
  [c3fe647b] AbstractAlgebra v0.16.0
  [79e6a3ab] Adapt v3.3.0
  [b99e7846] BinaryProvider v0.5.10
  [336ed68f] CSV v0.8.4
  [35d6a980] ColorSchemes v3.12.1
  [3da002f7] ColorTypes v0.11.0
  [5ae59095] Colors v0.12.8
  [34da2185] Compat v3.27.0
  [d38c429a] Contour v0.5.7
  [a8cc5b0e] Crayons v4.0.4
  [1f15a43c] CxxWrap v0.11.2
  [9a962f9c] DataAPI v1.6.0
  [a93c6f00] DataFrames v1.0.1
  [864edb3b] DataStructures v0.18.9
  [e2d170a0] DataValueInterfaces v1.0.0
  [ffbed154] DocStringExtensions v0.8.4
  [c87230d0] FFMPEG v0.4.0
  [53c48c17] FixedPointNumbers v0.8.4
  [59287772] Formatting v0.4.2
  [c863536a] GAP v0.5.2
  [28b8d3ca] GR v0.57.4
  [5c1252a2] GeometryBasics v0.3.12
  [42e2da0e] Grisu v1.0.2
  [cd3eb016] HTTP v0.9.7
  [3e1990a7] Hecke v0.10.5
  [83e8ac13] IniFile v0.5.0
  [41ab1584] InvertedIndices v1.0.0
  [c8e1da08] IterTools v1.3.0
  [82899510] IteratorInterfaceExtensions v1.0.0
  [692b3bcd] JLLWrappers v1.3.0
  [682c06a0] JSON v0.21.1
  [b964fa9f] LaTeXStrings v1.2.1
  [23fbe1c1] Latexify v0.15.5
  [472f376f] LoadFlint v0.5.1
  [1914dd2f] MacroTools v0.5.6
  [739be429] MbedTLS v1.0.3
  [442fdcdd] Measures v0.3.1
  [e1d29d7a] Missings v1.0.0
  [4fe8b98c] Mongoc v0.6.2
  [77ba4419] NaNMath v0.3.5
  [2edaba10] Nemo v0.22.1
  [bac558e1] OrderedCollections v1.4.0
  [f1435218] Oscar v0.5.2
  [69de0a69] Parsers v1.1.0
  [ccf2f8ad] PlotThemes v2.0.1
  [995b91a9] PlotUtils v1.0.10
  [91a5bcdd] Plots v1.13.2
  [d720cf60] Polymake v0.5.5
  [2dfb63ee] PooledArrays v1.2.1
  [21216c6a] Preferences v1.2.1
  [08abe8d2] PrettyTables v1.0.1
  [fb686558] RandomExtensions v0.4.3
  [3cdcf5f2] RecipesBase v1.1.1
  [01d81517] RecipesPipeline v0.3.2
  [189a3867] Reexport v1.0.0
  [ae029012] Requires v1.1.3
  [6c6a2e73] Scratch v1.0.3
  [91c51154] SentinelArrays v1.2.16
  [992d4aef] Showoff v1.0.3
  [bcd08a7b] Singular v0.5.2
  [a2af1166] SortingAlgorithms v1.0.0
  [90137ffa] StaticArrays v1.1.2
  [2913bbd2] StatsBase v0.33.7
  [09ab397b] StructArrays v0.5.1
  [ab02a1b2] TableOperations v1.0.0
  [3783bdb8] TableTraits v1.0.1
  [bd369af6] Tables v1.4.2
  [5c2747f8] URIs v1.3.0
  [e21ec000] Antic_jll v0.200.400+0
  [d9960996] Arb_jll v200.1900.1+0
  [6e34b625] Bzip2_jll v1.0.6+5
  [83423d85] Cairo_jll v1.16.0+6
  [5ae413db] EarCut_jll v2.1.5+1
  [2e619515] Expat_jll v2.2.7+6
  [b22a6f82] FFMPEG_jll v4.3.1+4
  [e134572f] FLINT_jll v200.700.100+0
  [a3f928ae] Fontconfig_jll v2.13.1+14
  [d7e528f0] FreeType2_jll v2.10.1+5
  [559328eb] FriBidi_jll v1.0.5+6
  [5cd7a574] GAP_jll v400.1100.1+0
  [de1ad85e] GAP_lib_jll v400.1100.0+0
  [0656b61e] GLFW_jll v3.3.4+0
  [e8aa6df9] GLPK_jll v5.0.0+0
  [d2c73de3] GR_jll v0.57.2+0
  [78b55507] Gettext_jll v0.20.1+7
  [7746bdde] Glib_jll v2.59.0+4
  [aacddb02] JpegTurbo_jll v2.0.1+3
  [c1c5ebd0] LAME_jll v3.100.0+3
  [dd4b983a] LZO_jll v2.10.0+3
  [dd192d2f] LibVPX_jll v1.9.0+1
  [e9f186c6] Libffi_jll v3.2.1+4
  [d4300ac3] Libgcrypt_jll v1.8.5+4
  [7e76a0d4] Libglvnd_jll v1.3.0+3
  [7add5ba3] Libgpg_error_jll v1.36.0+3
  [94ce4f54] Libiconv_jll v1.16.0+7
  [4b2f31a3] Libmount_jll v2.34.0+3
  [89763e89] Libtiff_jll v4.1.0+2
  [38a345b3] Libuuid_jll v2.34.0+7
  [90100e71] MongoC_jll v1.16.2+1
  [68e3532b] Ncurses_jll v6.1.0+5
  [76642167] Ninja_jll v1.10.2+0
  [e7412a2a] Ogg_jll v1.3.4+2
  [458c3c95] OpenSSL_jll v1.1.1+6
  [91d4177d] Opus_jll v1.3.1+3
  [2f80f16e] PCRE_jll v8.42.0+4
  [80dd9cbb] PPL_jll v1.2.0+1
  [83958c19] Perl_jll v5.30.3+2
  [30392449] Pixman_jll v0.40.0+0
  [ea2cea3b] Qt5Base_jll v5.15.2+0
  [05236dd9] Readline_jll v8.0.4+1
  [43d676ae] Singular_jll v402.0.104+0
  [a2964d1f] Wayland_jll v1.17.0+4
  [2381bf8a] Wayland_protocols_jll v1.18.0+4
  [02c8fc9c] XML2_jll v2.9.11+0
  [aed1982a] XSLT_jll v1.1.33+4
  [4f6342f7] Xorg_libX11_jll v1.6.9+4
  [0c0b7dd1] Xorg_libXau_jll v1.0.9+4
  [935fb764] Xorg_libXcursor_jll v1.2.0+4
  [a3789734] Xorg_libXdmcp_jll v1.1.3+4
  [1082639a] Xorg_libXext_jll v1.3.4+4
  [d091e8ba] Xorg_libXfixes_jll v5.0.3+4
  [a51aa0fd] Xorg_libXi_jll v1.7.10+4
  [d1454406] Xorg_libXinerama_jll v1.1.4+4
  [ec84b674] Xorg_libXrandr_jll v1.5.2+4
  [ea2f1a96] Xorg_libXrender_jll v0.9.10+4
  [14d82f49] Xorg_libpthread_stubs_jll v0.1.0+3
  [c7cfdc94] Xorg_libxcb_jll v1.13.0+3
  [cc61e674] Xorg_libxkbfile_jll v1.1.0+4
  [12413925] Xorg_xcb_util_image_jll v0.4.0+1
  [2def613f] Xorg_xcb_util_jll v0.4.0+1
  [975044d2] Xorg_xcb_util_keysyms_jll v0.4.0+1
  [0d47668e] Xorg_xcb_util_renderutil_jll v0.3.9+1
  [c22f9ab0] Xorg_xcb_util_wm_jll v0.4.1+1
  [35661453] Xorg_xkbcomp_jll v1.4.2+4
  [33bec58e] Xorg_xkeyboard_config_jll v2.27.0+4
  [c5fb5394] Xorg_xtrans_jll v1.4.0+3
  [3161d3a3] Zstd_jll v1.4.8+0
  [508c9074] bliss_jll v0.73.0+1
  [28df3c45] boost_jll v1.71.0+3
  [f07e07eb] cddlib_jll v0.94.10+1
  [1493ae25] lib4ti2_jll v1.6.9+2
  [0ac62f75] libass_jll v0.14.0+4
  [3eaa8342] libcxxwrap_julia_jll v0.8.6+0
  [f638f0a6] libfdk_aac_jll v0.1.6+4
  [b53b4c65] libpng_jll v1.6.37+6
  [4d8266f6] libpolymake_julia_jll v0.4.105+0
  [ae4fbd8f] libsingular_julia_jll v0.9.205+0
  [f27f6e37] libvorbis_jll v1.3.6+6
  [3873f7d0] lrslib_jll v0.2.0+0
  [55c6dc9b] nauty_jll v2.6.12+1
  [6690c6e9] normaliz_jll v300.800.901+0
  [7c209550] polymake_jll v400.300.1+0
  [fe1e1685] snappy_jll v1.1.8+1
  [1270edf5] x264_jll v2020.7.14+2
  [dfaa095f] x265_jll v3.0.0+3
  [d8fb68d0] xkbcommon_jll v0.9.1+5
  [0dad84c5] ArgTools
  [56f22d72] Artifacts
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [8bb1440f] DelimitedFiles
  [8ba89e20] Distributed
  [f43a241f] Downloads
  [9fa8497b] Future
  [b77e0a4c] InteractiveUtils
  [b27032c2] LibCURL
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [a63ad114] Mmap
  [ca575930] NetworkOptions
  [44cfe95a] Pkg
  [de0858da] Printf
  [9abbd945] Profile
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA
  [9e88b42a] Serialization
  [1a1011a3] SharedArrays
  [6462fe0b] Sockets
  [2f01184e] SparseArrays
  [10745b16] Statistics
  [fa267f1f] TOML
  [a4e569a6] Tar
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
  [e66e0078] CompilerSupportLibraries_jll
  [781609d7] GMP_jll
  [deac9b47] LibCURL_jll
  [29816b5a] LibSSH2_jll
  [3a97d323] MPFR_jll
  [c8ffd9c3] MbedTLS_jll
  [14a3606d] MozillaCACerts_jll
  [83775a58] Zlib_jll
  [8e850ede] nghttp2_jll
  [3f19e933] p7zip_jll

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/oscar-system/Singular.jl/issues/429

tthsqe12 commented 3 years ago

Hello Jon. I assume that this what you tried first (or at least should have tried first)

julia> R, (x, y) = Singular.PolynomialRing(Singular.ZZ,["x","y"])
(Singular Polynomial Ring (ZZ),(x,y),(dp(2),C), spoly{n_Z}[x, y])

julia> Singular.LibMultigrading.setBaseMultigrading(R,[1 0; 0 1])
ERROR: KeyError: key 301 not found
Stacktrace:
 [1] getindex(h::Dict{Int64, Tuple{Function, Bool, Tuple{Vararg{Symbol, N} where N}}}, key::Int64)
   @ Base ./dict.jl:482
 [2] convert_return_value(single_value::Vector{Any}, rng::PolyRing{n_Z})
   @ Singular ~/.julia/dev/Singular/src/caller.jl:90
 [3] convert_return_list(list_value::Vector{Any}, ring::PolyRing{n_Z})
   @ Singular ~/.julia/dev/Singular/src/caller.jl:113
 [4] low_level_caller_rng(lib::String, name::String, ring::PolyRing{n_Z}, args::Matrix{Int64})
   @ Singular ~/.julia/dev/Singular/src/caller.jl:228
 [5] setBaseMultigrading(ring::PolyRing{n_Z}, args::Matrix{Int64})
   @ Singular.LibMultigrading ~/.julia/dev/Singular/src/Meta.jl:49
 [6] top-level scope
   @ REPL[3]:1

The error is our fault as the programmer of the caller interface did not expect library procedures to return nothing: 301 is the code for nothing.

However, seeing that this function returns nothing, how useful can it be?

tthsqe12 commented 3 years ago

This singular library is probably not useful in Singular.jl. I put in a little 301 fix, and this is what I am getting:

julia> R, (x, y) = Singular.PolynomialRing(Singular.ZZ,["x","y"])
(Singular Polynomial Ring (ZZ),(x,y),(dp(2),C), spoly{n_Z}[x, y])

julia> Singular.LibMultigrading.setBaseMultigrading(R,[1 0; 0 1])

julia> R
Singular Polynomial Ring (ZZ),(x,y),(dp(2),C)

# there is nothing in the ring
julia> Singular.convert_ring_content(Singular.libSingular.get_ring_content(R.ptr), R)
Dict{Any, Any}()

# call fails
julia> Singular.LibMultigrading.getVariableWeights()
   ? `basering` is undefined
   ? error occurred in or before multigrading.lib::getVariableWeights line 753: `    def R = basering;`
   ? leaving multigrading.lib::getVariableWeights (0)
ERROR: Could not call function
Stacktrace:
 [1] call_singular_library_procedure(arg1::String, arg2::Ptr{Nothing}, arg3::Vector{Any})
   @ Singular.libSingular ~/.julia/packages/CxxWrap/OcN1Z/src/CxxWrap.jl:618
 [2] low_level_caller(::String, ::String)
   @ Singular ~/.julia/dev/Singular/src/caller.jl:245
 [3] getVariableWeights()
   @ Singular.LibMultigrading ~/.julia/dev/Singular/src/Meta.jl:48
 [4] top-level scope
   @ REPL[9]:1

# call also fails
julia> Singular.LibMultigrading.getVariableWeights(R)
   skipping text from `parameter`
   ? `#` is not defined
   ? error occurred in or before multigrading.lib::getVariableWeights line 757: `  def M = attrib(R, attrMgrad);`
ERROR: Could not call function
Stacktrace:
 [1] call_singular_library_procedure(arg1::String, arg2::CxxWrap.CxxWrapCore.CxxPtr{Singular.libSingular.ring}, arg3::Vector{Any})
   @ Singular.libSingular ~/.julia/packages/CxxWrap/OcN1Z/src/CxxWrap.jl:618
 [2] low_level_caller_rng(::String, ::String, ::PolyRing{n_Z})
   @ Singular ~/.julia/dev/Singular/src/caller.jl:229
 [3] getVariableWeights(::PolyRing{n_Z})
   @ Singular.LibMultigrading ~/.julia/dev/Singular/src/Meta.jl:49
 [4] top-level scope
   @ REPL[10]:1

# call also fails
julia> Singular.LibMultigrading.getVariableWeights(R, R)
   skipping text from `parameter` error at token `;`
ERROR: Could not call function
Stacktrace:
 [1] call_singular_library_procedure(arg1::String, arg2::CxxWrap.CxxWrapCore.CxxPtr{Singular.libSingular.ring}, arg3::Vector{Any})
   @ Singular.libSingular ~/.julia/packages/CxxWrap/OcN1Z/src/CxxWrap.jl:618
 [2] low_level_caller_rng(lib::String, name::String, ring::PolyRing{n_Z}, args::PolyRing{n_Z})
   @ Singular ~/.julia/dev/Singular/src/caller.jl:229
 [3] getVariableWeights(ring::PolyRing{n_Z}, args::PolyRing{n_Z})
   @ Singular.LibMultigrading ~/.julia/dev/Singular/src/Meta.jl:49
 [4] top-level scope
   @ REPL[11]:1

I would just like to make a note here that I think the caller functionality in Singular.jl is supposed to set the basering to R and use the rest of the arguments when called like Singular.LibMultigrading.getVariableWeights(R, ...)

Also, note that instead of returning something, Singular.LibMultigrading.setBaseMultigrading(R,[1 0; 0 1]) sets some attributes of the basering (basically a dictionary attached to each interpreter object). We do not have attributes in Singular.jl.

jtyard commented 3 years ago

Hi Claus,

Nice to meet you and thanks for the quick response. I hadn't realized that multigradings with possible torsion were already in Oscar. Are the equivalents of e.g. multiDeg, multiDegBasis, multiDegGroebner, and multigraded Hilbert series already in Oscar as well?

fieker commented 3 years ago

On Wed, May 12, 2021 at 07:50:48PM -0700, Jon Yard wrote:

Hi Claus,

Nice to meet you and thanks for the quick response. I hadn't realized that multigradings with possible torsion were already in Oscar. Are the equivalents of e.g. multiDeg, multiDegBasis, multiDegGroebner, and multigraded Hilbert series already in Oscar as well?

Hi Jon,

the precise answer is, of course, I don't know...

multiDeg -> degree (I think), for homogenous elements it gives the degree as an element of the group used to grade

multiDegBasis -> homogenous_component(R, a) for element in the group used to grade, get the k-VS of this degree

multiDegGroebner, multiDegSyzygy: do not know. What is this supposed to be doing? in multigrading, this just calls the "normal" GB and sets the grading...

However, we have some (multi) graded modules as well

Hilbert series: no.

Given that this is not my field, I stopped transferring stuff. However, at least some could be added easily - if there is demand.

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/oscar-system/Singular.jl/issues/429#issuecomment-840250507

jtyard commented 3 years ago

Thanks. homogeneous_component(R,a) is not quite working as I would expect. For instance,

G = abelian_group([0,2])
R, _ = PolynomialRing(QQ,2)
RG = grade(R,[G([1,1]),G([1,0])])
homogenous_component(RG,G([2,0]))

returns

(RG_[2 0] of dim 1, Map from
RG_[2 0] of dim 1 to RG defined by a julia-function with inverse
)

when it should really have dimension 2 (x1^2 and x2^2 span the component). Also, assert(fl) is failing when there is nothing of a given degree, e.g. in the simpler case

G = abelian_group([0,2])
R, _ = PolynomialRing(QQ,1)
RG = grade(R,[G([1,1])])
homogenous_component(RG,G([3,0]))
fieker commented 3 years ago

On Mon, May 17, 2021 at 12:38:07PM -0700, Jon Yard wrote:

Thanks. homogeneous_component(R,a) is not quite working as I would expect. For instance,

G = abelian_group([0,2])
R, _ = PolynomialRing(QQ,2)
RG = grade(R,[G([1,1]),G([1,0])])
homogenous_component(RG,G([2,0]))

returns

(RG_[2 0] of dim 1, Map from
RG_[2 0] of dim 1 to RG defined by a julia-function with inverse
)

when it should really have dimension 2 (x1^2 and x2^2 span the component). Also, assert(fl) is failing when there is nothing of a given degree, e.g. in the simpler case

G = abelian_group([0,2])
R, _ = PolynomialRing(QQ,1)
RG = grade(R,[G([1,1])])
homogenous_component(RG,G([3,0]))

Thanks! While trying to debug this, it finally dawned on me why there is a problem: as a QQ-Module, due to torsion, this is not fin. generated. As a module I first need to create the deg-0-subring and then return a module over that. When this was written, the infrastructure for this was missing... Is this s.th. that would be useful? Or would an error be sufficient? I allowed grading-with-torsion as I was assured there is an application. So far I don't have this. So: if this is useful, I can extend this to return a graded module over the deg-0-subring...(at least I think I have enough infrastructure for this).

What do you need? Would like? What functions in what form are useful for gradings-with-torsion?

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/oscar-system/Singular.jl/issues/429#issuecomment-842580692

fingolfin commented 2 years ago

What's the status of this issue?

tthsqe12 commented 2 years ago

I am going to close this by saying that misbehaving library procs are not going to be supported by Singular.jl.