[sage-devel] Re: matrix constructor signature clash

2015-06-22 Thread 'Martin R' via sage-devel
Am Sonntag, 21. Juni 2015 09:21:31 UTC+2 schrieb Martin R: Am Sonntag, 21. Juni 2015 03:56:43 UTC+2 schrieb Nils Bruin: On Saturday, June 20, 2015 at 3:34:06 PM UTC-7, Martin R wrote: What is the bug here? Do you think matrix(2,3,1) should succeed? Do you think it should produce a

[sage-devel] Re: matrix constructor signature clash

2015-06-21 Thread 'Martin R' via sage-devel
Am Sonntag, 21. Juni 2015 03:56:43 UTC+2 schrieb Nils Bruin: On Saturday, June 20, 2015 at 3:34:06 PM UTC-7, Martin R wrote: What is the bug here? Do you think matrix(2,3,1) should succeed? Do you think it should produce a different error message? No, I think that matrix(nrows, ncols,

Re: [sage-devel] Re: matrix constructor signature clash

2015-06-20 Thread Nils Bruin
On Friday, June 19, 2015 at 5:29:42 PM UTC-7, David Roe wrote: Another option might be to force certain construction paths to use keyword arguments. For example, matrix(4,4,scalar = x+y) matrix(4,4,iterator = x+y) David Indeed, but then: how is this more convenient than the following?

[sage-devel] Re: matrix constructor signature clash

2015-06-20 Thread Nils Bruin
On Saturday, June 20, 2015 at 9:15:06 AM UTC-7, Martin R wrote: I don't understand this. I just traced matrix(2,2,x) and this is handled by _matrix_constructor. I don't see why matrix(2,2,x) needs to return a diagonal matrix. Could you please explain what you mean with matrix(n,n,c) is

[sage-devel] Re: matrix constructor signature clash

2015-06-20 Thread 'Martin R' via sage-devel
The problem with matrix(n,n,c) is that it's actually coming from matrix rings! Scalars should probably coerce in there to make A - 1 work. It's something supported on a level below. I don't understand this. I just traced matrix(2,2,x) and this is handled by _matrix_constructor. I don't

[sage-devel] Re: matrix constructor signature clash

2015-06-20 Thread 'Martin R' via sage-devel
Am Samstag, 20. Juni 2015 18:44:30 UTC+2 schrieb Nils Bruin: On Saturday, June 20, 2015 at 9:15:06 AM UTC-7, Martin R wrote: I don't understand this. I just traced matrix(2,2,x) and this is handled by _matrix_constructor. I don't see why matrix(2,2,x) needs to return a diagonal matrix.

[sage-devel] Re: matrix constructor signature clash

2015-06-20 Thread Nils Bruin
On Saturday, June 20, 2015 at 3:34:06 PM UTC-7, Martin R wrote: What is the bug here? Do you think matrix(2,3,1) should succeed? Do you think it should produce a different error message? No, I think that matrix(nrows, ncols, element) sould fail, unless element is callable or iterable.

Re: [sage-devel] Re: matrix constructor signature clash

2015-06-20 Thread Vincent Delecroix
On 20/06/15 23:21, Nils Bruin wrote: On Saturday, June 20, 2015 at 11:55:02 AM UTC-7, Martin R wrote: Yes, that's quite clear. _matrix_constructor determines nrows (2) and ncols (3) and the ring (Symbolic Ring) and calls matrix_space.MatrixSpace(ring, nrows, ncols)(entries). This fails,

[sage-devel] Re: matrix constructor signature clash

2015-06-20 Thread Nils Bruin
On Saturday, June 20, 2015 at 11:55:02 AM UTC-7, Martin R wrote: Yes, that's quite clear. _matrix_constructor determines nrows (2) and ncols (3) and the ring (Symbolic Ring) and calls matrix_space.MatrixSpace(ring, nrows, ncols)(entries). This fails, since entries is a single element.

[sage-devel] Re: matrix constructor signature clash

2015-06-20 Thread 'Martin R' via sage-devel
Am Samstag, 20. Juni 2015 23:21:21 UTC+2 schrieb Nils Bruin: On Saturday, June 20, 2015 at 11:55:02 AM UTC-7, Martin R wrote: Yes, that's quite clear. _matrix_constructor determines nrows (2) and ncols (3) and the ring (Symbolic Ring) and calls matrix_space.MatrixSpace(ring, nrows,

Re: [sage-devel] Re: matrix constructor signature clash

2015-06-19 Thread David Roe
Another option might be to force certain construction paths to use keyword arguments. For example, matrix(4,4,scalar = x+y) matrix(4,4,iterator = x+y) David On Fri, Jun 19, 2015 at 11:03 AM, Nils Bruin nbr...@sfu.ca wrote: On Friday, June 19, 2015 at 9:10:41 AM UTC-7, Darij Grinberg wrote:

Re: [sage-devel] Re: matrix constructor signature clash

2015-06-19 Thread Nils Bruin
On Wednesday, June 17, 2015 at 7:48:15 AM UTC-7, Darij Grinberg wrote: Unfortunately, currently the ducktyping is not just in the matrix constructor; it is split across the three stations I mentioned (matrix constructor, matrix space, matrix class). Apparently every single of our matrix

Re: [sage-devel] Re: matrix constructor signature clash

2015-06-19 Thread Darij Grinberg
On Fri, Jun 19, 2015 at 5:45 PM, Nils Bruin nbr...@sfu.ca wrote: On Wednesday, June 17, 2015 at 7:48:15 AM UTC-7, Darij Grinberg wrote: Unfortunately, currently the ducktyping is not just in the matrix constructor; it is split across the three stations I mentioned (matrix constructor, matrix

Re: [sage-devel] Re: matrix constructor signature clash

2015-06-19 Thread Nils Bruin
On Friday, June 19, 2015 at 9:10:41 AM UTC-7, Darij Grinberg wrote: Unfortunately, this is invited by the design of sage: The __call__ entry on a parent is the main interface to element construction and since this is conversion, all kinds of wild input are allowed. I think this is

[sage-devel] Re: matrix constructor signature clash

2015-06-17 Thread Darij Grinberg
Hi, On Tuesday, 16 June 2015 20:10:05 UTC+2, Nils Bruin wrote: Tiebreaker needed: We have a whole bunch of ways in which a matrix can be constructed. Some of the possible signatures we support according to the documentation: A) matrix(n,m, callable f) which constructs the n x m matrix

[sage-devel] Re: matrix constructor signature clash

2015-06-17 Thread Nils Bruin
On Wednesday, June 17, 2015 at 5:52:20 AM UTC-7, Darij Grinberg wrote: I have a feeling that at least one reply to this message will try to justify the status quo by claiming that users cannot be expected to go search the doc for the right constructor, that the current syntax is the

Re: [sage-devel] Re: matrix constructor signature clash

2015-06-17 Thread Jeroen Demeyer
Quote of the day :-) On 2015-06-17 14:52, Darij Grinberg wrote: Ducktyping has its limits when the pond is bottomless and has frogs, chameleons, kraken, dead things and horrors unknown. -- You received this message because you are subscribed to the Google Groups sage-devel group. To

Re: [sage-devel] Re: matrix constructor signature clash

2015-06-17 Thread Darij Grinberg
Hi Nils, On Wed, Jun 17, 2015 at 4:37 PM, Nils Bruin nbr...@sfu.ca wrote: On Wednesday, June 17, 2015 at 5:52:20 AM UTC-7, Darij Grinberg wrote: Here is that response then. For the most part, matrix does work nicely and I really appreciate the typing it saves. I think a good interface design