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
f4af3f53
Commit
f4af3f53
authored
8 years ago
by
Dr. Felix Tobias Schindler
Browse files
Options
Downloads
Patches
Plain Diff
[container.istl] update backend/ensure_uniqueness usage
parent
3833204f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/xt/la/container/istl.hh
+16
-18
16 additions, 18 deletions
dune/xt/la/container/istl.hh
with
16 additions
and
18 deletions
dune/xt/la/container/istl.hh
+
16
−
18
View file @
f4af3f53
...
...
@@ -176,7 +176,6 @@ public:
const
BackendType
&
backend
()
const
{
ensure_uniqueness
();
return
*
backend_
;
}
...
...
@@ -265,7 +264,7 @@ public:
inline
const
ScalarType
&
operator
[](
const
size_t
ii
)
const
{
return
backend
_
->
operator
[](
ii
)
[
0
];
return
backend
()[
ii
]
[
0
];
}
/// \}
...
...
@@ -277,22 +276,22 @@ public:
if
(
other
.
size
()
!=
size
())
DUNE_THROW
(
Common
::
Exceptions
::
shapes_do_not_match
,
"The size of other ("
<<
other
.
size
()
<<
") does not match the size of this ("
<<
size
()
<<
")!"
);
return
backend
_
->
dot
(
*
(
other
.
backend
_
));
return
backend
().
dot
(
other
.
backend
(
));
}
// ... dot(...)
virtual
RealType
l1_norm
()
const
override
final
{
return
backend
_
->
one_norm
();
return
backend
().
one_norm
();
}
virtual
RealType
l2_norm
()
const
override
final
{
return
backend
_
->
two_norm
();
return
backend
().
two_norm
();
}
virtual
RealType
sup_norm
()
const
override
final
{
return
backend
_
->
infinity_norm
();
return
backend
().
infinity_norm
();
}
virtual
void
add
(
const
ThisType
&
other
,
ThisType
&
result
)
const
override
final
...
...
@@ -322,7 +321,7 @@ public:
if
(
other
.
size
()
!=
size
())
DUNE_THROW
(
Common
::
Exceptions
::
shapes_do_not_match
,
"The size of other ("
<<
other
.
size
()
<<
") does not match the size of this ("
<<
size
()
<<
")!"
);
backend
()
+=
*
(
other
.
backend
_
);
backend
()
+=
other
.
backend
(
);
}
// ... iadd(...)
virtual
void
sub
(
const
ThisType
&
other
,
ThisType
&
result
)
const
override
final
...
...
@@ -352,7 +351,7 @@ public:
if
(
other
.
size
()
!=
size
())
DUNE_THROW
(
Common
::
Exceptions
::
shapes_do_not_match
,
"The size of other ("
<<
other
.
size
()
<<
") does not match the size of this ("
<<
size
()
<<
")!"
);
backend
()
-=
(
*
(
other
.
backend
_
)
);
backend
()
-=
other
.
backend
(
);
}
// ... isub(...)
/// \}
...
...
@@ -361,7 +360,7 @@ protected:
/**
* \see ContainerInterface
*/
inline
void
ensure_uniqueness
()
const
inline
void
ensure_uniqueness
()
{
if
(
!
backend_
.
unique
())
backend_
=
std
::
make_shared
<
BackendType
>
(
*
backend_
);
...
...
@@ -371,7 +370,7 @@ private:
friend
class
VectorInterface
<
internal
::
IstlDenseVectorTraits
<
ScalarType
>
,
ScalarType
>
;
friend
class
IstlRowMajorSparseMatrix
<
ScalarType
>
;
mutable
std
::
shared_ptr
<
BackendType
>
backend_
;
std
::
shared_ptr
<
BackendType
>
backend_
;
};
// class IstlDenseVector
/**
...
...
@@ -474,7 +473,6 @@ public:
const
BackendType
&
backend
()
const
{
ensure_uniqueness
();
return
*
backend_
;
}
...
...
@@ -501,7 +499,7 @@ public:
<<
"x"
<<
cols
()
<<
")!"
);
backend
().
axpy
(
alpha
,
*
(
xx
.
backend
_
));
backend
().
axpy
(
alpha
,
xx
.
backend
(
));
}
// ... axpy(...)
bool
has_equal_shape
(
const
ThisType
&
other
)
const
...
...
@@ -526,7 +524,7 @@ public:
inline
void
mv
(
const
IstlDenseVector
<
ScalarType
>&
xx
,
IstlDenseVector
<
ScalarType
>&
yy
)
const
{
DUNE_XT_COMMON_TIMING_SCOPE
(
static_id
()
+
".mv"
);
backend
_
->
mv
(
*
(
xx
.
backend
_
),
yy
.
backend
());
backend
().
mv
(
xx
.
backend
(
),
yy
.
backend
());
}
void
add_to_entry
(
const
size_t
ii
,
const
size_t
jj
,
const
ScalarType
&
value
)
...
...
@@ -561,10 +559,10 @@ public:
void
clear_col
(
const
size_t
jj
)
{
ensure_uniqueness
();
if
(
jj
>=
cols
())
DUNE_THROW
(
Common
::
Exceptions
::
index_out_of_range
,
"Given jj ("
<<
jj
<<
") is larger than the cols of this ("
<<
cols
()
<<
")!"
);
ensure_uniqueness
();
for
(
size_t
ii
=
0
;
ii
<
rows
();
++
ii
)
{
auto
&
row
=
backend_
->
operator
[](
ii
);
const
auto
search_result
=
row
.
find
(
jj
);
...
...
@@ -575,6 +573,7 @@ public:
void
unit_row
(
const
size_t
ii
)
{
ensure_uniqueness
();
if
(
ii
>=
cols
())
DUNE_THROW
(
Common
::
Exceptions
::
index_out_of_range
,
"Given ii ("
<<
ii
<<
") is larger than the cols of this ("
<<
cols
()
<<
")!"
);
...
...
@@ -584,13 +583,13 @@ public:
if
(
!
backend_
->
exists
(
ii
,
ii
))
DUNE_THROW
(
Common
::
Exceptions
::
index_out_of_range
,
"Diagonal entry ("
<<
ii
<<
", "
<<
ii
<<
") is not contained in the sparsity pattern!"
);
ensure_uniqueness
();
backend_
->
operator
[](
ii
)
*=
ScalarType
(
0
);
backend_
->
operator
[](
ii
)[
ii
]
=
ScalarType
(
1
);
}
// ... unit_row(...)
void
unit_col
(
const
size_t
jj
)
{
ensure_uniqueness
();
if
(
jj
>=
cols
())
DUNE_THROW
(
Common
::
Exceptions
::
index_out_of_range
,
"Given jj ("
<<
jj
<<
") is larger than the cols of this ("
<<
cols
()
<<
")!"
);
...
...
@@ -600,7 +599,6 @@ public:
if
(
!
backend_
->
exists
(
jj
,
jj
))
DUNE_THROW
(
Common
::
Exceptions
::
index_out_of_range
,
"Diagonal entry ("
<<
jj
<<
", "
<<
jj
<<
") is not contained in the sparsity pattern!"
);
ensure_uniqueness
();
for
(
size_t
ii
=
0
;
(
ii
<
rows
())
&&
(
ii
!=
jj
);
++
ii
)
{
auto
&
row
=
backend_
->
operator
[](
ii
);
const
auto
search_result
=
row
.
find
(
jj
);
...
...
@@ -710,14 +708,14 @@ protected:
/**
* \see ContainerInterface
*/
inline
void
ensure_uniqueness
()
const
inline
void
ensure_uniqueness
()
{
if
(
!
backend_
.
unique
())
backend_
=
std
::
make_shared
<
BackendType
>
(
*
backend_
);
}
// ... ensure_uniqueness(...)
private
:
mutable
std
::
shared_ptr
<
BackendType
>
backend_
;
std
::
shared_ptr
<
BackendType
>
backend_
;
};
// class IstlRowMajorSparseMatrix
template
<
class
S
>
...
...
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