[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.