LCOV - code coverage report
Current view: top level - ugbase/lib_algebra/small_algebra/small_matrix - densematrix_operations.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 14 0
Test Date: 2025-09-21 23:31:46 Functions: 0.0 % 7 0

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2010-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Martin Rupp
       4              :  * 
       5              :  * This file is part of UG4.
       6              :  * 
       7              :  * UG4 is free software: you can redistribute it and/or modify it under the
       8              :  * terms of the GNU Lesser General Public License version 3 (as published by the
       9              :  * Free Software Foundation) with the following additional attribution
      10              :  * requirements (according to LGPL/GPL v3 §7):
      11              :  * 
      12              :  * (1) The following notice must be displayed in the Appropriate Legal Notices
      13              :  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
      14              :  * 
      15              :  * (2) The following notice must be displayed at a prominent place in the
      16              :  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
      17              :  * 
      18              :  * (3) The following bibliography is recommended for citation and must be
      19              :  * preserved in all covered files:
      20              :  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
      21              :  *   parallel geometric multigrid solver on hierarchically distributed grids.
      22              :  *   Computing and visualization in science 16, 4 (2013), 151-164"
      23              :  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
      24              :  *   flexible software system for simulating pde based models on high performance
      25              :  *   computers. Computing and visualization in science 16, 4 (2013), 165-179"
      26              :  * 
      27              :  * This program is distributed in the hope that it will be useful,
      28              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      29              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      30              :  * GNU Lesser General Public License for more details.
      31              :  */
      32              : 
      33              : #ifndef __H__UG__COMMON__DENSEMATRIX_OPERATIONS_H__
      34              : #define __H__UG__COMMON__DENSEMATRIX_OPERATIONS_H__
      35              : 
      36              : #include "densematrix.h"
      37              : #include "densevector.h"
      38              : 
      39              : #include "../../common/operations.h"
      40              : 
      41              : namespace ug{
      42              : 
      43              : /// \addtogroup small_algebra
      44              : /// \{
      45              : 
      46              : template<typename T>
      47              : struct matrix_algebra_type_traits;
      48              : 
      49              : template<typename T>
      50              : struct matrix_algebra_type_traits<DenseMatrix<T> >
      51              : {
      52              :         static const int type = MATRIX_USE_GLOBAL_FUNCTIONS;
      53              : };
      54              : 
      55              : //! calculates dest = beta1 * A1 * w1;
      56              : template<typename vector_t, typename matrix_t>
      57            0 : inline void MatMult(DenseVector<vector_t> &dest,
      58              :                 const number &beta1, const DenseMatrix<matrix_t> &A1, const DenseVector<vector_t> &w1)
      59              : {
      60            0 :         for(size_t r = 0; r < dest.size(); ++r)
      61              :         {
      62              :                 MatMult(dest[r], beta1, A1(r,0), w1[0]);
      63            0 :                 for(size_t c = 1; c < w1.size(); ++c)
      64              :                         MatMultAdd(dest[r], 1.0, dest[r], beta1, A1(r,c), w1[c]);
      65              :         }
      66            0 : }
      67              : 
      68              : //! calculates dest = alpha1*v1 + beta1 * A1 *w1;
      69              : template<typename vector_t, typename matrix_t>
      70            0 : inline void MatMultAdd(DenseVector<vector_t> &dest,
      71              :                 const number &alpha1, const DenseVector<vector_t> &v1,
      72              :                 const number &beta1, const DenseMatrix<matrix_t> &A1, const DenseVector<vector_t> &w1)
      73              : {
      74            0 :         for(size_t r = 0; r < dest.size(); ++r)
      75              :         {
      76            0 :                 VecScaleAssign(dest[r], alpha1, v1[r]);
      77            0 :                 for(size_t c = 0; c < w1.size(); ++c)
      78              :                         MatMultAdd(dest[r], 1.0, dest[r], beta1, A1(r,c), w1[c]);
      79              :         }
      80            0 : }
      81              : 
      82              : //! calculates dest = alpha1*v1 + beta1 * A1^T *w1;
      83              : template<typename vector_t, typename matrix_t>
      84            0 : inline void MatMultTransposedAdd(DenseVector<vector_t> &dest,
      85              :                 const number &alpha1, const DenseVector<vector_t> &v1,
      86              :                 const number &beta1, const DenseMatrix<matrix_t> &A1, const DenseVector<vector_t> &w1)
      87              : {
      88            0 :         for(size_t r = 0; r < dest.size(); ++r)
      89              :         {
      90            0 :                 VecScaleAssign(dest[r], alpha1, v1[r]);
      91            0 :                 for(size_t c = 0; c < w1.size(); ++c)
      92              :                         MatMultTransposedAdd(dest[r], 1.0, dest[r], beta1, A1(c,r), w1[c]);
      93              :         }
      94            0 : }
      95              : 
      96              : // end group small_algebra
      97              : /// \}
      98              : 
      99              : }
     100              : 
     101              : #endif // __H__UG__COMMON__DENSEMATRIX_OPERATIONS_H__
        

Generated by: LCOV version 2.0-1