From: guido Date: Wed, 5 May 1999 11:31:31 +0000 (+0000) Subject: number templates improved for long double X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5858e2b49e7fe836a8000fac460a639b76b078f4;p=dealii-svn.git number templates improved for long double git-svn-id: https://svn.dealii.org/trunk@1272 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/full_matrix.h b/deal.II/lac/include/lac/full_matrix.h index 88635a9d41..732efc0b34 100644 --- a/deal.II/lac/include/lac/full_matrix.h +++ b/deal.II/lac/include/lac/full_matrix.h @@ -36,6 +36,9 @@ class iVector; * data types, the implementation of non-inline functions is in * "fullmatrix.templates.h". Driver files are in the source tree. * + * Internal calculations are usually done with the accuracy of the vector argument to + * functions. If there is no argument with a number type, the matrix number type is used. + * * *
thisother * matrixvectorrhs in diff --git a/deal.II/lac/include/lac/full_matrix.templates.h b/deal.II/lac/include/lac/full_matrix.templates.h index dff65e6cb2..f6193a393d 100644 --- a/deal.II/lac/include/lac/full_matrix.templates.h +++ b/deal.II/lac/include/lac/full_matrix.templates.h @@ -115,10 +115,10 @@ FullMatrix::vmult (Vector& dst, Assert(dst.size() == m(), ExcDimensionMismatch(dst.size(), m())); Assert(src.size() == n(), ExcDimensionMismatch(src.size(), n())); - double s; + number2 s; if ((n()==3) && (m()==3)) { - double s0,s1,s2; + number2 s0,s1,s2; s = src(0); s0 = s*val[0]; s1 = s*val[3]; s2 = s*val[6]; s = src(1); @@ -141,7 +141,7 @@ FullMatrix::vmult (Vector& dst, } else if ((n()==4) && (m()==4)) { - double s0,s1,s2,s3; + number2 s0,s1,s2,s3; s = src(0); s0 = s*val[0]; s1 = s*val[4]; s2 = s*val[8]; s3 = s*val[12]; s = src(1); @@ -168,7 +168,7 @@ FullMatrix::vmult (Vector& dst, } else if ((n()==8) && (m()==8)) { - double s0,s1,s2,s3,s4,s5,s6,s7; + number2 s0,s1,s2,s3,s4,s5,s6,s7; s = src(0); s0 = s*val[0]; s1 = s*val[8]; s2 = s*val[16]; s3 = s*val[24]; s4 = s*val[32]; s5 = s*val[40]; s6 = s*val[48]; s7 = s*val[56]; @@ -244,10 +244,10 @@ void FullMatrix::gsmult (Vector& dst, const Vector& sr Assert(src.size() == n(), ExcDimensionMismatch(src.size(), n())); Assert(gl.n() == n(), ExcDimensionMismatch(gl.n(), n())); - double s; + number2 s; if ((n()==3) && (m()==3)) { - double s0=0.,s1=0.,s2=0.; + number2 s0=0.,s1=0.,s2=0.; s = src(0); if(gl(1)::gsmult (Vector& dst, const Vector& sr } else if ((n()==4) && (m()==4)) { - double s0=0.,s1=0.,s2=0.,s3=0.; + number2 s0=0.,s1=0.,s2=0.,s3=0.; s = src(0); if(gl(1)::gsmult (Vector& dst, const Vector& sr } else if ((n()==8) && (m()==8)) { - double s0=0.,s1=0.,s2=0.,s3=0.,s4=0.,s5=0.,s6=0.,s7=0.; + number2 s0=0.,s1=0.,s2=0.,s3=0.,s4=0.,s5=0.,s6=0.,s7=0.; s = src(0); if(gl(1)::Tvmult (Vector& dst, Assert(src.size() == m(), ExcDimensionMismatch(src.size(), m())); unsigned int i,j; - double s; + number2 s; const unsigned int size_m = m(), size_n = n(); for (i=0; i::residual (Vector& dst, Assert(right.size() == m(), ExcDimensionMismatch(right.size(), m())); unsigned int i,j; - double s, res = 0.; + number2 s, res = 0.; const unsigned int size_m = m(), size_n = n(); for (i=0; i::forward (Vector& dst, unsigned int i,j; unsigned int nu = ( (m()::backward (Vector& dst, { unsigned int j; unsigned int nu = (m()=0; --i) { s = src(i); @@ -593,7 +593,7 @@ void FullMatrix::mmult (FullMatrix& dst, { Assert (n() == src.m(), ExcDimensionMismatch(n(), src.m())); unsigned int i,j,k; - double s = 1.; + number2 s = 1.; dst.reinit(m(), src.n()); for (i=0;i::mmult (FullMatrix& dst, Assert (m() == src.n(), ExcDimensionMismatch(m(), src.n())); unsigned int i,j,k; - double s = 1.; + number2 s = 1.; dst.reinit(n(), src.m()); @@ -634,7 +634,7 @@ void FullMatrix::Tmmult (FullMatrix& dst, const FullMatrix::Tmmult (FullMatrix& dst, const FullMatrix::matrix_norm (const Vector &v) const Assert(m() == v.size(), ExcDimensionMismatch(m(),v.size())); Assert(n() == v.size(), ExcDimensionMismatch(n(),v.size())); - double sum = 0.; + number2 sum = 0.; const unsigned int n_rows = m(); const number *val_ptr = &val[0]; const number2 *v_ptr; for (unsigned int row=0; row::matrix_scalar_product (const Vector &u, cons Assert(m() == u.size(), ExcDimensionMismatch(m(),v.size())); Assert(n() == v.size(), ExcDimensionMismatch(n(),v.size())); - double sum = 0.; + number2 sum = 0.; const unsigned int n_rows = m(); const unsigned int n_cols = n(); const number *val_ptr = &val[0]; @@ -711,7 +711,7 @@ double FullMatrix::matrix_scalar_product (const Vector &u, cons for (unsigned int row=0; row double FullMatrix::norm2 () const { - double s = 0.; + number s = 0.; for (unsigned int i=0;i::invert (const FullMatrix &M) // this is Maple output, // thus a bit unstructured { - const double t4 = 1.0/(M.el(0,0)*M.el(1,1)-M.el(0,1)*M.el(1,0)); + const number t4 = 1.0/(M.el(0,0)*M.el(1,1)-M.el(0,1)*M.el(1,0)); el(0,0) = M.el(1,1)*t4; el(0,1) = -M.el(0,1)*t4; el(1,0) = -M.el(1,0)*t4; @@ -1233,7 +1233,7 @@ FullMatrix::invert (const FullMatrix &M) case 3: { - const double t4 = M.el(0,0)*M.el(1,1), + const number t4 = M.el(0,0)*M.el(1,1), t6 = M.el(0,0)*M.el(1,2), t8 = M.el(0,1)*M.el(1,0), t00 = M.el(0,2)*M.el(1,0), @@ -1262,61 +1262,61 @@ FullMatrix::invert (const FullMatrix &M) // readlib(C); // C(ai,optimized,filename=x4); - const double t14 = M.el(0,0)*M.el(1,1); - const double t15 = M.el(2,2)*M.el(3,3); - const double t17 = M.el(2,3)*M.el(3,2); - const double t19 = M.el(0,0)*M.el(2,1); - const double t20 = M.el(1,2)*M.el(3,3); - const double t22 = M.el(1,3)*M.el(3,2); - const double t24 = M.el(0,0)*M.el(3,1); - const double t25 = M.el(1,2)*M.el(2,3); - const double t27 = M.el(1,3)*M.el(2,2); - const double t29 = M.el(1,0)*M.el(0,1); - const double t32 = M.el(1,0)*M.el(2,1); - const double t33 = M.el(0,2)*M.el(3,3); - const double t35 = M.el(0,3)*M.el(3,2); - const double t37 = M.el(1,0)*M.el(3,1); - const double t38 = M.el(0,2)*M.el(2,3); - const double t40 = M.el(0,3)*M.el(2,2); - const double t42 = t14*t15-t14*t17-t19*t20+t19*t22+ + const number t14 = M.el(0,0)*M.el(1,1); + const number t15 = M.el(2,2)*M.el(3,3); + const number t17 = M.el(2,3)*M.el(3,2); + const number t19 = M.el(0,0)*M.el(2,1); + const number t20 = M.el(1,2)*M.el(3,3); + const number t22 = M.el(1,3)*M.el(3,2); + const number t24 = M.el(0,0)*M.el(3,1); + const number t25 = M.el(1,2)*M.el(2,3); + const number t27 = M.el(1,3)*M.el(2,2); + const number t29 = M.el(1,0)*M.el(0,1); + const number t32 = M.el(1,0)*M.el(2,1); + const number t33 = M.el(0,2)*M.el(3,3); + const number t35 = M.el(0,3)*M.el(3,2); + const number t37 = M.el(1,0)*M.el(3,1); + const number t38 = M.el(0,2)*M.el(2,3); + const number t40 = M.el(0,3)*M.el(2,2); + const number t42 = t14*t15-t14*t17-t19*t20+t19*t22+ t24*t25-t24*t27-t29*t15+t29*t17+ t32*t33-t32*t35-t37*t38+t37*t40; - const double t43 = M.el(2,0)*M.el(0,1); - const double t46 = M.el(2,0)*M.el(1,1); - const double t49 = M.el(2,0)*M.el(3,1); - const double t50 = M.el(0,2)*M.el(1,3); - const double t52 = M.el(0,3)*M.el(1,2); - const double t54 = M.el(3,0)*M.el(0,1); - const double t57 = M.el(3,0)*M.el(1,1); - const double t60 = M.el(3,0)*M.el(2,1); - const double t63 = t43*t20-t43*t22-t46*t33+t46*t35+ + const number t43 = M.el(2,0)*M.el(0,1); + const number t46 = M.el(2,0)*M.el(1,1); + const number t49 = M.el(2,0)*M.el(3,1); + const number t50 = M.el(0,2)*M.el(1,3); + const number t52 = M.el(0,3)*M.el(1,2); + const number t54 = M.el(3,0)*M.el(0,1); + const number t57 = M.el(3,0)*M.el(1,1); + const number t60 = M.el(3,0)*M.el(2,1); + const number t63 = t43*t20-t43*t22-t46*t33+t46*t35+ t49*t50-t49*t52-t54*t25+t54*t27+ t57*t38-t57*t40-t60*t50+t60*t52; - const double t65 = 1/(t42+t63); - const double t71 = M.el(0,2)*M.el(2,1); - const double t73 = M.el(0,3)*M.el(2,1); - const double t75 = M.el(0,2)*M.el(3,1); - const double t77 = M.el(0,3)*M.el(3,1); - const double t81 = M.el(0,1)*M.el(1,2); - const double t83 = M.el(0,1)*M.el(1,3); - const double t85 = M.el(0,2)*M.el(1,1); - const double t87 = M.el(0,3)*M.el(1,1); - const double t101 = M.el(1,0)*M.el(2,2); - const double t103 = M.el(1,0)*M.el(2,3); - const double t105 = M.el(2,0)*M.el(1,2); - const double t107 = M.el(2,0)*M.el(1,3); - const double t109 = M.el(3,0)*M.el(1,2); - const double t111 = M.el(3,0)*M.el(1,3); - const double t115 = M.el(0,0)*M.el(2,2); - const double t117 = M.el(0,0)*M.el(2,3); - const double t119 = M.el(2,0)*M.el(0,2); - const double t121 = M.el(2,0)*M.el(0,3); - const double t123 = M.el(3,0)*M.el(0,2); - const double t125 = M.el(3,0)*M.el(0,3); - const double t129 = M.el(0,0)*M.el(1,2); - const double t131 = M.el(0,0)*M.el(1,3); - const double t133 = M.el(1,0)*M.el(0,2); - const double t135 = M.el(1,0)*M.el(0,3); + const number t65 = 1/(t42+t63); + const number t71 = M.el(0,2)*M.el(2,1); + const number t73 = M.el(0,3)*M.el(2,1); + const number t75 = M.el(0,2)*M.el(3,1); + const number t77 = M.el(0,3)*M.el(3,1); + const number t81 = M.el(0,1)*M.el(1,2); + const number t83 = M.el(0,1)*M.el(1,3); + const number t85 = M.el(0,2)*M.el(1,1); + const number t87 = M.el(0,3)*M.el(1,1); + const number t101 = M.el(1,0)*M.el(2,2); + const number t103 = M.el(1,0)*M.el(2,3); + const number t105 = M.el(2,0)*M.el(1,2); + const number t107 = M.el(2,0)*M.el(1,3); + const number t109 = M.el(3,0)*M.el(1,2); + const number t111 = M.el(3,0)*M.el(1,3); + const number t115 = M.el(0,0)*M.el(2,2); + const number t117 = M.el(0,0)*M.el(2,3); + const number t119 = M.el(2,0)*M.el(0,2); + const number t121 = M.el(2,0)*M.el(0,3); + const number t123 = M.el(3,0)*M.el(0,2); + const number t125 = M.el(3,0)*M.el(0,3); + const number t129 = M.el(0,0)*M.el(1,2); + const number t131 = M.el(0,0)*M.el(1,3); + const number t133 = M.el(1,0)*M.el(0,2); + const number t135 = M.el(1,0)*M.el(0,3); el(0,0) = (M.el(1,1)*M.el(2,2)*M.el(3,3)-M.el(1,1)*M.el(2,3)*M.el(3,2)- M.el(2,1)*M.el(1,2)*M.el(3,3)+M.el(2,1)*M.el(1,3)*M.el(3,2)+ M.el(3,1)*M.el(1,2)*M.el(2,3)-M.el(3,1)*M.el(1,3)*M.el(2,2))*t65; @@ -1396,7 +1396,7 @@ FullMatrix::gauss_jordan() iVector p(n()); unsigned int i,j,k,r; - double max, hr; + number max, hr; for (i=0; i::householder(Vector& src) for (unsigned int j=0 ; j::least_squares(Vector& dst, Vector& src) householder(src); backward(dst, src); - double sum = 0.; + number2 sum = 0.; for (unsigned int i=n() ; i::vmult (Vector& dst, const Vector& somenumber *dst_ptr = &dst(0); for (unsigned int row=0; rowrowstart[row+1]]; while (val_ptr != val_end_of_row) s += *val_ptr++ * src(*colnum_ptr++); @@ -233,13 +233,13 @@ SparseMatrix::matrix_norm (const Vector& v) const Assert(m() == v.size(), ExcDimensionsDontMatch(m(),v.size())); Assert(n() == v.size(), ExcDimensionsDontMatch(n(),v.size())); - double sum = 0.; + somenumber sum = 0.; const unsigned int n_rows = m(); const number *val_ptr = &val[cols->rowstart[0]]; const int *colnum_ptr = &cols->colnums[cols->rowstart[0]]; for (unsigned int row=0; rowrowstart[row+1]]; while (val_ptr != val_end_of_row) s += *val_ptr++ * v(*colnum_ptr++); @@ -303,7 +303,7 @@ SparseMatrix::residual (Vector& dst, Assert(m() == b.size(), ExcDimensionsDontMatch(m(),b.size())); Assert(n() == u.size(), ExcDimensionsDontMatch(n(),u.size())); - double s,norm=0.; + somenumber s,norm=0.; for (unsigned int i=0;i::SSOR (Vector& dst, const number om) const int p; const unsigned int n = dst.size(); unsigned int j; - double s; + somenumber s; for (unsigned int i=0; i -#include +//#include #include #include @@ -487,122 +487,3 @@ SparseMatrixStruct::n_nonzero_elements () const { }; - - - - - - -// explicit instantiations for "float" -template class SparseMatrix; - -template SparseMatrix & SparseMatrix::copy_from (const SparseMatrix &); -template SparseMatrix & SparseMatrix::copy_from (const SparseMatrix &); - -template void SparseMatrix::add_scaled (const float, const SparseMatrix &); -template void SparseMatrix::add_scaled (const float, const SparseMatrix &); - -template void SparseMatrix::vmult (Vector &, const Vector &) const; -template void SparseMatrix::vmult (Vector &, const Vector &) const; - -template void SparseMatrix::Tvmult (Vector &, const Vector &) const; -template void SparseMatrix::Tvmult (Vector &, const Vector &) const; - -template double SparseMatrix::matrix_norm (const Vector &) const; -template double SparseMatrix::matrix_norm (const Vector &) const; - -template double SparseMatrix::residual (Vector &, - const Vector &, - const Vector &) const; -template double SparseMatrix::residual (Vector &, - const Vector &, - const Vector &) const; - -template void SparseMatrix::precondition_SSOR (Vector &, - const Vector &, - float) const; -template void SparseMatrix::precondition_SSOR (Vector &, - const Vector &, - float) const; - -template void SparseMatrix::precondition_SOR (Vector &, - const Vector &, - float) const; -template void SparseMatrix::precondition_SOR (Vector &, - const Vector &, - float) const; - -template void SparseMatrix::precondition_Jacobi (Vector &, - const Vector &, - float) const; -template void SparseMatrix::precondition_Jacobi (Vector &, - const Vector &, - float) const; - -template void SparseMatrix::SOR (Vector &, - float) const; -template void SparseMatrix::SOR (Vector &, - float) const; - -template void SparseMatrix::SSOR (Vector &, - float) const; -template void SparseMatrix::SSOR (Vector &, - float) const; - - - -// explicit instantiations for "double" -template class SparseMatrix; - -template SparseMatrix & SparseMatrix::copy_from (const SparseMatrix &); -template SparseMatrix & SparseMatrix::copy_from (const SparseMatrix &); - -template void SparseMatrix::add_scaled (const double, const SparseMatrix &); -template void SparseMatrix::add_scaled (const double, const SparseMatrix &); - -template void SparseMatrix::vmult (Vector &, const Vector &) const; -template void SparseMatrix::vmult (Vector &, const Vector &) const; - -template void SparseMatrix::Tvmult (Vector &, const Vector &) const; -template void SparseMatrix::Tvmult (Vector &, const Vector &) const; - -template double SparseMatrix::matrix_norm (const Vector &) const; -template double SparseMatrix::matrix_norm (const Vector &) const; - -template double SparseMatrix::residual (Vector &, - const Vector &, - const Vector &) const; -template double SparseMatrix::residual (Vector &, - const Vector &, - const Vector &) const; - -template void SparseMatrix::precondition_SSOR (Vector &, - const Vector &, - double) const; -template void SparseMatrix::precondition_SSOR (Vector &, - const Vector &, - double) const; - -template void SparseMatrix::precondition_SOR (Vector &, - const Vector &, - double) const; -template void SparseMatrix::precondition_SOR (Vector &, - const Vector &, - double) const; - -template void SparseMatrix::precondition_Jacobi (Vector &, - const Vector &, - double) const; -template void SparseMatrix::precondition_Jacobi (Vector &, - const Vector &, - double) const; - -template void SparseMatrix::SOR (Vector &, - double) const; -template void SparseMatrix::SOR (Vector &, - double) const; - -template void SparseMatrix::SSOR (Vector &, - double) const; -template void SparseMatrix::SSOR (Vector &, - double) const; diff --git a/deal.II/lac/source/sparse_matrix.double.cc b/deal.II/lac/source/sparse_matrix.double.cc new file mode 100644 index 0000000000..d3adea7812 --- /dev/null +++ b/deal.II/lac/source/sparse_matrix.double.cc @@ -0,0 +1,88 @@ +// $Id$ + +// SparseMatrix template instantiation + + +/* Instantiation is controlled by preprocessor symbols: + * + * 1. TYPEMAT : numerical type used in the matrix + * 2. TYPE2 : numerical type for function arguments + */ + +#include +#include + +#define TYPEMAT double + +template class SparseMatrix; + +#define TYPE2 float + +template SparseMatrix & +SparseMatrix::copy_from (const SparseMatrix &); + +template void SparseMatrix::add_scaled (const TYPEMAT, + const SparseMatrix &); + +template void SparseMatrix::vmult (Vector &, + const Vector &) const; +template void SparseMatrix::Tvmult (Vector &, + const Vector &) const; + +template double +SparseMatrix::matrix_norm (const Vector &) const; + +template double SparseMatrix::residual (Vector &, + const Vector &, + const Vector &) const; + +template void SparseMatrix::precondition_SSOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_SOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_Jacobi (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::SOR (Vector &, TYPEMAT) const; +template void SparseMatrix::SSOR (Vector &, TYPEMAT) const; + +#undef TYPE2 +#define TYPE2 double + +template SparseMatrix & +SparseMatrix::copy_from (const SparseMatrix &); + +template void SparseMatrix::add_scaled (const TYPEMAT, + const SparseMatrix &); + +template void SparseMatrix::vmult (Vector &, + const Vector &) const; +template void SparseMatrix::Tvmult (Vector &, + const Vector &) const; + +template double +SparseMatrix::matrix_norm (const Vector &) const; + +template double SparseMatrix::residual (Vector &, + const Vector &, + const Vector &) const; + +template void SparseMatrix::precondition_SSOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_SOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_Jacobi (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::SOR (Vector &, TYPEMAT) const; +template void SparseMatrix::SSOR (Vector &, TYPEMAT) const; diff --git a/deal.II/lac/source/sparse_matrix.float.cc b/deal.II/lac/source/sparse_matrix.float.cc new file mode 100644 index 0000000000..5be1b54c19 --- /dev/null +++ b/deal.II/lac/source/sparse_matrix.float.cc @@ -0,0 +1,88 @@ +// $Id$ + +// SparseMatrix template instantiation + + +/* Instantiation is controlled by preprocessor symbols: + * + * 1. TYPEMAT : numerical type used in the matrix + * 2. TYPE2 : numerical type for function arguments + */ + +#include +#include + +#define TYPEMAT float + +template class SparseMatrix; + +#define TYPE2 float + +template SparseMatrix & +SparseMatrix::copy_from (const SparseMatrix &); + +template void SparseMatrix::add_scaled (const TYPEMAT, + const SparseMatrix &); + +template void SparseMatrix::vmult (Vector &, + const Vector &) const; +template void SparseMatrix::Tvmult (Vector &, + const Vector &) const; + +template double +SparseMatrix::matrix_norm (const Vector &) const; + +template double SparseMatrix::residual (Vector &, + const Vector &, + const Vector &) const; + +template void SparseMatrix::precondition_SSOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_SOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_Jacobi (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::SOR (Vector &, TYPEMAT) const; +template void SparseMatrix::SSOR (Vector &, TYPEMAT) const; + +#undef TYPE2 +#define TYPE2 double + +template SparseMatrix & +SparseMatrix::copy_from (const SparseMatrix &); + +template void SparseMatrix::add_scaled (const TYPEMAT, + const SparseMatrix &); + +template void SparseMatrix::vmult (Vector &, + const Vector &) const; +template void SparseMatrix::Tvmult (Vector &, + const Vector &) const; + +template double +SparseMatrix::matrix_norm (const Vector &) const; + +template double SparseMatrix::residual (Vector &, + const Vector &, + const Vector &) const; + +template void SparseMatrix::precondition_SSOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_SOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_Jacobi (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::SOR (Vector &, TYPEMAT) const; +template void SparseMatrix::SSOR (Vector &, TYPEMAT) const; diff --git a/deal.II/lac/source/sparse_matrix.long_double.cc b/deal.II/lac/source/sparse_matrix.long_double.cc new file mode 100644 index 0000000000..6678c95d2f --- /dev/null +++ b/deal.II/lac/source/sparse_matrix.long_double.cc @@ -0,0 +1,196 @@ +// $Id$ + +// SparseMatrix template instantiation + + +/* Instantiation is controlled by preprocessor symbols: + * + * 1. TYPEMAT : numerical type used in the matrix + * 2. TYPE2 : numerical type for function arguments + */ + +#include +#include + +#define TYPEMAT long double + +template class SparseMatrix; + +#define TYPE2 float + +template SparseMatrix & +SparseMatrix::copy_from (const SparseMatrix &); + +template void SparseMatrix::add_scaled (const TYPEMAT, + const SparseMatrix &); + +template void SparseMatrix::vmult (Vector &, + const Vector &) const; +template void SparseMatrix::Tvmult (Vector &, + const Vector &) const; + +template double +SparseMatrix::matrix_norm (const Vector &) const; + +template double SparseMatrix::residual (Vector &, + const Vector &, + const Vector &) const; + +template void SparseMatrix::precondition_SSOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_SOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_Jacobi (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::SOR (Vector &, TYPEMAT) const; +template void SparseMatrix::SSOR (Vector &, TYPEMAT) const; + +#undef TYPE2 +#define TYPE2 double + +template SparseMatrix & +SparseMatrix::copy_from (const SparseMatrix &); + +template void SparseMatrix::add_scaled (const TYPEMAT, + const SparseMatrix &); + +template void SparseMatrix::vmult (Vector &, + const Vector &) const; +template void SparseMatrix::Tvmult (Vector &, + const Vector &) const; + +template double +SparseMatrix::matrix_norm (const Vector &) const; + +template double SparseMatrix::residual (Vector &, + const Vector &, + const Vector &) const; + +template void SparseMatrix::precondition_SSOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_SOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_Jacobi (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::SOR (Vector &, TYPEMAT) const; +template void SparseMatrix::SSOR (Vector &, TYPEMAT) const; + +#undef TYPE2 +#define TYPE2 long double + +template SparseMatrix & +SparseMatrix::copy_from (const SparseMatrix &); + +template void SparseMatrix::add_scaled (const TYPEMAT, + const SparseMatrix &); + +template void SparseMatrix::vmult (Vector &, + const Vector &) const; +template void SparseMatrix::Tvmult (Vector &, + const Vector &) const; + +template double +SparseMatrix::matrix_norm (const Vector &) const; + +template double SparseMatrix::residual (Vector &, + const Vector &, + const Vector &) const; + +template void SparseMatrix::precondition_SSOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_SOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_Jacobi (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::SOR (Vector &, TYPEMAT) const; +template void SparseMatrix::SSOR (Vector &, TYPEMAT) const; + +#undef TYPEMAT +#define TYPEMAT double + +template SparseMatrix & +SparseMatrix::copy_from (const SparseMatrix &); + +template void SparseMatrix::add_scaled (const TYPEMAT, + const SparseMatrix &); + +template void SparseMatrix::vmult (Vector &, + const Vector &) const; +template void SparseMatrix::Tvmult (Vector &, + const Vector &) const; + +template double +SparseMatrix::matrix_norm (const Vector &) const; + +template double SparseMatrix::residual (Vector &, + const Vector &, + const Vector &) const; + +template void SparseMatrix::precondition_SSOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_SOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_Jacobi (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::SOR (Vector &, TYPEMAT) const; +template void SparseMatrix::SSOR (Vector &, TYPEMAT) const; + +#undef TYPEMAT +#define TYPEMAT float + +template SparseMatrix & +SparseMatrix::copy_from (const SparseMatrix &); + +template void SparseMatrix::add_scaled (const TYPEMAT, + const SparseMatrix &); + +template void SparseMatrix::vmult (Vector &, + const Vector &) const; +template void SparseMatrix::Tvmult (Vector &, + const Vector &) const; + +template double +SparseMatrix::matrix_norm (const Vector &) const; + +template double SparseMatrix::residual (Vector &, + const Vector &, + const Vector &) const; + +template void SparseMatrix::precondition_SSOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_SOR (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::precondition_Jacobi (Vector &, + const Vector &, + TYPEMAT) const; + +template void SparseMatrix::SOR (Vector &, TYPEMAT) const; +template void SparseMatrix::SSOR (Vector &, TYPEMAT) const; diff --git a/deal.II/lac/source/vector.long_double.cc b/deal.II/lac/source/vector.long_double.cc new file mode 100644 index 0000000000..2fc8e16f28 --- /dev/null +++ b/deal.II/lac/source/vector.long_double.cc @@ -0,0 +1,13 @@ +// $Id$ + +#include + +// explicit instantiations +template class Vector; +template Vector& Vector::operator=(const Vector&); +template Vector& Vector::operator=(const Vector&); +template Vector& Vector::operator=(const Vector&); +template Vector& Vector::operator=(const Vector&); +// see the .h file for why these functions are disabled. +// template Vector::Vector (const Vector& v); +// template Vector::Vector (const Vector& v);