changeset 21219:ddf0a5f3a967

split interface and implementation for dmsolve * sparse-dmsolve.h: New file. Provide dmsolve declaration only. * liboctave/numeric/module.mk: Update. * sparse-dmsolve.cc: Explicitly instantiate template types we need. * CSparse.cc, dSparse.cc: Include sparse-dmsolve.h instead of sparse-dmsolve.cc.
author John W. Eaton <jwe@octave.org>
date Sun, 07 Feb 2016 14:06:43 -0500
parents 2bb4e5a6290d
children d78e45987d6a
files liboctave/array/CSparse.cc liboctave/array/dSparse.cc liboctave/numeric/module.mk liboctave/numeric/sparse-dmsolve.cc liboctave/numeric/sparse-dmsolve.h
diffstat 5 files changed, 72 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/array/CSparse.cc	Sun Feb 07 13:19:04 2016 -0500
+++ b/liboctave/array/CSparse.cc	Sun Feb 07 14:06:43 2016 -0500
@@ -66,8 +66,8 @@
 // Define whether to use a basic QR solver or one that uses a Dulmange
 // Mendelsohn factorization to seperate the problem into under-determined,
 // well-determined and over-determined parts and solves them seperately
-#ifndef USE_QRSOLVE
-#  include "sparse-dmsolve.cc"
+#if ! defined (USE_QRSOLVE)
+#  include "sparse-dmsolve.h"
 #endif
 
 // Fortran functions we call.
--- a/liboctave/array/dSparse.cc	Sun Feb 07 13:19:04 2016 -0500
+++ b/liboctave/array/dSparse.cc	Sun Feb 07 14:06:43 2016 -0500
@@ -61,8 +61,8 @@
 // Define whether to use a basic QR solver or one that uses a Dulmange
 // Mendelsohn factorization to seperate the problem into under-determined,
 // well-determined and over-determined parts and solves them seperately
-#ifndef USE_QRSOLVE
-#  include "sparse-dmsolve.cc"
+#if ! defined (USE_QRSOLVE)
+#  include "sparse-dmsolve.h"
 #endif
 
 // Fortran functions we call.
--- a/liboctave/numeric/module.mk	Sun Feb 07 13:19:04 2016 -0500
+++ b/liboctave/numeric/module.mk	Sun Feb 07 14:06:43 2016 -0500
@@ -81,6 +81,7 @@
   liboctave/numeric/randmtzig.h \
   liboctave/numeric/randpoisson.h \
   liboctave/numeric/sparse-chol.h \
+  liboctave/numeric/sparse-dmsolve.h \
   liboctave/numeric/sparse-lu.h \
   liboctave/numeric/sparse-qr.h
 
@@ -144,6 +145,7 @@
   liboctave/numeric/oct-rand.cc \
   liboctave/numeric/oct-spparms.cc \
   liboctave/numeric/sparse-chol.cc \
+  liboctave/numeric/sparse-dmsolve.cc \
   liboctave/numeric/sparse-lu.cc \
   liboctave/numeric/sparse-qr.cc \
   $(NUMERIC_C_SRC)
@@ -151,8 +153,7 @@
 LIBOCTAVE_TEMPLATE_SRC += \
   liboctave/numeric/base-lu.cc \
   liboctave/numeric/base-qr.cc \
-  liboctave/numeric/bsxfun-defs.cc \
-  liboctave/numeric/sparse-dmsolve.cc
+  liboctave/numeric/bsxfun-defs.cc
 
 ## Special rules for sources which must be built before rest of compilation.
 $(LIBOCTAVE_OPT_INC) : %.h : %.in
--- a/liboctave/numeric/sparse-dmsolve.cc	Sun Feb 07 13:19:04 2016 -0500
+++ b/liboctave/numeric/sparse-dmsolve.cc	Sun Feb 07 14:06:43 2016 -0500
@@ -475,3 +475,37 @@
 
 #endif
 }
+
+// Instantiations we need.
+
+template ComplexMatrix
+dmsolve<ComplexMatrix, SparseComplexMatrix, Matrix>
+  (const SparseComplexMatrix&, const Matrix&, octave_idx_type&);
+
+template SparseComplexMatrix
+dmsolve<SparseComplexMatrix, SparseComplexMatrix, SparseMatrix>
+  (const SparseComplexMatrix&, const SparseMatrix&, octave_idx_type&);
+
+template ComplexMatrix
+dmsolve<ComplexMatrix, SparseComplexMatrix, ComplexMatrix>
+  (const SparseComplexMatrix&, const ComplexMatrix&, octave_idx_type&);
+
+template SparseComplexMatrix
+dmsolve<SparseComplexMatrix, SparseComplexMatrix, SparseComplexMatrix>
+  (const SparseComplexMatrix&, const SparseComplexMatrix&, octave_idx_type&);
+
+template Matrix
+dmsolve<Matrix, SparseMatrix, Matrix>
+  (const SparseMatrix&, const Matrix&, octave_idx_type&);
+
+template SparseMatrix
+dmsolve<SparseMatrix, SparseMatrix, SparseMatrix>
+  (const SparseMatrix&, const SparseMatrix&, octave_idx_type&);
+
+template ComplexMatrix
+dmsolve<ComplexMatrix, SparseMatrix, ComplexMatrix>
+  (const SparseMatrix&, const ComplexMatrix&, octave_idx_type&);
+
+template SparseComplexMatrix
+dmsolve<SparseComplexMatrix, SparseMatrix, SparseComplexMatrix>
+  (const SparseMatrix&, const SparseComplexMatrix&, octave_idx_type&);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/numeric/sparse-dmsolve.h	Sun Feb 07 14:06:43 2016 -0500
@@ -0,0 +1,31 @@
+/*
+
+Copyright (C) 2016 John W. Eaton
+Copyright (C) 2006-2015 David Bateman
+
+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
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if ! defined (octave_sparse_dmsolve_h)
+#define octave_sparse_dmsolve_h 1
+
+template <typename RT, typename ST, typename T>
+RT
+dmsolve (const ST& a, const T& b, octave_idx_type& info);
+
+#endif