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
ff386db2
Commit
ff386db2
authored
8 years ago
by
Christoph Lehmann
Browse files
Options
Downloads
Patches
Plain Diff
[MaL] added componentwiseDivide to BLAS
parent
c46ecaac
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
+28
-0
28 additions, 0 deletions
MathLib/LinAlg/BLAS.cpp
MathLib/LinAlg/BLAS.h
+5
-0
5 additions, 0 deletions
MathLib/LinAlg/BLAS.h
with
33 additions
and
0 deletions
MathLib/LinAlg/BLAS.cpp
+
28
−
0
View file @
ff386db2
...
@@ -19,6 +19,15 @@
...
@@ -19,6 +19,15 @@
namespace
MathLib
{
namespace
BLAS
namespace
MathLib
{
namespace
BLAS
{
{
// Explicit specialization
// Computes w = x/y componentwise.
template
<
>
void
componentwiseDivide
(
Eigen
::
VectorXd
&
w
,
Eigen
::
VectorXd
const
&
x
,
Eigen
::
VectorXd
const
&
y
)
{
w
.
noalias
()
=
x
.
cwiseQuotient
(
y
);
}
// Explicit specialization
// Explicit specialization
// Computes the Manhattan norm of x
// Computes the Manhattan norm of x
template
<
>
template
<
>
...
@@ -90,6 +99,15 @@ void axpby(PETScVector& y, double const a, double const b, PETScVector const& x)
...
@@ -90,6 +99,15 @@ void axpby(PETScVector& y, double const a, double const b, PETScVector const& x)
VecAXPBY
(
*
y
.
getRawVector
(),
a
,
b
,
*
x
.
getRawVector
());
VecAXPBY
(
*
y
.
getRawVector
(),
a
,
b
,
*
x
.
getRawVector
());
}
}
// Explicit specialization
// Computes w = x/y componentwise.
template
<
>
void
componentwiseDivide
(
PETScVector
&
w
,
PETScVector
const
&
x
,
PETScVector
const
&
y
)
{
VecPointwiseDivide
(
*
w
.
getRawVector
(),
*
x
.
getRawVector
(),
*
y
.
getRawVector
());
}
// Explicit specialization
// Explicit specialization
// Computes the Manhattan norm of x
// Computes the Manhattan norm of x
template
<
>
template
<
>
...
@@ -224,6 +242,16 @@ void axpby(EigenVector& y, double const a, double const b, EigenVector const& x)
...
@@ -224,6 +242,16 @@ void axpby(EigenVector& y, double const a, double const b, EigenVector const& x)
y
.
getRawVector
()
=
a
*
x
.
getRawVector
()
+
b
*
y
.
getRawVector
();
y
.
getRawVector
()
=
a
*
x
.
getRawVector
()
+
b
*
y
.
getRawVector
();
}
}
// Explicit specialization
// Computes w = x/y componentwise.
template
<
>
void
componentwiseDivide
(
EigenVector
&
w
,
EigenVector
const
&
x
,
EigenVector
const
&
y
)
{
w
.
getRawVector
().
noalias
()
=
x
.
getRawVector
().
cwiseQuotient
(
y
.
getRawVector
());
}
// Explicit specialization
// Explicit specialization
// Computes the Manhattan norm of x
// Computes the Manhattan norm of x
template
<
>
template
<
>
...
...
This diff is collapsed.
Click to expand it.
MathLib/LinAlg/BLAS.h
+
5
−
0
View file @
ff386db2
...
@@ -66,6 +66,11 @@ void axpby(MatrixOrVector& y, double const a, double const b, MatrixOrVector con
...
@@ -66,6 +66,11 @@ void axpby(MatrixOrVector& y, double const a, double const b, MatrixOrVector con
y
=
a
*
x
+
b
*
y
;
y
=
a
*
x
+
b
*
y
;
}
}
//! Computes \f$w = x/y\f$ componentwise.
template
<
typename
MatrixOrVector
>
void
componentwiseDivide
(
MatrixOrVector
&
w
,
MatrixOrVector
const
&
x
,
MatrixOrVector
const
&
y
);
//! Computes the Manhattan norm of \c x.
//! Computes the Manhattan norm of \c x.
template
<
typename
MatrixOrVector
>
template
<
typename
MatrixOrVector
>
double
norm1
(
MatrixOrVector
const
&
x
);
double
norm1
(
MatrixOrVector
const
&
x
);
...
...
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