# Re: sparse matrix support in MathML

From: W Naylor <wn@cs.bath.ac.uk>
Date: Fri, 1 Jun 2007 10:28:20 +0100 (BST)
To: Jason Davis <jasonkarldavis@gmail.com>

Message-ID: <Pine.LNX.4.61.0706010953060.8761@ralph.cs.bath.ac.uk>
```
On Thu, 31 May 2007, Jason Davis wrote:

>
> How wise is it to require specifying every row? You get the benefit of having
> sparse columns, but the markup is still dense in the rows. I would suggest:
>
> <smatrix rows="m" cols="n">
> <smatrixdefault><cn>0</cn></smatrixdefault>
> <smatrixelement row="i" col="j"><cn>5</cn></smatrixelement>
> ...
> </smatrix>

Jason does have a point here, however there are situations where the
matrix will be dense in the number of rows (or columns). The situation I
was dealing with in my project was factorisation by the quadratic sieve
method, here the matrices were dense in the rows, but sparse in the
columns. To address this I made two symbols in the CD at:
http://www.cs.bath.ac.uk/~wn/OpenMath/GENSS/html/cd/linalg6.html
nonZeroRowSparseMatrix and sparseMatrix
the first being for row dense matrices whlst the second for the general
case.

Of course for 'MathML style' markup it wouldn't be necessary to have
separate elements for the different cases, we could just have  an optional
attribute on the enclosing 'smatrix' element which specifies the
sparsity of the matrix.
e.g.
optional attribute:
name = sparsity		permissable values = rowdense/columndense/
this attribute would then determine the admissable content,

thoughts?

Bill

>
> As far as I know, programs like Matlab simply uses a list of (i,j)-
> > value tuples in their sparse matrix implementation (or at least
> makes it appear that way to the user), and this is a direct reflection of it.
>
> -Jason Davis
>
>
> On May 31, 2007, at 9:16 AM, Max Berger wrote:
>
> > Dear David,
> >
> > David Carlisle schrieb:
> > > > - Reuse mtable, mrow, mcolumn (otherwise functionality is
> > > > duplicated).
> > >
> > > wouldn't you want to use content markup rather than presentation for
> > > this?
> >
> > You are right. Assuming display math is for displaying only, and
> > therefore it wouldn't matter to insert numerous extra <mtd>, the
> > original idea of introducing a <smatrix> for content markup seems fine
> > to me. However, I think the ideas of attribute handling are still valid.
> >
> > Here is an idea for the "rest" of the matrix:
> >
> > <smatrix columns="4">
> > <smatrixdefalut><cn>0</cn><smatrixdefault>
> > <smatrixrow>
> > <smatrixelem col="1"><cn>1</cn></smatrixelem>
> > <smatrixelem col="2"><cn>2</cn></smatrixelem>
> > </smatrixrow>
> > <smatrixrow>
> >  <smatrixelem col="4"><cn>3</cn></smatrixelem>
> > </smatrixrow>
> > <smatrixrow>
> >  <smatrixelem col="4"><cn>4</cn></smatrixelem>
> >  </smatrixrow>
> > </smatrix>
> >
> > the "smatrixdefault" element would give the "default" value for all
> > unspecified elements. If not given, I believe <cn>0</cn> seems like a
> > good default value. However, one would have to use <smatrixdefault/
> > > to
> > empty the default element.
> >
> >
> > > David
> >
> >
> > mfG
> >
> > Max Berger
> > e-mail: max@berger.name
> >
> > --
> > OpenPG ID: E81592BC   Print: F489F8759D4132923EC4 BC7E072AB73AE81592BC
> > For information about me and my work please see http://max.berger.name
> >
>
>
>
>
>
>
>

-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
-
-                  Dr. W.A. Naylor
-
-                  http://www.cs.bath.ac.uk/~wn
-
-                  work tel: +44 1225 386183
-
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
```
Received on Friday, 1 June 2007 09:28:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 20 February 2010 06:13:00 GMT