elect
07/08/2024, 12:36 PMsnap_descriptors_np = extract_compute_np(
lmp,
"bgrid",
0,
2,
(nz, ny, nx, self.fingerprint_length),
use_fp64=use_fp64,
)
lmp.close()
# switch from x-fastest to z-fastest order (swaps 0th and 2nd dimension)
snap_descriptors_np = snap_descriptors_np.transpose([2, 1, 0, 3])
where extract_compute_np
returns a flat doubleArray representing an ndarray of [nz, ny, nx, self.fingerprint_length]
now, I have to swap the 0 and 2nd dimensions and I'm trying to do this:
Array(nx) { x ->
Array(ny) { y ->
Array(nz) { z ->
val ofsX = x * (ny * nz * fingerprintLength)
val ofsY = y * (nz * fingerprintLength)
val ofsZ = z * fingerprintLength
DoubleArray(fingerprintLength) { doubles[ofsX + ofsY + ofsZ + it] }
}
}
}
but it looks like it's wrong, anyone spots the problem?Gleb Minaev
07/08/2024, 1:22 PMArray<Array<Array<DoubleArray>>>
with initial ndarray [nz, ny, nx, fingerprintLength]
and then replace Array(nx) { x ->
with Array(nz) { z ->
and vice versa to swap x
and z
dimensions.
Here is how I solved it: https://pl.kotl.in/y3FM_tGzSelect
07/08/2024, 3:33 PMelect
07/08/2024, 3:33 PMaltavir
07/09/2024, 9:04 AM