Opened 6 years ago

Closed 5 years ago

#13643 closed defect (fixed)

default norm for RDF/CDF matrices is inconsistent with other types of matrices

Reported by: jason Owned by: jason, was
Priority: major Milestone: sage-5.5
Component: linear algebra Keywords:
Cc: rbeezer Merged in: sage-5.5.beta1
Authors: Jason Grout Reviewers: Punarbasu Purkayastha
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:


Currently, the default norm for matrices is the induced 2-norm, unless the matrix is an RDF or CDF matrix, in which case the default norm is the Frobenius norm. Needless to say, this is very confusing:

sage: version()
'Sage Version 5.4.rc1, Release Date: 2012-10-05'
sage: a=matrix(QQ, 3, range(9))
sage: a.norm()
sage: a.norm(2)
sage: b=a.change_ring(RDF)
sage: b.norm()
sage: b.norm('frob')

I propose we change the default norm for RDF/CDF matrices to the induced 2-norm.

Attachments (1)

13643-matrix-norm.patch (2.9 KB) - added by jason 6 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 6 years ago by jason

More info for a decision:

Defaults to Frobenius norm:

Defaults to induced 2-norm:

Changed 6 years ago by jason

comment:2 Changed 6 years ago by jason

  • Status changed from new to needs_review

patch tested on the affected file...

comment:3 Changed 6 years ago by jason

  • Authors set to Jason Grout

comment:4 Changed 6 years ago by ppurka

Patch looks fine to me. Let some more people comment on your email first :)

comment:5 Changed 6 years ago by kcrisman

I don't feel like this is a bad idea at all, given that we are focused more on the Ms than imitating NumPy?, and with the deprecation warning we will hopefully catch any power users. I don't usually do a norm of a matrix myself...

comment:6 Changed 6 years ago by jason

Just FYI, my post to numpy sparked a thread where the reason was uncovered: (in particular, see

comment:7 Changed 5 years ago by jason

I think this has now dropped off the voting on sage-devel, with several positive votes. Can someone review the patch?

comment:8 Changed 5 years ago by ppurka

  • Reviewers set to Punarbasu Purkayastha
  • Status changed from needs_review to positive_review

I had checked it earlier, when I last reviewed it. It was positive review from my side. Patchbot gives a green signal too :)

comment:9 Changed 5 years ago by jdemeyer

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