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
c96b387e
Commit
c96b387e
authored
5 years ago
by
Tobias Leibner
Browse files
Options
Downloads
Patches
Plain Diff
[container.matrix-view] add get_pattern to non-const view
parent
aeec2baf
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/xt/la/container/matrix-view.hh
+11
-6
11 additions, 6 deletions
dune/xt/la/container/matrix-view.hh
with
11 additions
and
6 deletions
dune/xt/la/container/matrix-view.hh
+
11
−
6
View file @
c96b387e
...
@@ -321,7 +321,7 @@ public:
...
@@ -321,7 +321,7 @@ public:
ThisType
&
operator
=
(
const
Matrix
&
other
)
ThisType
&
operator
=
(
const
Matrix
&
other
)
{
{
const
auto
&
patt
=
const_matrix_view_
.
get_pattern
();
const
auto
&
patt
=
get_pattern
();
assert
(
pattern_assignable
(
other
));
assert
(
pattern_assignable
(
other
));
for
(
size_t
ii
=
0
;
ii
<
rows
();
++
ii
)
for
(
size_t
ii
=
0
;
ii
<
rows
();
++
ii
)
for
(
auto
&&
jj
:
patt
.
inner
(
ii
))
for
(
auto
&&
jj
:
patt
.
inner
(
ii
))
...
@@ -351,7 +351,7 @@ public:
...
@@ -351,7 +351,7 @@ public:
inline
void
scal
(
const
ScalarType
&
alpha
)
inline
void
scal
(
const
ScalarType
&
alpha
)
{
{
const
auto
&
patt
=
const_matrix_view_
.
get_pattern
();
const
auto
&
patt
=
get_pattern
();
for
(
size_t
ii
=
0
;
ii
<
rows
();
++
ii
)
for
(
size_t
ii
=
0
;
ii
<
rows
();
++
ii
)
for
(
auto
&&
jj
:
patt
.
inner
(
ii
))
for
(
auto
&&
jj
:
patt
.
inner
(
ii
))
set_entry
(
ii
,
jj
,
get_entry
(
ii
,
jj
)
*
alpha
);
set_entry
(
ii
,
jj
,
get_entry
(
ii
,
jj
)
*
alpha
);
...
@@ -361,7 +361,7 @@ public:
...
@@ -361,7 +361,7 @@ public:
{
{
const
auto
other_patt
=
xx
.
pattern
();
const
auto
other_patt
=
xx
.
pattern
();
#ifndef NDEBUG
#ifndef NDEBUG
const
auto
&
patt
=
const_matrix_view_
.
get_pattern
();
const
auto
&
patt
=
get_pattern
();
if
(
xx
.
rows
()
!=
rows
()
||
xx
.
cols
()
!=
cols
())
if
(
xx
.
rows
()
!=
rows
()
||
xx
.
cols
()
!=
cols
())
DUNE_THROW
(
Common
::
Exceptions
::
shapes_do_not_match
,
"Shapes do not match!"
);
DUNE_THROW
(
Common
::
Exceptions
::
shapes_do_not_match
,
"Shapes do not match!"
);
for
(
size_t
ii
=
0
;
ii
<
rows
();
++
ii
)
for
(
size_t
ii
=
0
;
ii
<
rows
();
++
ii
)
...
@@ -422,14 +422,14 @@ public:
...
@@ -422,14 +422,14 @@ public:
inline
void
clear_row
(
const
size_t
ii
)
inline
void
clear_row
(
const
size_t
ii
)
{
{
const
auto
&
patt
=
const_matrix_view_
.
get_pattern
();
const
auto
&
patt
=
get_pattern
();
for
(
auto
&&
jj
:
patt
.
inner
(
ii
))
for
(
auto
&&
jj
:
patt
.
inner
(
ii
))
set_entry
(
ii
,
jj
,
0.
);
set_entry
(
ii
,
jj
,
0.
);
}
}
inline
void
clear_col
(
const
size_t
jj
)
inline
void
clear_col
(
const
size_t
jj
)
{
{
const
auto
&
patt
=
const_matrix_view_
.
get_pattern
();
const
auto
&
patt
=
get_pattern
();
for
(
size_t
ii
=
0
;
ii
<
rows
();
++
ii
)
for
(
size_t
ii
=
0
;
ii
<
rows
();
++
ii
)
if
(
std
::
find
(
patt
.
inner
(
ii
).
begin
(),
patt
.
inner
(
ii
).
end
(),
jj
)
!=
patt
.
inner
(
ii
).
end
())
if
(
std
::
find
(
patt
.
inner
(
ii
).
begin
(),
patt
.
inner
(
ii
).
end
(),
jj
)
!=
patt
.
inner
(
ii
).
end
())
set_entry
(
ii
,
jj
,
0.
);
set_entry
(
ii
,
jj
,
0.
);
...
@@ -452,10 +452,15 @@ public:
...
@@ -452,10 +452,15 @@ public:
return
const_matrix_view_
.
operator
Matrix
();
return
const_matrix_view_
.
operator
Matrix
();
}
}
const
SparsityPatternDefault
&
get_pattern
()
const
{
return
const_matrix_view_
.
get_pattern
();
}
private
:
private
:
bool
pattern_assignable
(
const
Matrix
&
other
)
const
bool
pattern_assignable
(
const
Matrix
&
other
)
const
{
{
const
auto
&
patt
=
const_matrix_view_
.
get_pattern
();
const
auto
&
patt
=
get_pattern
();
const
auto
&
other_patt
=
other
.
pattern
();
const
auto
&
other_patt
=
other
.
pattern
();
for
(
size_t
ii
=
0
;
ii
<
rows
();
++
ii
)
for
(
size_t
ii
=
0
;
ii
<
rows
();
++
ii
)
for
(
auto
&&
jj
:
other_patt
.
inner
(
ii
))
for
(
auto
&&
jj
:
other_patt
.
inner
(
ii
))
...
...
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