mirror of
https://github.com/janishutz/eth-summaries.git
synced 2025-11-25 10:34:23 +00:00
[NumCS] Remove imports from code listings
This commit is contained in:
Binary file not shown.
@@ -64,8 +64,6 @@ Da die Matrix $R$ eine obere Dreiecksmatrix ist, ist das Ergebnis die Teilsummen
|
||||
Das \verb|[::-1]| dient hier lediglich dazu, den Vektor $x$ umzudrehen, sodass das richtige Resultat entsteht.
|
||||
Die vollständige Implementation sieht so aus:
|
||||
\begin{code}{python}
|
||||
import numpy as np
|
||||
|
||||
def low_rank_matrix_vector_product(A: np.ndarray, B: np.ndarray, x: np.ndarray):
|
||||
n, _ = A.shape
|
||||
y = np.zeros(n)
|
||||
@@ -97,8 +95,6 @@ Die vollständige Implementation sieht so aus:
|
||||
|
||||
Die vollständige Implementation ist auch hier nicht schwer und sieht folgendermassen aus:
|
||||
\begin{code}{python}
|
||||
import numpy as np
|
||||
|
||||
def fast_kron_vector_product(A: np.ndarray, B: np.ndarray, x: np.ndarray):
|
||||
# First multiply Bx_i, (and define x_i as a reshaped numpy array to save cost (as that will create a valid array))
|
||||
# This will actually crash if x.shape[0] is not divisible by A.shape[0]
|
||||
|
||||
Reference in New Issue
Block a user