Skip to content

Clip #470

Open
Open
Clip#470
@nilgoyette

Description

@nilgoyette

I can't find a numpy::clip function in ndarray. Is there one?

If not, I know I can use something like

arr.mapv(|v| if v < 4.0 { 0.0 } else { v } );

but do you think it would be better to have a clip function?

// min and max in the same function
arr.clip(Some(0.0), None);

// or 3 functions
arr.clip_min(0.0);
arr.clip_max(1.0);
arr.clip(0.0, 1.0);

I can code it, I just wonder if we want it.

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