Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Chaofan Chen
ogs
Commits
93ff97c7
Commit
93ff97c7
authored
8 years ago
by
Christoph Lehmann
Browse files
Options
Downloads
Patches
Plain Diff
[MaL] added Manhattan and max norm to BLAS
parent
0e49aa47
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/BLAS.cpp
+48
-0
48 additions, 0 deletions
MathLib/LinAlg/BLAS.cpp
MathLib/LinAlg/BLAS.h
+8
-0
8 additions, 0 deletions
MathLib/LinAlg/BLAS.h
with
56 additions
and
0 deletions
MathLib/LinAlg/BLAS.cpp
+
48
−
0
View file @
93ff97c7
...
...
@@ -19,6 +19,14 @@
namespace
MathLib
{
namespace
BLAS
{
// Explicit specialization
// Computes the Manhattan norm of x
template
<
>
double
norm1
(
Eigen
::
VectorXd
const
&
x
)
{
return
x
.
lpNorm
<
1
>
();
}
// Explicit specialization
// Computes the Euclidean norm of x
template
<
>
...
...
@@ -27,6 +35,14 @@ double norm2(Eigen::VectorXd const& x)
return
x
.
norm
();
}
// Explicit specialization
// Computes the Maximum norm of x
template
<
>
double
normMax
(
Eigen
::
VectorXd
const
&
x
)
{
return
x
.
lpNorm
<
Eigen
::
Infinity
>
();
}
}
}
// namespaces
#endif
...
...
@@ -74,6 +90,14 @@ void axpby(PETScVector& y, double const a, double const b, PETScVector const& x)
VecAXPBY
(
*
y
.
getRawVector
(),
a
,
b
,
*
x
.
getRawVector
());
}
// Explicit specialization
// Computes the Manhattan norm of x
template
<
>
double
norm1
(
PETScVector
const
&
x
)
{
return
x
.
getNorm
(
MathLib
::
VecNormType
::
NORM1
);
}
// Explicit specialization
// Computes the Euclidean norm of x
template
<
>
...
...
@@ -82,6 +106,14 @@ double norm2(PETScVector const& x)
return
x
.
getNorm
(
MathLib
::
VecNormType
::
NORM2
);
}
// Explicit specialization
// Computes the Maximum norm of x
template
<
>
double
normMax
(
PETScVector
const
&
x
)
{
return
x
.
getNorm
(
MathLib
::
VecNormType
::
INFINITY_N
);
}
// Matrix
...
...
@@ -192,6 +224,14 @@ void axpby(EigenVector& y, double const a, double const b, EigenVector const& x)
y
.
getRawVector
()
=
a
*
x
.
getRawVector
()
+
b
*
y
.
getRawVector
();
}
// Explicit specialization
// Computes the Manhattan norm of x
template
<
>
double
norm1
(
EigenVector
const
&
x
)
{
return
x
.
getRawVector
().
lpNorm
<
1
>
();
}
// Explicit specialization
// Euclidean norm
template
<
>
...
...
@@ -200,6 +240,14 @@ double norm2(EigenVector const& x)
return
x
.
getRawVector
().
norm
();
}
// Explicit specialization
// Computes the Maximum norm of x
template
<
>
double
normMax
(
EigenVector
const
&
x
)
{
return
x
.
getRawVector
().
lpNorm
<
Eigen
::
Infinity
>
();
}
// Matrix
...
...
This diff is collapsed.
Click to expand it.
MathLib/LinAlg/BLAS.h
+
8
−
0
View file @
93ff97c7
...
...
@@ -66,10 +66,18 @@ void axpby(MatrixOrVector& y, double const a, double const b, MatrixOrVector con
y
=
a
*
x
+
b
*
y
;
}
//! Computes the Manhattan norm of \c x.
template
<
typename
MatrixOrVector
>
double
norm1
(
MatrixOrVector
const
&
x
);
//! Computes the Euclidean norm of \c x.
template
<
typename
MatrixOrVector
>
double
norm2
(
MatrixOrVector
const
&
x
);
//! Computes the maximum norm of \c x.
template
<
typename
MatrixOrVector
>
double
normMax
(
MatrixOrVector
const
&
x
);
template
<
typename
Matrix
>
void
finalizeAssembly
(
Matrix
&
/*A*/
)
{
...
...
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