Revision 011918364aba1e855ffb647ff66d3922815b9899 authored by Lars Bilke on 11 October 2021, 09:04:49 UTC, committed by Lars Bilke on 11 October 2021, 09:04:49 UTC
1 parent 187df32
Raw File
MatrixTools.h
/**
 * \copyright
 * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
 *            Distributed under a Modified BSD License.
 *              See accompanying file LICENSE.txt or
 *              http://www.opengeosys.org/project/license
 *
 */

#pragma once

namespace FeTestData
{

// copy matrix entries in upper triangle to lower triangle
template <class T_MATRIX, typename ID_TYPE=signed>
inline void copyUpperToLower(const ID_TYPE dim, T_MATRIX &m)
{
    for (ID_TYPE i=0; i<dim; i++)
        for (ID_TYPE j=0; j<i; j++)
            m(i,j) = m(j,i);
}

// set an identity matrix
template <class T_MATRIX, typename ID_TYPE=signed>
inline void setIdentityMatrix(unsigned dim, T_MATRIX &m)
{
    for (unsigned i=0; i<dim; i++)
        for (unsigned j=0; j<dim; j++)
            m(i,j) = 0.0;
    for (unsigned i=0; i<dim; i++)
        m(i,i) = 1.0;
}

}  // namespace FeTestData
back to top