Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-solvers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
agnumpde
dune-solvers
Commits
be454cbc
Commit
be454cbc
authored
8 years ago
by
Elias Pipping
Browse files
Options
Downloads
Patches
Plain Diff
transpose moved to dune-matrix-vector
parent
3b16cfa1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/solvers/common/arithmetic.hh
+3
-92
3 additions, 92 deletions
dune/solvers/common/arithmetic.hh
with
3 additions
and
92 deletions
dune/solvers/common/arithmetic.hh
+
3
−
92
View file @
be454cbc
...
...
@@ -14,6 +14,7 @@
#include
<dune/istl/scaledidmatrix.hh>
#include
<dune/matrix-vector/axpy.hh>
#include
<dune/matrix-vector/transpose.hh>
#include
<dune/solvers/common/resize.hh>
...
...
@@ -170,98 +171,8 @@ namespace Arithmetic
}
};
template
<
class
A
>
struct
TransposeHelper
;
template
<
class
MatrixType
>
using
Transposed
=
typename
TransposeHelper
<
MatrixType
>::
TransposedType
;
template
<
class
A
>
struct
TransposeHelper
{
typedef
A
TransposedType
;
static
void
transpose
(
const
A
&
a
,
TransposedType
&
aT
)
{
DUNE_UNUSED_PARAMETER
(
a
);
DUNE_UNUSED_PARAMETER
(
aT
);
DUNE_THROW
(
Dune
::
Exception
,
"Not implemented for general matrix types!"
);
}
};
//! Specialization for Dune::FieldMatrix
template
<
class
T
,
int
n
,
int
m
>
struct
TransposeHelper
<
Dune
::
FieldMatrix
<
T
,
n
,
m
>
>
{
typedef
Dune
::
FieldMatrix
<
T
,
n
,
m
>
MatrixType
;
typedef
Dune
::
FieldMatrix
<
T
,
m
,
n
>
TransposedType
;
static
void
transpose
(
const
MatrixType
&
a
,
TransposedType
&
aT
)
{
for
(
int
row
=
0
;
row
<
m
;
++
row
)
for
(
int
col
=
0
;
col
<
n
;
++
col
)
aT
[
row
][
col
]
=
a
[
col
][
row
];
}
};
template
<
class
T
,
int
n
>
struct
TransposeHelper
<
Dune
::
DiagonalMatrix
<
T
,
n
>
>
{
typedef
Dune
::
DiagonalMatrix
<
T
,
n
>
MatrixType
;
typedef
Dune
::
DiagonalMatrix
<
T
,
n
>
TransposedType
;
static
void
transpose
(
const
MatrixType
&
a
,
TransposedType
&
aT
)
{
aT
=
a
;
}
};
template
<
class
T
,
int
n
>
struct
TransposeHelper
<
Dune
::
ScaledIdentityMatrix
<
T
,
n
>
>
{
typedef
Dune
::
ScaledIdentityMatrix
<
T
,
n
>
MatrixType
;
typedef
Dune
::
ScaledIdentityMatrix
<
T
,
n
>
TransposedType
;
static
void
transpose
(
const
MatrixType
&
a
,
TransposedType
&
aT
)
{
aT
=
a
;
}
};
//! Specialization for Dune::BCRSMatrix Type
template
<
class
A
>
struct
TransposeHelper
<
Dune
::
BCRSMatrix
<
A
>
>
{
typedef
Dune
::
BCRSMatrix
<
Transposed
<
A
>
>
TransposedType
;
static
void
transpose
(
const
Dune
::
BCRSMatrix
<
A
>&
a
,
TransposedType
&
aT
)
{
Dune
::
MatrixIndexSet
idxSetaT
(
a
.
M
(),
a
.
N
());
typedef
typename
Dune
::
BCRSMatrix
<
A
>::
ConstColIterator
ColIterator
;
// add indices into transposed matrix
for
(
size_t
row
=
0
;
row
<
a
.
N
();
++
row
)
{
ColIterator
col
=
a
[
row
].
begin
();
ColIterator
end
=
a
[
row
].
end
();
for
(
;
col
!=
end
;
++
col
)
idxSetaT
.
add
(
col
.
index
(),
row
);
}
idxSetaT
.
exportIdx
(
aT
);
for
(
size_t
row
=
0
;
row
<
a
.
N
();
++
row
)
{
ColIterator
col
=
a
[
row
].
begin
();
ColIterator
end
=
a
[
row
].
end
();
for
(
;
col
!=
end
;
++
col
)
TransposeHelper
<
A
>::
transpose
(
*
col
,
aT
[
col
.
index
()][
row
]);
}
}
};
using
Transposed
=
typename
Dune
::
MatrixVector
::
Transposed
<
MatrixType
>
;
/** \brief Add a product to some matrix or vector
*
...
...
@@ -308,7 +219,7 @@ namespace Arithmetic
template
<
class
A
>
void
transpose
(
const
A
&
a
,
Transposed
<
A
>&
aT
)
{
TransposeHelper
<
A
>
::
transpose
(
a
,
aT
);
Dune
::
MatrixVector
::
transpose
(
a
,
aT
);
}
/** \brief Add a scaled product to some matrix or vector
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment