Skip to content

Commit c6c34a1

Browse files
author
Rolf Johan Lorentzen
committed
Avoid dublicate storage of samples
1 parent a096ee1 commit c6c34a1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/geostat/gaussian_sim.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ def fast_gaussian(dimension, sdev, corr, num_samples=1):
111111
t3 = np.exp(-t3 ** 2) + 1e-10 * np.eye(p)
112112
cholt3 = np.linalg.cholesky(t3)
113113

114-
z = np.random.randn(dim, num_samples)
114+
x = np.random.randn(dim, num_samples)
115115

116116
# Memory-efficient multiplication without explicit large Kronecker product
117117
if p is None:
118-
x = z.reshape(m, n, num_samples, order='F')
118+
x = x.reshape(m, n, num_samples, order='F')
119119
x = np.tensordot(cholt1, x, axes=([1], [0]))
120120
x = np.tensordot(cholt2, x, axes=([1], [1]))
121121
else:
122-
x = z.reshape(m, n, p, num_samples, order='F')
122+
x = x.reshape(m, n, p, num_samples, order='F')
123123
if n <= p:
124124
x = np.tensordot(cholt1, x, axes=([1], [0]))
125125
x = np.tensordot(cholt2, x, axes=([1], [1]))

0 commit comments

Comments
 (0)