ENH: Matrix: add non-conjugate transpose function

This commit is contained in:
Kutalmis Bercin
2022-02-01 08:44:09 +00:00
committed by Mark Olesen
parent addfcf1bc2
commit 96cb473305
2 changed files with 23 additions and 3 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -405,6 +405,23 @@ Form Foam::Matrix<Form, Type>::T() const
}
template<class Form, class Type>
Form Foam::Matrix<Form, Type>::transpose() const
{
Form At(labelPair{n(), m()});
for (label i = 0; i < m(); ++i)
{
for (label j = 0; j < n(); ++j)
{
At(j, i) = (*this)(i, j);
}
}
return At;
}
template<class Form, class Type>
Foam::List<Type> Foam::Matrix<Form, Type>::diag() const
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -372,9 +372,12 @@ public:
// Operations
//- Return (conjugate) transpose of Matrix
//- Return conjugate transpose of Matrix
Form T() const;
//- Return non-conjugate transpose of Matrix
Form transpose() const;
//- Right-multiply Matrix by a column vector (A * x)
inline tmp<Field<Type>> Amul(const UList<Type>& x) const;