Opened 10 months ago

Closed 8 months ago

#14874 closed defect (fixed)

matrix mutability not same as vectors from rows() mutability

Reported by: tscrim Owned by: tscrim
Priority: major Milestone: sage-5.12
Component: linear algebra Keywords:
Cc: Merged in: sage-5.12.beta1
Authors: Travis Scrimshaw Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by vbraun)

sage: MS = MatrixSpace(GF(2),2,2)
sage: A = MS([1,0,1,1])
sage: A.is_mutable()
True
sage: map(lambda x: x.is_mutable(), A.rows())
[True, True]
sage: A.set_immutable()
sage: map(lambda x: x.is_mutable(), A.rows())
[True, True]
sage: A.rows()[0] = 5
sage: A.rows()
[(1, 0), (1, 1)]
sage: A.rows()[0].set_immutable()
sage: map(lambda x: x.is_mutable(), A.rows())
[False, True]

Same thing happens on columns() as well.

Apply trac_14874-fix_matrix_row_col-ts.patch

Attachments (1)

trac_14874-fix_matrix_row_col-ts.patch (4.3 KB) - added by tscrim 10 months ago.

Download all attachments as: .zip

Change History (6)

comment:1 follow-up: Changed 10 months ago by vbraun

Since the rows / columns are cached they should always be set immutable before returning them.

Changed 10 months ago by tscrim

comment:2 in reply to: ↑ 1 Changed 10 months ago by tscrim

  • Authors set to Travis Scrimshaw
  • Status changed from new to needs_review

Replying to vbraun:

Since the rows / columns are cached they should always be set immutable before returning them.

Good point. I've made it so that the result from rows() and columns() and similar methods always return immutable vectors.

comment:3 Changed 10 months ago by vbraun

  • Reviewers set to Volker Braun
  • Status changed from needs_review to positive_review

Looks good to me!

comment:4 Changed 10 months ago by vbraun

  • Description modified (diff)

comment:5 Changed 8 months ago by jdemeyer

  • Merged in set to sage-5.12.beta1
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.