Skip to content

ndarray.set the i, j vector #32

Open
@PetrochukM

Description

@PetrochukM

Using this library, I have found frequently that I need to set an entire vector at a time when manipulating the ndarray. For example:

const n = ndarray([1, 2, 3, 4, 5, 6, 7, 8], [2, 2, 2]);
const newVector = n.pick(0, 0);
for (let i = 0; i < n.shape[3]; i++) {
    n.set(1, 1, j, newVector.get(j));
}

Is there an intended way to handle this redundancy? Ideally:

const n = ndarray([1, 2, 3, 4, 5, 6, 7, 8], [2, 2, 2]);
const newVector = n.pick(0, 0);
n.set(1, 1, newVector);

Context:
Writing an image processing library. I wrote a median filter for the image. I need iterate over all the pixels and set them to the median of their neighbors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions