Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-istl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Stephan Hilb
dune-istl
Commits
b2c9640a
Commit
b2c9640a
authored
11 years ago
by
Peter Bastian
Browse files
Options
Downloads
Patches
Plain Diff
added product AT*B
[[Imported from SVN: r1927]]
parent
9e431b27
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/istl/matrixmatrix.hh
+32
-5
32 additions, 5 deletions
dune/istl/matrixmatrix.hh
with
32 additions
and
5 deletions
dune/istl/matrixmatrix.hh
+
32
−
5
View file @
b2c9640a
...
...
@@ -482,18 +482,19 @@ namespace Dune
res
.
setSize
(
rows
,
cols
,
patternInit
.
nonzeros
());
res
.
setBuildMode
(
BCRSMatrix
<
FieldMatrix
<
T
,
n1
,
m1
>
,
A
>::
row_wise
);
std
::
cout
<<
"Counting nonzeros took "
<<
timer
.
elapsed
()
<<
std
::
endl
;
//
std::cout<<"Counting nonzeros took "<<timer.elapsed()<<std::endl;
timer
.
reset
();
// Second step is to allocate the storage for the result and initialize the nonzero pattern
patternInit
.
initPattern
(
mat1
,
mat2
);
std
::
cout
<<
"Setting up sparsity pattern took "
<<
timer
.
elapsed
()
<<
std
::
endl
;
//
std::cout<<"Setting up sparsity pattern took "<<timer.elapsed()<<std::endl;
timer
.
reset
();
// As a last step calculate the entries
res
=
0.0
;
EntryAccumulator
<
T
,
A
,
n1
,
m1
,
transpose
>
entriesAccu
(
res
);
NonzeroPatternTraverser
<
transpose
>::
traverse
(
mat1
,
mat2
,
entriesAccu
);
std
::
cout
<<
"Calculating entries took "
<<
timer
.
elapsed
()
<<
std
::
endl
;
//
std::cout<<"Calculating entries took "<<timer.elapsed()<<std::endl;
}
}
...
...
@@ -518,10 +519,36 @@ namespace Dune
template
<
typename
T
,
typename
A
,
typename
A1
,
int
n
,
int
k
,
int
m
>
struct
MatMultMatResult
<
BCRSMatrix
<
FieldMatrix
<
T
,
n
,
k
>
,
A
>
,
BCRSMatrix
<
FieldMatrix
<
T
,
k
,
m
>
,
A1
>
>
{
typedef
BCRSMatrix
<
typename
MatMultMatResult
<
FieldMatrix
<
T
,
n
,
k
>
,
FieldMatrix
<
T
,
k
,
m
>
>::
type
,
A
>
type
;
typedef
BCRSMatrix
<
typename
MatMultMatResult
<
FieldMatrix
<
T
,
n
,
k
>
,
FieldMatrix
<
T
,
k
,
m
>
>::
type
,
std
::
allocator
<
typename
MatMultMatResult
<
FieldMatrix
<
T
,
n
,
k
>
,
FieldMatrix
<
T
,
k
,
m
>
>::
type
>
>
type
;
};
/**
* @brief Helper TMP to get the result type of a sparse matrix matrix multiplication (\f$C=A*B\f$)
*
* The type of matrix C will be stored as the associated type MatMultMatResult::type.
* @tparam M1 The type of matrix A.
* @tparam M2 The type of matrix B.
*/
template
<
typename
M1
,
typename
M2
>
struct
TransposedMatMultMatResult
{};
template
<
typename
T
,
int
n
,
int
k
,
int
m
>
struct
TransposedMatMultMatResult
<
FieldMatrix
<
T
,
k
,
n
>
,
FieldMatrix
<
T
,
k
,
m
>
>
{
typedef
FieldMatrix
<
T
,
n
,
m
>
type
;
};
template
<
typename
T
,
typename
A
,
typename
A1
,
int
n
,
int
k
,
int
m
>
struct
TransposedMatMultMatResult
<
BCRSMatrix
<
FieldMatrix
<
T
,
k
,
n
>
,
A
>
,
BCRSMatrix
<
FieldMatrix
<
T
,
k
,
m
>
,
A1
>
>
{
typedef
BCRSMatrix
<
typename
MatMultMatResult
<
FieldMatrix
<
T
,
n
,
k
>
,
FieldMatrix
<
T
,
k
,
m
>
>::
type
,
std
::
allocator
<
typename
MatMultMatResult
<
FieldMatrix
<
T
,
n
,
k
>
,
FieldMatrix
<
T
,
k
,
m
>
>::
type
>
>
type
;
};
/**
* @brief Calculate product of a sparse matrix with a transposed sparse matrices (\f$C=A*B^T\f$).
*
...
...
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