From: Ralf Hartmann Date: Thu, 16 Feb 2006 09:59:26 +0000 (+0000) Subject: Implementation of add function. add_scaled is now deprecated. X-Git-Tag: v8.0.0~12295 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85f50d69a918998be442184b3b76b08ecdab320c;p=dealii.git Implementation of add function. add_scaled is now deprecated. git-svn-id: https://svn.dealii.org/trunk@12387 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/block_matrix_base.h b/deal.II/lac/include/lac/block_matrix_base.h index 0eea778a92..2beb4499b3 100644 --- a/deal.II/lac/include/lac/block_matrix_base.h +++ b/deal.II/lac/include/lac/block_matrix_base.h @@ -510,9 +510,29 @@ class BlockMatrixBase : public Subscriptor * this matrix. */ template + void add (const value_type factor, + const BlockMatrixType &matrix); + + + /** + * @deprecated Add + * matrix scaled by + * factor to this + * matrix, i.e. the matrix + * factor*matrix is + * added to this. + * + * This function is + * deprecated. Use add + * instead, since this has the + * same interface as the other + * matrix and vector classes in + * the library. + */ + template void add_scaled (const value_type factor, const BlockMatrixType &matrix); - + /** * Adding Matrix-vector * multiplication. Add $M*src$ on @@ -1469,7 +1489,7 @@ add_scaled (const value_type factor, { for (unsigned int r=0; r */ FullMatrix & operator /= (const double factor); - /** - * Add matrix scaled by - * factor to this matrix, - * i.e. the matrix factor*matrix - * is added to this. + /** + * Weighted addition. The matrix + * s*B is added to this. * * The source matrix may be a full matrix * over an arbitrary underlying scalar @@ -596,23 +594,27 @@ class FullMatrix : public Table<2,number> * convertible to the data type of this * matrix. */ - template - void add_scaled (const number factor, - const FullMatrix &matrix); - - /** - * Weighted addition. The matrix - * s*B is added to this. - * - * This function is deprecated. Use - * add_scaled instead, since - * this has the same interface as the - * other matrix classes in the library. - */ template void add (const number s, const FullMatrix &B); + /** + * @deprecated Weighted + * addition. The matrix + * s*B is added to + * this. + * + * This function is + * deprecated. Use add + * instead, since this has the + * same interface as the other + * matrix and vector classes in + * the library. + */ + template + void add_scaled (const number factor, + const FullMatrix &matrix); + /** * Add rectangular block. * diff --git a/deal.II/lac/include/lac/full_matrix.templates.h b/deal.II/lac/include/lac/full_matrix.templates.h index 610a0650c7..856a7656ea 100644 --- a/deal.II/lac/include/lac/full_matrix.templates.h +++ b/deal.II/lac/include/lac/full_matrix.templates.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -750,8 +750,8 @@ FullMatrix::print (STREAM &s, template template void -FullMatrix::add_scaled (const number s, - const FullMatrix &src) +FullMatrix::add (const number s, + const FullMatrix &src) { Assert (!this->empty(), ExcEmptyMatrix()); @@ -925,12 +925,13 @@ void FullMatrix::Tadd (const FullMatrix &src, template template void -FullMatrix::add (const number s, - const FullMatrix &src) +FullMatrix::add_scaled (const number s, + const FullMatrix &src) { - // this function is deprecated. forward to - // the other one - add_scaled (s, src); + // this function is + // deprecated. forward to the other + // one + add (s, src); } diff --git a/deal.II/lac/include/lac/sparse_matrix.h b/deal.II/lac/include/lac/sparse_matrix.h index c32dd0312f..eb75aa6c62 100644 --- a/deal.II/lac/include/lac/sparse_matrix.h +++ b/deal.II/lac/include/lac/sparse_matrix.h @@ -844,6 +844,25 @@ class SparseMatrix : public virtual Subscriptor * this matrix. */ template + void add (const number factor, + const SparseMatrix &matrix); + + /** + * @deprecated Add + * matrix scaled by + * factor to this + * matrix, i.e. the matrix + * factor*matrix is + * added to this. + * + * This function is + * deprecated. Use add + * instead, since this has the + * same interface as the other + * matrix and vector classes in + * the library. + */ + template void add_scaled (const number factor, const SparseMatrix &matrix); diff --git a/deal.II/lac/include/lac/sparse_matrix.templates.h b/deal.II/lac/include/lac/sparse_matrix.templates.h index 6d01e4cccb..1bf79f2d9e 100644 --- a/deal.II/lac/include/lac/sparse_matrix.templates.h +++ b/deal.II/lac/include/lac/sparse_matrix.templates.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -272,8 +272,8 @@ SparseMatrix::copy_from (const FullMatrix &matrix) template template void -SparseMatrix::add_scaled (const number factor, - const SparseMatrix &matrix) +SparseMatrix::add (const number factor, + const SparseMatrix &matrix) { Assert (cols != 0, ExcNotInitialized()); Assert (val != 0, ExcNotInitialized()); @@ -288,6 +288,16 @@ SparseMatrix::add_scaled (const number factor, } +template +template +void +SparseMatrix::add_scaled (const number factor, + const SparseMatrix &matrix) +{ + add(factor, matrix); +} + + template template void diff --git a/deal.II/lac/include/lac/sparse_matrix_ez.h b/deal.II/lac/include/lac/sparse_matrix_ez.h index cd27fa1f6e..2af0484815 100644 --- a/deal.II/lac/include/lac/sparse_matrix_ez.h +++ b/deal.II/lac/include/lac/sparse_matrix_ez.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2002, 2003, 2004, 2005 by the deal.II authors +// Copyright (C) 2002, 2003, 2004, 2005, 2006 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -593,6 +593,22 @@ class SparseMatrixEZ : public Subscriptor * standard @p const_iterator. */ template + void add (const number factor, + const MATRIX &matrix); + + /** + * @deprecated Add @p matrix + * scaled by @p factor to this + * matrix. + * + * This function is + * deprecated. Use add + * instead, since this has the + * same interface as the other + * matrix and vector classes in + * the library. + */ + template void add_scaled (const number factor, const MATRIX &matrix); @@ -1584,8 +1600,8 @@ template template inline void -SparseMatrixEZ::add_scaled (const number factor, - const MATRIX& M) +SparseMatrixEZ::add (const number factor, + const MATRIX& M) { Assert (M.m() == m(), ExcDimensionMismatch(M.m(), m())); Assert (M.n() == n(), ExcDimensionMismatch(M.n(), n())); @@ -1605,6 +1621,17 @@ SparseMatrixEZ::add_scaled (const number factor, } +template +template +inline +void +SparseMatrixEZ::add_scaled (const number factor, + const MATRIX& M) +{ + add (factor, M); +} + + template template inline void diff --git a/deal.II/lac/source/full_matrix.double.cc b/deal.II/lac/source/full_matrix.double.cc index ed96b22750..0e80525e22 100644 --- a/deal.II/lac/source/full_matrix.double.cc +++ b/deal.II/lac/source/full_matrix.double.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -32,9 +32,9 @@ template FullMatrix& FullMatrix::operator =( template void FullMatrix::fill ( const FullMatrix&, unsigned, unsigned, unsigned, unsigned); template void FullMatrix::add (const TYPEMAT, const FullMatrix&); +template void FullMatrix::add_scaled (const TYPEMAT, const FullMatrix&); template void FullMatrix::add ( const FullMatrix&, double, unsigned, unsigned, unsigned, unsigned); -template void FullMatrix::add_scaled (const TYPEMAT, const FullMatrix&); template void FullMatrix::Tadd (const TYPEMAT, const FullMatrix&); template void FullMatrix::Tadd ( const FullMatrix&, double, unsigned, unsigned, unsigned, unsigned); diff --git a/deal.II/lac/source/full_matrix.float.cc b/deal.II/lac/source/full_matrix.float.cc index c9fe30d339..d77b4df006 100644 --- a/deal.II/lac/source/full_matrix.float.cc +++ b/deal.II/lac/source/full_matrix.float.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -33,9 +33,9 @@ template FullMatrix& FullMatrix::operator =( template void FullMatrix::fill ( const FullMatrix&, unsigned, unsigned, unsigned, unsigned); template void FullMatrix::add (const TYPEMAT, const FullMatrix&); +template void FullMatrix::add_scaled (const TYPEMAT, const FullMatrix&); template void FullMatrix::add ( const FullMatrix&, double, unsigned, unsigned, unsigned, unsigned); -template void FullMatrix::add_scaled (const TYPEMAT, const FullMatrix&); template void FullMatrix::Tadd (const TYPEMAT, const FullMatrix&); template void FullMatrix::Tadd ( const FullMatrix&, double, unsigned, unsigned, unsigned, unsigned);