[sage-devel] Re: Current status of possibility of integrating libraries written in Rust into Sage

2024-06-01 Thread Jing Guo


It seems that Dima Pasechnik's replies are not displaying here, so I will 
add them:

*First message:*

*Hi,*

*pyo3 seems to be for calling Python from Rust. You need the opposite, Rust 
from Python, e.g. as described in 
https://bheisler.github.io/post/calling-rust-in-python/ 
.*

*Making a PyPI (pip) package seems to be the most obvious option.*

*With the current (outdated, I think) policies it will not be possible to 
make such a package standard part of Sage (but I am gathering support for 
relaxing these policies - see the thread on standard pip packages - that's 
what would be needed).*

*HTH, Dima*

*Second message:*

*PS. I realised that pyo3 is an option too.*


在2024年6月1日星期六 UTC+2 13:46:14 写道:

> Dear all,
>
> Recently we released a library for counting graph homomorphisms [0] in 
> Sage. Due to performance and parallelism reasons, I was considering the 
> possibility of re-writing some/all of the algorithms in Rust. I found a 
> Rust library called `pyo3` [1] seems to be good for Python-Rust interop.
>
> The latest post I could found is from one year ago [2], so I was wondering 
> what the current status of possibility of integrating libraries written in 
> Rust into Sage? Is the recommended approach still to make it an optional 
> package? For instance, what I have something in mind is like `addcombq` [3] 
> -- a Rust library which is callable from Sage/Python.
>
> Many thanks!
>
> Jing
>
> [0]: https://github.com/guojing0/count-graph-homs
> [1]: https://github.com/PyO3/pyo3
> [2]: https://groups.google.com/g/sage-devel/c/OpBIfmbOlPA/m/hFKTdyE4CgAJ
> [3]: https://github.com/Torrencem/addcombq
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/7a431a60-0d3b-44c9-a7c1-8b2daf63cf20n%40googlegroups.com.


[sage-devel] Current status of possibility of integrating libraries written in Rust into Sage

2024-06-01 Thread Jing Guo
Dear all,

Recently we released a library for counting graph homomorphisms [0] in 
Sage. Due to performance and parallelism reasons, I was considering the 
possibility of re-writing some/all of the algorithms in Rust. I found a 
Rust library called `pyo3` [1] seems to be good for Python-Rust interop.

The latest post I could found is from one year ago [2], so I was wondering 
what the current status of possibility of integrating libraries written in 
Rust into Sage? Is the recommended approach still to make it an optional 
package? For instance, what I have something in mind is like `addcombq` [3] 
-- a Rust library which is callable from Sage/Python.

Many thanks!

Jing

[0]: https://github.com/guojing0/count-graph-homs
[1]: https://github.com/PyO3/pyo3
[2]: https://groups.google.com/g/sage-devel/c/OpBIfmbOlPA/m/hFKTdyE4CgAJ
[3]: https://github.com/Torrencem/addcombq

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/604dc1b9-d5ae-48bc-a181-dd9007ff3082n%40googlegroups.com.


Re: [sage-devel] Re: Standard/Recommended practices for adding codes with third-party libraries into Sage codebase?

2024-05-20 Thread Jing Guo
Thank you for all the advice. I guess for the concurrent one, I probably would 
go with the pip approach.

For Sage specific functions, we use tree decomposition and nice tree 
decomposition, and all other graph functions.

Jing
2024年5月20日 +0200 16:57 Dima Pasechnik ,写道:
> On Mon, May 20, 2024 at 3:43 AM Matthias Koeppe
>  wrote:
> >
> > On Sunday, May 19, 2024 at 12:53:25 PM UTC-7 Jing Guo wrote:
> >
> > In the past few months I have been working on a Sage library for counting 
> > graph homomorphisms: https://github.com/guojing0/count-graph-homs (It's 
> > still updating, hence not 100% complete)
> >
> > In `concurrent_hom_count.py`, I use third-party libraries, such as `numba`, 
> > `dask`, and `numpy`. For numpy, I think it's already in Sage. So I was 
> > wondering what would be the standard/best/recommended practices if I want 
> > to contribute this code to Sage, which I suppose does not support either 
> > `numba` or `dask` (searching in the codebase returns nothing)?
> >
> >
> > It depends on the intended degree of integration into Sage.
> > The loosest integration: Prepare it as a pip-installable package (which 
> > declares its dependencies using the standard Python packaging practices); 
> > then add it as an optional "pip" package to the Sage disitribution.
>
> How exactly is this code using Sage - what are graph Sage-specific
> functions used?
> Tight integration with Sage would need, in the present Sage distro
> model, numbda and dask as its packages, and in particular numba would
> be very tricky, as it needs LLVM.
>
> > See Meta-ticket: Add external user packages as optional/experimental 
> > packages (https://github.com/sagemath/sage/issues/31164) for examples and 
> > pointers to documentation.
> >
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "sage-devel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to sage-devel+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/sage-devel/d29caf89-d6b5-4896-94b1-b4703218e857n%40googlegroups.com.
>
> --
> You received this message because you are subscribed to a topic in the Google 
> Groups "sage-devel" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/sage-devel/L6lp0CSKMR8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/CAAWYfq2ZLpQ-s8eDmwcZUtAccN42UJOYWt_%2B_qJ_v20d8fka4g%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/0306787e-6ca4-40c6-ade9-f0c540625a6f%40Spark.


[sage-devel] Standard/Recommended practices for adding codes with third-party libraries into Sage codebase?

2024-05-19 Thread Jing Guo
Dear all,

In the past few months I have been working on a Sage library for counting 
graph homomorphisms: https://github.com/guojing0/count-graph-homs (It's 
still updating, hence not 100% complete)

In `concurrent_hom_count.py`, I use third-party libraries, such as `numba`, 
`dask`, and `numpy`. For numpy, I think it's already in Sage. So I was 
wondering what would be the standard/best/recommended practices if I want 
to contribute this code to Sage, which I suppose does not support either 
`numba` or `dask` (searching in the codebase returns nothing)?

Thank you!

Jing

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/70e34b93-4664-46d9-8591-72a4d29bb44bn%40googlegroups.com.


Re: [sage-devel] Unable to `load` or `import/cimport` Cython files into Sage while developing

2023-12-31 Thread Jing Guo
It’s fine, I’m not building Sage on Mac anyway.

I used homebrew in the past but it doesn’t support old macOS versions any more. 
Also I find MacPorts to be easier to manage and keep the versions consistent.

Jing
2024年1月1日 +0100 00:16 Dima Pasechnik ,写道:
>
>
> On 31 December 2023 23:05:42 WET, Jing Guo  wrote:
> > Thank you for all your helps. I asked in that GitHub repo and here is the
> > issue: https://github.com/3-manifolds/Sage_macOS/issues/62
> >
> > The reason it does not work is probably caused by my macOS being too old
> > (10.13.6), so `ld` does not recognize `-platform_version` flag. MacPorts
> > does not seem to support `ld` as well. I guess I will try to find other
> > workarounds.
>
> Building Sage with Homebrew is well-supported.
> With MacPorts, no, noone I think managed to build Sage from source using a 
> nontrivial number of MacPorts packages.
> So it's probably a MacPorts problem too.
>
>
>
>
>
> >
> > 在2023年12月28日星期四 UTC+1 08:32:34 写道:
> >
> > > Dear Jing,
> > >
> > > Not being able to use Cython from this sage app is indeed problematic.
> > > However as Dima said this is more a problem of the app rather than a
> > > problem with sage itself. You would better open an issue at
> > > https://github.com/3-manifolds/Sage_macOS. If you do, please post the
> > > link of the issue in this thread.
> > >
> > > Best
> > > Vincent
> > >
> > > On Wed, 27 Dec 2023 at 13:43, Dima Pasechnik  wrote:
> > > >
> > > > On Wed, Dec 27, 2023 at 12:23 PM Jing Guo  wrote:
> > > > >
> > > > > I just did. The following is the new error.
> > > > >
> > > > > ➜ local-hom-count git:(main) ✗ sage
> > > > > ┌┐
> > > > > │ SageMath version 10.2, Release Date: 2023-12-03 │
> > > > > │ Using Python 3.11.1. Type "help()" for help. │
> > > > > └┘
> > > > > sage: load("helper_functions.pyx")
> > > > > Compiling ./helper_functions.pyx...
> > > > >
> > > ---
> > > > > DistutilsExecError Traceback (most recent call last)
> > > > > File
> > > /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/unixccompiler.py:266,
> > > in UnixCCompiler.link(self, target_desc, objects, output_filename,
> > > output_dir, libraries, library_dirs, runtime_library_dirs, export_symbols,
> > > debug, extra_preargs, extra_postargs, build_temp, target_lang)
> > > > > 264 linker = compiler_fixup(linker, ld_args)
> > > > > --> 266 self.spawn(linker + ld_args)
> > > > > 267 except DistutilsExecError as msg:
> > > > >
> > > > > File
> > > /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/ccompiler.py:1041,
> > > in CCompiler.spawn(self, cmd, **kwargs)
> > > > > 1040 def spawn(self, cmd, **kwargs):
> > > > > -> 1041 spawn(cmd, dry_run=self.dry_run, **kwargs)
> > > > >
> > > > > File
> > > /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/spawn.py:70,
> > > in spawn(cmd, search_path, verbose, dry_run, env)
> > > > > 69 cmd = cmd[0]
> > > > > ---> 70 raise DistutilsExecError(
> > > > > 71 "command {!r} failed with exit code {}".format(cmd, exitcode)
> > > > > 72 )
> > > > >
> > > > > DistutilsExecError: command '/usr/bin/gcc' failed with exit code 1
> > > >
> > > > Please check
> > > https://doc.sagemath.org/html/en/installation/index.html#macos
> > > > and note that you re doing development. I.e.
> > > > you are trying to do Sage development in an unsupported environment.
> > > > The app you are using does not come with all the tools needed to
> > > > create Python extensions from Cython (this needs Apple software, which
> > > > one cannot just bundle for copyright reasons).
> > > >
> > > > Having said that, your errors probably indicate that you have an
> > > > outdated XCode/command line tools installed. But I don't know whether
>

Re: [sage-devel] Unable to `load` or `import/cimport` Cython files into Sage while developing

2023-12-31 Thread Jing Guo
Thank you for all your helps. I asked in that GitHub repo and here is the 
issue: https://github.com/3-manifolds/Sage_macOS/issues/62

The reason it does not work is probably caused by my macOS being too old 
(10.13.6), so `ld` does not recognize `-platform_version` flag. MacPorts 
does not seem to support `ld` as well. I guess I will try to find other 
workarounds.

在2023年12月28日星期四 UTC+1 08:32:34 写道:

> Dear Jing,
>
> Not being able to use Cython from this sage app is indeed problematic.
> However as Dima said this is more a problem of the app rather than a
> problem with sage itself. You would better open an issue at
> https://github.com/3-manifolds/Sage_macOS. If you do, please post the
> link of the issue in this thread.
>
> Best
> Vincent
>
> On Wed, 27 Dec 2023 at 13:43, Dima Pasechnik  wrote:
> >
> > On Wed, Dec 27, 2023 at 12:23 PM Jing Guo  wrote:
> > >
> > > I just did. The following is the new error.
> > >
> > > ➜ local-hom-count git:(main) ✗ sage
> > > ┌┐
> > > │ SageMath version 10.2, Release Date: 2023-12-03 │
> > > │ Using Python 3.11.1. Type "help()" for help. │
> > > └┘
> > > sage: load("helper_functions.pyx")
> > > Compiling ./helper_functions.pyx...
> > > 
> ---
> > > DistutilsExecError Traceback (most recent call last)
> > > File 
> /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/unixccompiler.py:266,
>  
> in UnixCCompiler.link(self, target_desc, objects, output_filename, 
> output_dir, libraries, library_dirs, runtime_library_dirs, export_symbols, 
> debug, extra_preargs, extra_postargs, build_temp, target_lang)
> > > 264 linker = compiler_fixup(linker, ld_args)
> > > --> 266 self.spawn(linker + ld_args)
> > > 267 except DistutilsExecError as msg:
> > >
> > > File 
> /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/ccompiler.py:1041,
>  
> in CCompiler.spawn(self, cmd, **kwargs)
> > > 1040 def spawn(self, cmd, **kwargs):
> > > -> 1041 spawn(cmd, dry_run=self.dry_run, **kwargs)
> > >
> > > File 
> /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/spawn.py:70,
>  
> in spawn(cmd, search_path, verbose, dry_run, env)
> > > 69 cmd = cmd[0]
> > > ---> 70 raise DistutilsExecError(
> > > 71 "command {!r} failed with exit code {}".format(cmd, exitcode)
> > > 72 )
> > >
> > > DistutilsExecError: command '/usr/bin/gcc' failed with exit code 1
> >
> > Please check 
> https://doc.sagemath.org/html/en/installation/index.html#macos
> > and note that you re doing development. I.e.
> > you are trying to do Sage development in an unsupported environment.
> > The app you are using does not come with all the tools needed to
> > create Python extensions from Cython (this needs Apple software, which
> > one cannot just bundle for copyright reasons).
> >
> > Having said that, your errors probably indicate that you have an
> > outdated XCode/command line tools installed. But I don't know whether
> > this can be made to work at all, or you really need a different
> > install of Sage for your tasks.
> >
> >
> >
> >
> > >
> > > During handling of the above exception, another exception occurred:
> > >
> > > LinkError Traceback (most recent call last)
> > > File 
> /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/misc/cython.py:454,
>  
> in cython(filename, verbose, compile_message, use_cache, 
> create_local_c_file, annotate, sage_namespace, create_local_so_file)
> > > 453 with redirection(2, errfile, close=False):
> > > --> 454 dist.run_command("build")
> > > 455 finally:
> > >
> > > File 
> /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/dist.py:989,
>  
> in Distribution.run_command(self, command)
> > > 986 # Postpone defaults until all explicit configuration is considered
> > > 987 # (setup() args, config files, command line and plugins)
> > > --> 989 super().run_command(command)
> > >
> > > File 
> /private/va

Re: [sage-devel] Unable to `load` or `import/cimport` Cython files into Sage while developing

2023-12-27 Thread Jing Guo
g = str(msg) + "\n" + distutils_messages
--> 460 raise RuntimeError(msg.strip())
462 if verbose >= 0:
463 sys.stderr.write(distutils_messages)

RuntimeError: command '/usr/bin/gcc' failed with exit code 1
ld: unknown option: -platform_version
clang: error: linker command failed with exit code 1 (use -v to see 
invocation)

在2023年12月27日星期三 UTC+1 10:39:25 写道:

>
>
> On 27 December 2023 01:45:58 WET, Jing Guo  wrote:
> >I downloaded from here https://github.com/3-manifolds/Sage_macOS/releases
> >
> >I was not and am not building Sage on Mac. To clarify, I’m simply 
> “developing” this algorithm locally, though with the intention of 
> submitting it to Sage source code.
>
> It's most probably a bug (or a feature) of this specific app.
>
> It could be that compilers from MacPorts interfere here.
> Try temporarily moving MacPorts away or uninstall it.
>
>
>
> >
> >Jing
> >2023年12月27日 +0100 02:44 Dima Pasechnik ,写道:
> >>
> >>
> >> On 27 December 2023 01:25:30 WET, Jing Guo  wrote:
> >> > Sorry for the confusion. I used Sage downloaded from the website.
> >>
> >> it's not clear what you mean.
> >> We don't distribute Sage binaries, you need to build them.
> >> Please provide more details.
> >>
> >> >
> >> > Gcc was installed with MacPorts.
> >>
> >> gcc (gcc.gnu.org, not Apple's "gcc")
> >> cannot be used to build Sage on macOS.
> >>
> >>
> >> >
> >> > Jing
> >> > 2023年12月27日 +0100 01:54 Dima Pasechnik ,写道:
> >> > > it seems you have gcc in /opt/local - what is it?
> >> > > Not very usual. Normally speaking gcc on macOS is Apple's clang. 
> How have you built (?) Sage?
> >> > >
> >> > >
> >> > >
> >> > > > On 26 December 2023 14:52:23 WET, Jing Guo  
> wrote:
> >> > > > > Dear all,
> >> > > > >
> >> > > > > I have implemented an algorithm related to graph homomorphism 
> counting, and recently I am thinking about improving its performance, so I 
> think of writing some of the modules/codes in Cython.
> >> > > > >
> >> > > > > For instance, I wrote helper functions in 
> `helper_functions.pyx`, which can be imported sucessfully in Python 3, via 
> `from helper_functions import *`.
> >> > > > >
> >> > > > > However, when I run the above command in Sage notebook or Sage, 
> the output reads
> >> > > > >
> >> > > > > sage: import helper_functions
> >> > > > > 
> ---
> >> > > > > ModuleNotFoundError   Traceback (most 
> recent call last)
> >> > > > > Cell In [1], line 1
> >> > > > > > 1 import helper_functions
> >> > > > >
> >> > > > > ModuleNotFoundError: No module named 'helper_functions'
> >> > > > >
> >> > > > > When I try to run `load("helper_functions.pyx")`, it will 
> output a long line of errors (see end of the post).
> >> > > > >
> >> > > > > I searched online for relevant keywords but couldn't find good 
> solutions to these problems. I am on macOS 10.13.6
> >> > > > >
> >> > > > > Thank you for your time!
> >> > > > >
> >> > > > > Jing
> >> > > > >
> >> > > > >
> >> > > > > sage: load("helper_functions.pyx")
> >> > > > > Compiling ./helper_functions.pyx...
> >> > > > > 
> ---
> >> > > > > DistutilsExecErrorTraceback (most 
> recent call last)
> >> > > > > File 
> /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/unixccompiler.py:266,
>  
> in UnixCCompiler.link(self, target_desc, objects, output_filename, 
> output_dir, libraries, library_dirs, runtime_library_dirs, export_symbols, 
> debug, extra_preargs, extra_postargs, build_temp, target_lang)
> >> > > > > 264 linker = compiler_fixup(linker, ld_args)
> >> > > > > --> 266 self.spawn(linker + ld_args)
>

Re: [sage-devel] Unable to `load` or `import/cimport` Cython files into Sage while developing

2023-12-26 Thread Jing Guo
I downloaded from here https://github.com/3-manifolds/Sage_macOS/releases

I was not and am not building Sage on Mac. To clarify, I’m simply “developing” 
this algorithm locally, though with the intention of submitting it to Sage 
source code.

Jing
2023年12月27日 +0100 02:44 Dima Pasechnik ,写道:
>
>
> On 27 December 2023 01:25:30 WET, Jing Guo  wrote:
> > Sorry for the confusion. I used Sage downloaded from the website.
>
> it's not clear what you mean.
> We don't distribute Sage binaries, you need to build them.
> Please provide more details.
>
> >
> > Gcc was installed with MacPorts.
>
> gcc (gcc.gnu.org, not Apple's "gcc")
> cannot be used to build Sage on macOS.
>
>
> >
> > Jing
> > 2023年12月27日 +0100 01:54 Dima Pasechnik ,写道:
> > > it seems you have gcc in /opt/local - what is it?
> > > Not very usual. Normally speaking gcc on macOS is Apple's clang. How have 
> > > you built (?) Sage?
> > >
> > >
> > >
> > > > On 26 December 2023 14:52:23 WET, Jing Guo  wrote:
> > > > > Dear all,
> > > > >
> > > > > I have implemented an algorithm related to graph homomorphism 
> > > > > counting, and recently I am thinking about improving its performance, 
> > > > > so I think of writing some of the modules/codes in Cython.
> > > > >
> > > > > For instance, I wrote helper functions in `helper_functions.pyx`, 
> > > > > which can be imported sucessfully in Python 3, via `from 
> > > > > helper_functions import *`.
> > > > >
> > > > > However, when I run the above command in Sage notebook or Sage, the 
> > > > > output reads
> > > > >
> > > > > sage: import helper_functions
> > > > > ---
> > > > > ModuleNotFoundError                       Traceback (most recent call 
> > > > > last)
> > > > > Cell In [1], line 1
> > > > > > 1 import helper_functions
> > > > >
> > > > > ModuleNotFoundError: No module named 'helper_functions'
> > > > >
> > > > > When I try to run `load("helper_functions.pyx")`, it will output a 
> > > > > long line of errors (see end of the post).
> > > > >
> > > > > I searched online for relevant keywords but couldn't find good 
> > > > > solutions to these problems. I am on macOS 10.13.6
> > > > >
> > > > > Thank you for your time!
> > > > >
> > > > > Jing
> > > > >
> > > > >
> > > > > sage: load("helper_functions.pyx")
> > > > > Compiling ./helper_functions.pyx...
> > > > > ---
> > > > > DistutilsExecError                        Traceback (most recent call 
> > > > > last)
> > > > > File 
> > > > > /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/unixccompiler.py:266,
> > > > >  in UnixCCompiler.link(self, target_desc, objects, output_filename, 
> > > > > output_dir, libraries, library_dirs, runtime_library_dirs, 
> > > > > export_symbols, debug, extra_preargs, extra_postargs, build_temp, 
> > > > > target_lang)
> > > > >     264     linker = compiler_fixup(linker, ld_args)
> > > > > --> 266     self.spawn(linker + ld_args)
> > > > >     267 except DistutilsExecError as msg:
> > > > >
> > > > > File 
> > > > > /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/ccompiler.py:1041,
> > > > >  in CCompiler.spawn(self, cmd, **kwargs)
> > > > >    1040 def spawn(self, cmd, **kwargs):
> > > > > -> 1041     spawn(cmd, dry_run=self.dry_run, **kwargs)
> > > > >
> > > > > File 
> > > > > /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/spawn.py:70,
> > > > >  in spawn(cmd, search_path, verbose, dry_run, env)
> > > > >      69     cmd = cmd[0]
> > > > > ---> 70 raise DistutilsExecError(
> > > > >      71     "command {!r} failed with exit code {}&qu

Re: [sage-devel] Unable to `load` or `import/cimport` Cython files into Sage while developing

2023-12-26 Thread Jing Guo
Sorry for the confusion. I used Sage downloaded from the website.

Gcc was installed with MacPorts.

Jing
2023年12月27日 +0100 01:54 Dima Pasechnik ,写道:
> it seems you have gcc in /opt/local - what is it?
> Not very usual. Normally speaking gcc on macOS is Apple's clang. How have you 
> built (?) Sage?
>
>
>
> > On 26 December 2023 14:52:23 WET, Jing Guo  wrote:
> > > Dear all,
> > >
> > > I have implemented an algorithm related to graph homomorphism counting, 
> > > and recently I am thinking about improving its performance, so I think of 
> > > writing some of the modules/codes in Cython.
> > >
> > > For instance, I wrote helper functions in `helper_functions.pyx`, which 
> > > can be imported sucessfully in Python 3, via `from helper_functions 
> > > import *`.
> > >
> > > However, when I run the above command in Sage notebook or Sage, the 
> > > output reads
> > >
> > > sage: import helper_functions
> > > ---
> > > ModuleNotFoundError                       Traceback (most recent call 
> > > last)
> > > Cell In [1], line 1
> > > > 1 import helper_functions
> > >
> > > ModuleNotFoundError: No module named 'helper_functions'
> > >
> > > When I try to run `load("helper_functions.pyx")`, it will output a long 
> > > line of errors (see end of the post).
> > >
> > > I searched online for relevant keywords but couldn't find good solutions 
> > > to these problems. I am on macOS 10.13.6
> > >
> > > Thank you for your time!
> > >
> > > Jing
> > >
> > >
> > > sage: load("helper_functions.pyx")
> > > Compiling ./helper_functions.pyx...
> > > ---
> > > DistutilsExecError                        Traceback (most recent call 
> > > last)
> > > File 
> > > /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/unixccompiler.py:266,
> > >  in UnixCCompiler.link(self, target_desc, objects, output_filename, 
> > > output_dir, libraries, library_dirs, runtime_library_dirs, 
> > > export_symbols, debug, extra_preargs, extra_postargs, build_temp, 
> > > target_lang)
> > >     264     linker = compiler_fixup(linker, ld_args)
> > > --> 266     self.spawn(linker + ld_args)
> > >     267 except DistutilsExecError as msg:
> > >
> > > File 
> > > /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/ccompiler.py:1041,
> > >  in CCompiler.spawn(self, cmd, **kwargs)
> > >    1040 def spawn(self, cmd, **kwargs):
> > > -> 1041     spawn(cmd, dry_run=self.dry_run, **kwargs)
> > >
> > > File 
> > > /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/spawn.py:70,
> > >  in spawn(cmd, search_path, verbose, dry_run, env)
> > >      69     cmd = cmd[0]
> > > ---> 70 raise DistutilsExecError(
> > >      71     "command {!r} failed with exit code {}".format(cmd, exitcode)
> > >      72 )
> > >
> > > DistutilsExecError: command '/opt/local/bin/gcc' failed with exit code 1
> > >
> > > During handling of the above exception, another exception occurred:
> > >
> > > LinkError                                 Traceback (most recent call 
> > > last)
> > > File 
> > > /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/misc/cython.py:454,
> > >  in cython(filename, verbose, compile_message, use_cache, 
> > > create_local_c_file, annotate, sage_namespace, create_local_so_file)
> > >     453     with redirection(2, errfile, close=False):
> > > --> 454         dist.run_command("build")
> > >     455 finally:
> > >
> > > File 
> > > /private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/dist.py:989,
> > >  in Distribution.run_command(self, command)
> > >     986 # Postpone defaults until all explicit configuration is considered
> > >     987 # (setup() args, config files, command line and plugins)
> > > --> 989 super().run_command(command)
> > >
>

[sage-devel] Unable to `load` or `import/cimport` Cython files into Sage while developing

2023-12-26 Thread Jing Guo
Dear all,

I have implemented an algorithm related to graph homomorphism counting, and 
recently I am thinking about improving its performance, so I think of 
writing some of the modules/codes in Cython.

For instance, I wrote helper functions in `helper_functions.pyx`, which can 
be imported sucessfully in Python 3, via `from helper_functions import *`.

However, when I run the above command in Sage notebook or Sage, the output 
reads







*sage: import 
helper_functions---ModuleNotFoundError
 
  Traceback (most recent call last)Cell In [1], line 
1> 1 import helper_functionsModuleNotFoundError: No module named 
'helper_functions'*

When I try to run `load("helper_functions.pyx")`, it will output a long 
line of errors (see end of the post).

I searched online for relevant keywords but couldn't find good solutions to 
these problems. I am on macOS 10.13.6

Thank you for your time!

Jing


sage: load("helper_functions.pyx")
Compiling ./helper_functions.pyx...
---
DistutilsExecErrorTraceback (most recent call last)
File 
/private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/unixccompiler.py:266,
 
in UnixCCompiler.link(self, target_desc, objects, output_filename, 
output_dir, libraries, library_dirs, runtime_library_dirs, export_symbols, 
debug, extra_preargs, extra_postargs, build_temp, target_lang)
264 linker = compiler_fixup(linker, ld_args)
--> 266 self.spawn(linker + ld_args)
267 except DistutilsExecError as msg:

File 
/private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/ccompiler.py:1041,
 
in CCompiler.spawn(self, cmd, **kwargs)
   1040 def spawn(self, cmd, **kwargs):
-> 1041 spawn(cmd, dry_run=self.dry_run, **kwargs)

File 
/private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/spawn.py:70,
 
in spawn(cmd, search_path, verbose, dry_run, env)
 69 cmd = cmd[0]
---> 70 raise DistutilsExecError(
 71 "command {!r} failed with exit code {}".format(cmd, exitcode)
 72 )

DistutilsExecError: command '/opt/local/bin/gcc' failed with exit code 1

During handling of the above exception, another exception occurred:

LinkError Traceback (most recent call last)
File 
/private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/misc/cython.py:454,
 
in cython(filename, verbose, compile_message, use_cache, 
create_local_c_file, annotate, sage_namespace, create_local_so_file)
453 with redirection(2, errfile, close=False):
--> 454 dist.run_command("build")
455 finally:

File 
/private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/dist.py:989,
 
in Distribution.run_command(self, command)
986 # Postpone defaults until all explicit configuration is considered
987 # (setup() args, config files, command line and plugins)
--> 989 super().run_command(command)

File 
/private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/dist.py:988,
 
in Distribution.run_command(self, command)
987 cmd_obj.ensure_finalized()
--> 988 cmd_obj.run()
989 self.have_run[command] = 1

File 
/private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/command/build.py:131,
 
in build.run(self)
130 for cmd_name in self.get_sub_commands():
--> 131 self.run_command(cmd_name)

File 
/private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/cmd.py:318,
 
in Command.run_command(self, command)
314 """Run some other command: uses the 'run_command()' method of
315 Distribution, which creates and finalizes the command object if
316 necessary and then invokes its 'run()' method.
317 """
--> 318 self.distribution.run_command(command)

File 
/private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/dist.py:989,
 
in Distribution.run_command(self, command)
986 # Postpone defaults until all explicit configuration is considered
987 # (setup() args, config files, command line and plugins)
--> 989 super().run_command(command)

File 
/private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/setuptools/_distutils/dist.py:988,
 
in Distribution.run_command(self, command)
987 cmd_obj.ensure_finalized()
--> 988 cmd_obj.run()
989 self.have_run[command] = 1

File 
/private/var/tmp/sage-10.2-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11

[sage-devel] Re: Ubuntu 22.04, Sage 10.3.beta0: Cannot import sage.all; caanot test due to libflint

2023-12-08 Thread Jing Guo
Issue was resolved. I ran 

make doc-uninstall
make doc-clean
make sagelib-clean sagelib-uninstall
make

I also manually removed it and it was rebuilt later.

在2023年12月7日星期四 UTC+1 15:29:31 写道:

> Dear all,
>
> I have been developing on sage 10.2.rc0, i.e., the latest version prior to 
> 10.3.beta0. I am developing on CoCalc with Ubuntu 22.04.
>
> Since some functions that I helped contribute were recently merged into 
> 10.3.beta0, so I want to develop on this version. However, after I run 
> `./sage -br`, it would say that "Warning: sage.all is not available; this 
> is a limited REPL", see below:
>
> *[sagelib-10.3.beta0] Installed /home/user/github/sage/src*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *[sagelib-10.3.beta0] Successfully installed 
> sagemath-standard-10.3b0[sagelib-10.3.beta0] [sagelib-10.3.beta0] real 
>   0m40.993s[sagelib-10.3.beta0] user   0m20.073s[sagelib-10.3.beta0] 
> sys0m7.142sreal0m44.150suser0m20.326ssys 0m7.398sSage 
> build/upgrade 
> complete!┌┐│
>  
> SageMath version 10.3.beta0, Release Date: 2023-12-05  ││ Using 
> Python 3.10.12. Type "help()" for help. 
>  
> │└┘┏┓┃
>  
> Warning: this is a prerelease version, and it may be unstable. ┃┃ 
> Warning: sage.all is not available; this is a limited REPL.   
>  
> ┃┗┛WARNING:
>  
> your terminal doesn't support cursor position requests (CPR).sage: 1 + 2 + 
> 36*
> *sage: quit*
>
> *Problem 2*: I am trying to implement something related to graph 
> homomorphism counting, and it seems to say that I have something wrong with 
> libflint?
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *~/github/sage$ ./sage -t src/sage/graphs/hom_count.py too few successful 
> tests, not using stored timingsRunning doctests with ID 
> 2023-12-07-14-23-43-1aa9ccc1.Git branch: hom-countGit ref: 
> 10.3.beta0-28-g3eb4878d7aRunning with 
> SAGE_LOCAL='/home/user/github/sage/local' and 
> SAGE_VENV='/home/user/github/sage/local/var/lib/sage/venv-python3.10'Using 
> --optional=debian,pip,sage,sage_spkg,tdlibFeatures to be detected: 
> 4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,cvxopt,cvxopt,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_cubic_hecke,database_jones_numfield,database_knotinfo,dvipng,fpylll,fricas,gap_package_atlasrep,gap_package_design,gap_package_grape,gap_package_guava,gap_package_hap,gap_package_polycyclic,gap_package_qpa,gap_package_quagroup,gfan,graphviz,imagemagick,ipython,jupymake,kenzo,latte_int,lrcalc_python,lrslib,mcqd,meataxe,mpmath,msolve,nauty,networkx,numpy,palp,pandoc,pdf2svg,pdftocairo,pexpect,phitigra,pillow,plantri,polytopes_db,polytopes_db_4d,pplpy,primecountpy,ptyprocess,pynormaliz,pyparsing,python_igraph,requests,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.libs.ecl,sage.libs.flint,sage.libs.gap,sage.libs.linbox,sage.libs.m4ri,sage.libs.ntl,sage.libs.pari,sage.libs.singular,sage.misc.cython,sage.modular,sage.modules,sage.numerical.mip,sage.plot,sage.rings.complex_double,sage.rings.finite_rings,sage.rings.function_field,sage.rings.number_field,sage.rings.padics,sage.rings.polynomial.pbori,sage.rings.real_double,sage.rings.real_mpfr,sage.sat,sage.schemes,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,scipy,singular,sphinx,sympy,tdlibDoctesting
>  
> 1 file.Traceback (most recent call last):  File 
> "/home/user/github/sage/src/bin/sage-runtests", line 162, in 
> err = DC.run()  File "/home/user/github/sage/src/sage/doctest/control.py", 
> line 1540, in runself.run_doctests()  File 
> "/home/user/github/sage/src/sage/doctest/control.py", line 1147, in 
> run_doctestsself.dispatcher = DocTestDispatcher(self)  File 
> "/home/user/github/sage/src/sage/doctest/forker.py", line 1690, in 
> __init__init_sage(controller)  File 
> "/home/user/github/sage/src/sage/doctest/forker.py", line 207, in 
> init_sagecontroller.load_environment()  File 
> "/home/user/github/sage/src/sage/doctest/control.py", line 678, in 
> load_environmentreturn import_module(self.options.environment)  File 
> "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)  File " importlib._bootstrap>", line 1050, in _gcd_import  File " importlib._bootstrap>", line 1027, in _find_and_load  File " importlib._bootstrap>", line 1006, in _find_and_load_unlocked  File 
> "", line 688, in _load_unlocked  File " importlib._bootstrap_external>", line 883, in exec_module  File " importlib._bootstrap>", line 241, in _call_with_frames_removed  File 
> "/home/user/github/sage/src/sage/repl/ipython_kernel/all_jup

[sage-devel] Ubuntu 22.04, Sage 10.3.beta0: Cannot import sage.all; caanot test due to libflint

2023-12-07 Thread Jing Guo
Dear all,

I have been developing on sage 10.2.rc0, i.e., the latest version prior to 
10.3.beta0. I am developing on CoCalc with Ubuntu 22.04.

Since some functions that I helped contribute were recently merged into 
10.3.beta0, so I want to develop on this version. However, after I run 
`./sage -br`, it would say that "Warning: sage.all is not available; this 
is a limited REPL", see below:

*[sagelib-10.3.beta0] Installed /home/user/github/sage/src*





















*[sagelib-10.3.beta0] Successfully installed 
sagemath-standard-10.3b0[sagelib-10.3.beta0] [sagelib-10.3.beta0] real 
  0m40.993s[sagelib-10.3.beta0] user   0m20.073s[sagelib-10.3.beta0] 
sys0m7.142sreal0m44.150suser0m20.326ssys 0m7.398sSage 
build/upgrade 
complete!┌┐│
 
SageMath version 10.3.beta0, Release Date: 2023-12-05  ││ Using 
Python 3.10.12. Type "help()" for help. 
 
│└┘┏┓┃
 
Warning: this is a prerelease version, and it may be unstable. ┃┃ 
Warning: sage.all is not available; this is a limited REPL.   
 
┃┗┛WARNING: 
your terminal doesn't support cursor position requests (CPR).sage: 1 + 2 + 
36*
*sage: quit*

*Problem 2*: I am trying to implement something related to graph 
homomorphism counting, and it seems to say that I have something wrong with 
libflint?















































*~/github/sage$ ./sage -t src/sage/graphs/hom_count.py too few successful 
tests, not using stored timingsRunning doctests with ID 
2023-12-07-14-23-43-1aa9ccc1.Git branch: hom-countGit ref: 
10.3.beta0-28-g3eb4878d7aRunning with 
SAGE_LOCAL='/home/user/github/sage/local' and 
SAGE_VENV='/home/user/github/sage/local/var/lib/sage/venv-python3.10'Using 
--optional=debian,pip,sage,sage_spkg,tdlibFeatures to be detected: 
4ti2,benzene,bliss,buckygen,conway_polynomials,csdp,cvxopt,cvxopt,database_cremona_ellcurve,database_cremona_mini_ellcurve,database_cubic_hecke,database_jones_numfield,database_knotinfo,dvipng,fpylll,fricas,gap_package_atlasrep,gap_package_design,gap_package_grape,gap_package_guava,gap_package_hap,gap_package_polycyclic,gap_package_qpa,gap_package_quagroup,gfan,graphviz,imagemagick,ipython,jupymake,kenzo,latte_int,lrcalc_python,lrslib,mcqd,meataxe,mpmath,msolve,nauty,networkx,numpy,palp,pandoc,pdf2svg,pdftocairo,pexpect,phitigra,pillow,plantri,polytopes_db,polytopes_db_4d,pplpy,primecountpy,ptyprocess,pynormaliz,pyparsing,python_igraph,requests,rubiks,sage.combinat,sage.geometry.polyhedron,sage.graphs,sage.groups,sage.libs.ecl,sage.libs.flint,sage.libs.gap,sage.libs.linbox,sage.libs.m4ri,sage.libs.ntl,sage.libs.pari,sage.libs.singular,sage.misc.cython,sage.modular,sage.modules,sage.numerical.mip,sage.plot,sage.rings.complex_double,sage.rings.finite_rings,sage.rings.function_field,sage.rings.number_field,sage.rings.padics,sage.rings.polynomial.pbori,sage.rings.real_double,sage.rings.real_mpfr,sage.sat,sage.schemes,sage.symbolic,sage_numerical_backends_coin,sagemath_doc_html,scipy,singular,sphinx,sympy,tdlibDoctesting
 
1 file.Traceback (most recent call last):  File 
"/home/user/github/sage/src/bin/sage-runtests", line 162, in 
err = DC.run()  File "/home/user/github/sage/src/sage/doctest/control.py", 
line 1540, in runself.run_doctests()  File 
"/home/user/github/sage/src/sage/doctest/control.py", line 1147, in 
run_doctestsself.dispatcher = DocTestDispatcher(self)  File 
"/home/user/github/sage/src/sage/doctest/forker.py", line 1690, in 
__init__init_sage(controller)  File 
"/home/user/github/sage/src/sage/doctest/forker.py", line 207, in 
init_sagecontroller.load_environment()  File 
"/home/user/github/sage/src/sage/doctest/control.py", line 678, in 
load_environmentreturn import_module(self.options.environment)  File 
"/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)  File "", line 1050, in _gcd_import  File "", line 1027, in _find_and_load  File "", line 1006, in _find_and_load_unlocked  File 
"", line 688, in _load_unlocked  File "", line 883, in exec_module  File "", line 241, in _call_with_frames_removed  File 
"/home/user/github/sage/src/sage/repl/ipython_kernel/all_jupyter.py", line 
5, in from sage.all_cmdline import *  File 
"/home/user/github/sage/src/sage/all_cmdline.py", line 17, in 
from sage.all import *  File "/home/user/github/sage/src/sage/all.py", line 
84, in from sage.rings.all  import *  File 
"/home/user/github/sage/src/sage/rings/all.py", line 55, in 
from sage.rings.number_field.all import *  File 
"/home/user/github/sage/src/sage/rings/number_field/all.py", line 2, in 
from .number_field import (NumberField, NumberF

[sage-devel] Integrating algorithms implemented in C++ and Java into SageMath

2023-10-08 Thread Jing Guo
Dear all,

Some days ago I asked a question [0] here regarding performance of Sage and 
fast graph algorithms.

For a project I am/will be working on, I am thinking about *adding a 
interface/library for homomorphism counting into Sage*, which should be 
helpful for many researchers. This implementation is largely written in C++ 
(including a little CUDA for parallel computation), with some Java code for 
tree decomposition (from the PACE 2017 challenge).

In the Sage developer documentation, it's only written for using external 
libraries [1] and packing third-party codes [2]. There are no results for 
"Java" or "GPU". 

My questions:


*1) What would be a good approach to integrate C++ codes into Sage, via 
Cython? *


*2) In the Sage repo on GitHub, there is no Java files. Is it possible to 
integrate Java into Sage as well, or it would involve some JVM/GraalVM 
issues?*

*3) Homomorphism counting can be slow on very large graphs, so it would 
helpful to use GPU for computation. My plan is to use CPU for computing by 
default, and allow users to enable GPU computing via an optional argument.*

*I couldn't find anything on GitHub Sage repo or the developer 
documentation, so I was wondering are GPU and CUDA currently supported by 
Sage? (In [0], cugraph [3] was also mentioned) If so, what would be the 
recommended approaches here?*

Many thanks.

[0]: https://groups.google.com/g/sage-devel/c/c7wZIrMGqIE
[1]: https://doc.sagemath.org/html/en/developer/coding_in_other.html
[2]: https://doc.sagemath.org/html/en/developer/packaging.html
[3]: https://github.com/rapidsai/cugraph

Jing

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/db20b872-68f8-4543-843f-25364f73584bn%40googlegroups.com.


[sage-devel] Questions about performance of SageMath, and of graph (algorithms) libraries

2023-09-30 Thread Jing Guo
Dear all,

I contributed to algebraic geometry and dynamics parts of SageMath. During 
the process, sometimes the tests could take some time to process, which I 
guess is reasonable, since schemes and other objects can take long time to 
compute.

Today I saw a post [0] on JAX from Hacker News, in which currently the 
first top comment mentions that other than ML research, JAX is also 
suitable for scientific computing, as well as large-scale vectorized 
computations. From the GitHub page [1] of JAX, it seems that it makes use 
of and improves upon Autograd and XLA, hence very fast.

I'm aware that SageMath is already fast for a lot of tasks, so I was 
wondering *would it be possible to make use similar tricks/techniques 
and/or libraries that can make SageMath even faster?*

To give an explicit and specific example, I'm also interested in graph 
algorithms, *without calling libraries written in C/C++ or Julia, is it 
possible to make graph algorithms faster  on very-large graphs with what's 
mentioned above?*

I found the following interesting comparisons of graph algorithms: 
https://www.timlrx.com/blog/benchmark-of-popular-graph-network-packages-v2

Thank you.

[0]: https://news.ycombinator.com/item?id=37698740
[1]: https://github.com/google/jax

Jing

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/35e86100-570e-4d71-acdf-7b166ab27469n%40googlegroups.com.


[sage-devel] "TypeError: Not an element of the order." in multiple places when generalizing `canonical_height` in `projective_ds.py`

2023-08-31 Thread Jing Guo
Dear all,

As part of this year's GSoC, I am trying to generalize `canonical_height` 
from `projective_ds.py` to number fields with unique factorization.

The PR is https://github.com/sagemath/sage/pull/35967

As of now, there are 8 test failures in this PR, one of which is the 
following one

sage: S. = QQ[]
sage: K. = NumberField(z^3-5)
sage: O = K.maximal_order()
sage: P. = ProjectiveSpace(K, 1)
sage: f = DynamicalSystem([x^2 + 3*y^2, v*y^2])
sage: f.canonical_height(P(25*11, 5*v))

I have been trying to debug this in the evening, however, I couldn't get 
very far (in fact this error has bugged me for a few days, even after 
checking relevant documentations), so I was wondering if you could suggest 
anything?

Thank you.

sage: R. = QQ[]
: K. = NumberField(3*x^2 - 1)
: O = K.maximal_order()
: P.=ProjectiveSpace(K,1)
: f=DynamicalSystem([x^2,y^2])
: Q=P(a,2)
: f.canonical_height(Q)
: 
: 
---
TypeError Traceback (most recent call last)
File ~/github/sage/src/sage/structure/sequence.py:450, in 
Sequence_generic.__init__(self, x, universe, check, immutable, cr, cr_str, 
use_sage_types)
449 try:
--> 450 x[i] = universe(x[i])
451 except TypeError:

File ~/github/sage/src/sage/structure/parent.pyx:901, in 
sage.structure.parent.Parent.__call__()
900 if no_extra_args:
--> 901 return mor._call_(x)
902 else:

File ~/github/sage/src/sage/structure/coerce_maps.pyx:163, in 
sage.structure.coerce_maps.DefaultConvertMap_unique._call_()
162 print(type(C._element_constructor), C._element_constructor)
--> 163 raise
164 

File ~/github/sage/src/sage/structure/coerce_maps.pyx:158, in 
sage.structure.coerce_maps.DefaultConvertMap_unique._call_()
157 try:
--> 158 return C._element_constructor(x)
159 except Exception:

File ~/github/sage/src/sage/rings/number_field/order.py:1573, in 
Order_absolute._element_constructor_(self, x)
   1572 if not embedding(x) in self._module_rep:
-> 1573 raise TypeError("Not an element of the order.")
   1574 return self._element_type(self, x)

TypeError: Not an element of the order.

During handling of the above exception, another exception occurred:

TypeError Traceback (most recent call last)
Cell In [1], line 7
  5 f=DynamicalSystem([x**Integer(2),y**Integer(2)])
  6 Q=P(a,Integer(2))
> 7 f.canonical_height(Q)

File 
~/github/sage/src/sage/dynamics/arithmetic_dynamics/projective_ds.py:2428, 
in DynamicalSystem_projective.canonical_height(self, point, **kwds)
   2426 max_order_PS = ProjectiveSpace(O, 1)
   2427 number_field_pt.clear_denominators()
-> 2428 number_field_pt = max_order_PS(number_field_pt)
   2430 x_i = number_field_pt[0]
   2431 y_i = number_field_pt[1]

File ~/github/sage/src/sage/schemes/generic/scheme.py:266, in 
Scheme.__call__(self, *args)
264 return S
265 args = S
--> 266 return self.point(args)

File ~/github/sage/src/sage/schemes/projective/projective_space.py:822, in 
ProjectiveSpace_ring.point(self, v, check)
819 raise ValueError("%s not well defined in dimension > 1" % v)
820 v = [1, 0]
--> 822 return self.point_homset()(v, check=check)

File ~/github/sage/src/sage/schemes/generic/homset.py:279, in 
SchemeHomset_generic.__call__(self, *args, **kwds)
266 r"""
267 Make Hom-sets callable.
268 
   (...)
276 (4, 5)
277 """
278 # Homset (base of HomsetWithBase) overrides __call__ @#$
--> 279 return Set_generic.__call__(self, *args, **kwds)

File ~/github/sage/src/sage/structure/parent.pyx:903, in 
sage.structure.parent.Parent.__call__()
901 return mor._call_(x)
902 else:
--> 903 return mor._call_with_args(x, args, kwds)
904 
905 raise TypeError(_LazyString("No conversion defined from %s to %s", 
(R, self), {}))

File ~/github/sage/src/sage/structure/coerce_maps.pyx:182, in 
sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args()
180 print(type(C), C)
181 print(type(C._element_constructor), C._element_constructor)
--> 182 raise
183 
184 

File ~/github/sage/src/sage/structure/coerce_maps.pyx:172, in 
sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args()
170 return C._element_constructor(x)
171 else:
--> 172 return C._element_constructor(x, **kwds)
173 else:
174 if len(kwds) == 0:

File ~/github/sage/src/sage/schemes/generic/homset.py:656, in 
SchemeHomset_points._element_constructor_(self, *v, **kwds)
654 if len(v) == 1:
655 v = v[0]
--> 656 return self.codomain()._point(self, v, **kwds)

File ~/github/sage/src/sage/schemes/projective/projective_space.py:837, in 
ProjectiveSpace_ring._point(self, *args, **kwds)
824 def _point(self, *args, **kwds):
825 """
826 Construct a point.
827 
   (...)
835 (2

[sage-devel] "TypeError: not a constant polynomial" when trying to fix `normalize_coordinates` in `projective_morphism.py`

2023-06-25 Thread Jing Guo
Hello everyone,

As it is mentioned [here](*https://github.com/sagemath/sage/issues/35797*), 
we are trying to resolve this issue, which is mainly going on in this [PR](
*https://github.com/sagemath/sage/pull/35809*).

One of the questions that we face is that when running the following 
example code (the last test of the docstring):





*sage: R. = QQ[]sage: K. = NumberField(3*x^2 + 1)sage: P. = 
ProjectiveSpace(K, 1)sage: f = DynamicalSystem_projective([a*(z^2 + w^2), 
z*w])sage: f.normalize_coordinates(); f*

We obtain the following error:

> *TypeError: not a constant polynomial*

I did some search online but couldn't find anything helpful, so I was 
wondering if you could give me some hints or ideas?

Thank you!

Jing

---
TypeError Traceback (most recent call last)
Cell In [28], line 5
  3 P = ProjectiveSpace(K, Integer(1), names=('z', 'w',)); (z, w,) = 
P._first_ngens(2)
  4 f = DynamicalSystem_projective([a*(z**Integer(2) + w**Integer(2)), 
z*w])
> 5 f.normalize_coordinates(); f

File ~/github/sage/src/sage/schemes/projective/projective_morphism.py:993, 
in SchemeMorphism_polynomial_projective_space.normalize_coordinates(self, 
**kwds)
991 denom = lcm([self[i].denominator() for i in 
range(len(list(self)))])
992 else:
--> 993 denom = R.ideal(list(self)).absolute_norm().denominator()
995 self.scale_by(denom)
997 # There are cases, such as the example above over GF(7),
998 # where we want to compute GCDs, but NOT in the case
999 # where R is a NumberField of class number > 1.

File ~/github/sage/src/sage/rings/number_field/number_field.py:3632, in 
NumberField_generic.ideal(self, *gens, **kwds)
   3607 """
   3608 Return a fractional ideal of the field, except for the
   3609 zero ideal, which is not a fractional ideal.
   (...)
   3629 Fractional ideal (1)
   3630 """
   3631 try:
-> 3632 return self.fractional_ideal(*gens, **kwds)
   3633 except ValueError:
   3634 return sage.rings.ring.Ring.ideal(self, gens, **kwds)

File ~/github/sage/src/sage/rings/number_field/number_field.py:3749, in 
NumberField_generic.fractional_ideal(self, *gens, **kwds)
   3747 else:
   3748 gens = I.gens()
-> 3749 return self._fractional_ideal_class_()(self, gens, **kwds)

File ~/github/sage/src/sage/rings/number_field/number_field_ideal.py:1814, 
in NumberFieldFractionalIdeal.__init__(self, field, gens, coerce)
   1812 gens = gens[0]
   1813 if misc.exists(gens,bool)[0]:
-> 1814 NumberFieldIdeal.__init__(self, field, gens)
   1815 else:
   1816 raise ValueError("gens must have a nonzero element (zero ideal 
is not a fractional ideal)")

File ~/github/sage/src/sage/rings/number_field/number_field_ideal.py:138, 
in NumberFieldIdeal.__init__(self, field, gens, coerce)
136 if len(gens)==0:
137 raise ValueError("gens must have length at least 1 (zero ideal 
is not a fractional ideal)")
--> 138 Ideal_generic.__init__(self, field, gens, coerce)
139 if field.absolute_degree() == 2:
140 self.quadratic_form = self._quadratic_form

File ~/github/sage/src/sage/rings/ideal.py:274, in 
Ideal_generic.__init__(self, ring, gens, coerce)
272 gens = [gens]
273 if coerce:
--> 274 gens = [ring(x) for x in gens]
276 gens = tuple(gens)
277 if len(gens) == 0:

File ~/github/sage/src/sage/rings/ideal.py:274, in (.0)
272 gens = [gens]
273 if coerce:
--> 274 gens = [ring(x) for x in gens]
276 gens = tuple(gens)
277 if len(gens) == 0:

File ~/github/sage/src/sage/structure/parent.pyx:901, in 
sage.structure.parent.Parent.__call__()
899 if mor is not None:
900 if no_extra_args:
--> 901 return mor._call_(x)
902 else:
903 return mor._call_with_args(x, args, kwds)

File ~/github/sage/src/sage/rings/polynomial/polynomial_element.pyx:12240, 
in 
sage.rings.polynomial.polynomial_element.ConstantPolynomialSection._call_()
  12238 return 
((x).constant_coefficient())
  12239 else:
> 12240 raise TypeError("not a constant polynomial")
  12241 
  12242 cdef class PolynomialBaseringInjection(Morphism):

TypeError: not a constant polynomial

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/3c310f0d-e626-484f-a9be-91d93f67d45cn%40googlegroups.com.


Re: [sage-devel] Develop Sage inside GitHub Codespaces and/or other "cloud" options?

2023-06-04 Thread Jing Guo
Thank you for the info, Tobias. Currently I more or less decided to develop 
Sage on CoCalc. I will check out some of the things you mentioned though.

在2023年6月4日星期日 UTC+2 17:19:43 写道:

> I used github codespaces for sage development for some until since I only 
> had a weak laptop with me. It worked quite well, actually better than 
> gitpod (mainly due to better vscode integration). But you can easily try it 
> out yourself. Just go to 
> https://github.com/codespaces/new?hide_repo_select=true&ref=develop&repo=597660615
>  
> (or use Code > Codespaces from https://github.com/sagemath/sage if the 
> direct link is not working) and create a codespace.  You may need to select 
> the 4 core machine type, otherwise leave the defaults (develop branch and 
> conda devcontainer). We provide prebuilds, so it should only take a min or 
> so until you have a dev environment with fully compiled sage. 
>
> On Saturday, 3 June 2023 at 22:40:15 UTC+8 William Stein wrote:
>
>> On Sat, Jun 3, 2023 at 7:13 AM Jing Guo  wrote:
>>
>>> Thank you, Dima. I just learned that CoCalc also provides dev 
>>> environment setup...
>>>
>>
>> I can also give you a significant free upgrade on cocalc if you want to 
>> use it for sage dev. 
>>
>>
>>> I guess I will try GitPod first then.
>>>
>>> 在2023年6月3日星期六 UTC+2 14:26:01 写道:
>>>
>>>> On Sat, Jun 3, 2023 at 1:19 PM Jing Guo  wrote: 
>>>> > 
>>>> > I have not. I am exploring different options and weighing the 
>>>> pros-and-cons. 
>>>>
>>>> Another option is cocalc.com - although you'd rather pay for 
>>>> subscription, to allow development environments. 
>>>> Apart from this, I am only aware of GitPod and Codespaces. 
>>>> Needless to say, you can also set up a sufficently big VM on a cloud 
>>>> service and use it, but most probably you'd need to pay, 
>>>> as Sage is resource-hungry. 
>>>>
>>>>
>>>> > 
>>>> > 在2023年6月3日星期六 UTC+2 14:01:00 写道: 
>>>> >> 
>>>> >> On Sat, Jun 3, 2023 at 12:16 PM Jing Guo  wrote: 
>>>> >> > 
>>>> >> > Hello everyone, 
>>>> >> > 
>>>> >> > Last year, I developed Sage inside Linux VM (Debian, to be 
>>>> specific) on my old Macbook Pro, so the compiling time was not really 
>>>> good, 
>>>> or was not what it could have been. 
>>>> >> > 
>>>> >> > Recently, I learn that there exist some services like GitHub's 
>>>> Codespaces, which seems to provide develop-and-build environments on their 
>>>> own machines(?). I was wondering that if anyone have had some experience 
>>>> with these services. If so, do you have any recommendations for 
>>>> alternatives other than the GitHub one? Or would you say that the GitHub 
>>>> one is good enough? (Sage documentation seems to suggest GitPod) 
>>>> >> 
>>>> >> Have you tried GitPod? 
>>>> >> 
>>>> >> > 
>>>> >> > Thank you for your time. 
>>>> >> > 
>>>> >> > Jing 
>>>> >> > 
>>>> >> > -- 
>>>> >> > You received this message because you are subscribed to the Google 
>>>> Groups "sage-devel" group. 
>>>> >> > To unsubscribe from this group and stop receiving emails from it, 
>>>> send an email to sage-devel+...@googlegroups.com. 
>>>> >> > To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/sage-devel/686c07aa-a4d5-4f50-88cf-0e30f0e95278n%40googlegroups.com.
>>>>  
>>>>
>>>> > 
>>>> > -- 
>>>> > You received this message because you are subscribed to the Google 
>>>> Groups "sage-devel" group. 
>>>> > To unsubscribe from this group and stop receiving emails from it, 
>>>> send an email to sage-devel+...@googlegroups.com. 
>>>> > To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/sage-devel/60475ea1-a782-4c54-a3dc-a8d1dacc8b53n%40googlegroups.com.
>>>>  
>>>>
>>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "sage-devel" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to sage-devel+...@googlegroups.com.
>>>
>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/sage-devel/6d2df1b1--4820-8817-12a37327f6d7n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/sage-devel/6d2df1b1--4820-8817-12a37327f6d7n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> -- 
>> -- William Stein
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/69285291-5a24-4bb1-b990-e254db32fb34n%40googlegroups.com.


Re: [sage-devel] Develop Sage inside GitHub Codespaces and/or other "cloud" options?

2023-06-03 Thread Jing Guo
Thank you, Dima. I just learned that CoCalc also provides dev environment 
setup...

I guess I will try GitPod first then.

在2023年6月3日星期六 UTC+2 14:26:01 写道:

> On Sat, Jun 3, 2023 at 1:19 PM Jing Guo  wrote:
> >
> > I have not. I am exploring different options and weighing the 
> pros-and-cons.
>
> Another option is cocalc.com - although you'd rather pay for
> subscription, to allow development environments.
> Apart from this, I am only aware of GitPod and Codespaces.
> Needless to say, you can also set up a sufficently big VM on a cloud
> service and use it, but most probably you'd need to pay,
> as Sage is resource-hungry.
>
>
> >
> > 在2023年6月3日星期六 UTC+2 14:01:00 写道:
> >>
> >> On Sat, Jun 3, 2023 at 12:16 PM Jing Guo  wrote:
> >> >
> >> > Hello everyone,
> >> >
> >> > Last year, I developed Sage inside Linux VM (Debian, to be specific) 
> on my old Macbook Pro, so the compiling time was not really good, or was 
> not what it could have been.
> >> >
> >> > Recently, I learn that there exist some services like GitHub's 
> Codespaces, which seems to provide develop-and-build environments on their 
> own machines(?). I was wondering that if anyone have had some experience 
> with these services. If so, do you have any recommendations for 
> alternatives other than the GitHub one? Or would you say that the GitHub 
> one is good enough? (Sage documentation seems to suggest GitPod)
> >>
> >> Have you tried GitPod?
> >>
> >> >
> >> > Thank you for your time.
> >> >
> >> > Jing
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google 
> Groups "sage-devel" group.
> >> > To unsubscribe from this group and stop receiving emails from it, 
> send an email to sage-devel+...@googlegroups.com.
> >> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/686c07aa-a4d5-4f50-88cf-0e30f0e95278n%40googlegroups.com
> .
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "sage-devel" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to sage-devel+...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/60475ea1-a782-4c54-a3dc-a8d1dacc8b53n%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/6d2df1b1--4820-8817-12a37327f6d7n%40googlegroups.com.


Re: [sage-devel] Develop Sage inside GitHub Codespaces and/or other "cloud" options?

2023-06-03 Thread Jing Guo
I have not. I am exploring different options and weighing the pros-and-cons.

在2023年6月3日星期六 UTC+2 14:01:00 写道:

> On Sat, Jun 3, 2023 at 12:16 PM Jing Guo  wrote:
> >
> > Hello everyone,
> >
> > Last year, I developed Sage inside Linux VM (Debian, to be specific) on 
> my old Macbook Pro, so the compiling time was not really good, or was not 
> what it could have been.
> >
> > Recently, I learn that there exist some services like GitHub's 
> Codespaces, which seems to provide develop-and-build environments on their 
> own machines(?). I was wondering that if anyone have had some experience 
> with these services. If so, do you have any recommendations for 
> alternatives other than the GitHub one? Or would you say that the GitHub 
> one is good enough? (Sage documentation seems to suggest GitPod)
>
> Have you tried GitPod?
>
> >
> > Thank you for your time.
> >
> > Jing
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "sage-devel" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to sage-devel+...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/686c07aa-a4d5-4f50-88cf-0e30f0e95278n%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/60475ea1-a782-4c54-a3dc-a8d1dacc8b53n%40googlegroups.com.


[sage-devel] Develop Sage inside GitHub Codespaces and/or other "cloud" options?

2023-06-03 Thread Jing Guo
Hello everyone,

Last year, I developed Sage inside Linux VM (Debian, to be specific) on my 
old Macbook Pro, so the compiling time was not really good, or was not what 
it could have been.

Recently, I learn that there exist some services like GitHub's Codespaces, 
which seems to provide develop-and-build environments on their own 
machines(?). I was wondering that if anyone have had some experience with 
these services. If so, do you have any recommendations for alternatives 
other than the GitHub one? Or would you say that the GitHub one is good 
enough? (Sage documentation seems to suggest GitPod)

Thank you for your time.

Jing

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/686c07aa-a4d5-4f50-88cf-0e30f0e95278n%40googlegroups.com.


Re: [sage-devel] VOTE: move Sage development to Github

2022-09-21 Thread Jing Guo
+1 for Github

在2022年9月22日星期四 UTC+8 06:01:46 写道:

> +1 for Github
>
> Op wo 21 sep. 2022 19:23 schreef David Roe :
>
>> Dear Sage developers,
>> Following extensive discussion, both recently 
>>  
>> (prompted 
>> by issues upgrading the trac server) and over 
>>  the 
>>  
>> last 
>>  
>> decade 
>> , 
>> we are calling a vote on switching Sage development from Trac 
>>  to Github .  We've 
>> created a summary of the pros and cons of each system 
>> , a 
>> description 
>> of the development model to be used on github 
>> , 
>> and a trac ticket  for 
>> coordinating work on the transition.  More work will need to be done to 
>> carry out the actual transition once voting is complete.
>>
>> The voting will last until noon Eastern time (16:00 UTC) on Wednesday, 
>> October 5.  Please use this thread only for sending votes, to make it 
>> easier to count them afterward; there is a parallel thread where you can 
>> make arguments in favor of either system.
>>
>> Finally, I will close with a plea to be involved in this vote and 
>> discussion even if you are not a core Sage developer.  By definition, core 
>> Sage developers have become comfortable with trac, and I think that one of 
>> the major arguments in favor of github is that it will help bring in new 
>> contributors who are not familiar with Sage's development workfow 
>> .  Anyone who has 
>> ever contributed to the Sage code base or who maintains a Sage user package 
>> is welcome to vote.
>> David
>>
>> -- 
>>
> You received this message because you are subscribed to the Google Groups 
>> "sage-devel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to sage-devel+...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-devel/CAChs6_%3DyvZ869L66E1tFmziWDirbawSEABf_uc_j9Dy8VBFW8w%40mail.gmail.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/47a62148-181d-4d76-93da-b0ee74dabd0en%40googlegroups.com.


[sage-devel] Return "type" of the `logarithmic_embedding` function

2022-07-27 Thread Jing Guo
Hi,

I am implementing the `logarithmic_embedding` function [0] (based on 
Krumm's code) for my GSoC project, which is used for implementing 
`points_of_bounded_height` function [1].

However, we encounter the following problem:

By definition (Def. 4.9.6, on page 208 of "A course in computational 
algebraic number theory"), the logarithmic embedding is a map from number 
field K to R^n. We are not sure how this function should return, and we 
consider two options:

1. The function returns a function closure, see examples in [2]

2. It returns a morphism, which is more mathematically correct:

V = VectorSpace(RR, 1)
K = CyclotomicField(3)
B = Hom(K, V, category=Sets())
phi = B(log_map)
phi

Which one do you think is better from math and software engineering 
perspectives? Are there any other approaches that would be better for this 
case?

Thank you.

[0]: https://trac.sagemath.org/ticket/34212
[1]: https://trac.sagemath.org/ticket/32686
[2]: 
https://git.sagemath.org/sage.git/diff?id=8129e332b20c8cd73b50f2e1d48222e7a706ba21

Jing

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/ace5d6d9-22d3-4adf-9cc0-654bbc72c915n%40googlegroups.com.


[sage-devel] Where to put height function for polynomials

2022-06-22 Thread Jing Guo
Hi,

I am contributing to Sage via GSoC this summer. As part of my work, I am 
implementing the (global) height on polynomials for number fields. After 
looking into relevant functions, such as degrees and coefficients, my 
mentors and I think the following three files can be the candidates:



*multi_polynomial_element.py multi_polynomial_libsingular.pyx 
polynomial_element.pyx*

So I was wondering which one of them would be the best place to put *(global) 
height function on polynomials for number fields*?

Thank you for your time.

Relevant Trac ticket: *https://trac.sagemath.org/ticket/33971*

Jing

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/a37e5961-e3f9-49d5-b251-2e7bd5573cf2n%40googlegroups.com.


[sage-devel] Re: Developing for Sage without running "./sage -br" too often?

2022-06-12 Thread Jing Guo
Thank you, Matthias.

After using this, I typed and ran "./sage -br" and for some reason it could 
not build... So I run "make" again and am waiting for it to finish.

在2022年6月12日星期日 UTC+8 02:05:18 写道:

> Use "./configure --enable-editable"
>
>
> https://wiki.sagemath.org/ReleaseTours/sage-9.3#Editable_.28.22in-place.22.2C_.22develop.22.29_installs_of_the_Sage_library
>
> On Saturday, June 11, 2022 at 8:16:28 AM UTC-7 dev@gmail.com wrote:
>
>> Dear all,
>>
>> As it's written in the developer guide [0]:
>>
>> > Once you have made any changes you of course want to build Sage and try 
>> out your edits. As long as you only modified the Sage library (that is, 
>> Python and Cython files under src/sage/...) you just have to run: "./sage 
>> -br"
>>
>> Because of some issues in my old Mac, I need to compile Sage code in my 
>> Debian VM, which implies that sometimes even running "./sage -br" can take 
>> some time.
>>
>> So I was wondering that do you have any advice or suggetions regarding 
>> how one could compile/build newly modified code without having to run 
>> "./sage -br" too often, hence speed up the whole process? (I think I read 
>> in the documentation that Gitpod is one of possible solutions?)
>>
>> Thank you for your time.
>>
>> [0]: https://doc.sagemath.org/html/en/developer/walk_through.html
>>
>> Jing
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/e8eb456a-18ea-4603-94b3-80ec1210230bn%40googlegroups.com.


[sage-devel] Developing for Sage without running "./sage -br" too often?

2022-06-11 Thread Jing Guo
Dear all,

As it's written in the developer guide [0]:

> Once you have made any changes you of course want to build Sage and try 
out your edits. As long as you only modified the Sage library (that is, 
Python and Cython files under src/sage/...) you just have to run: "./sage 
-br"

Because of some issues in my old Mac, I need to compile Sage code in my 
Debian VM, which implies that sometimes even running "./sage -br" can take 
some time.

So I was wondering that do you have any advice or suggetions regarding how 
one could compile/build newly modified code without having to run "./sage 
-br" too often, hence speed up the whole process? (I think I read in the 
documentation that Gitpod is one of possible solutions?)

Thank you for your time.

[0]: https://doc.sagemath.org/html/en/developer/walk_through.html

Jing

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/63eced2f-25a6-4748-9218-37b6946bf78cn%40googlegroups.com.


[sage-devel] Re: Unable to build Sage develop branch on MacOS 10.13.6

2022-04-16 Thread Jing Guo
Thank you, Prof. Koeppe.

I was just wondering that is there another way to resolve this without 
having to "build everything" from scartch again?

在2022年4月16日星期六 UTC+8 01:53:28 写道:

> Using macports is currently untested. I have a branch for macports support 
> in https://trac.sagemath.org/ticket/31505 (which I've just rebased on the 
> current release candidate). Please try with this.
>
>
> On Friday, April 15, 2022 at 5:01:48 AM UTC-7 dev@gmail.com wrote:
>
>> Thank you. I used MacPorts to install `gcc` but after I did some changes, 
>> the problem is now resolved. I installed `libpng` via MacPorts, however, 
>> when I am trying to build, this appears:
>>
>> make --no-print-directory tachyon-SAGE_LOCAL-no-deps
>> [tachyon-0.98.9.p7] Using cached file 
>> /Users/Latisp/github/sage/upstream/tachyon-0.98.9.tar.bz2
>> [tachyon-0.98.9.p7] tachyon-0.98.9.p7
>> [tachyon-0.98.9.p7] 
>> [tachyon-0.98.9.p7] Setting up build directory for tachyon-0.98.9.p7
>> [tachyon-0.98.9.p7] Finished extraction
>> [tachyon-0.98.9.p7] Applying patches from ../patches...
>> [tachyon-0.98.9.p7] Applying ../patches/Make-arch.patch
>> [tachyon-0.98.9.p7] patching file unix/Make-arch
>> [tachyon-0.98.9.p7] Applying ../patches/Make-config.patch
>> [tachyon-0.98.9.p7] patching file unix/Make-config
>> [tachyon-0.98.9.p7] Applying ../patches/Makefile.patch
>> [tachyon-0.98.9.p7] patching file unix/Makefile
>> [tachyon-0.98.9.p7] Applying ../patches/main.c.patch
>> [tachyon-0.98.9.p7] patching file demosrc/main.c
>> [tachyon-0.98.9.p7] 
>> [tachyon-0.98.9.p7] Host system:
>> [tachyon-0.98.9.p7] Darwin jing.local 17.7.0 Darwin Kernel Version 
>> 17.7.0: Fri Oct 30 13:34:27 PDT 2020; 
>> root:xnu-4570.71.82.8~1/RELEASE_X86_64 x86_64
>> [tachyon-0.98.9.p7] 
>> [tachyon-0.98.9.p7] C compiler: gcc
>> [tachyon-0.98.9.p7] C compiler version:
>> [tachyon-0.98.9.p7] Configured with: 
>> --prefix=/Applications/Xcode.app/Contents/Developer/usr 
>> --with-gxx-include-dir=/usr/include/c++/4.2.1
>> [tachyon-0.98.9.p7] Apple LLVM version 10.0.0 (clang-1000.11.45.5)
>> [tachyon-0.98.9.p7] Target: x86_64-apple-darwin17.7.0
>> [tachyon-0.98.9.p7] Thread model: posix
>> [tachyon-0.98.9.p7] InstalledDir: 
>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
>> [tachyon-0.98.9.p7] 
>> [tachyon-0.98.9.p7] Package 'tachyon' is currently not installed
>> [tachyon-0.98.9.p7] No legacy uninstaller found for 'tachyon'; nothing to 
>> do
>> [tachyon-0.98.9.p7] Building tachyon-0.98.9.p7
>> [tachyon-0.98.9.p7] make all \
>> [tachyon-0.98.9.p7] "ARCH = macosx" \
>> [tachyon-0.98.9.p7] "CFLAGS = -Os -ffast-math -DBsd  -DUSEPNG   
>>  -I/Users/Latisp/github/sage/local/include " \
>> [tachyon-0.98.9.p7] "ARFLAGS = r" \
>> [tachyon-0.98.9.p7] "STRIP = strip" \
>> [tachyon-0.98.9.p7] "LIBS = -L. -ltachyon 
>>  -L/Users/Latisp/github/sage/local/lib -lpng -lz "
>> [tachyon-0.98.9.p7] Building Tachyon Parallel Ray Tracing library
>> [tachyon-0.98.9.p7] Copyright 1994-2007, John E. Stone
>> [tachyon-0.98.9.p7] All Rights Reserveed
>> [tachyon-0.98.9.p7] Making architecture directory ../compile/macosx
>> [tachyon-0.98.9.p7] Making library directory ../compile/macosx/libtachyon
>> [tachyon-0.98.9.p7] make ../compile ../compile/macosx 
>> ../compile/macosx/libtachyon  ../compile/macosx/libtachyon.a 
>>  ../compile/macosx/tachyon
>> [tachyon-0.98.9.p7] make[7]: Nothing to be done for `../compile'.
>> [tachyon-0.98.9.p7] make[7]: Nothing to be done for `../compile/macosx'.
>> [tachyon-0.98.9.p7] make[7]: Nothing to be done for 
>> `../compile/macosx/libtachyon'.
>> [tachyon-0.98.9.p7] gcc -Os -ffast-math -DBsd  -DUSEPNG   
>>  -I/Users/Latisp/github/sage/local/include  -c ../src/api.c -o 
>> ../compile/macosx/libtachyon/api.o
>> [tachyon-0.98.9.p7] gcc -Os -ffast-math -DBsd  -DUSEPNG   
>>  -I/Users/Latisp/github/sage/local/include  -c ../src/apigeom.c -o 
>> ../compile/macosx/libtachyon/apigeom.o
>> [tachyon-0.98.9.p7] gcc -Os -ffast-math -DBsd  -DUSEPNG   
>>  -I/Users/Latisp/github/sage/local/include  -c ../src/box.c -o 
>> ../compile/macosx/libtachyon/box.o
>> [tachyon-0.98.9.p7] gcc -Os -ffast-math -DBsd  -DUSEPNG   
>>  -I/Users/Latisp/github/sage/local/include  -c ../src/global.c -o 
>> ../compile/macosx/libtachyon/global.o
>> [tachyon-0.98.9.p7] gcc -Os -ffast-math -DBsd  -DUSEPNG   
>>  -I/Users/Latisp/github/sage/local/include  -c ../src/hash.c -o 
>> ../compile/macosx/libtachyon/hash.o
>> [tachyon-0.98.9.p7] gcc -Os -ffast-math -DBsd  -DUSEPNG   
>>  -I/Users/Latisp/github/sage/local/include  -c ../src/parallel.c -o 
>> ../compile/macosx/libtachyon/parallel.o
>> [tachyon-0.98.9.p7] gcc -Os -ffast-math -DBsd  -DUSEPNG   
>>  -I/Users/Latisp/github/sage/local/include  -c ../src/threads.c -o 
>> ../compile/m