Opened 10 years ago

Closed 8 years ago

#13570 closed PLEASE CHANGE (invalid)

Matrix Entries Can Be Callable Objects not tested

Reported by: startakovsky 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 jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:2 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:3 in reply to: ↑ description Changed 8 years ago by mmezzarobba

  • Component changed from PLEASE CHANGE to linear algebra
  • Milestone changed from sage-6.2 to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_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 8 years ago by mmezzarobba (previous) (diff)

comment:4 Changed 8 years ago by startakovsky

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 8 years ago by aapitzsch

  • Status changed from needs_review to positive_review

comment:6 Changed 8 years ago by vbraun

  • Resolution set to invalid
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.