changeset 21190:342764537e5a

don't install eigs-base.cc * eigs-base.h: New file. * __eigs__.cc: Include eigs-base.h, not eigs-base.cc * eigs-base.cc: Instantiate functions needed in Octave. * liboctave/numeric/module.mk: Update.
author John W. Eaton <jwe@octave.org>
date Thu, 04 Feb 2016 02:24:51 -0500
parents 47765afaf131
children 8e317ce26a24
files libinterp/dldfcn/__eigs__.cc liboctave/numeric/eigs-base.cc liboctave/numeric/eigs-base.h liboctave/numeric/module.mk
diffstat 4 files changed, 287 insertions(+), 82 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/dldfcn/__eigs__.cc	Thu Feb 04 00:40:14 2016 -0500
+++ b/libinterp/dldfcn/__eigs__.cc	Thu Feb 04 02:24:51 2016 -0500
@@ -24,19 +24,18 @@
 #include <config.h>
 #endif
 
-#include "ov.h"
 #include "defun-dld.h"
+#include "eigs-base.h"
 #include "error.h"
 #include "errwarn.h"
-#include "quit.h"
-#include "variables.h"
-#include "ov-re-sparse.h"
+#include "oct-map.h"
 #include "ov-cx-sparse.h"
-#include "oct-map.h"
+#include "ov-re-sparse.h"
+#include "ov.h"
 #include "pager.h"
+#include "quit.h"
 #include "unwind-prot.h"
-
-#include "eigs-base.cc"
+#include "variables.h"
 
 // Global pointer for user defined function.
 static octave_function *eigs_fcn = 0;
--- a/liboctave/numeric/eigs-base.cc	Thu Feb 04 00:40:14 2016 -0500
+++ b/liboctave/numeric/eigs-base.cc	Thu Feb 04 02:24:51 2016 -0500
@@ -29,24 +29,23 @@
 #include <vector>
 #include <iostream>
 
-#include "f77-fcn.h"
-#include "oct-locbuf.h"
-#include "quit.h"
-#include "sparse-lu.h"
-#include "dSparse.h"
 #include "CSparse.h"
+#include "CmplxCHOL.h"
+#include "CmplxLU.h"
 #include "MatrixType.h"
-#include "sparse-chol.h"
-#include "oct-rand.h"
+#include "dSparse.h"
 #include "dbleCHOL.h"
-#include "CmplxCHOL.h"
 #include "dbleLU.h"
-#include "CmplxLU.h"
+#include "eigs-base.h"
+#include "f77-fcn.h"
+#include "mx-ops.h"
+#include "oct-locbuf.h"
+#include "oct-rand.h"
+#include "quit.h"
+#include "sparse-chol.h"
+#include "sparse-lu.h"
 
 #ifdef HAVE_ARPACK
-typedef ColumnVector (*EigsFunc) (const ColumnVector &x, int &eigs_error);
-typedef ComplexColumnVector (*EigsComplexFunc)
-  (const ComplexColumnVector &x, int &eigs_error);
 
 // Arpack and blas fortran functions we call.
 extern "C"
@@ -3255,45 +3254,122 @@
   return ip(4);
 }
 
-#ifndef _MSC_VER
-template octave_idx_type
-lusolve (const SparseMatrix&, const SparseMatrix&, Matrix&);
-
-template octave_idx_type
-lusolve (const SparseComplexMatrix&, const SparseComplexMatrix&,
-         ComplexMatrix&);
-
-template octave_idx_type
-lusolve (const Matrix&, const Matrix&, Matrix&);
-
-template octave_idx_type
-lusolve (const ComplexMatrix&, const ComplexMatrix&, ComplexMatrix&);
-
-template ComplexMatrix
-ltsolve (const SparseComplexMatrix&, const ColumnVector&,
-         const ComplexMatrix&);
-
-template Matrix
-ltsolve (const SparseMatrix&, const ColumnVector&, const Matrix&);
-
-template ComplexMatrix
-ltsolve (const ComplexMatrix&, const ColumnVector&, const ComplexMatrix&);
-
-template Matrix
-ltsolve (const Matrix&, const ColumnVector&, const Matrix&);
-
-template ComplexMatrix
-utsolve (const SparseComplexMatrix&, const ColumnVector&,
-         const ComplexMatrix&);
-
-template Matrix
-utsolve (const SparseMatrix&, const ColumnVector&, const Matrix&);
-
-template ComplexMatrix
-utsolve (const ComplexMatrix&, const ColumnVector&, const ComplexMatrix&);
-
-template Matrix
-utsolve (const Matrix&, const ColumnVector&, const Matrix&);
-#endif
+// Instantiations for the types we need.
+
+// Matrix
+
+template
+octave_idx_type
+EigsRealSymmetricMatrix<Matrix>
+  (const Matrix& m, const std::string typ, octave_idx_type k,
+   octave_idx_type p, octave_idx_type& info, Matrix& eig_vec,
+   ColumnVector& eig_val, const Matrix& _b, ColumnVector& permB,
+   ColumnVector& resid, std::ostream& os, double tol, bool rvec,
+   bool cholB, int disp, int maxit);
+
+template
+octave_idx_type
+EigsRealSymmetricMatrixShift<Matrix>
+  (const Matrix& m, double sigma, octave_idx_type k,
+   octave_idx_type p, octave_idx_type& info, Matrix& eig_vec,
+   ColumnVector& eig_val, const Matrix& _b, ColumnVector& permB,
+   ColumnVector& resid, std::ostream& os, double tol, bool rvec,
+   bool cholB, int disp, int maxit);
+
+template
+octave_idx_type
+EigsRealNonSymmetricMatrix<Matrix>
+  (const Matrix& m, const std::string typ, octave_idx_type k,
+   octave_idx_type p, octave_idx_type& info, ComplexMatrix& eig_vec,
+   ComplexColumnVector& eig_val, const Matrix& _b, ColumnVector& permB,
+   ColumnVector& resid, std::ostream& os, double tol, bool rvec,
+   bool cholB, int disp, int maxit);
+
+template
+octave_idx_type
+EigsRealNonSymmetricMatrixShift<Matrix>
+  (const Matrix& m, double sigmar, octave_idx_type k,
+   octave_idx_type p, octave_idx_type& info, ComplexMatrix& eig_vec,
+   ComplexColumnVector& eig_val, const Matrix& _b, ColumnVector& permB,
+   ColumnVector& resid, std::ostream& os, double tol, bool rvec,
+   bool cholB, int disp, int maxit);
+
+// SparseMatrix
+
+template
+octave_idx_type
+EigsRealSymmetricMatrix<SparseMatrix>
+  (const SparseMatrix& m, const std::string typ, octave_idx_type k,
+   octave_idx_type p, octave_idx_type& info, Matrix& eig_vec,
+   ColumnVector& eig_val, const SparseMatrix& _b, ColumnVector& permB,
+   ColumnVector& resid, std::ostream& os, double tol, bool rvec,
+   bool cholB, int disp, int maxit);
+
+template
+octave_idx_type
+EigsRealSymmetricMatrixShift<SparseMatrix>
+  (const SparseMatrix& m, double sigma, octave_idx_type k,
+   octave_idx_type p, octave_idx_type& info, Matrix& eig_vec,
+   ColumnVector& eig_val, const SparseMatrix& _b, ColumnVector& permB,
+   ColumnVector& resid, std::ostream& os, double tol, bool rvec,
+   bool cholB, int disp, int maxit);
+
+template
+octave_idx_type
+EigsRealNonSymmetricMatrix<SparseMatrix>
+  (const SparseMatrix& m, const std::string typ, octave_idx_type k,
+   octave_idx_type p, octave_idx_type& info, ComplexMatrix& eig_vec,
+   ComplexColumnVector& eig_val, const SparseMatrix& _b, ColumnVector& permB,
+   ColumnVector& resid, std::ostream& os, double tol, bool rvec,
+   bool cholB, int disp, int maxit);
+
+template
+octave_idx_type
+EigsRealNonSymmetricMatrixShift<SparseMatrix>
+  (const SparseMatrix& m, double sigmar, octave_idx_type k,
+   octave_idx_type p, octave_idx_type& info, ComplexMatrix& eig_vec,
+   ComplexColumnVector& eig_val, const SparseMatrix& _b, ColumnVector& permB,
+   ColumnVector& resid, std::ostream& os, double tol, bool rvec,
+   bool cholB, int disp, int maxit);
+
+// ComplexMatrix
+
+template
+octave_idx_type
+EigsComplexNonSymmetricMatrix<ComplexMatrix>
+  (const ComplexMatrix& m, const std::string typ, octave_idx_type k,
+   octave_idx_type p, octave_idx_type& info, ComplexMatrix& eig_vec,
+   ComplexColumnVector& eig_val, const ComplexMatrix& _b, ColumnVector& permB,
+   ComplexColumnVector& cresid, std::ostream& os, double tol,
+   bool rvec, bool cholB, int disp, int maxit);
+
+template
+octave_idx_type
+EigsComplexNonSymmetricMatrixShift<ComplexMatrix>
+  (const ComplexMatrix& m, Complex sigma, octave_idx_type k,
+   octave_idx_type p, octave_idx_type& info, ComplexMatrix& eig_vec,
+   ComplexColumnVector& eig_val, const ComplexMatrix& _b, ColumnVector& permB,
+   ComplexColumnVector& cresid, std::ostream& os, double tol,
+   bool rvec, bool cholB, int disp, int maxit);
+
+// SparseComplexMatrix
+
+template
+octave_idx_type
+EigsComplexNonSymmetricMatrix<SparseComplexMatrix>
+  (const SparseComplexMatrix& m, const std::string typ, octave_idx_type k,
+   octave_idx_type p, octave_idx_type& info, ComplexMatrix& eig_vec,
+   ComplexColumnVector& eig_val, const SparseComplexMatrix& _b,
+   ColumnVector& permB, ComplexColumnVector& cresid, std::ostream& os,
+   double tol, bool rvec, bool cholB, int disp, int maxit);
+
+template
+octave_idx_type
+EigsComplexNonSymmetricMatrixShift<SparseComplexMatrix>
+  (const SparseComplexMatrix& m, Complex sigma, octave_idx_type k,
+   octave_idx_type p, octave_idx_type& info, ComplexMatrix& eig_vec,
+   ComplexColumnVector& eig_val, const SparseComplexMatrix& _b,
+   ColumnVector& permB, ComplexColumnVector& cresid, std::ostream& os,
+   double tol, bool rvec, bool cholB, int disp, int maxit);
 
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/numeric/eigs-base.h	Thu Feb 04 02:24:51 2016 -0500
@@ -0,0 +1,129 @@
+/*
+
+Copyright (C) 2005-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_eigs_base_h)
+#define octave_eigs_base_h 1
+
+#include <iosfwd>
+
+class ColumnVector;
+class ComplexColumnVector;
+class Matrix;
+class ComplexMatrix;
+
+typedef ColumnVector (*EigsFunc) (const ColumnVector& x, int& eigs_error);
+
+typedef ComplexColumnVector (*EigsComplexFunc) (const ComplexColumnVector& x, int& eigs_error);
+
+template <typename M>
+octave_idx_type
+EigsRealSymmetricMatrix (const M& m, const std::string typ,
+                         octave_idx_type k, octave_idx_type p,
+                         octave_idx_type& info, Matrix& eig_vec,
+                         ColumnVector& eig_val, const M& _b,
+                         ColumnVector& permB, ColumnVector& resid,
+                         std::ostream& os, double tol, bool rvec,
+                         bool cholB, int disp, int maxit);
+
+template <typename M>
+octave_idx_type
+EigsRealSymmetricMatrixShift (const M& m, double sigma,
+                              octave_idx_type k, octave_idx_type p,
+                              octave_idx_type& info, Matrix& eig_vec,
+                              ColumnVector& eig_val, const M& _b,
+                              ColumnVector& permB, ColumnVector& resid,
+                              std::ostream& os, double tol, bool rvec,
+                              bool cholB, int disp, int maxit);
+
+extern OCTAVE_API octave_idx_type
+EigsRealSymmetricFunc (EigsFunc fun, octave_idx_type n,
+                       const std::string& _typ, double sigma,
+                       octave_idx_type k, octave_idx_type p,
+                       octave_idx_type& info, Matrix& eig_vec,
+                       ColumnVector& eig_val, ColumnVector& resid,
+                       std::ostream& os, double tol, bool rvec,
+                       bool /* cholB */, int disp, int maxit);
+
+template <typename M>
+octave_idx_type
+EigsRealNonSymmetricMatrix (const M& m, const std::string typ,
+                            octave_idx_type k, octave_idx_type p,
+                            octave_idx_type& info, ComplexMatrix& eig_vec,
+                            ComplexColumnVector& eig_val, const M& _b,
+                            ColumnVector& permB, ColumnVector& resid,
+                            std::ostream& os, double tol, bool rvec,
+                            bool cholB, int disp, int maxit);
+
+template <typename M>
+octave_idx_type
+EigsRealNonSymmetricMatrixShift (const M& m, double sigmar,
+                                 octave_idx_type k, octave_idx_type p,
+                                 octave_idx_type& info,
+                                 ComplexMatrix& eig_vec,
+                                 ComplexColumnVector& eig_val, const M& _b,
+                                 ColumnVector& permB, ColumnVector& resid,
+                                 std::ostream& os, double tol, bool rvec,
+                                 bool cholB, int disp, int maxit);
+
+extern OCTAVE_API octave_idx_type
+EigsRealNonSymmetricFunc (EigsFunc fun, octave_idx_type n,
+                          const std::string& _typ, double sigmar,
+                          octave_idx_type k, octave_idx_type p,
+                          octave_idx_type& info, ComplexMatrix& eig_vec,
+                          ComplexColumnVector& eig_val, ColumnVector& resid,
+                          std::ostream& os, double tol, bool rvec,
+                          bool /* cholB */, int disp, int maxit);
+
+template <typename M>
+octave_idx_type
+EigsComplexNonSymmetricMatrix (const M& m, const std::string typ,
+                               octave_idx_type k, octave_idx_type p,
+                               octave_idx_type& info, ComplexMatrix& eig_vec,
+                               ComplexColumnVector& eig_val, const M& _b,
+                               ColumnVector& permB,
+                               ComplexColumnVector& cresid,
+                               std::ostream& os, double tol, bool rvec,
+                               bool cholB, int disp, int maxit);
+
+template <typename M>
+octave_idx_type
+EigsComplexNonSymmetricMatrixShift (const M& m, Complex sigma,
+                                    octave_idx_type k, octave_idx_type p,
+                                    octave_idx_type& info,
+                                    ComplexMatrix& eig_vec,
+                                    ComplexColumnVector& eig_val, const M& _b,
+                                    ColumnVector& permB,
+                                    ComplexColumnVector& cresid,
+                                    std::ostream& os, double tol, bool rvec,
+                                    bool cholB, int disp, int maxit);
+
+extern OCTAVE_API octave_idx_type
+EigsComplexNonSymmetricFunc (EigsComplexFunc fun, octave_idx_type n,
+                             const std::string& _typ, Complex sigma,
+                             octave_idx_type k, octave_idx_type p,
+                             octave_idx_type& info, ComplexMatrix& eig_vec,
+                             ComplexColumnVector& eig_val,
+                             ComplexColumnVector& cresid, std::ostream& os,
+                             double tol, bool rvec, bool /* cholB */,
+                             int disp, int maxit);
+
+#endif
--- a/liboctave/numeric/module.mk	Thu Feb 04 00:40:14 2016 -0500
+++ b/liboctave/numeric/module.mk	Thu Feb 04 02:24:51 2016 -0500
@@ -8,14 +8,6 @@
 LIBOCTAVE_OPT_IN = $(LIBOCTAVE_OPT_INC:.h=.in)
 
 NUMERIC_INC = \
-  liboctave/numeric/base-aepbal.h \
-  liboctave/numeric/base-dae.h \
-  liboctave/numeric/base-de.h \
-  liboctave/numeric/base-lu.h \
-  liboctave/numeric/base-min.h \
-  liboctave/numeric/base-qr.h \
-  liboctave/numeric/bsxfun-decl.h \
-  liboctave/numeric/bsxfun.h \
   liboctave/numeric/CmplxAEPBAL.h \
   liboctave/numeric/CmplxCHOL.h \
   liboctave/numeric/CmplxGEPBAL.h \
@@ -26,13 +18,29 @@
   liboctave/numeric/CmplxSCHUR.h \
   liboctave/numeric/CmplxSVD.h \
   liboctave/numeric/CollocWt.h \
+  liboctave/numeric/DAE.h \
   liboctave/numeric/DAEFunc.h \
-  liboctave/numeric/DAE.h \
+  liboctave/numeric/DAERT.h \
   liboctave/numeric/DAERTFunc.h \
-  liboctave/numeric/DAERT.h \
   liboctave/numeric/DASPK.h \
   liboctave/numeric/DASRT.h \
   liboctave/numeric/DASSL.h \
+  liboctave/numeric/DET.h \
+  liboctave/numeric/EIG.h \
+  liboctave/numeric/LSODE.h \
+  liboctave/numeric/ODE.h \
+  liboctave/numeric/ODEFunc.h \
+  liboctave/numeric/ODES.h \
+  liboctave/numeric/ODESFunc.h \
+  liboctave/numeric/Quad.h \
+  liboctave/numeric/base-aepbal.h \
+  liboctave/numeric/base-dae.h \
+  liboctave/numeric/base-de.h \
+  liboctave/numeric/base-lu.h \
+  liboctave/numeric/base-min.h \
+  liboctave/numeric/base-qr.h \
+  liboctave/numeric/bsxfun-decl.h \
+  liboctave/numeric/bsxfun.h \
   liboctave/numeric/dbleAEPBAL.h \
   liboctave/numeric/dbleCHOL.h \
   liboctave/numeric/dbleGEPBAL.h \
@@ -42,8 +50,7 @@
   liboctave/numeric/dbleQRP.h \
   liboctave/numeric/dbleSCHUR.h \
   liboctave/numeric/dbleSVD.h \
-  liboctave/numeric/DET.h \
-  liboctave/numeric/EIG.h \
+  liboctave/numeric/eigs-base.h \
   liboctave/numeric/fCmplxAEPBAL.h \
   liboctave/numeric/fCmplxCHOL.h \
   liboctave/numeric/fCmplxGEPBAL.h \
@@ -65,17 +72,11 @@
   liboctave/numeric/floatSVD.h \
   liboctave/numeric/lo-mappers.h \
   liboctave/numeric/lo-specfun.h \
-  liboctave/numeric/LSODE.h \
   liboctave/numeric/oct-convn.h \
   liboctave/numeric/oct-fftw.h \
   liboctave/numeric/oct-norm.h \
   liboctave/numeric/oct-rand.h \
   liboctave/numeric/oct-spparms.h \
-  liboctave/numeric/ODEFunc.h \
-  liboctave/numeric/ODE.h \
-  liboctave/numeric/ODESFunc.h \
-  liboctave/numeric/ODES.h \
-  liboctave/numeric/Quad.h \
   liboctave/numeric/randgamma.h \
   liboctave/numeric/randmtzig.h \
   liboctave/numeric/randpoisson.h \
@@ -102,19 +103,20 @@
   liboctave/numeric/DASPK.cc \
   liboctave/numeric/DASRT.cc \
   liboctave/numeric/DASSL.cc \
+  liboctave/numeric/EIG.cc \
+  liboctave/numeric/LSODE.cc \
+  liboctave/numeric/ODES.cc \
+  liboctave/numeric/Quad.cc \
   liboctave/numeric/dbleAEPBAL.cc \
   liboctave/numeric/dbleCHOL.cc \
   liboctave/numeric/dbleGEPBAL.cc \
   liboctave/numeric/dbleHESS.cc \
   liboctave/numeric/dbleLU.cc \
-  liboctave/numeric/EIG.cc \
-  liboctave/numeric/LSODE.cc \
-  liboctave/numeric/ODES.cc \
-  liboctave/numeric/Quad.cc \
   liboctave/numeric/dbleQR.cc \
   liboctave/numeric/dbleQRP.cc \
   liboctave/numeric/dbleSCHUR.cc \
   liboctave/numeric/dbleSVD.cc \
+  liboctave/numeric/eigs-base.cc \
   liboctave/numeric/fCmplxAEPBAL.cc \
   liboctave/numeric/fCmplxCHOL.cc \
   liboctave/numeric/fCmplxGEPBAL.cc \
@@ -150,7 +152,6 @@
   liboctave/numeric/base-lu.cc \
   liboctave/numeric/base-qr.cc \
   liboctave/numeric/bsxfun-defs.cc \
-  liboctave/numeric/eigs-base.cc \
   liboctave/numeric/sparse-dmsolve.cc
 
 ## Special rules for sources which must be built before rest of compilation.