[sage-combinat-devel] Re: fast vector partitions algorithm

2020-02-22 Thread Denis Sunko


On Thursday, February 20, 2020 at 2:13:23 PM UTC+1, Denis Sunko wrote:
>
>
>
> On Thursday, February 20, 2020 at 2:46:37 AM UTC+1, Travis Scrimshaw wrote:
>>
>>
>>
>>> there is nothing wrong with pushing a non-working branch somewhere.
>>> This way it's very easy to see what's going wrong there.
>>> (I guess it's something to do with importing things)
>>>
>>
>> Also linking it to the ticket by filling out the branch field there.
>>
>> Best,
>> Travis
>>
>
> Did all that, thanks to everyone for the quick replies.
>
> Looking forward to comments on the code,
>
> Denis
>
>
Code has progressed very much, thanks to the help I got on the ticket. Now 
something funny is happening with the patchbots, can anyone have a quick 
look and maybe comment?

Thanks in advance,

Denis

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/722b6e55-714f-4056-99b7-90c6c35856b4%40googlegroups.com.


[sage-combinat-devel] Re: fast vector partitions algorithm

2020-02-20 Thread Denis Sunko


On Thursday, February 20, 2020 at 2:46:37 AM UTC+1, Travis Scrimshaw wrote:
>
>
>
>> there is nothing wrong with pushing a non-working branch somewhere.
>> This way it's very easy to see what's going wrong there.
>> (I guess it's something to do with importing things)
>>
>
> Also linking it to the ticket by filling out the branch field there.
>
> Best,
> Travis
>

Did all that, thanks to everyone for the quick replies.

Looking forward to comments on the code,

Denis


 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/006f9bb2-2c60-48c5-b6b1-92c8dddcc3a4%40googlegroups.com.


[sage-combinat-devel] Re: fast vector partitions algorithm

2020-02-19 Thread Travis Scrimshaw


>
>> I have opened a trac ticket  
>> now. Unfortunately something weird is happening with my local git branch. I 
>> have copied a file fast_vector_partitions.py with all the source code (it 
>> works in ordinary Python with 'import fast_vector_partitions') and 
>> recompiled Sage under this branch, which I call fast_vector_partitions (the 
>> head is local, no connection to the trac server yet). 
>>
>> Problem: after rebuilding Sage under this branch I cannot use the 
>> functions in the file under the sage prompt - the function name is 
>> "undefined". I did both ./sage -br and make, several times.
>>
>> I can see that something happened in the build because the file has 
>> migrated from src/sage (where I put it) to src/build and local/lib, and 
>> a .pyc file has appeared:
>>
>> $ find . -name "*fast_vector*"
>> ./src/build/lib.linux-x86_64-3.7/sage/combinat/fast_vector_partitions.py
>> ./src/sage/combinat/fast_vector_partitions.py
>>
>> ./local/lib/python3.7/site-packages/sage/combinat/fast_vector_partitions.py
>>
>> ./local/lib/python3.7/site-packages/sage/combinat/__pycache__/fast_vector_partitions.cpython-37.pyc
>> ./.git/logs/refs/heads/fast_vector_partitions
>> ./.git/refs/heads/fast_vector_partitions
>>
>> I hesitate to connect this branch with the trac server before figuring 
>> out what is going on. In any case I think I should try the build locally 
>> first.
>>
>
> there is nothing wrong with pushing a non-working branch somewhere.
> This way it's very easy to see what's going wrong there.
> (I guess it's something to do with importing things)
>

Also linking it to the ticket by filling out the branch field there.

Best,
Travis

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/de04b8ee-a78f-44d3-b087-f37c61286da4%40googlegroups.com.


[sage-combinat-devel] Re: fast vector partitions algorithm

2020-02-19 Thread Dima Pasechnik


On Wednesday, February 19, 2020 at 5:50:46 PM UTC+1, Denis Sunko wrote:
>
>
> I have opened a trac ticket  now. 
> Unfortunately something weird is happening with my local git branch. I have 
> copied a file fast_vector_partitions.py with all the source code (it works 
> in ordinary Python with 'import fast_vector_partitions') and recompiled 
> Sage under this branch, which I call fast_vector_partitions (the head is 
> local, no connection to the trac server yet). 
>
> Problem: after rebuilding Sage under this branch I cannot use the 
> functions in the file under the sage prompt - the function name is 
> "undefined". I did both ./sage -br and make, several times.
>
> I can see that something happened in the build because the file has 
> migrated from src/sage (where I put it) to src/build and local/lib, and a 
> .pyc file has appeared:
>
> $ find . -name "*fast_vector*"
> ./src/build/lib.linux-x86_64-3.7/sage/combinat/fast_vector_partitions.py
> ./src/sage/combinat/fast_vector_partitions.py
> ./local/lib/python3.7/site-packages/sage/combinat/fast_vector_partitions.py
>
> ./local/lib/python3.7/site-packages/sage/combinat/__pycache__/fast_vector_partitions.cpython-37.pyc
> ./.git/logs/refs/heads/fast_vector_partitions
> ./.git/refs/heads/fast_vector_partitions
>
> I hesitate to connect this branch with the trac server before figuring out 
> what is going on. In any case I think I should try the build locally first.
>

there is nothing wrong with pushing a non-working branch somewhere.
This way it's very easy to see what's going wrong there.
(I guess it's something to do with importing things)
 

>
> Can anyone please help?
>
> Thanks,
>
> Denis
>
> On Monday, February 10, 2020 at 12:34:40 PM UTC+1, Denis Sunko wrote:
>
>> I have translated the Haskell code for vector partitions 
>> ...
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/632c859b-362a-4c8e-b212-45b69ff90e07%40googlegroups.com.


[sage-combinat-devel] Re: fast vector partitions algorithm

2020-02-19 Thread Denis Sunko

I have opened a trac ticket  now. 
Unfortunately something weird is happening with my local git branch. I have 
copied a file fast_vector_partitions.py with all the source code (it works 
in ordinary Python with 'import fast_vector_partitions') and recompiled 
Sage under this branch, which I call fast_vector_partitions (the head is 
local, no connection to the trac server yet). 

Problem: after rebuilding Sage under this branch I cannot use the functions 
in the file under the sage prompt - the function name is "undefined". I did 
both ./sage -br and make, several times.

I can see that something happened in the build because the file has 
migrated from src/sage (where I put it) to src/build and local/lib, and a 
.pyc file has appeared:

$ find . -name "*fast_vector*"
./src/build/lib.linux-x86_64-3.7/sage/combinat/fast_vector_partitions.py
./src/sage/combinat/fast_vector_partitions.py
./local/lib/python3.7/site-packages/sage/combinat/fast_vector_partitions.py
./local/lib/python3.7/site-packages/sage/combinat/__pycache__/fast_vector_partitions.cpython-37.pyc
./.git/logs/refs/heads/fast_vector_partitions
./.git/refs/heads/fast_vector_partitions

I hesitate to connect this branch with the trac server before figuring out 
what is going on. In any case I think I should try the build locally first.

Can anyone please help?

Thanks,

Denis

On Monday, February 10, 2020 at 12:34:40 PM UTC+1, Denis Sunko wrote:

> I have translated the Haskell code for vector partitions 
> ...
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/26c8ac8e-f505-496f-921c-0935be237f41%40googlegroups.com.


[sage-combinat-devel] Re: fast vector partitions algorithm

2020-02-16 Thread Samuel Lelievre
I forgot to say you need to work on the "develop" branch.

So the steps would be:
 
- open an account on gitlab.com
- connect to gitlab.com
- fork this project:

https://gitlab.com/sagemath/sage/

- modify the "develop" branch in your fork
- send a merge request against the
  "develop" branch of

https://gitlab.com/sagemath/sage/

This will automatically create an associated ticket
on Sage's Trac server, with a branch that has the
changes from your GitLab merge request.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/984dde19-a629-424d-98b5-45d5e4e507ed%40googlegroups.com.


[sage-combinat-devel] Re: fast vector partitions algorithm

2020-02-16 Thread Samuel Lelievre
Thu 2020-02-13 19:29:57 UTC, Denis Sunko:
>
> I read some of the developer's guide but it all seemed
> rather intimidating, especially for a small change.

Alternatively to pushing a branch to Sage's Trac server,
you can 

- open an account on gitlab.com
- fork this project on GitLab

https://gitlab.com/sagemath/sage/

- modify your fork and send a merge request.

This will automatically create an associated ticket
on Sage's Trac server.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/0854aad7-940a-4568-b7f3-ecbc62b3bd26%40googlegroups.com.


[sage-combinat-devel] Re: fast vector partitions algorithm

2020-02-13 Thread Travis Scrimshaw


Thanks to everybody for the friendly replies.
>
> I could paste the code right here, is that the proper way to do it? How is 
> the license transferred to Sage?
>

The way to submit code is to push a git branch to our trac server and then 
update the ticket to include that branch name under the branch field. For 
more, see

http://doc.sagemath.org/html/en/developer/manual_git.html


> I have a trac account because I once contributed a small bugfix 
>  but nothing happened with it, so 
> it seems like i don't understand how the system works.
>

You need someone to see the ticket, and from the title and status, it was 
not clear that there is a fix proposed. Your proposed fix should be turned 
into a git branch as well, and you should also add a doctest showing it is 
fixed (specifically, the example in the description).

>
> I read some of the developer's guide but it all seemed rather 
> intimidating, especially for a small change. I have been programming as 
> part of research, but only my own code, never collaborative projects.
>
> I will repost to sage-devel. Any further advice is welcome.
>

I don't see the need to do that here since you have gotten some attention 
for your proposal. However, future posts might be better relegated to 
sage-devel as this is not as active of a mailing list as it used to be. 
Feel free to ask here or on sage-devel (maybe sage-support?) or on the 
tickets if you have any questions. You can cc me "tscrim" on them as well.

Best,
Travis

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/d9eb60de-b00a-43a5-a84d-7a51dbcaaf59%40googlegroups.com.


[sage-combinat-devel] Re: fast vector partitions algorithm

2020-02-13 Thread Denis Sunko
Thanks to everybody for the friendly replies.

I could paste the code right here, is that the proper way to do it? How is 
the license transferred to Sage?

I have a trac account because I once contributed a small bugfix 
 but nothing happened with it, so 
it seems like i don't understand how the system works.

I read some of the developer's guide but it all seemed rather intimidating, 
especially for a small change. I have been programming as part of research, 
but only my own code, never collaborative projects.

I will repost to sage-devel. Any further advice is welcome.

Denis

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/bf4ee717-661b-49fb-b036-f70eb80ef14f%40googlegroups.com.


[sage-combinat-devel] Re: fast vector partitions algorithm

2020-02-13 Thread Travis Scrimshaw
Hi Denis,
   That is great that it can have a faster implementation. Do you have the 
code available for us somewhere? Some thing to also note is that 
VectorPartitions creates a Sage Element instance instead of a simple Pyhton 
list, which has extra overhead. However, this should not account for most 
of the difference between the two timings I believe. Dealing with the min 
should be straight-forward; worst case is we just fallback to the current 
implementation. We might even be able to get it faster with Cythonizing it.

As Simon said, I would just insert it directly into the Sage source code.

Best,
Travis


On Monday, February 10, 2020 at 9:34:40 PM UTC+10, Denis Sunko wrote:
>
> I have translated the Haskell code for vector partitions by M. C. Er, The 
> Computer Journal, Vol. 31, 1988, 283-284, into Python (2 or 3, stand-alone 
> file with 60 lines total).
>
> The code works significantly faster than the Sage implementation:
>
> ┌┐
> │ SageMath version 9.0, Release Date: 2020-01-01 │
> │ Using Python 3.7.3. Type "help()" for help.│
> └┘
> sage: import vpartitions
> sage: %time myvparts=vpartitions.vPartitionso([6,6,6])
> CPU times: user 9.13 s, sys: 89.8 ms, total: 9.22 s
> Wall time: 9.22 s
> sage: %time sagevparts=list(VectorPartitions([6,6,6]))
> CPU times: user 2min 10s, sys: 177 ms, total: 2min 10s
> Wall time: 2min 10s
> sage: myvparts[::-1]==sagevparts
> True
>
> If someone would take over the job of contributing this code to Sage, I 
> would be glad to help. There are a few caveats:
>
> 1) the code is recursive;
> 2) there is no "min" option like in the Sage implementation.
>
> I do not know how difficult (or necessary) it would be to address these 
> points.
>
> Of course, anyone can take it up straight from Er's paper instead, I won't 
> be jealous:)
>
> Cheers,
>
> Denis
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/45509e06-9672-47c8-be92-7a1a52d36287%40googlegroups.com.


[sage-combinat-devel] Re: fast vector partitions algorithm

2020-02-13 Thread Simon King
PS:

Sorry, I just notice that you did answer my question: It is 60 lines of
python code. That shouldn't be a problem to include in the Sage library
(i.e., in relevant parts of src/sage/..., maybe in the same location
than the current implementation.

Do you have a trac account?

Best regards,
Simon

On 2020-02-13, Simon King  wrote:
> Hi Denis,
>
> in the past, sage-combinat-devel was a very active list and certainly
> the topic of your post fits well, but it seems to me that it would be a
> good idea to re-post on sage-devel.
>
> Did you read the developer's guide?
>  
> Certainly people could help you contributing the code. In particular if
> the code is written in Python or Cython, it would probably be easy to
> fit it into src/sage/...
>
> Or is it an external package? Then it would of course be nice to have
> code in the sage library that makes use of the external package. Note
> that at least in the beginning, a new package would be optional.
>
> Concerning the "min" option: At least for now, the old code in Sage
> would not be removed. So, even with your package installed, one could
> easily make it so that the old code is used when the user requests the
> "min" option.
>
> Best regards,
> Simon
>
> On 2020-02-10, Denis Sunko  wrote:
>> I have translated the Haskell code for vector partitions by M. C. Err, The 
>> Computer Journal, Vol. 31, 1988, 283-284, into Python (2 or 3, stand-alone 
>> file with 60 lines total).
>>
>> The code works significantly faster than the Sage implementation:
>>
>> ┌┐
>> │ SageMath version 9.0, Release Date: 2020-01-01 │
>> │ Using Python 3.7.3. Type "help()" for help.│
>> └┘
>> sage: import vpartitions
>> sage: %time myvparts=vpartitions.vPartitionso([6,6,6])
>> CPU times: user 9.13 s, sys: 89.8 ms, total: 9.22 s
>> Wall time: 9.22 s
>> sage: %time sagevparts=list(VectorPartitions([6,6,6]))
>> CPU times: user 2min 10s, sys: 177 ms, total: 2min 10s
>> Wall time: 2min 10s
>> sage: myvparts[::-1]==sagevparts
>> True
>>
>> If someone would take over the job of contributing this code to Sage, I 
>> would be glad to help. There are a few caveats:
>>
>> 1) the code is recursive;
>> 2) there is no "min" option like in the Sage implementation.
>>
>> I do not know how difficult (or necessary) it would be to address these 
>> points.
>>
>> Of course, anyone can take it up straight from Err's paper instead, I won't 
>> be jealous:)
>>
>> Cheers,
>>
>> Denis
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/r23999%24ph9%241%40ciao.gmane.io.


[sage-combinat-devel] Re: fast vector partitions algorithm

2020-02-13 Thread Simon King
Hi Denis,

in the past, sage-combinat-devel was a very active list and certainly
the topic of your post fits well, but it seems to me that it would be a
good idea to re-post on sage-devel.

Did you read the developer's guide?
 
Certainly people could help you contributing the code. In particular if
the code is written in Python or Cython, it would probably be easy to
fit it into src/sage/...

Or is it an external package? Then it would of course be nice to have
code in the sage library that makes use of the external package. Note
that at least in the beginning, a new package would be optional.

Concerning the "min" option: At least for now, the old code in Sage
would not be removed. So, even with your package installed, one could
easily make it so that the old code is used when the user requests the
"min" option.

Best regards,
Simon

On 2020-02-10, Denis Sunko  wrote:
> I have translated the Haskell code for vector partitions by M. C. Err, The 
> Computer Journal, Vol. 31, 1988, 283-284, into Python (2 or 3, stand-alone 
> file with 60 lines total).
>
> The code works significantly faster than the Sage implementation:
>
> ┌┐
> │ SageMath version 9.0, Release Date: 2020-01-01 │
> │ Using Python 3.7.3. Type "help()" for help.│
> └┘
> sage: import vpartitions
> sage: %time myvparts=vpartitions.vPartitionso([6,6,6])
> CPU times: user 9.13 s, sys: 89.8 ms, total: 9.22 s
> Wall time: 9.22 s
> sage: %time sagevparts=list(VectorPartitions([6,6,6]))
> CPU times: user 2min 10s, sys: 177 ms, total: 2min 10s
> Wall time: 2min 10s
> sage: myvparts[::-1]==sagevparts
> True
>
> If someone would take over the job of contributing this code to Sage, I 
> would be glad to help. There are a few caveats:
>
> 1) the code is recursive;
> 2) there is no "min" option like in the Sage implementation.
>
> I do not know how difficult (or necessary) it would be to address these 
> points.
>
> Of course, anyone can take it up straight from Err's paper instead, I won't 
> be jealous:)
>
> Cheers,
>
> Denis
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/r23952%243jri%241%40ciao.gmane.io.