Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blatt3_algo_aufgaben_python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dimitri Tayo Fongang Wembe
blatt3_algo_aufgaben_python
Commits
c3baa36f
Commit
c3baa36f
authored
2 years ago
by
Dimitri Tayo Fongang Wembe
Browse files
Options
Downloads
Patches
Plain Diff
fix mistake in formula of Q in QR-split
parent
968aa090
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
qr.py
+15
-3
15 additions, 3 deletions
qr.py
with
15 additions
and
3 deletions
qr.py
+
15
−
3
View file @
c3baa36f
...
...
@@ -16,8 +16,12 @@ def givens_rotation(A, i, j):
np.ndarray: Rotation Matrix ``J`` as above.
"""
# TODO
c
=
abs
(
A
[
j
][
j
])
/
((
A
[
i
][
j
]
**
2
+
A
[
j
][
j
]
**
2
)
**
0.5
)
s
=
abs
(
A
[
i
][
j
])
/
((
A
[
i
][
j
]
**
2
+
A
[
j
][
j
]
**
2
)
**
0.5
)
if
abs
(
A
[
j
][
j
])
==
0.0
:
p
=
((
A
[
i
][
j
]
**
2
+
A
[
j
][
j
]
**
2
)
**
0.5
)
else
:
p
=
np
.
sign
(
A
[
j
][
j
])
*
((
A
[
i
][
j
]
**
2
+
A
[
j
][
j
]
**
2
)
**
0.5
)
c
=
A
[
j
][
j
]
/
p
s
=
A
[
i
][
j
]
/
p
n
,
m
=
np
.
shape
(
A
)
J
=
np
.
eye
(
n
)
J
[
j
][
j
]
=
c
...
...
@@ -99,7 +103,15 @@ def main():
Hier kann beliebiger Testcode stehen, der bei der Korrektur vollständig
ignoriert wird.
"""
pass
arr1
=
np
.
array
(([
3
,
-
4
],
[
3
,
5
]))
J1
=
givens_rotation
(
arr1
,
1
,
0
)
arr2
=
np
.
array
(([
3
,
4
],
[
3
,
5
]))
J2
=
givens_rotation
(
arr2
,
1
,
0
)
Q
,
R
=
qr_decompose
(
arr1
)
print
(
f
"
J1=
{
J1
}
"
)
print
(
f
"
J2=
{
J2
}
"
)
print
(
f
"
J1*arr=
{
np
.
dot
(
J1
,
arr1
)
}
"
)
print
(
f
"
J2*arr=
{
np
.
dot
(
J2
,
arr2
)
}
"
)
if
__name__
==
"
__main__
"
:
main
()
\ No newline at end of file
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