Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
ag-ohlberger
dune-community
dune-xt
Commits
3ee9c134
Commit
3ee9c134
authored
6 years ago
by
Tobias Leibner
Browse files
Options
Downloads
Patches
Plain Diff
[container.matrix] add transposed pattern, fix multiply for sparse matrices
parent
b543dc13
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dune/xt/la/container/matrix-interface.hh
+8
-6
8 additions, 6 deletions
dune/xt/la/container/matrix-interface.hh
dune/xt/la/container/pattern.cc
+10
-0
10 additions, 0 deletions
dune/xt/la/container/pattern.cc
dune/xt/la/container/pattern.hh
+2
-0
2 additions, 0 deletions
dune/xt/la/container/pattern.hh
with
20 additions
and
6 deletions
dune/xt/la/container/matrix-interface.hh
+
8
−
6
View file @
3ee9c134
...
...
@@ -235,10 +235,11 @@ public:
derived_type
transposed
()
const
{
derived_type
yy
(
rows
(),
cols
(),
0.
);
const
auto
this_pattern
=
pattern
();
derived_type
yy
(
cols
(),
rows
(),
this_pattern
.
transposed
(
cols
()));
for
(
size_t
rr
=
0
;
rr
<
rows
();
++
rr
)
for
(
size_t
cc
=
0
;
cc
<
cols
();
++
cc
)
yy
.
set_entry
(
rr
,
cc
,
get_entry
(
cc
,
rr
));
for
(
const
auto
&
cc
:
this_pattern
.
inner
(
rr
)
)
yy
.
set_entry
(
cc
,
rr
,
get_entry
(
rr
,
cc
));
return
yy
;
}
...
...
@@ -376,11 +377,12 @@ protected:
{
if
(
other
.
rows
()
!=
cols
())
DUNE_THROW
(
XT
::
Common
::
Exceptions
::
shapes_do_not_match
,
"Dimensions of matrices to be multiplied do not match!"
);
const
auto
new_pattern
=
multiplication_pattern
(
pattern
(),
other
.
pattern
(),
other
.
cols
());
const
auto
this_pattern
=
pattern
();
const
auto
new_pattern
=
multiplication_pattern
(
this_pattern
,
other
.
pattern
(),
other
.
cols
());
derived_type
yy
(
rows
(),
other
.
cols
(),
new_pattern
);
for
(
size_t
rr
=
0
;
rr
<
rows
();
++
rr
)
for
(
size_t
cc
=
0
;
cc
<
other
.
cols
();
++
cc
)
for
(
size_t
kk
=
0
;
kk
<
cols
();
++
kk
)
for
(
auto
&&
cc
:
new_pattern
.
inner
(
rr
)
)
for
(
auto
&&
kk
:
this_pattern
.
inner
(
rr
)
)
yy
.
add_to_entry
(
rr
,
cc
,
get_entry
(
rr
,
kk
)
*
other
.
get_entry
(
kk
,
cc
));
return
yy
;
}
...
...
This diff is collapsed.
Click to expand it.
dune/xt/la/container/pattern.cc
+
10
−
0
View file @
3ee9c134
...
...
@@ -110,6 +110,16 @@ void SparsityPatternDefault::sort()
std
::
sort
(
inner_vector
.
begin
(),
inner_vector
.
end
());
}
SparsityPatternDefault
SparsityPatternDefault
::
transposed
(
const
size_t
cols
)
const
{
SparsityPatternDefault
transposed_pattern
(
cols
);
for
(
size_t
rr
=
0
;
rr
<
size
();
++
rr
)
for
(
const
auto
&
cc
:
inner
(
rr
))
transposed_pattern
.
insert
(
cc
,
rr
);
transposed_pattern
.
sort
();
return
transposed_pattern
;
}
SparsityPatternDefault
dense_pattern
(
const
size_t
rows
,
const
size_t
cols
)
{
SparsityPatternDefault
ret
(
rows
);
...
...
This diff is collapsed.
Click to expand it.
dune/xt/la/container/pattern.hh
+
2
−
0
View file @
3ee9c134
...
...
@@ -61,6 +61,8 @@ public:
void
sort
();
SparsityPatternDefault
transposed
(
const
size_t
cols
)
const
;
private:
BaseType
vector_of_vectors_
;
};
// class SparsityPatternDefault
...
...
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