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
3216ee8e
Commit
3216ee8e
authored
6 years ago
by
Tobias Leibner
Browse files
Options
Downloads
Patches
Plain Diff
[container.common.matrix.dense] make axpy usable for other matrix types
parent
e26692b6
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/common/matrix/dense.hh
+21
-3
21 additions, 3 deletions
dune/xt/la/container/common/matrix/dense.hh
with
21 additions
and
3 deletions
dune/xt/la/container/common/matrix/dense.hh
+
21
−
3
View file @
3216ee8e
...
...
@@ -241,7 +241,9 @@ public:
entry
*=
alpha
;
}
void
axpy
(
const
ScalarType
&
alpha
,
const
ThisType
&
xx
)
template
<
class
OtherMatrixType
>
std
::
enable_if_t
<
Common
::
is_matrix
<
OtherMatrixType
>::
value
,
void
>
axpy
(
const
ScalarType
&
alpha
,
const
OtherMatrixType
&
xx
)
{
ensure_uniqueness
();
const
internal
::
VectorLockGuard
DUNE_UNUSED
(
guard
)(
mutexes_
);
...
...
@@ -252,11 +254,27 @@ public:
<<
"x"
<<
cols
()
<<
")!"
);
axpy_impl
(
alpha
,
xx
);
}
// ... axpy(...)
private
:
void
axpy_impl
(
const
ScalarType
&
alpha
,
const
ThisType
&
xx
)
{
for
(
size_t
ii
=
0
;
ii
<
backend_
->
entries_
.
size
();
++
ii
)
backend_
->
entries_
[
ii
]
+=
alpha
*
xx
.
backend_
->
entries_
[
ii
];
}
// ... axpy(...)
}
bool
has_equal_shape
(
const
ThisType
&
other
)
const
template
<
class
OtherMatrixType
>
void
axpy_impl
(
const
ScalarType
&
alpha
,
const
OtherMatrixType
&
xx
)
{
for
(
size_t
ii
=
0
;
ii
<
rows
();
++
ii
)
for
(
size_t
jj
=
0
;
jj
<
cols
();
++
jj
)
add_to_entry
(
ii
,
jj
,
alpha
*
Common
::
MatrixAbstraction
<
OtherMatrixType
>::
get_entry
(
xx
,
ii
,
jj
));
}
public
:
template
<
class
OtherMatrixType
>
std
::
enable_if_t
<
Common
::
is_matrix
<
OtherMatrixType
>::
value
,
bool
>
has_equal_shape
(
const
OtherMatrixType
&
other
)
const
{
return
(
rows
()
==
other
.
rows
())
&&
(
cols
()
==
other
.
cols
());
}
...
...
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