Nektar++
Loading...
Searching...
No Matches
library
LibUtilities
LinearAlgebra
LinearAlgebra/NekMatrix.hpp
Go to the documentation of this file.
1
///////////////////////////////////////////////////////////////////////////////
2
//
3
// File: NekMatrix.hpp
4
//
5
// For more information, please see: http://www.nektar.info
6
//
7
// The MIT License
8
//
9
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10
// Department of Aeronautics, Imperial College London (UK), and Scientific
11
// Computing and Imaging Institute, University of Utah (USA).
12
//
13
// Permission is hereby granted, free of charge, to any person obtaining a
14
// copy of this software and associated documentation files (the "Software"),
15
// to deal in the Software without restriction, including without limitation
16
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17
// and/or sell copies of the Software, and to permit persons to whom the
18
// Software is furnished to do so, subject to the following conditions:
19
//
20
// The above copyright notice and this permission notice shall be included
21
// in all copies or substantial portions of the Software.
22
//
23
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29
// DEALINGS IN THE SOFTWARE.
30
//
31
// Description: Generic Matrix
32
//
33
//
34
//
35
///////////////////////////////////////////////////////////////////////////////
36
37
#ifndef NEKTAR_LIB_UTILITIES_NEK_MATRIX_HPP
38
#define NEKTAR_LIB_UTILITIES_NEK_MATRIX_HPP
39
40
#include <
LibUtilities/LinearAlgebra/BlockMatrix.hpp
>
41
#include <
LibUtilities/LinearAlgebra/MatrixBase.hpp
>
42
#include <
LibUtilities/LinearAlgebra/MatrixOperations.hpp
>
43
#include <
LibUtilities/LinearAlgebra/ScaledMatrix.hpp
>
44
#include <
LibUtilities/LinearAlgebra/StandardMatrix.hpp
>
45
46
namespace
Nektar
47
{
48
template
<
typename
DataType,
typename
FormType>
49
std::ostream &
operator<<
(std::ostream &os,
50
const
NekMatrix<DataType, FormType>
&rhs)
51
{
52
int
oswidth = 9;
53
int
osprecision = 6;
54
55
for
(
unsigned
int
i = 0; i < rhs.GetRows(); ++i)
56
{
57
os <<
"["
;
58
for
(
unsigned
int
j = 0; j < rhs.GetColumns(); ++j)
59
{
60
os.width(oswidth);
61
os.precision(osprecision);
62
os << rhs(i, j);
63
if
(j != rhs.GetColumns() - 1)
64
{
65
os <<
", "
;
66
}
67
}
68
os <<
"]"
;
69
if
(i != rhs.GetRows() - 1)
70
{
71
os << std::endl;
72
}
73
}
74
return
os;
75
}
76
77
template
<
typename
DataType,
typename
FormType>
78
std::ostream &
operator>>
(std::ostream &os,
79
const
NekMatrix<DataType, FormType>
&rhs)
80
{
81
NekDouble
tol = 1e-12;
82
os <<
"["
<< std::endl;
83
84
for
(
unsigned
int
i = 0; i < rhs.GetRows(); ++i)
85
{
86
for
(
unsigned
int
j = 0; j < rhs.GetColumns(); ++j)
87
{
88
if
((
NekDouble
)rhs(i, j) > tol)
89
{
90
os <<
'+'
;
91
}
92
else
if
((
NekDouble
)rhs(i, j) < -tol)
93
{
94
os <<
'*'
;
95
}
96
else
97
{
98
os <<
'-'
;
99
}
100
}
101
if
(i != rhs.GetRows() - 1)
102
{
103
os << std::endl;
104
}
105
}
106
os <<
"]"
<< std::endl;
107
return
os;
108
}
109
}
// namespace Nektar
110
111
#endif
// NEKTAR_LIB_UTILITIES_NEK_MATRIX_HPP
BlockMatrix.hpp
MatrixBase.hpp
MatrixOperations.hpp
ScaledMatrix.hpp
StandardMatrix.hpp
Nektar::NekMatrix
Definition
NekMatrixFwd.hpp:52
Nektar::LibUtilities::operator<<
std::ostream & operator<<(std::ostream &os, const BasisKey &rhs)
Definition
Foundations/Basis.cpp:81
Nektar
Definition
CoupledSolver.h:2
Nektar::operator>>
std::ostream & operator>>(std::ostream &os, const NekMatrix< DataType, FormType > &rhs)
Definition
LinearAlgebra/NekMatrix.hpp:78
Nektar::NekDouble
double NekDouble
Definition
NektarUnivTypeDefs.hpp:43
Generated on Sun Nov 9 2025 20:16:57 for Nektar++ by
1.9.8