Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs-feliks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
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
Feliks Kiszkurno
ogs-feliks
Commits
e8dfa1c2
Commit
e8dfa1c2
authored
11 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
Added parameter for penalty to applyKnownSolution(), some formatting.
parent
78491466
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MathLib/LinAlg/Lis/LisTools.cpp
+8
-8
8 additions, 8 deletions
MathLib/LinAlg/Lis/LisTools.cpp
MathLib/LinAlg/Lis/LisTools.h
+6
-3
6 additions, 3 deletions
MathLib/LinAlg/Lis/LisTools.h
with
14 additions
and
11 deletions
MathLib/LinAlg/Lis/LisTools.cpp
+
8
−
8
View file @
e8dfa1c2
...
@@ -22,18 +22,18 @@
...
@@ -22,18 +22,18 @@
namespace
MathLib
namespace
MathLib
{
{
void
applyKnownSolution
(
LisMatrix
&
A
,
LisVector
&
b
,
const
std
::
vector
<
std
::
size_t
>
&
_vec_knownX_id
,
const
std
::
vector
<
double
>
&
_vec_knownX_x
)
void
applyKnownSolution
(
LisMatrix
&
A
,
LisVector
&
b
,
const
std
::
vector
<
std
::
size_t
>
&
vec_knownX_id
,
const
std
::
vector
<
double
>
&
vec_knownX_x
,
double
penalty_scaling
)
{
{
//Use penalty parameter
//Use penalty parameter
const
double
penalty_scaling
=
1e+10
;
const
double
max_diag_coeff
=
A
.
getMaxDiagCoeff
();
const
double
_max_diag_coeff
=
A
.
getMaxDiagCoeff
();
const
double
penalty
=
max_diag_coeff
*
penalty_scaling
;
const
double
penalty
=
_max_diag_coeff
*
penalty_scaling
;
INFO
(
"-> max. absolute value of diagonal entries = %e"
,
max_diag_coeff
);
INFO
(
"-> max. absolute value of diagonal entries = %e"
,
_max_diag_coeff
);
INFO
(
"-> penalty scaling = %e"
,
penalty_scaling
);
INFO
(
"-> penalty scaling = %e"
,
penalty_scaling
);
const
std
::
size_t
n_bc
=
_
vec_knownX_id
.
size
();
const
std
::
size_t
n_bc
=
vec_knownX_id
.
size
();
for
(
std
::
size_t
i_bc
=
0
;
i_bc
<
n_bc
;
i_bc
++
)
{
for
(
std
::
size_t
i_bc
=
0
;
i_bc
<
n_bc
;
i_bc
++
)
{
const
std
::
size_t
rowId
=
_
vec_knownX_id
[
i_bc
];
const
std
::
size_t
rowId
=
vec_knownX_id
[
i_bc
];
const
double
x
=
_
vec_knownX_x
[
i_bc
];
const
double
x
=
vec_knownX_x
[
i_bc
];
//A(k, k) = penalty
//A(k, k) = penalty
A
.
setValue
(
rowId
,
rowId
,
penalty
);
A
.
setValue
(
rowId
,
rowId
,
penalty
);
//b(k) = x*penalty
//b(k) = x*penalty
...
...
This diff is collapsed.
Click to expand it.
MathLib/LinAlg/Lis/LisTools.h
+
6
−
3
View file @
e8dfa1c2
...
@@ -29,10 +29,13 @@ class LisVector;
...
@@ -29,10 +29,13 @@ class LisVector;
*
*
* @param A Coefficient matrix
* @param A Coefficient matrix
* @param b RHS vector
* @param b RHS vector
* @param _vec_knownX_id a vector of known solution entry IDs
* @param vec_knownX_id a vector of known solution entry IDs
* @param _vec_knownX_x a vector of known solutions
* @param vec_knownX_x a vector of known solutions
* @param penalty_scaling value for scaling some matrix and right hand side
* entries to enforce some conditions
*/
*/
void
applyKnownSolution
(
LisMatrix
&
A
,
LisVector
&
b
,
const
std
::
vector
<
std
::
size_t
>
&
_vec_knownX_id
,
const
std
::
vector
<
double
>
&
_vec_knownX_x
);
void
applyKnownSolution
(
LisMatrix
&
A
,
LisVector
&
b
,
const
std
::
vector
<
std
::
size_t
>
&
_vec_knownX_id
,
const
std
::
vector
<
double
>
&
_vec_knownX_x
,
double
penalty_scaling
=
1e+10
);
}
// MathLib
}
// MathLib
...
...
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