#7723: Sparse matrices for double fields
------------------------------+---------------------------------------------
Reporter: dagss | Owner: jkantor
Type: enhancement | Status: needs_work
Priority: major | Milestone: sage-feature
Component: linear algebra | Keywords:
Work_issues: | Author: Dag Sverre Seljebotn
Upstream: N/A | Reviewer:
Merged: |
------------------------------+---------------------------------------------
Changes (by was):
* status: needs_review => needs_work
Comment:
REFEREE REPORT:
* trac_7723-generic_multiply.patch:
Looks good, except there is a missing word "have" in this documentation:
{{{
3485 The matrices should both the same base ring and either
both
3486 should be dense or both sparse.
}}}
This doesn't cause any doctest failures, and factoring this code out is a
good idea.
* trac_7723-double_sparse.patch
Looks good.
* trac_7723-coo_format.patch
This causes a bunch of doctest failures:
{{{
wst...@sage:~/build/referee/sage-4.3.rc0$ sage -t
devel/sage/sage/matrix/matrix_integer_2x2.pyx # 5 doctests failed
sage -t "devel/sage/sage/matrix/matrix_integer_2x2.pyx"
**********************************************************************
File
"/scratch/wstein/build/referee/sage-4.3.rc0/devel/sage/sage/matrix/matrix_integer_2x2.pyx",
line 266:
sage: m.__iter__()
Expected:
<listiterator object at ...>
Got:
<generator object row_iterator at 0x3ddab90>
**********************************************************************
File
"/scratch/wstein/build/referee/sage-4.3.rc0/devel/sage/sage/matrix/matrix_integer_2x2.pyx",
line 397:
sage: m.__invert__unit()
Exception raised:
Traceback (most recent call last):
File
"/scratch/wstein/build/referee/sage-4.3.rc0/local/bin/ncadoctest.py", line
1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File
"/scratch/wstein/build/referee/sage-4.3.rc0/local/bin/sagedoctest.py",
line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename,
compileflags)
File
"/scratch/wstein/build/referee/sage-4.3.rc0/local/bin/ncadoctest.py", line
1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_19[4]>", line 1, in <module>
m.__invert__unit()###line 397:
sage: m.__invert__unit()
AttributeError: 'sage.matrix.matrix_integer_dense.Matrix_integer_de'
object has no attribute '__invert__unit'
**********************************************************************
File
"/scratch/wstein/build/referee/sage-4.3.rc0/devel/sage/sage/matrix/matrix_integer_2x2.pyx",
line 400:
sage: type(m.__invert__unit())
Exception raised:
Traceback (most recent call last):
File
"/scratch/wstein/build/referee/sage-4.3.rc0/local/bin/ncadoctest.py", line
1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File
"/scratch/wstein/build/referee/sage-4.3.rc0/local/bin/sagedoctest.py",
line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename,
compileflags)
File
"/scratch/wstein/build/referee/sage-4.3.rc0/local/bin/ncadoctest.py", line
1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_19[5]>", line 1, in <module>
type(m.__invert__unit())###line 400:
sage: type(m.__invert__unit())
AttributeError: 'sage.matrix.matrix_integer_dense.Matrix_integer_de'
object has no attribute '__invert__unit'
**********************************************************************
File
"/scratch/wstein/build/referee/sage-4.3.rc0/devel/sage/sage/matrix/matrix_integer_2x2.pyx",
line 407:
sage: m.__invert__unit() == m^-1
Exception raised:
Traceback (most recent call last):
File
"/scratch/wstein/build/referee/sage-4.3.rc0/local/bin/ncadoctest.py", line
1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File
"/scratch/wstein/build/referee/sage-4.3.rc0/local/bin/sagedoctest.py",
line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename,
compileflags)
File
"/scratch/wstein/build/referee/sage-4.3.rc0/local/bin/ncadoctest.py", line
1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_19[8]>", line 1, in <module>
m.__invert__unit() == m**-Integer(1)###line 407:
sage: m.__invert__unit() == m^-1
AttributeError: 'sage.matrix.matrix_integer_dense.Matrix_integer_de'
object has no attribute '__invert__unit'
**********************************************************************
File
"/scratch/wstein/build/referee/sage-4.3.rc0/devel/sage/sage/matrix/matrix_integer_2x2.pyx",
line 409:
sage: M([2,0,0,2]).__invert__unit()
Expected:
Traceback (most recent call last):
...
ZeroDivisionError: Not a unit!
Got:
Traceback (most recent call last):
File
"/scratch/wstein/build/referee/sage-4.3.rc0/local/bin/ncadoctest.py", line
1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File
"/scratch/wstein/build/referee/sage-4.3.rc0/local/bin/sagedoctest.py",
line 38, in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename,
compileflags)
File
"/scratch/wstein/build/referee/sage-4.3.rc0/local/bin/ncadoctest.py", line
1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_19[9]>", line 1, in <module>
M([Integer(2),Integer(0),Integer(0),Integer(2)]).__invert__unit()###line
409:
sage: M([2,0,0,2]).__invert__unit()
AttributeError: 'sage.matrix.matrix_integer_dense.Matrix_integer_de'
object has no attribute '__invert__unit'
**********************************************************************
2 items had failures:
1 of 5 in __main__.example_13
4 of 10 in __main__.example_19
***Test Failed*** 5 failures.
For whitespace errors, see the file
/scratch/wstein/sage//tmp/.doctest_matrix_integer_2x2.py
[1.5 s]
exit code: 1024
----------------------------------------------------------------------
The following tests failed:
sage -t "devel/sage/sage/matrix/matrix_integer_2x2.pyx"
Total time for all tests: 1.5 seconds
}}}
I noticed a *massive* performance regression as a result of your patches:
{{{
OLD SAGE:
sage: s = random_matrix(RDF,100)
sage: time t =s*s
CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
Wall time: 0.15 s
WITH YOUR PATCHES:
sage: s = random_matrix(RDF,100)
sage: time t =s*s
CPU times: user 0.91 s, sys: 0.00 s, total: 0.91 s
Wall time: 0.91 s
}}}
Ouch. These are both dense matrices. There must be something that got
seriously messed up with re-factoring?
* Why is there a backslash here in {{{matrix_double_sparse.pyx}}}:
{{{
either as a single list of length ``nrows\*ncols``, or as a
}}}
---
Overall I'm very happy and excited about this patch!! I'm really, really
glad you're working on this, and would like to do anything I can to
encourage this. It is critically valuable to the Sage project to get much
better numerical sparse matrix support.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7723#comment:3>
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.