Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-solvers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
agnumpde
dune-solvers
Commits
50ee728a
Commit
50ee728a
authored
12 years ago
by
Uli Sack
Committed by
usack
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
added support for coefficients in the sumoperator, e.g. now implementing aA+bB
[[Imported from SVN: r7056]]
parent
036da4c3
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/solvers/operators/sumoperator.hh
+24
-8
24 additions, 8 deletions
dune/solvers/operators/sumoperator.hh
with
24 additions
and
8 deletions
dune/solvers/operators/sumoperator.hh
+
24
−
8
View file @
50ee728a
...
...
@@ -22,15 +22,28 @@ class SumOperator
//! default constructor - allocates memory for summand operators internally
SumOperator
()
:
alpha_
(
1.0
),
beta_
(
1.0
),
summands_allocated_internally_
(
true
)
{
sparse_matrix_
=
new
SparseMatrixType
;
lowrank_matrix_
=
new
LowRankMatrixType
;
}
//! construct from summands
SumOperator
(
double
a
,
SparseMatrixType
&
A
,
double
b
,
LowRankMatrixType
&
M
)
:
alpha_
(
a
),
sparse_matrix_
(
&
A
),
beta_
(
b
),
lowrank_matrix_
(
&
M
),
summands_allocated_internally_
(
false
)
{}
//! construct from summands
SumOperator
(
SparseMatrixType
&
A
,
LowRankMatrixType
&
M
)
:
alpha_
(
1.0
),
sparse_matrix_
(
&
A
),
beta_
(
1.0
),
lowrank_matrix_
(
&
M
),
summands_allocated_internally_
(
false
)
{}
...
...
@@ -48,32 +61,33 @@ class SumOperator
template
<
class
LVectorType
,
class
RVectorType
>
void
umv
(
const
LVectorType
&
x
,
RVectorType
&
b
)
const
{
sparse_matrix_
->
umv
(
x
,
b
);
lowrank_matrix_
->
umv
(
x
,
b
);
sparse_matrix_
->
u
s
mv
(
alpha_
,
x
,
b
);
lowrank_matrix_
->
u
s
mv
(
beta_
,
x
,
b
);
}
//! b -= (A+M)x
template
<
class
LVectorType
,
class
RVectorType
>
void
mmv
(
const
LVectorType
&
x
,
RVectorType
&
b
)
const
{
sparse_matrix_
->
m
mv
(
x
,
b
);
lowrank_matrix_
->
m
mv
(
x
,
b
);
sparse_matrix_
->
us
mv
(
-
alpha_
,
x
,
b
);
lowrank_matrix_
->
us
mv
(
-
beta_
,
x
,
b
);
}
//! b = (A+M)x
template
<
class
LVectorType
,
class
RVectorType
>
void
mv
(
const
LVectorType
&
x
,
RVectorType
&
b
)
const
{
sparse_matrix_
->
mv
(
x
,
b
);
lowrank_matrix_
->
umv
(
x
,
b
);
b
=
0.0
;
sparse_matrix_
->
usmv
(
alpha_
,
x
,
b
);
lowrank_matrix_
->
usmv
(
beta_
,
x
,
b
);
}
//! b += a*(A+M)x
template
<
class
LVectorType
,
class
RVectorType
>
void
usmv
(
const
field_type
a
,
const
LVectorType
&
x
,
RVectorType
&
b
)
const
{
sparse_matrix_
->
usmv
(
a
,
x
,
b
);
lowrank_matrix_
->
usmv
(
a
,
x
,
b
);
sparse_matrix_
->
usmv
(
a
*
alpha_
,
x
,
b
);
lowrank_matrix_
->
usmv
(
a
*
beta_
,
x
,
b
);
}
//! return the number of rows
...
...
@@ -112,6 +126,8 @@ class SumOperator
return
*
lowrank_matrix_
;
}
double
alpha_
,
beta_
;
private
:
//! one summand
SparseMatrixType
*
sparse_matrix_
;
...
...
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