/*
Copyright (C) 2004-2015 David Bateman
Copyright (C) 1998-2004 Andy Adler
This file is part of Octave.
Octave is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
Octave is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with Octave; see the file COPYING. If not, see
.
*/
#if !defined (octave_MSparse_h)
#define octave_MSparse_h 1
#include "MArray.h"
#include "Sparse.h"
// Two dimensional sparse array with math ops.
// But first, some preprocessor abuse...
#include "MSparse-defs.h"
SPARSE_OPS_FORWARD_DECLS (MSparse, MArray, )
template
class
MSparse : public Sparse
{
public:
MSparse (void) : Sparse () { }
MSparse (octave_idx_type n, octave_idx_type m) : Sparse (n, m) { }
MSparse (const dim_vector& dv, octave_idx_type nz = 0)
: Sparse (dv, nz) { }
MSparse (const MSparse& a) : Sparse (a) { }
MSparse (const MSparse& a, const dim_vector& dv) : Sparse (a, dv) { }
MSparse (const Sparse& a) : Sparse (a) { }
template
MSparse (const Sparse& a) : Sparse (a) { }
MSparse (const Array& a, const idx_vector& r, const idx_vector& c,
octave_idx_type nr = -1, octave_idx_type nc = -1,
bool sum_terms = true, octave_idx_type nzm = -1)
: Sparse (a, r, c, nr, nc, sum_terms, nzm) { }
explicit MSparse (octave_idx_type r, octave_idx_type c, T val)
: Sparse (r, c, val) { }
explicit MSparse (const PermMatrix& a) : Sparse(a) { }
MSparse (octave_idx_type r, octave_idx_type c, octave_idx_type num_nz)
: Sparse (r, c, num_nz) { }
~MSparse (void) { }
MSparse& operator = (const MSparse& a)
{
Sparse::operator = (a);
return *this;
}
MSparse& insert (const Sparse& a, octave_idx_type r, octave_idx_type c)
{
Sparse::insert (a, r, c);
return *this;
}
MSparse& insert (const Sparse& a, const Array& indx)
{
Sparse::insert (a, indx);
return *this;
}
MSparse transpose (void) const { return Sparse::transpose (); }
MSparse squeeze (void) const { return Sparse::squeeze (); }
MSparse reshape (const dim_vector& new_dims) const
{ return Sparse::reshape (new_dims); }
MSparse permute (const Array& vec, bool inv = false) const
{ return Sparse::permute (vec, inv); }
MSparse ipermute (const Array& vec) const
{ return Sparse::ipermute (vec); }
MSparse diag (octave_idx_type k = 0) const
{
return Sparse::diag (k);
}
// FIXME: should go away.
template
MSparse
map (U (&fcn) (T)) const
{ return Sparse::template map (fcn); }
template
MSparse
map (U (&fcn) (const T&)) const
{ return Sparse::template map (fcn); }
// Currently, the OPS functions don't need to be friends, but that
// may change.
// SPARSE_OPS_FRIEND_DECLS (MSparse, MArray)
};
#endif