Opened 11 years ago
Last modified 2 months ago
#10116 new defect
norm method does not work for sparse matrices
Reported by: | victor | Owned by: | jason, was |
---|---|---|---|
Priority: | major | Milestone: | sage-6.4 |
Component: | linear algebra | Keywords: | matrices |
Cc: | mjo | Merged in: | |
Authors: | Victor Miller | Reviewers: | |
Report Upstream: | Reported upstream. No feedback yet. | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
sage: M = matrix(ZZ,4,4,sparse=True) sage: M.norm() Traceback (click to the left of this block for traceback) ... AttributeError: 'sage.matrix.matrix_generic_sparse.Matrix_generic_sparse' object has no attribute 'SVD' sage: M.norm(1) Traceback (click to the left of this block for traceback) ... TypeError: base_ring (=Category of objects) must be a ring and similarly for any other argument to norm. When I do sage: M.base_ring() Integer Ring But if I do sage: M = matrix(ZZ,4,4) # without sparse=True everything works ok
Change History (9)
comment:1 Changed 11 years ago by
- Description modified (diff)
comment:2 Changed 11 years ago by
comment:3 Changed 10 years ago by
- Report Upstream changed from Reported upstream. Little or no feedback. to Reported upstream. No feedback yet.
comment:4 Changed 8 years ago by
- Milestone changed from sage-5.11 to sage-5.12
comment:5 Changed 8 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:6 Changed 8 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:7 Changed 7 years ago by
- Milestone changed from sage-6.3 to sage-6.4
comment:8 Changed 2 months ago by
The lack of a sparse SVD can kill this in another way:
sage: A = matrix(RDF, 1, 1, [[1]], sparse=True) sage: A.norm() ... AttributeError: 'sage.matrix.matrix_generic_sparse.Matrix_generic_sparse' object has no attribute 'SVD'
comment:9 Changed 2 months ago by
- Cc mjo added
Note: See
TracTickets for help on using
tickets.
Calculating the Frobenius norm also seems problematic with sparse matrices over higher precision floating point rings. As seen in the example below, sometimes it works and sometimes it doesn't. Note that the Frobenius norm can be calculated without using the SVD.