Added another solution to question 96.

This commit is contained in:
kuzand 2018-11-02 15:23:51 +02:00 committed by GitHub
parent e163a6417f
commit 5ec27f54c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1156,6 +1156,11 @@ T = np.ascontiguousarray(Z).view(np.dtype((np.void, Z.dtype.itemsize * Z.shape[1
_, idx = np.unique(T, return_index=True) _, idx = np.unique(T, return_index=True)
uZ = Z[idx] uZ = Z[idx]
print(uZ) print(uZ)
# Another solution, for NumPy >= 1.13
# Author: Andreas Kouzelis
uZ = np.unique(Z, axis=0)
print(uZ)
``` ```
#### 97. Considering 2 vectors A & B, write the einsum equivalent of inner, outer, sum, and mul function (★★★) #### 97. Considering 2 vectors A & B, write the einsum equivalent of inner, outer, sum, and mul function (★★★)