Opened 10 years ago

Closed 9 years ago

#13570 closed PLEASE CHANGE (invalid)

Matrix Entries Can Be Callable Objects not tested

Reported by: Steven Tartakovsky Owned by: tbd
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: linear algebra Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

In the documentation, http://www.sagemath.org/doc/reference/sage/matrix/constructor.html,

it states that matrices can pass in callable objects, though there is no example or test of this here. Is there documentation at least showing a test of this functionality? If not, it probably should be added, if not for the end user, at least to ensure it doesn't break.

In the meanwhile, any tip on getting a matrix like:

['apple', 'frog'] [[3,2] , 3 ]

Change History (6)

comment:1 Changed 9 years ago by Jeroen Demeyer

Milestone: sage-5.11sage-5.12

comment:2 Changed 9 years ago by For batch modifications

Milestone: sage-6.1sage-6.2

comment:3 in reply to:  description Changed 9 years ago by Marc Mezzarobba

Component: PLEASE CHANGElinear algebra
Milestone: sage-6.2sage-duplicate/invalid/wontfix
Status: newneeds_review

Replying to startakovsky:

In the documentation, http://www.sagemath.org/doc/reference/sage/matrix/constructor.html, it states that matrices can pass in callable objects, though there is no example or test of this here. Is there documentation at least showing a test of this functionality?

Yes, there is:

sage: m = matrix(QQ, 3, 3, lambda i, j: i+j); m
[0 1 2]
[1 2 3]
[2 3 4]

In the meanwhile, any tip on getting a matrix like:

['apple', 'frog'] [[3,2] , 3 ]

I don't think there is special support for matrices of callable objects on which multiplication would act as function application, if that is what you are looking for.

Last edited 9 years ago by Marc Mezzarobba (previous) (diff)

comment:4 Changed 9 years ago by Steven Tartakovsky

Thanks. I ended up solving what I needed to solve and ultimately defined class on which there exists multiplication and addition, and that multiplication is cartesian product and addition is disjoint unions, and it works well.

comment:5 Changed 9 years ago by aapitzsch

Status: needs_reviewpositive_review

comment:6 Changed 9 years ago by Volker Braun

Resolution: invalid
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.