#10116: norm method does not work for sparse matrices
------------------------------+---------------------------------------------
Reporter: victor | Owner: jason, was
Type: defect | Status: new
Priority: major | Milestone: sage-4.7
Component: linear algebra | Keywords: matrices
Work_issues: | Upstream: Reported upstream. Little or
no feedback.
Reviewer: | Author: Victor Miller
Merged: | Dependencies:
------------------------------+---------------------------------------------
Comment(by hartke):
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.
{{{
sage: R=RealField(200)
sage: m=10
sage: A=diagonal_matrix(R,range(m))
sage: A.norm('frob')
16.8819430161
sage: A.transpose().norm('frob')
16.8819430161
sage: (A-A.transpose()).norm('frob')
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/desert/hartke/apps/<ipython console> in <module>()
/home/hartke/apps/sage/local/lib/python2.6/site-
packages/sage/matrix/matrix2.so in sage.matrix.matrix2.Matrix.norm
(sage/matrix/matrix2.c:36319)()
/home/hartke/apps/sage/local/lib/python2.6/site-
packages/sage/matrix/matrix_sparse.so in
sage.matrix.matrix_sparse.Matrix_sparse.apply_map
(sage/matrix/matrix_sparse.c:6433)()
/home/hartke/apps/sage/local/lib/python2.6/site-
packages/sage/matrix/matrix_space.pyc in MatrixSpace(base_ring, nrows,
ncols, sparse)
179 """
180 if not base_ring in Rings():
--> 181 raise TypeError("base_ring (=%s) must be a
ring"%base_ring)
182
183 if ncols is None: ncols = nrows
TypeError: base_ring (=Category of objects) must be a ring
sage: type(A)
<type 'sage.matrix.matrix_generic_sparse.Matrix_generic_sparse'>
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10116#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.