<p>A rudimentary implementation of a masked array is nothing more than a sparse matrix + a bitmask. The only operations we need are to be able to lookup if an i,j entry is present and iteration over the present values. we don't, for instance, need to multiply a masked array with a vector. </p>

<p>I feel like your proposed additions to spmat complicate its implementation for very little additional gain; we seem to be the only use case. All the sparse matrix multiplication / factorization algorithms don't apply in the non-zero case, so you'll have to write two implementations of everything (the fast common case one + the slow non-zero one). If, on the other hand, you decide to not implement the majority of the algorithms for the non-zero case, then it's basically no different from a masked array with a default value. </p>

<p>Honestly, I don't see what the big problem is with (uvec, vec) pair to specify matrix entries from an API perspective. Maybe all we need is a wrapper class</p>

<pre><code>class MatrixEntries {
  arma::uvec indices;
  arma::vec values;
};
</code></pre>

<p>Of course, maybe there are some performance issues you are concerned with, which I have not thought about. Could you maybe elaborate more on why you think its important for the API to change in this regard?</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/mlpack/mlpack/issues/379#issuecomment-69857664">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFOrZKL6A27UMmkzGCsxDP9IA0loUks5nhcXJgaJpZM4DRaGQ.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
  <div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
    <link itemprop="url" href="https://github.com/mlpack/mlpack/issues/379#issuecomment-69857664"></link>
    <meta itemprop="name" content="View Issue"></meta>
  </div>
  <meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>