Mercurial > octave
changeset 29242:f207504ae98d
sparse-qr: Export member function instantiations (patch #8919).
* liboctave/numeric/sparse-qr.cc: Do not export class instatiation before
specializations. Explicitly instantiate all exported member functions of
sparse_qr class.
* liboctave/numeric/sparse-qr.h: Import/export template class instantiation with
clang or for Windows.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 01 Jan 2021 16:05:31 +0100 |
parents | 0a6ed9dcd601 |
children | e2bca6106057 |
files | liboctave/numeric/sparse-qr.cc liboctave/numeric/sparse-qr.h |
diffstat | 2 files changed, 51 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/numeric/sparse-qr.cc Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/numeric/sparse-qr.cc Fri Jan 01 16:05:31 2021 +0100 @@ -173,12 +173,6 @@ #endif } - // Instantiations we need. - - template class OCTAVE_API sparse_qr<SparseMatrix>; - - template class OCTAVE_API sparse_qr<SparseComplexMatrix>; - // Specializations. // Real-valued matrices. @@ -2301,6 +2295,46 @@ return rep->template wide_solve<RHS_T, RET_T> (b, info); } + // Explicitly instantiate all member functions + + template OCTAVE_API sparse_qr<SparseMatrix>::sparse_qr (void); + template OCTAVE_API + sparse_qr<SparseMatrix>::sparse_qr (const SparseMatrix& a, int order); + template OCTAVE_API + sparse_qr<SparseMatrix>::sparse_qr (const sparse_qr<SparseMatrix>& a); + template OCTAVE_API sparse_qr<SparseMatrix>::~sparse_qr (void); + template OCTAVE_API bool sparse_qr<SparseMatrix>::ok (void) const; + template OCTAVE_API SparseMatrix sparse_qr<SparseMatrix>::V (void) const; + template OCTAVE_API ColumnVector sparse_qr<SparseMatrix>::Pinv (void) const; + template OCTAVE_API ColumnVector sparse_qr<SparseMatrix>::P (void) const; + template OCTAVE_API SparseMatrix + sparse_qr<SparseMatrix>::R (bool econ) const; + template OCTAVE_API Matrix + sparse_qr<SparseMatrix>::C (const Matrix& b) const; + template OCTAVE_API Matrix sparse_qr<SparseMatrix>::Q (void) const; + + template OCTAVE_API sparse_qr<SparseComplexMatrix>::sparse_qr (void); + template OCTAVE_API + sparse_qr<SparseComplexMatrix>::sparse_qr + (const SparseComplexMatrix& a, int order); + template OCTAVE_API + sparse_qr<SparseComplexMatrix>::sparse_qr + (const sparse_qr<SparseComplexMatrix>& a); + template OCTAVE_API sparse_qr<SparseComplexMatrix>::~sparse_qr (void); + template OCTAVE_API bool sparse_qr<SparseComplexMatrix>::ok (void) const; + template OCTAVE_API SparseComplexMatrix + sparse_qr<SparseComplexMatrix>::V (void) const; + template OCTAVE_API ColumnVector + sparse_qr<SparseComplexMatrix>::Pinv (void) const; + template OCTAVE_API ColumnVector + sparse_qr<SparseComplexMatrix>::P (void) const; + template OCTAVE_API SparseComplexMatrix + sparse_qr<SparseComplexMatrix>::R (bool econ) const; + template OCTAVE_API ComplexMatrix + sparse_qr<SparseComplexMatrix>::C (const ComplexMatrix& b) const; + template OCTAVE_API ComplexMatrix + sparse_qr<SparseComplexMatrix>::Q (void) const; + Matrix qrsolve (const SparseMatrix& a, const MArray<double>& b, octave_idx_type& info)
--- a/liboctave/numeric/sparse-qr.h Tue Dec 29 19:51:08 2020 +0100 +++ b/liboctave/numeric/sparse-qr.h Fri Jan 01 16:05:31 2021 +0100 @@ -32,8 +32,8 @@ class Matrix; class ComplexMatrix; +class SparseMatrix; class SparseComplexMatrix; -class SparseMatrix; class ColumnVector; template <typename T> class MArray; @@ -98,6 +98,14 @@ wide_solve (const RHS_T& b, octave_idx_type& info) const; }; +#if defined (__clang__) || defined (_WIN32) + // extern instantiations with set visibility/export/import attribute + + extern template class OCTAVE_API sparse_qr<SparseMatrix>; + + extern template class OCTAVE_API sparse_qr<SparseComplexMatrix>; +#endif + // Provide qrsolve for backward compatibility. extern OCTAVE_API Matrix @@ -132,8 +140,8 @@ qrsolve (const SparseComplexMatrix& a, const SparseComplexMatrix& b, octave_idx_type& info); - //typedef sparse_qr<SparseMatrix> SparseQR; - //typedef sparse_qr<SparseComplexMatrix> SparseComplexQR; + typedef sparse_qr<SparseMatrix> SparseQR; + typedef sparse_qr<SparseComplexMatrix> SparseComplexQR; } }