Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Troubled Cell Detection
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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Laura Christine Kühle
Troubled Cell Detection
Commits
a1951eb1
Commit
a1951eb1
authored
2 years ago
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Vectorized '_calculate_reconstructions()' in OrthonormalLegendre basis.
parent
d0c50bb4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/tcd/Basis_Function.py
+38
-11
38 additions, 11 deletions
scripts/tcd/Basis_Function.py
with
38 additions
and
11 deletions
scripts/tcd/Basis_Function.py
+
38
−
11
View file @
a1951eb1
...
...
@@ -533,17 +533,44 @@ class OrthonormalLegendre(Legendre):
Notes
-----
To increase speed
.
this function uses a simplified calculation
To increase speed
,
this function uses a simplified calculation
specific to the orthonormal Legendre polynomial basis.
"""
left_reconstructions
=
[
sum
(
projection
[
degree
][
cell
]
*
(
-
1
)
**
degree
*
np
.
sqrt
(
degree
+
0.5
)
for
degree
in
range
(
self
.
_polynomial_degree
+
1
))
for
cell
in
range
(
len
(
projection
[
0
]))]
right_reconstructions
=
[
sum
(
projection
[
degree
][
cell
]
*
np
.
sqrt
(
degree
+
0.5
)
for
degree
in
range
(
self
.
_polynomial_degree
+
1
))
for
cell
in
range
(
len
(
projection
[
0
]))]
return
left_reconstructions
,
right_reconstructions
left_reconstruction
=
projection
.
T
@
(
self
.
_root_vector
*
self
.
_sign_vector
)
right_reconstruction
=
projection
.
T
@
self
.
_sign_vector
return
left_reconstruction
,
right_reconstruction
@property
@cache
def
_root_vector
(
self
):
"""
Return root vector.
Return vector with the roots of all degrees plus 0.5.
Returns
-------
ndarray
Root vector.
"""
return
np
.
array
([
np
.
sqrt
(
degree
+
0.5
)
for
degree
in
range
(
self
.
polynomial_degree
+
1
)])
@property
@cache
def
_sign_vector
(
self
):
"""
Return sign vector.
Return identity vector with sign changes for all even degrees.
Returns
-------
ndarray
Sign vector.
"""
return
np
.
array
([
-
1
if
degree
%
2
else
1
for
degree
in
range
(
self
.
_polynomial_degree
+
1
)])
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