# Re: sparse matrix support in MathML

From: Richard Kaye <R.W.Kaye@bham.ac.uk>
Date: Thu, 31 May 2007 14:40:35 +0100

Message-Id: <1180618835.16410.38.camel@mat140.bham.ac.uk>
```
David's right of course, and I *was* thinking about it as
a presentational problem.  But if we are interested in
content/semantics and try to specify a matrix as a
"sparse matrix" by specifying its dimensions
(a million by million) and six nontrivial values
then we haven't succeeded.  What is the specification
for the value in the other slots?  If it is zero, is it
the zero in the ring of integers, or the zero in the field
of complex numbers, or something else?

So from the content/semantics point of view the question is
what is a "sparse matrix"?  Is it one with (1) some specified
dimension and (2) some specified values, and all other values
always being <cn>0</cn>?  Or is it one with three variable
items, the third being the default value entry?

The third possible point of view is that what is really wanted
is a presentation for sparse matrices - something like what
Max Berger was suggesting.  After all, from the point of view
of content/semantics a sparse matrix is just a 4-tuple [5-tuple]
( n , m , V , f [, z] )
where n,m specifies the dimension, V is a set of triples
(i,j,v) with 1 le i le n, 1 le j le m and v is the value in the
(i,j)th position [and z, if you want to give it, is the value
of all entries not specified in V].  This representation of
a sparse matrix can already be given in content MathML I think.

Richard

On Thu, 2007-05-31 at 13:39 +0100, David Carlisle wrote:
>
>
> >t may need to be changed if the author prefers
> > to display a blank here,
>
> I think there's an implication here that the default rendering for a
> sparse matrix markup should be the "full matrix" with the 0's filled in
> (as zeros or blanks as something to be specified)? Sometimes that's
> wanted but sometimes it isn't, basically depending how sparse is your
> matrix. If you have a million by million matrix with 6 non zero entries,
> you probably want the display to just show those entries and their
> indicies:-)
>
> The alternative is just to display the sparse encodings as a vector of
> vectors together with the constructor. Either a general "packed"
> constructor as Michael just suggested, or more specific constructors for
> diagonal or banded forms, or less sparse forms such as upper triangular
> or whatever.
>
> Even if not displayed, one could still ask for a specification of the
> value of the "unspecified" entries but I suspect that "zero" (in
> whatever field you are working over) would cover the vast majority oif
> use cases.
>
> David
>
> ________________________________________________________________________
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>
> This e-mail has been scanned for all viruses by Star. The service is