numpy-indexed

weighted numpy bincount for 2D IDs array and 1D weights

泄露秘密 提交于 2020-07-09 08:39:50
问题 I am using numpy_indexed for applying a vectorized numpy bincount, as follows: import numpy as np import numpy_indexed as npi rowidx, colidx = np.indices(index_tri.shape) (cols, rows), B = npi.count((index_tri.flatten(), rowidx.flatten())) where index_tri is the following matrix: index_tri = np.array([[ 0, 0, 0, 7, 1, 3], [ 1, 2, 2, 9, 8, 9], [ 3, 1, 1, 4, 9, 1], [ 5, 6, 6, 10, 10, 10], [ 7, 8, 9, 4, 3, 3], [ 3, 8, 6, 3, 8, 6], [ 4, 3, 3, 7, 8, 9], [10, 10, 10, 5, 6, 6], [ 4, 9, 1, 3, 1, 1],

weighted numpy bincount for 2D IDs array and 1D weights

我与影子孤独终老i 提交于 2020-07-09 08:38:17
问题 I am using numpy_indexed for applying a vectorized numpy bincount, as follows: import numpy as np import numpy_indexed as npi rowidx, colidx = np.indices(index_tri.shape) (cols, rows), B = npi.count((index_tri.flatten(), rowidx.flatten())) where index_tri is the following matrix: index_tri = np.array([[ 0, 0, 0, 7, 1, 3], [ 1, 2, 2, 9, 8, 9], [ 3, 1, 1, 4, 9, 1], [ 5, 6, 6, 10, 10, 10], [ 7, 8, 9, 4, 3, 3], [ 3, 8, 6, 3, 8, 6], [ 4, 3, 3, 7, 8, 9], [10, 10, 10, 5, 6, 6], [ 4, 9, 1, 3, 1, 1],

weighted numpy bincount for 2D IDs array and 1D weights

雨燕双飞 提交于 2020-07-09 08:37:30
问题 I am using numpy_indexed for applying a vectorized numpy bincount, as follows: import numpy as np import numpy_indexed as npi rowidx, colidx = np.indices(index_tri.shape) (cols, rows), B = npi.count((index_tri.flatten(), rowidx.flatten())) where index_tri is the following matrix: index_tri = np.array([[ 0, 0, 0, 7, 1, 3], [ 1, 2, 2, 9, 8, 9], [ 3, 1, 1, 4, 9, 1], [ 5, 6, 6, 10, 10, 10], [ 7, 8, 9, 4, 3, 3], [ 3, 8, 6, 3, 8, 6], [ 4, 3, 3, 7, 8, 9], [10, 10, 10, 5, 6, 6], [ 4, 9, 1, 3, 1, 1],