Opened 12 years ago

Last modified 12 years ago

#7920 needs_work task

Common numerical matrix base class

Reported by: dagss Owned by: was
Priority: major Milestone:
Component: linear algebra Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


Currently, Matrix_double_dense inherits from Matrix_dense and Matrix_double_sparse from Matrix_sparse. However numerical matrices share a lot compared to other matrices and should probably have a common base class:

  • Docstrings of numerical decompositions should likely be shared
  • solve_right implementation should be shared
  • Even if one matrix uses SuiteSparse? and another LAPACK for making decompositions, the code for using those decompositions to find solutions, and iteratively improve the solutions, can be shared
  • In general, a place to put docstrings and examples with terminology more familiar to numerical users

Luckily, Matrix_dense/sparse offers little in terms of implementation for numerical matrices (the exception is the hash value -- which is useless for numerical matrices anyway, but should be implemented).

In the future, there might be diagonal, Hermitian, triangular, banded etc. matrices, and then it makes even more sense to change the hierarchy, so that sparse/dense isn't a superclass.

So, this ticket should result in:

  • Introduce Matrix_numerical
  • Change the base class of Matrix_double_dense and Matrix_double_sparse to Matrix_numerical
  • A Matrix_numerical.solve_right centered around matrix decompositions

Incidentally, this is likely to result in:

  • A proper pickle implementation for dense double matrices (just pickle the NumPy? array; and read back the dtype on unpickle)
  • Loosing the Matrix_real_double_dense and Matrix_complex_double_dense subclasses -- these serve no real purpose at all, and prevents introducing e.g. efficient dense lower-triangular matrices and so on. (Remember to keep stubs aliased to Matrix_double_dense for unpickling backward compatability)

Attachments (1)

7920-preview.patch (24.4 KB) - added by dagss 12 years ago.

Download all attachments as: .zip

Change History (3)

Changed 12 years ago by dagss

comment:1 Changed 12 years ago by dagss

  • Status changed from new to needs_work

The patch is very much unfinished. There's some stuff that likely belongs to a seperate patch. The interesting part is matrix_numerical.pyx, and the fact that Matrix_double_sparse is "converted" to it as a base class.

comment:2 Changed 12 years ago by dagss

  • Type changed from defect to task
Note: See TracTickets for help on using tickets.