changeset 29227:a009cb8ef68f

Set API tags in files in liboctave/array (patch #8919). * dSparse.h (SparseMatrix), MatrixType.h (MatrixType), Sparse.h (SparseRep): Export (un-defined) member functions instead of entire classes. * Sparse-b.cc, Sparse-C.cc, Sparse-d.cc: Export template function specializations.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 29 Dec 2020 17:41:39 +0100
parents 3ef055ca1d5e
children 5c14f81e0937
files liboctave/array/MatrixType.h liboctave/array/Sparse-C.cc liboctave/array/Sparse-b.cc liboctave/array/Sparse-d.cc liboctave/array/Sparse.cc liboctave/array/Sparse.h liboctave/array/dSparse.h
diffstat 7 files changed, 417 insertions(+), 326 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/array/MatrixType.h	Tue Dec 29 17:32:25 2020 +0100
+++ b/liboctave/array/MatrixType.h	Tue Dec 29 17:41:39 2020 +0100
@@ -38,7 +38,6 @@
 class SparseComplexMatrix;
 
 class
-OCTAVE_API
 MatrixType
 {
 public:
@@ -60,46 +59,47 @@
     Rectangular
   };
 
-  MatrixType (void);
+  OCTAVE_API MatrixType (void);
 
-  MatrixType (const MatrixType& a);
+  OCTAVE_API MatrixType (const MatrixType& a);
 
-  MatrixType (const Matrix& a);
+  OCTAVE_API MatrixType (const Matrix& a);
 
-  MatrixType (const ComplexMatrix& a);
+  OCTAVE_API MatrixType (const ComplexMatrix& a);
 
-  MatrixType (const FloatMatrix& a);
+  OCTAVE_API MatrixType (const FloatMatrix& a);
 
-  MatrixType (const FloatComplexMatrix& a);
+  OCTAVE_API MatrixType (const FloatComplexMatrix& a);
 
   template <typename T>
+  OCTAVE_API
   MatrixType (const MSparse<T> &a);
 
-  MatrixType (const matrix_type t, bool _full = false);
+  OCTAVE_API MatrixType (const matrix_type t, bool _full = false);
 
-  MatrixType (const matrix_type t, const octave_idx_type np,
+  OCTAVE_API MatrixType (const matrix_type t, const octave_idx_type np,
               const octave_idx_type *p, bool _full = false);
 
-  MatrixType (const matrix_type t, const octave_idx_type ku,
+  OCTAVE_API MatrixType (const matrix_type t, const octave_idx_type ku,
               const octave_idx_type kl, bool _full = false);
 
-  ~MatrixType (void);
+  OCTAVE_API ~MatrixType (void);
 
-  MatrixType& operator = (const MatrixType& a);
+  OCTAVE_API MatrixType& operator = (const MatrixType& a);
 
-  int type (bool quiet = true);
+  OCTAVE_API int type (bool quiet = true);
 
-  int type (const Matrix& a);
+  OCTAVE_API int type (const Matrix& a);
 
-  int type (const ComplexMatrix& a);
+  OCTAVE_API int type (const ComplexMatrix& a);
 
-  int type (const FloatMatrix& a);
+  OCTAVE_API int type (const FloatMatrix& a);
 
-  int type (const FloatComplexMatrix& a);
+  OCTAVE_API int type (const FloatComplexMatrix& a);
 
-  int type (const SparseMatrix& a);
+  OCTAVE_API int type (const SparseMatrix& a);
 
-  int type (const SparseComplexMatrix& a);
+  OCTAVE_API int type (const SparseComplexMatrix& a);
 
   double band_density (void) const { return bandden; }
 
@@ -136,7 +136,7 @@
 
   bool is_unknown (void) const { return (typ == Unknown); }
 
-  void info (void) const;
+  OCTAVE_API void info (void) const;
 
   octave_idx_type * triangular_perm (void) const { return perm; }
 
@@ -163,15 +163,15 @@
 
   void mark_as_not_dense (void) { dense = false; }
 
-  void mark_as_symmetric (void);
+  OCTAVE_API void mark_as_symmetric (void);
 
-  void mark_as_unsymmetric (void);
+  OCTAVE_API void mark_as_unsymmetric (void);
 
-  void mark_as_permuted (const octave_idx_type np, const octave_idx_type *p);
+  OCTAVE_API void mark_as_permuted (const octave_idx_type np, const octave_idx_type *p);
 
-  void mark_as_unpermuted (void);
+  OCTAVE_API void mark_as_unpermuted (void);
 
-  MatrixType transpose (void) const;
+  OCTAVE_API MatrixType transpose (void) const;
 
 private:
   void type (int new_typ) { typ = static_cast<matrix_type> (new_typ); }
--- a/liboctave/array/Sparse-C.cc	Tue Dec 29 17:32:25 2020 +0100
+++ b/liboctave/array/Sparse-C.cc	Tue Dec 29 17:41:39 2020 +0100
@@ -44,6 +44,7 @@
 }
 
 template <>
+OCTAVE_API
 bool
 sparse_ascending_compare<Complex> (const Complex& a, const Complex& b)
 {
@@ -52,6 +53,7 @@
 }
 
 template <>
+OCTAVE_API
 bool
 sparse_descending_compare<Complex> (const Complex& a, const Complex& b)
 {
--- a/liboctave/array/Sparse-b.cc	Tue Dec 29 17:32:25 2020 +0100
+++ b/liboctave/array/Sparse-b.cc	Tue Dec 29 17:41:39 2020 +0100
@@ -33,13 +33,14 @@
 #include "Sparse.cc"
 
 template <>
+OCTAVE_API
 bool
 Sparse<bool>::SparseRep::any_element_is_nan (void) const
 {
   return false;
 }
 
-INSTANTIATE_SPARSE (bool, OCTAVE_API);
+INSTANTIATE_SPARSE (bool, );
 
 #if 0
 template std::ostream& operator << (std::ostream&, const Sparse<bool>&);
--- a/liboctave/array/Sparse-d.cc	Tue Dec 29 17:32:25 2020 +0100
+++ b/liboctave/array/Sparse-d.cc	Tue Dec 29 17:41:39 2020 +0100
@@ -34,6 +34,7 @@
 #include "Sparse.cc"
 
 template <>
+OCTAVE_API
 bool
 sparse_ascending_compare<double> (double a, double b)
 {
@@ -41,6 +42,7 @@
 }
 
 template <>
+OCTAVE_API
 bool
 sparse_descending_compare<double> (double a, double b)
 {
--- a/liboctave/array/Sparse.cc	Tue Dec 29 17:32:25 2020 +0100
+++ b/liboctave/array/Sparse.cc	Tue Dec 29 17:41:39 2020 +0100
@@ -54,7 +54,7 @@
 #include "PermMatrix.h"
 
 template <typename T>
-typename Sparse<T>::SparseRep *
+OCTAVE_API typename Sparse<T>::SparseRep *
 Sparse<T>::nil_rep (void)
 {
   static typename Sparse<T>::SparseRep nr;
@@ -62,6 +62,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 T&
 Sparse<T>::SparseRep::elem (octave_idx_type _r, octave_idx_type _c)
 {
@@ -103,6 +104,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 T
 Sparse<T>::SparseRep::celem (octave_idx_type _r, octave_idx_type _c) const
 {
@@ -114,6 +116,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 void
 Sparse<T>::SparseRep::maybe_compress (bool remove_zeros)
 {
@@ -138,6 +141,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 void
 Sparse<T>::SparseRep::change_length (octave_idx_type nz)
 {
@@ -171,6 +175,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 bool
 Sparse<T>::SparseRep::indices_ok (void) const
 {
@@ -178,6 +183,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 bool
 Sparse<T>::SparseRep::any_element_is_nan (void) const
 {
@@ -191,6 +197,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>::Sparse (octave_idx_type nr, octave_idx_type nc, T val)
   : rep (nullptr), dimensions (dim_vector (nr, nc))
 {
@@ -219,6 +226,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>::Sparse (const PermMatrix& a)
   : rep (new typename Sparse<T>::SparseRep (a.rows (), a.cols (), a.rows ())),
     dimensions (dim_vector (a.rows (), a.cols ()))
@@ -237,6 +245,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>::Sparse (const dim_vector& dv)
   : rep (nullptr), dimensions (dv)
 {
@@ -248,6 +257,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>::Sparse (const Sparse<T>& a, const dim_vector& dv)
   : rep (nullptr), dimensions (dv)
 {
@@ -290,6 +300,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>::Sparse (const Array<T>& a, const idx_vector& r,
                    const idx_vector& c, octave_idx_type nr,
                    octave_idx_type nc, bool sum_terms,
@@ -657,6 +668,7 @@
 */
 
 template <typename T>
+OCTAVE_API
 Sparse<T>::Sparse (const Array<T>& a)
   : rep (nullptr), dimensions (a.dims ())
 {
@@ -691,6 +703,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>::~Sparse (void)
 {
   if (--rep->count == 0)
@@ -716,6 +729,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 octave_idx_type
 Sparse<T>::compute_index (const Array<octave_idx_type>& ra_idx) const
 {
@@ -739,6 +753,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 T
 Sparse<T>::range_error (const char *fcn, octave_idx_type n) const
 {
@@ -747,6 +762,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 T&
 Sparse<T>::range_error (const char *fcn, octave_idx_type n)
 {
@@ -755,6 +771,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 T
 Sparse<T>::range_error (const char *fcn, octave_idx_type i,
                         octave_idx_type j) const
@@ -765,6 +782,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 T&
 Sparse<T>::range_error (const char *fcn, octave_idx_type i, octave_idx_type j)
 {
@@ -774,6 +792,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 T
 Sparse<T>::range_error (const char *fcn,
                         const Array<octave_idx_type>& ra_idx) const
@@ -798,6 +817,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 T&
 Sparse<T>::range_error (const char *fcn, const Array<octave_idx_type>& ra_idx)
 {
@@ -821,6 +841,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>
 Sparse<T>::reshape (const dim_vector& new_dims) const
 {
@@ -900,6 +921,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>
 Sparse<T>::permute (const Array<octave_idx_type>& perm_vec, bool) const
 {
@@ -928,6 +950,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 void
 Sparse<T>::resize1 (octave_idx_type n)
 {
@@ -947,6 +970,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 void
 Sparse<T>::resize (const dim_vector& dv)
 {
@@ -959,6 +983,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 void
 Sparse<T>::resize (octave_idx_type r, octave_idx_type c)
 {
@@ -1009,6 +1034,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>&
 Sparse<T>::insert (const Sparse<T>& a, octave_idx_type r, octave_idx_type c)
 {
@@ -1090,6 +1116,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>&
 Sparse<T>::insert (const Sparse<T>& a, const Array<octave_idx_type>& ra_idx)
 {
@@ -1101,6 +1128,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>
 Sparse<T>::transpose (void) const
 {
@@ -1140,7 +1168,8 @@
 // Lower bound lookup.  Could also use octave_sort, but that has upper bound
 // semantics, so requires some manipulation to set right.  Uses a plain loop
 // for small columns.
-static octave_idx_type
+static
+octave_idx_type
 lblookup (const octave_idx_type *ridx, octave_idx_type nr,
           octave_idx_type ri)
 {
@@ -1157,6 +1186,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 void
 Sparse<T>::delete_elements (const idx_vector& idx)
 {
@@ -1258,6 +1288,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 void
 Sparse<T>::delete_elements (const idx_vector& idx_i, const idx_vector& idx_j)
 {
@@ -1377,6 +1408,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 void
 Sparse<T>::delete_elements (int dim, const idx_vector& idx)
 {
@@ -1389,6 +1421,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>
 Sparse<T>::index (const idx_vector& idx, bool resize_ok) const
 {
@@ -1589,6 +1622,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>
 Sparse<T>::index (const idx_vector& idx_i, const idx_vector& idx_j,
                   bool resize_ok) const
@@ -1833,6 +1867,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 void
 Sparse<T>::assign (const idx_vector& idx, const Sparse<T>& rhs)
 {
@@ -1985,6 +2020,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 void
 Sparse<T>::assign (const idx_vector& idx_i,
                    const idx_vector& idx_j, const Sparse<T>& rhs)
@@ -2224,6 +2260,7 @@
 // Can't use versions of these in Array.cc due to duplication of the
 // instantiations for Array<double and Sparse<double>, etc
 template <typename T>
+OCTAVE_API
 bool
 sparse_ascending_compare (typename ref_param<T>::type a,
                           typename ref_param<T>::type b)
@@ -2232,6 +2269,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 bool
 sparse_descending_compare (typename ref_param<T>::type a,
                            typename ref_param<T>::type b)
@@ -2240,6 +2278,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>
 Sparse<T>::sort (octave_idx_type dim, sortmode mode) const
 {
@@ -2306,6 +2345,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>
 Sparse<T>::sort (Array<octave_idx_type> &sidx, octave_idx_type dim,
                  sortmode mode) const
@@ -2413,6 +2453,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>
 Sparse<T>::diag (octave_idx_type k) const
 {
@@ -2586,6 +2627,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Sparse<T>
 Sparse<T>::cat (int dim, octave_idx_type n, const Sparse<T> *sparse_list)
 {
@@ -2684,6 +2726,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 Array<T>
 Sparse<T>::array_value () const
 {
@@ -2708,6 +2751,7 @@
 }
 
 template <typename T>
+OCTAVE_API
 std::istream&
 read_sparse_matrix (std::istream& is, Sparse<T>& a,
                     T (*read_fcn) (std::istream&))
@@ -3010,6 +3054,7 @@
 */
 
 template <typename T>
+OCTAVE_API
 void
 Sparse<T>::print_info (std::ostream& os, const std::string& prefix) const
 {
@@ -3025,6 +3070,6 @@
 
 #define INSTANTIATE_SPARSE(T, API)                                      \
   template class API Sparse<T>;                                         \
-  template std::istream&                                                \
+  template API std::istream&                                            \
   read_sparse_matrix<T> (std::istream& is, Sparse<T>& a,                \
                          T (*read_fcn) (std::istream&));
--- a/liboctave/array/Sparse.h	Tue Dec 29 17:32:25 2020 +0100
+++ b/liboctave/array/Sparse.h	Tue Dec 29 17:41:39 2020 +0100
@@ -56,7 +56,7 @@
   // The real representation of all Sparse arrays.
   //--------------------------------------------------------------------
 
-  class OCTAVE_API SparseRep
+  class SparseRep
   {
   public:
 
@@ -104,9 +104,9 @@
 
     octave_idx_type nnz (void) const { return c[ncols]; }
 
-    T& elem (octave_idx_type _r, octave_idx_type _c);
+    OCTAVE_API T& elem (octave_idx_type _r, octave_idx_type _c);
 
-    T celem (octave_idx_type _r, octave_idx_type _c) const;
+    OCTAVE_API T celem (octave_idx_type _r, octave_idx_type _c) const;
 
     T& data (octave_idx_type i) { return d[i]; }
 
@@ -120,19 +120,19 @@
 
     octave_idx_type ccidx (octave_idx_type i) const { return c[i]; }
 
-    void maybe_compress (bool remove_zeros);
+    OCTAVE_API void maybe_compress (bool remove_zeros);
 
-    void change_length (octave_idx_type nz);
+    OCTAVE_API void change_length (octave_idx_type nz);
 
-    bool indices_ok (void) const;
+    OCTAVE_API bool indices_ok (void) const;
 
-    bool any_element_is_nan (void) const;
+    OCTAVE_API bool any_element_is_nan (void) const;
 
   private:
 
     // No assignment!
 
-    SparseRep& operator = (const SparseRep& a);
+    OCTAVE_API SparseRep& operator = (const SparseRep& a);
   };
 
   //--------------------------------------------------------------------
@@ -161,7 +161,7 @@
 
 private:
 
-  static typename Sparse<T>::SparseRep *nil_rep (void);
+  static OCTAVE_API typename Sparse<T>::SparseRep *nil_rep (void);
 
 public:
 
@@ -179,7 +179,7 @@
     : rep (new typename Sparse<T>::SparseRep (nr, nc)),
       dimensions (dim_vector (nr, nc)) { }
 
-  explicit Sparse (octave_idx_type nr, octave_idx_type nc, T val);
+  explicit OCTAVE_API Sparse (octave_idx_type nr, octave_idx_type nc, T val);
 
   Sparse (const dim_vector& dv, octave_idx_type nz)
     : rep (new typename Sparse<T>::SparseRep (dv(0), dv(1), nz)),
@@ -191,7 +191,7 @@
 
   // Both SparseMatrix and SparseBoolMatrix need this ctor, and this
   // is their only common ancestor.
-  explicit Sparse (const PermMatrix& a);
+  explicit OCTAVE_API Sparse (const PermMatrix& a);
 
   // Type conversion case.  Preserves nzmax.
   template <typename U>
@@ -215,20 +215,21 @@
 
 public:
 
-  Sparse (const dim_vector& dv);
+  OCTAVE_API Sparse (const dim_vector& dv);
 
-  Sparse (const Sparse<T>& a, const dim_vector& dv);
+  OCTAVE_API Sparse (const Sparse<T>& a, const dim_vector& dv);
 
+  OCTAVE_API
   Sparse (const Array<T>& 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);
 
   // Sparsify a normal matrix
-  Sparse (const Array<T>& a);
+  OCTAVE_API Sparse (const Array<T>& a);
 
   virtual ~Sparse (void);
 
-  Sparse<T>& operator = (const Sparse<T>& a);
+  OCTAVE_API Sparse<T>& operator = (const Sparse<T>& a);
 
   //! Amount of storage for nonzero elements.
   //! This may differ from the actual number of elements, see nnz().
@@ -271,20 +272,23 @@
 
   Sparse<T> squeeze (void) const { return *this; }
 
-  octave_idx_type compute_index (const Array<octave_idx_type>& ra_idx) const;
+  OCTAVE_API octave_idx_type
+  compute_index (const Array<octave_idx_type>& ra_idx) const;
 
-  OCTAVE_NORETURN T range_error (const char *fcn, octave_idx_type n) const;
-  OCTAVE_NORETURN T& range_error (const char *fcn, octave_idx_type n);
+  OCTAVE_NORETURN OCTAVE_API T
+  range_error (const char *fcn, octave_idx_type n) const;
+  OCTAVE_NORETURN OCTAVE_API T&
+  range_error (const char *fcn, octave_idx_type n);
 
-  OCTAVE_NORETURN T range_error (const char *fcn,
-                                 octave_idx_type i, octave_idx_type j) const;
-  OCTAVE_NORETURN T& range_error (const char *fcn,
-                                  octave_idx_type i, octave_idx_type j);
+  OCTAVE_NORETURN OCTAVE_API T
+  range_error (const char *fcn, octave_idx_type i, octave_idx_type j) const;
+  OCTAVE_NORETURN OCTAVE_API T&
+  range_error (const char *fcn, octave_idx_type i, octave_idx_type j);
 
-  OCTAVE_NORETURN T range_error (const char *fcn,
-                                 const Array<octave_idx_type>& ra_idx) const;
-  OCTAVE_NORETURN T& range_error (const char *fcn,
-                                  const Array<octave_idx_type>& ra_idx);
+  OCTAVE_NORETURN OCTAVE_API T
+  range_error (const char *fcn, const Array<octave_idx_type>& ra_idx) const;
+  OCTAVE_NORETURN OCTAVE_API T&
+  range_error (const char *fcn, const Array<octave_idx_type>& ra_idx);
 
   // No checking, even for multiple references, ever.
 
@@ -433,20 +437,21 @@
     return (*this);
   }
 
-  Sparse<T> reshape (const dim_vector& new_dims) const;
+  OCTAVE_API Sparse<T> reshape (const dim_vector& new_dims) const;
 
-  Sparse<T> permute (const Array<octave_idx_type>& vec, bool inv = false) const;
+  OCTAVE_API Sparse<T>
+  permute (const Array<octave_idx_type>& vec, bool inv = false) const;
 
   Sparse<T> ipermute (const Array<octave_idx_type>& vec) const
   {
     return permute (vec, true);
   }
 
-  void resize1 (octave_idx_type n);
+  OCTAVE_API void resize1 (octave_idx_type n);
 
-  void resize (octave_idx_type r, octave_idx_type c);
+  OCTAVE_API void resize (octave_idx_type r, octave_idx_type c);
 
-  void resize (const dim_vector& dv);
+  OCTAVE_API void resize (const dim_vector& dv);
 
   void change_capacity (octave_idx_type nz)
   {
@@ -455,14 +460,16 @@
     rep->change_length (nz);
   }
 
-  Sparse<T>& insert (const Sparse<T>& a, octave_idx_type r, octave_idx_type c);
-  Sparse<T>& insert (const Sparse<T>& a, const Array<octave_idx_type>& idx);
+  OCTAVE_API Sparse<T>&
+  insert (const Sparse<T>& a, octave_idx_type r, octave_idx_type c);
+  OCTAVE_API Sparse<T>&
+  insert (const Sparse<T>& a, const Array<octave_idx_type>& idx);
 
   bool issquare (void) const { return (dim1 () == dim2 ()); }
 
   bool isempty (void) const { return (rows () < 1 || cols () < 1); }
 
-  Sparse<T> transpose (void) const;
+  OCTAVE_API Sparse<T> transpose (void) const;
 
   T * data (void) { make_unique (); return rep->d; }
   T& data (octave_idx_type i) { make_unique (); return rep->data (i); }
@@ -501,22 +508,26 @@
 
   octave_idx_type ndims (void) const { return dimensions.ndims (); }
 
-  void delete_elements (const idx_vector& i);
+  OCTAVE_API void delete_elements (const idx_vector& i);
 
-  void delete_elements (int dim, const idx_vector& i);
+  OCTAVE_API void delete_elements (int dim, const idx_vector& i);
 
-  void delete_elements (const idx_vector& i, const idx_vector& j);
+  OCTAVE_API void delete_elements (const idx_vector& i, const idx_vector& j);
 
-  Sparse<T> index (const idx_vector& i, bool resize_ok = false) const;
+  OCTAVE_API Sparse<T>
+  index (const idx_vector& i, bool resize_ok = false) const;
 
-  Sparse<T> index (const idx_vector& i, const idx_vector& j,
-                   bool resize_ok = false) const;
+  OCTAVE_API Sparse<T>
+  index (const idx_vector& i, const idx_vector& j,
+         bool resize_ok = false) const;
+
+  OCTAVE_API void assign (const idx_vector& i, const Sparse<T>& rhs);
 
-  void assign (const idx_vector& i, const Sparse<T>& rhs);
+  OCTAVE_API void
+  assign (const idx_vector& i, const idx_vector& j, const Sparse<T>& rhs);
 
-  void assign (const idx_vector& i, const idx_vector& j, const Sparse<T>& rhs);
-
-  void print_info (std::ostream& os, const std::string& prefix) const;
+  OCTAVE_API void
+  print_info (std::ostream& os, const std::string& prefix) const;
 
   // Unsafe.  These functions exist to support the MEX interface.
   // You should not use them anywhere else.
@@ -532,17 +543,19 @@
     return const_cast<octave_idx_type *> (cidx ());
   }
 
-  Sparse<T> sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const;
-  Sparse<T> sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
-                  sortmode mode = ASCENDING) const;
+  OCTAVE_API Sparse<T>
+  sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const;
+  OCTAVE_API Sparse<T>
+  sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0,
+        sortmode mode = ASCENDING) const;
 
-  Sparse<T> diag (octave_idx_type k = 0) const;
+  OCTAVE_API Sparse<T> diag (octave_idx_type k = 0) const;
 
   // dim = -1 and dim = -2 are special; see Array<T>::cat description.
-  static Sparse<T>
+  static OCTAVE_API Sparse<T>
   cat (int dim, octave_idx_type n, const Sparse<T> *sparse_list);
 
-  Array<T> array_value (void) const;
+  OCTAVE_API Array<T> array_value (void) const;
 
   // Generic any/all test functionality with arbitrary predicate.
   template <typename F, bool zero>
@@ -646,6 +659,7 @@
 };
 
 template <typename T>
+OCTAVE_API
 std::istream&
 read_sparse_matrix (std::istream& is, Sparse<T>& a,
                     T (*read_fcn) (std::istream&));
--- a/liboctave/array/dSparse.h	Tue Dec 29 17:32:25 2020 +0100
+++ b/liboctave/array/dSparse.h	Tue Dec 29 17:41:39 2020 +0100
@@ -44,7 +44,6 @@
 class SparseBoolMatrix;
 
 class
-OCTAVE_API
 SparseMatrix : public MSparse<double>
 {
 public:
@@ -74,7 +73,7 @@
 
   SparseMatrix (const Sparse<double>& a) : MSparse<double> (a) { }
 
-  explicit SparseMatrix (const SparseBoolMatrix& a);
+  explicit OCTAVE_API SparseMatrix (const SparseBoolMatrix& a);
 
   explicit SparseMatrix (const Matrix& a) : MSparse<double> (a) { }
 
@@ -86,7 +85,7 @@
                 octave_idx_type nzm = -1)
     : MSparse<double> (a, r, c, nr, nc, sum_terms, nzm) { }
 
-  explicit SparseMatrix (const DiagMatrix& a);
+  explicit OCTAVE_API SparseMatrix (const DiagMatrix& a);
 
   explicit SparseMatrix (const PermMatrix& a) : MSparse<double>(a) { }
 
@@ -99,28 +98,28 @@
     return *this;
   }
 
-  bool operator == (const SparseMatrix& a) const;
-  bool operator != (const SparseMatrix& a) const;
+  OCTAVE_API bool operator == (const SparseMatrix& a) const;
+  OCTAVE_API bool operator != (const SparseMatrix& a) const;
 
-  bool issymmetric (void) const;
+  OCTAVE_API bool issymmetric (void) const;
 
-  SparseMatrix max (int dim = -1) const;
-  SparseMatrix max (Array<octave_idx_type>& index, int dim = -1) const;
-  SparseMatrix min (int dim = -1) const;
-  SparseMatrix min (Array<octave_idx_type>& index, int dim = -1) const;
+  OCTAVE_API SparseMatrix max (int dim = -1) const;
+  OCTAVE_API SparseMatrix max (Array<octave_idx_type>& index, int dim = -1) const;
+  OCTAVE_API SparseMatrix min (int dim = -1) const;
+  OCTAVE_API SparseMatrix min (Array<octave_idx_type>& index, int dim = -1) const;
 
   // destructive insert/delete/reorder operations
 
-  SparseMatrix& insert (const SparseMatrix& a, octave_idx_type r,
-                        octave_idx_type c);
+  OCTAVE_API SparseMatrix&
+  insert (const SparseMatrix& a, octave_idx_type r, octave_idx_type c);
 
-  SparseMatrix& insert (const SparseMatrix& a,
-                        const Array<octave_idx_type>& indx);
+  OCTAVE_API SparseMatrix&
+  insert (const SparseMatrix& a, const Array<octave_idx_type>& indx);
 
-  SparseMatrix concat (const SparseMatrix& rb,
-                       const Array<octave_idx_type>& ra_idx);
-  SparseComplexMatrix concat (const SparseComplexMatrix& rb,
-                              const Array<octave_idx_type>& ra_idx);
+  OCTAVE_API SparseMatrix
+  concat (const SparseMatrix& rb, const Array<octave_idx_type>& ra_idx);
+  OCTAVE_API SparseComplexMatrix
+  concat (const SparseComplexMatrix& rb, const Array<octave_idx_type>& ra_idx);
 
   friend OCTAVE_API SparseMatrix real (const SparseComplexMatrix& a);
   friend OCTAVE_API SparseMatrix imag (const SparseComplexMatrix& a);
@@ -133,301 +132,329 @@
 
   // extract row or column i.
 
-  RowVector row (octave_idx_type i) const;
+  OCTAVE_API RowVector row (octave_idx_type i) const;
 
-  ColumnVector column (octave_idx_type i) const;
+  OCTAVE_API ColumnVector column (octave_idx_type i) const;
 
 private:
-  SparseMatrix dinverse (MatrixType& mattype, octave_idx_type& info,
-                         double& rcond, const bool force = false,
-                         const bool calccond = true) const;
+  OCTAVE_API SparseMatrix
+  dinverse (MatrixType& mattype, octave_idx_type& info, double& rcond,
+            const bool force = false, const bool calccond = true) const;
 
-  SparseMatrix tinverse (MatrixType& mattype, octave_idx_type& info,
-                         double& rcond, const bool force = false,
-                         const bool calccond = true) const;
+  OCTAVE_API SparseMatrix
+  tinverse (MatrixType& mattype, octave_idx_type& info, double& rcond,
+            const bool force = false, const bool calccond = true) const;
 
 public:
-  SparseMatrix inverse (void) const;
-  SparseMatrix inverse (MatrixType& mattype) const;
-  SparseMatrix inverse (MatrixType& mattype, octave_idx_type& info) const;
-  SparseMatrix inverse (MatrixType& mattype, octave_idx_type& info,
-                        double& rcond, bool force = false,
-                        bool calc_cond = true) const;
+  OCTAVE_API SparseMatrix inverse (void) const;
+  OCTAVE_API SparseMatrix inverse (MatrixType& mattype) const;
+  OCTAVE_API SparseMatrix
+  inverse (MatrixType& mattype, octave_idx_type& info) const;
+  OCTAVE_API SparseMatrix
+  inverse (MatrixType& mattype, octave_idx_type& info, double& rcond,
+           bool force = false, bool calc_cond = true) const;
 
-  DET determinant (void) const;
-  DET determinant (octave_idx_type& info) const;
-  DET determinant (octave_idx_type& info, double& rcond,
-                   bool calc_cond = true) const;
+  OCTAVE_API DET determinant (void) const;
+  OCTAVE_API DET determinant (octave_idx_type& info) const;
+  OCTAVE_API DET determinant (octave_idx_type& info, double& rcond,
+                              bool calc_cond = true) const;
 
 private:
   // Diagonal matrix solvers
-  Matrix dsolve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
-                 double& rcond, solve_singularity_handler sing_handler,
-                 bool calc_cond = false) const;
+  OCTAVE_API Matrix
+  dsolve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
+          double& rcond, solve_singularity_handler sing_handler,
+          bool calc_cond = false) const;
 
-  ComplexMatrix dsolve (MatrixType& typ, const ComplexMatrix& b,
-                        octave_idx_type& info, double& rcond,
-                        solve_singularity_handler sing_handler,
-                        bool calc_cond = false) const;
+  OCTAVE_API ComplexMatrix
+  dsolve (MatrixType& typ, const ComplexMatrix& b, octave_idx_type& info,
+          double& rcond, solve_singularity_handler sing_handler,
+          bool calc_cond = false) const;
 
-  SparseMatrix dsolve (MatrixType& typ, const SparseMatrix& b,
-                       octave_idx_type& info, double& rcond,
-                       solve_singularity_handler sing_handler,
-                       bool calc_cond = false) const;
+  OCTAVE_API SparseMatrix
+  dsolve (MatrixType& typ, const SparseMatrix& b, octave_idx_type& info,
+          double& rcond, solve_singularity_handler sing_handler,
+          bool calc_cond = false) const;
 
-  SparseComplexMatrix dsolve (MatrixType& typ, const SparseComplexMatrix& b,
-                              octave_idx_type& info, double& rcond,
-                              solve_singularity_handler sing_handler,
-                              bool calc_cond = false) const;
+  OCTAVE_API SparseComplexMatrix
+  dsolve (MatrixType& typ, const SparseComplexMatrix& b, octave_idx_type& info,
+          double& rcond, solve_singularity_handler sing_handler,
+          bool calc_cond = false) const;
 
   // Upper triangular matrix solvers
-  Matrix utsolve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
-                  double& rcond, solve_singularity_handler sing_handler,
-                  bool calc_cond = false) const;
+  OCTAVE_API Matrix
+  utsolve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
+           double& rcond, solve_singularity_handler sing_handler,
+           bool calc_cond = false) const;
 
-  ComplexMatrix utsolve (MatrixType& typ, const ComplexMatrix& b,
-                         octave_idx_type& info, double& rcond,
-                         solve_singularity_handler sing_handler,
-                         bool calc_cond = false) const;
+  OCTAVE_API ComplexMatrix
+  utsolve (MatrixType& typ, const ComplexMatrix& b, octave_idx_type& info,
+           double& rcond, solve_singularity_handler sing_handler,
+           bool calc_cond = false) const;
 
-  SparseMatrix utsolve (MatrixType& typ, const SparseMatrix& b,
-                        octave_idx_type& info, double& rcond,
-                        solve_singularity_handler sing_handler,
-                        bool calc_cond = false) const;
+  OCTAVE_API SparseMatrix
+  utsolve (MatrixType& typ, const SparseMatrix& b, octave_idx_type& info,
+           double& rcond, solve_singularity_handler sing_handler,
+           bool calc_cond = false) const;
 
-  SparseComplexMatrix utsolve (MatrixType& typ, const SparseComplexMatrix& b,
-                               octave_idx_type& info, double& rcond,
-                               solve_singularity_handler sing_handler,
-                               bool calc_cond = false) const;
+  OCTAVE_API SparseComplexMatrix
+  utsolve (MatrixType& typ, const SparseComplexMatrix& b, octave_idx_type& info,
+           double& rcond, solve_singularity_handler sing_handler,
+           bool calc_cond = false) const;
 
   // Lower triangular matrix solvers
-  Matrix ltsolve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
-                  double& rcond, solve_singularity_handler sing_handler,
-                  bool calc_cond = false) const;
+  OCTAVE_API Matrix
+  ltsolve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
+           double& rcond, solve_singularity_handler sing_handler,
+           bool calc_cond = false) const;
 
-  ComplexMatrix ltsolve (MatrixType& typ, const ComplexMatrix& b,
-                         octave_idx_type& info, double& rcond,
-                         solve_singularity_handler sing_handler,
-                         bool calc_cond = false) const;
+  OCTAVE_API ComplexMatrix
+  ltsolve (MatrixType& typ, const ComplexMatrix& b, octave_idx_type& info,
+           double& rcond, solve_singularity_handler sing_handler,
+           bool calc_cond = false) const;
 
-  SparseMatrix ltsolve (MatrixType& typ, const SparseMatrix& b,
-                        octave_idx_type& info, double& rcond,
-                        solve_singularity_handler sing_handler,
-                        bool calc_cond = false) const;
+  OCTAVE_API SparseMatrix
+  ltsolve (MatrixType& typ, const SparseMatrix& b, octave_idx_type& info,
+           double& rcond, solve_singularity_handler sing_handler,
+           bool calc_cond = false) const;
 
-  SparseComplexMatrix ltsolve (MatrixType& typ, const SparseComplexMatrix& b,
-                               octave_idx_type& info, double& rcond,
-                               solve_singularity_handler sing_handler,
-                               bool calc_cond = false) const;
+  OCTAVE_API SparseComplexMatrix
+  ltsolve (MatrixType& typ, const SparseComplexMatrix& b, octave_idx_type& info,
+           double& rcond, solve_singularity_handler sing_handler,
+           bool calc_cond = false) const;
 
   // Tridiagonal matrix solvers
-  Matrix trisolve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
-                   double& rcond, solve_singularity_handler sing_handler,
-                   bool calc_cond = false) const;
+  OCTAVE_API Matrix
+  trisolve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
+            double& rcond, solve_singularity_handler sing_handler,
+            bool calc_cond = false) const;
 
-  ComplexMatrix trisolve (MatrixType& typ, const ComplexMatrix& b,
-                          octave_idx_type& info, double& rcond,
-                          solve_singularity_handler sing_handler,
-                          bool calc_cond = false) const;
+  OCTAVE_API ComplexMatrix
+  trisolve (MatrixType& typ, const ComplexMatrix& b, octave_idx_type& info,
+            double& rcond, solve_singularity_handler sing_handler,
+            bool calc_cond = false) const;
 
-  SparseMatrix trisolve (MatrixType& typ, const SparseMatrix& b,
-                         octave_idx_type& info, double& rcond,
-                         solve_singularity_handler sing_handler,
-                         bool calc_cond = false) const;
+  OCTAVE_API SparseMatrix
+  trisolve (MatrixType& typ, const SparseMatrix& b, octave_idx_type& info,
+            double& rcond, solve_singularity_handler sing_handler,
+            bool calc_cond = false) const;
 
-  SparseComplexMatrix trisolve (MatrixType& typ, const SparseComplexMatrix& b,
-                                octave_idx_type& info, double& rcond,
-                                solve_singularity_handler sing_handler,
-                                bool calc_cond = false) const;
+  OCTAVE_API SparseComplexMatrix
+  trisolve (MatrixType& typ, const SparseComplexMatrix& b, octave_idx_type& info,
+            double& rcond, solve_singularity_handler sing_handler,
+            bool calc_cond = false) const;
 
   // Banded matrix solvers (umfpack/cholesky)
-  Matrix bsolve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
-                 double& rcond, solve_singularity_handler sing_handler,
-                 bool calc_cond = false) const;
+  OCTAVE_API Matrix
+  bsolve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
+          double& rcond, solve_singularity_handler sing_handler,
+          bool calc_cond = false) const;
 
-  ComplexMatrix bsolve (MatrixType& typ, const ComplexMatrix& b,
-                        octave_idx_type& info, double& rcond,
-                        solve_singularity_handler sing_handler,
-                        bool calc_cond = false) const;
+  OCTAVE_API ComplexMatrix
+  bsolve (MatrixType& typ, const ComplexMatrix& b, octave_idx_type& info,
+          double& rcond, solve_singularity_handler sing_handler,
+          bool calc_cond = false) const;
 
-  SparseMatrix bsolve (MatrixType& typ, const SparseMatrix& b,
-                       octave_idx_type& info, double& rcond,
-                       solve_singularity_handler sing_handler,
-                       bool calc_cond = false) const;
+  OCTAVE_API SparseMatrix
+  bsolve (MatrixType& typ, const SparseMatrix& b, octave_idx_type& info,
+          double& rcond, solve_singularity_handler sing_handler,
+          bool calc_cond = false) const;
 
-  SparseComplexMatrix bsolve (MatrixType& typ, const SparseComplexMatrix& b,
-                              octave_idx_type& info, double& rcond,
-                              solve_singularity_handler sing_handler,
-                              bool calc_cond = false) const;
+  OCTAVE_API SparseComplexMatrix
+  bsolve (MatrixType& typ, const SparseComplexMatrix& b, octave_idx_type& info,
+          double& rcond, solve_singularity_handler sing_handler,
+          bool calc_cond = false) const;
 
   // Full matrix solvers (umfpack/cholesky)
-  void * factorize (octave_idx_type& err, double& rcond, Matrix& Control,
-                    Matrix& Info, solve_singularity_handler sing_handler,
-                    bool calc_cond = false) const;
+  OCTAVE_API void *
+  factorize (octave_idx_type& err, double& rcond, Matrix& Control,
+             Matrix& Info, solve_singularity_handler sing_handler,
+             bool calc_cond = false) const;
 
-  Matrix fsolve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
-                 double& rcond, solve_singularity_handler sing_handler,
-                 bool calc_cond = false) const;
+  OCTAVE_API Matrix
+  fsolve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
+          double& rcond, solve_singularity_handler sing_handler,
+          bool calc_cond = false) const;
 
-  ComplexMatrix fsolve (MatrixType& typ, const ComplexMatrix& b,
-                        octave_idx_type& info, double& rcond,
-                        solve_singularity_handler sing_handler,
-                        bool calc_cond = false) const;
+  OCTAVE_API ComplexMatrix
+  fsolve (MatrixType& typ, const ComplexMatrix& b, octave_idx_type& info,
+          double& rcond, solve_singularity_handler sing_handler,
+          bool calc_cond = false) const;
 
-  SparseMatrix fsolve (MatrixType& typ, const SparseMatrix& b,
-                       octave_idx_type& info, double& rcond,
-                       solve_singularity_handler sing_handler,
-                       bool calc_cond = false) const;
+  OCTAVE_API SparseMatrix
+  fsolve (MatrixType& typ, const SparseMatrix& b, octave_idx_type& info,
+          double& rcond, solve_singularity_handler sing_handler,
+          bool calc_cond = false) const;
 
-  SparseComplexMatrix fsolve (MatrixType& typ, const SparseComplexMatrix& b,
-                              octave_idx_type& info, double& rcond,
-                              solve_singularity_handler sing_handler,
-                              bool calc_cond = false) const;
+  OCTAVE_API SparseComplexMatrix
+  fsolve (MatrixType& typ, const SparseComplexMatrix& b, octave_idx_type& info,
+          double& rcond, solve_singularity_handler sing_handler,
+          bool calc_cond = false) const;
 
 public:
   // Generic interface to solver with no probing of type
-  Matrix solve (MatrixType& typ, const Matrix& b) const;
-  Matrix solve (MatrixType& typ, const Matrix& b, octave_idx_type& info) const;
-  Matrix solve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
-                double& rcond) const;
-  Matrix solve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
-                double& rcond, solve_singularity_handler sing_handler,
-                bool singular_fallback = true) const;
+  OCTAVE_API Matrix solve (MatrixType& typ, const Matrix& b) const;
+  OCTAVE_API Matrix
+  solve (MatrixType& typ, const Matrix& b, octave_idx_type& info) const;
+  OCTAVE_API Matrix
+  solve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
+         double& rcond) const;
+  OCTAVE_API Matrix
+  solve (MatrixType& typ, const Matrix& b, octave_idx_type& info,
+         double& rcond, solve_singularity_handler sing_handler,
+         bool singular_fallback = true) const;
 
-  ComplexMatrix solve (MatrixType& typ, const ComplexMatrix& b) const;
-  ComplexMatrix solve (MatrixType& typ, const ComplexMatrix& b,
-                       octave_idx_type& info) const;
-  ComplexMatrix solve (MatrixType& typ, const ComplexMatrix& b,
-                       octave_idx_type& info, double& rcond) const;
-  ComplexMatrix solve (MatrixType& typ, const ComplexMatrix& b,
-                       octave_idx_type& info, double& rcond,
-                       solve_singularity_handler sing_handler,
-                       bool singular_fallback = true) const;
+  OCTAVE_API ComplexMatrix
+  solve (MatrixType& typ, const ComplexMatrix& b) const;
+  OCTAVE_API ComplexMatrix
+  solve (MatrixType& typ, const ComplexMatrix& b, octave_idx_type& info) const;
+  OCTAVE_API ComplexMatrix
+  solve (MatrixType& typ, const ComplexMatrix& b, octave_idx_type& info,
+         double& rcond) const;
+  OCTAVE_API ComplexMatrix
+  solve (MatrixType& typ, const ComplexMatrix& b, octave_idx_type& info,
+         double& rcond, solve_singularity_handler sing_handler,
+         bool singular_fallback = true) const;
 
-  SparseMatrix solve (MatrixType& typ, const SparseMatrix& b) const;
-  SparseMatrix solve (MatrixType& typ, const SparseMatrix& b,
-                      octave_idx_type& info) const;
-  SparseMatrix solve (MatrixType& typ, const SparseMatrix& b,
-                      octave_idx_type& info, double& rcond) const;
-  SparseMatrix solve (MatrixType& typ, const SparseMatrix& b,
-                      octave_idx_type& info, double& rcond,
-                      solve_singularity_handler sing_handler,
-                      bool singular_fallback = true) const;
+  OCTAVE_API SparseMatrix solve (MatrixType& typ, const SparseMatrix& b) const;
+  OCTAVE_API SparseMatrix
+  solve (MatrixType& typ, const SparseMatrix& b, octave_idx_type& info) const;
+  OCTAVE_API SparseMatrix
+  solve (MatrixType& typ, const SparseMatrix& b, octave_idx_type& info,
+         double& rcond) const;
+  OCTAVE_API SparseMatrix
+  solve (MatrixType& typ, const SparseMatrix& b, octave_idx_type& info,
+         double& rcond, solve_singularity_handler sing_handler,
+         bool singular_fallback = true) const;
 
-  SparseComplexMatrix solve (MatrixType& typ,
-                             const SparseComplexMatrix& b) const;
-  SparseComplexMatrix solve (MatrixType& typ, const SparseComplexMatrix& b,
-                             octave_idx_type& info) const;
-  SparseComplexMatrix solve (MatrixType& typ, const SparseComplexMatrix& b,
-                             octave_idx_type& info, double& rcond) const;
-  SparseComplexMatrix solve (MatrixType& typ, const SparseComplexMatrix& b,
-                             octave_idx_type& info, double& rcond,
-                             solve_singularity_handler sing_handler,
-                             bool singular_fallabck = true) const;
+  OCTAVE_API SparseComplexMatrix
+  solve (MatrixType& typ, const SparseComplexMatrix& b) const;
+  OCTAVE_API SparseComplexMatrix
+  solve (MatrixType& typ, const SparseComplexMatrix& b,
+         octave_idx_type& info) const;
+  OCTAVE_API SparseComplexMatrix
+  solve (MatrixType& typ, const SparseComplexMatrix& b,
+         octave_idx_type& info, double& rcond) const;
+  OCTAVE_API SparseComplexMatrix
+  solve (MatrixType& typ, const SparseComplexMatrix& b,
+         octave_idx_type& info, double& rcond,
+         solve_singularity_handler sing_handler,
+         bool singular_fallabck = true) const;
 
-  ColumnVector solve (MatrixType& typ, const ColumnVector& b) const;
-  ColumnVector solve (MatrixType& typ, const ColumnVector& b,
-                      octave_idx_type& info) const;
-  ColumnVector solve (MatrixType& typ, const ColumnVector& b,
-                      octave_idx_type& info, double& rcond) const;
-  ColumnVector solve (MatrixType& typ, const ColumnVector& b,
-                      octave_idx_type& info, double& rcond,
-                      solve_singularity_handler sing_handler) const;
+  OCTAVE_API ColumnVector solve (MatrixType& typ, const ColumnVector& b) const;
+  OCTAVE_API ColumnVector
+  solve (MatrixType& typ, const ColumnVector& b, octave_idx_type& info) const;
+  OCTAVE_API ColumnVector
+  solve (MatrixType& typ, const ColumnVector& b, octave_idx_type& info,
+         double& rcond) const;
+  OCTAVE_API ColumnVector
+  solve (MatrixType& typ, const ColumnVector& b, octave_idx_type& info,
+         double& rcond, solve_singularity_handler sing_handler) const;
 
-  ComplexColumnVector solve (MatrixType& typ,
-                             const ComplexColumnVector& b) const;
-  ComplexColumnVector solve (MatrixType& typ, const ComplexColumnVector& b,
-                             octave_idx_type& info) const;
-  ComplexColumnVector solve (MatrixType& typ, const ComplexColumnVector& b,
-                             octave_idx_type& info, double& rcond) const;
-  ComplexColumnVector solve (MatrixType& typ, const ComplexColumnVector& b,
-                             octave_idx_type& info, double& rcond,
-                             solve_singularity_handler sing_handler) const;
+  OCTAVE_API ComplexColumnVector
+  solve (MatrixType& typ, const ComplexColumnVector& b) const;
+  OCTAVE_API ComplexColumnVector
+  solve (MatrixType& typ, const ComplexColumnVector& b,
+         octave_idx_type& info) const;
+  OCTAVE_API ComplexColumnVector
+  solve (MatrixType& typ, const ComplexColumnVector& b,
+         octave_idx_type& info, double& rcond) const;
+  OCTAVE_API ComplexColumnVector
+  solve (MatrixType& typ, const ComplexColumnVector& b,
+         octave_idx_type& info, double& rcond,
+         solve_singularity_handler sing_handler) const;
 
   // Generic interface to solver with probing of type
-  Matrix solve (const Matrix& b) const;
-  Matrix solve (const Matrix& b, octave_idx_type& info) const;
-  Matrix solve (const Matrix& b, octave_idx_type& info, double& rcond) const;
-  Matrix solve (const Matrix& b, octave_idx_type& info, double& rcond,
-                solve_singularity_handler sing_handler) const;
+  OCTAVE_API Matrix solve (const Matrix& b) const;
+  OCTAVE_API Matrix solve (const Matrix& b, octave_idx_type& info) const;
+  OCTAVE_API Matrix
+  solve (const Matrix& b, octave_idx_type& info, double& rcond) const;
+  OCTAVE_API Matrix
+  solve (const Matrix& b, octave_idx_type& info, double& rcond,
+         solve_singularity_handler sing_handler) const;
 
-  ComplexMatrix solve (const ComplexMatrix& b) const;
-  ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info) const;
-  ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info,
-                       double& rcond) const;
-  ComplexMatrix solve (const ComplexMatrix& b, octave_idx_type& info,
-                       double& rcond,
-                       solve_singularity_handler sing_handler) const;
+  OCTAVE_API ComplexMatrix solve (const ComplexMatrix& b) const;
+  OCTAVE_API ComplexMatrix
+  solve (const ComplexMatrix& b, octave_idx_type& info) const;
+  OCTAVE_API ComplexMatrix
+  solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond) const;
+  OCTAVE_API ComplexMatrix 
+  solve (const ComplexMatrix& b, octave_idx_type& info, double& rcond,
+         solve_singularity_handler sing_handler) const;
 
-  SparseMatrix solve (const SparseMatrix& b) const;
-  SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info) const;
-  SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info,
-                      double& rcond) const;
-  SparseMatrix solve (const SparseMatrix& b, octave_idx_type& info,
-                      double& rcond,
-                      solve_singularity_handler sing_handler) const;
+  OCTAVE_API SparseMatrix solve (const SparseMatrix& b) const;
+  OCTAVE_API SparseMatrix
+  solve (const SparseMatrix& b, octave_idx_type& info) const;
+  OCTAVE_API SparseMatrix
+  solve (const SparseMatrix& b, octave_idx_type& info, double& rcond) const;
+  OCTAVE_API SparseMatrix
+  solve (const SparseMatrix& b, octave_idx_type& info, double& rcond,
+         solve_singularity_handler sing_handler) const;
 
-  SparseComplexMatrix solve (const SparseComplexMatrix& b) const;
-  SparseComplexMatrix solve (const SparseComplexMatrix& b,
-                             octave_idx_type& info) const;
-  SparseComplexMatrix solve (const SparseComplexMatrix& b,
-                             octave_idx_type& info, double& rcond) const;
-  SparseComplexMatrix solve (const SparseComplexMatrix& b,
-                             octave_idx_type& info, double& rcond,
-                             solve_singularity_handler sing_handler) const;
+  OCTAVE_API SparseComplexMatrix solve (const SparseComplexMatrix& b) const;
+  OCTAVE_API SparseComplexMatrix
+  solve (const SparseComplexMatrix& b, octave_idx_type& info) const;
+  OCTAVE_API SparseComplexMatrix
+  solve (const SparseComplexMatrix& b, octave_idx_type& info,
+         double& rcond) const;
+  OCTAVE_API SparseComplexMatrix
+  solve (const SparseComplexMatrix& b, octave_idx_type& info,
+         double& rcond, solve_singularity_handler sing_handler) const;
 
-  ColumnVector solve (const ColumnVector& b) const;
-  ColumnVector solve (const ColumnVector& b, octave_idx_type& info) const;
-  ColumnVector solve (const ColumnVector& b, octave_idx_type& info,
-                      double& rcond) const;
-  ColumnVector solve (const ColumnVector& b, octave_idx_type& info,
-                      double& rcond,
-                      solve_singularity_handler sing_handler) const;
+  OCTAVE_API ColumnVector solve (const ColumnVector& b) const;
+  OCTAVE_API ColumnVector
+  solve (const ColumnVector& b, octave_idx_type& info) const;
+  OCTAVE_API ColumnVector
+  solve (const ColumnVector& b, octave_idx_type& info, double& rcond) const;
+  OCTAVE_API ColumnVector
+  solve (const ColumnVector& b, octave_idx_type& info, double& rcond,
+         solve_singularity_handler sing_handler) const;
 
-  ComplexColumnVector solve (const ComplexColumnVector& b) const;
-  ComplexColumnVector solve (const ComplexColumnVector& b,
-                             octave_idx_type& info) const;
-  ComplexColumnVector solve (const ComplexColumnVector& b,
-                             octave_idx_type& info, double& rcond) const;
-  ComplexColumnVector solve (const ComplexColumnVector& b,
-                             octave_idx_type& info, double& rcond,
-                             solve_singularity_handler sing_handler) const;
+  OCTAVE_API ComplexColumnVector solve (const ComplexColumnVector& b) const;
+  OCTAVE_API ComplexColumnVector
+  solve (const ComplexColumnVector& b, octave_idx_type& info) const;
+  OCTAVE_API ComplexColumnVector
+  solve (const ComplexColumnVector& b, octave_idx_type& info,
+         double& rcond) const;
+  OCTAVE_API ComplexColumnVector
+  solve (const ComplexColumnVector& b, octave_idx_type& info,
+         double& rcond, solve_singularity_handler sing_handler) const;
 
   // other operations
 
-  bool any_element_is_negative (bool = false) const;
-  bool any_element_is_nan (void) const;
-  bool any_element_is_inf_or_nan (void) const;
-  bool any_element_not_one_or_zero (void) const;
-  bool all_elements_are_zero (void) const;
-  bool all_elements_are_int_or_inf_or_nan (void) const;
-  bool all_integers (double& max_val, double& min_val) const;
-  bool too_large_for_float (void) const;
+  OCTAVE_API bool any_element_is_negative (bool = false) const;
+  OCTAVE_API bool any_element_is_nan (void) const;
+  OCTAVE_API bool any_element_is_inf_or_nan (void) const;
+  OCTAVE_API bool any_element_not_one_or_zero (void) const;
+  OCTAVE_API bool all_elements_are_zero (void) const;
+  OCTAVE_API bool all_elements_are_int_or_inf_or_nan (void) const;
+  OCTAVE_API bool all_integers (double& max_val, double& min_val) const;
+  OCTAVE_API bool too_large_for_float (void) const;
 
-  SparseBoolMatrix operator ! (void) const;
+  OCTAVE_API SparseBoolMatrix operator ! (void) const;
 
-  SparseBoolMatrix all (int dim = -1) const;
-  SparseBoolMatrix any (int dim = -1) const;
+  OCTAVE_API SparseBoolMatrix all (int dim = -1) const;
+  OCTAVE_API SparseBoolMatrix any (int dim = -1) const;
 
-  SparseMatrix cumprod (int dim = -1) const;
-  SparseMatrix cumsum (int dim = -1) const;
-  SparseMatrix prod (int dim = -1) const;
-  SparseMatrix sum (int dim = -1) const;
-  SparseMatrix sumsq (int dim = -1) const;
-  SparseMatrix abs (void) const;
+  OCTAVE_API SparseMatrix cumprod (int dim = -1) const;
+  OCTAVE_API SparseMatrix cumsum (int dim = -1) const;
+  OCTAVE_API SparseMatrix prod (int dim = -1) const;
+  OCTAVE_API SparseMatrix sum (int dim = -1) const;
+  OCTAVE_API SparseMatrix sumsq (int dim = -1) const;
+  OCTAVE_API SparseMatrix abs (void) const;
 
-  SparseMatrix diag (octave_idx_type k = 0) const;
+  OCTAVE_API SparseMatrix diag (octave_idx_type k = 0) const;
 
-  Matrix matrix_value (void) const;
+  OCTAVE_API Matrix matrix_value (void) const;
 
-  SparseMatrix squeeze (void) const;
+  OCTAVE_API SparseMatrix squeeze (void) const;
 
-  SparseMatrix reshape (const dim_vector& new_dims) const;
+  OCTAVE_API SparseMatrix reshape (const dim_vector& new_dims) const;
 
-  SparseMatrix permute (const Array<octave_idx_type>& vec,
-                        bool inv = false) const;
+  OCTAVE_API SparseMatrix
+  permute (const Array<octave_idx_type>& vec, bool inv = false) const;
 
-  SparseMatrix ipermute (const Array<octave_idx_type>& vec) const;
+  OCTAVE_API SparseMatrix ipermute (const Array<octave_idx_type>& vec) const;
 
   // i/o