GithubHelp home page GithubHelp logo

argmm's Introduction

Argmm

Argmin/max with SIMD support for u8, i16, u16, i32 and f32 arrays and vectors.

Installing

Add the following to your Cargo.toml

argmm = "0.1.2"

Getting started

You can use the extention trait which will take advantage of SIMD if available

use argmm::ArgMinMax;

fn main() {
    let v = vec![1., 3., -20., 50., -82., 9., -53., 60., 0.];
    let min_index = v.argmin();
    let max_index = v.argmax();
    assert_eq!(min_index, Some(4));
    assert_eq!(max_index, Some(7));
}

Alternatively, the generic function can be used if you require non-SIMD support for other types

use argmm::generic::{simple_argmin, simple_argmax};

fn main() {
    let v = vec![1u64, 3, 20, 50, 82, 9, 53, 60, 0];
    let min_index = simple_argmin(&v);
    let max_index = simple_argmax(&v);
    assert_eq!(min_index, 8);
    assert_eq!(max_index, 4);
}

Benchmarks

Using a MacBook Pro (Retina, 13-inch, Early 2015) Processor 2.7 GHz Dual-Core Intel Core i5 with an array size of 512.

See /benches/results.

Warning

NAN values are not supported.

License

Licensed under either of

argmm's People

Contributors

kore-signet avatar minimalrust avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.