npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ml-array-utils

v0.4.0

Published

Array utilities

Downloads

1,032

Readme

ArrayUtils

NPM version build status David deps npm download

Installation

$ npm install ml-array-utils

Methods

coordArrayToPoints(array, dimensions)

Function that returns an array of points given 1D array as follows:

[x1, y1, .. , x2, y2, ..]

And receive the number of dimensions of each point.

uniqueX(xs, ys)

In place modification of the 2 arrays to make X unique and sum the Y if X has the same value

  • @param xs
  • @param ys

And receive the number of dimensions of each point.

Arguments

  • array - 1D array
  • dimensions - number of dimensions that has each point.

coordArrayToCoordMatrix(array, dimensions)

Function that given an array as follows:

[x1, y1, .. , x2, y2, ..]

Returns an array as follows:

[[x1, x2, ..], [y1, y2, ..], [ .. ]]

And receives the number of dimensions of each coordinate.

Arguments

  • array - 1D array
  • dimensions - number of dimensions that has each point.

coordMatrixToCoordArray(coordMatrix)

Function that receives a coordinate matrix as follows:

[[x1, x2, ..], [y1, y2, ..], [ .. ]]

Returns an array of coordinates as follows:

[x1, y1, .. , x2, y2, ..]

Arguments

  • coordMatrix - Coordinate matrix

coordMatrixToPoints

Function that receives a coordinate matrix as follows:

[[x1, x2, ..], [y1, y2, ..], [ .. ]]

Returns an array of points.

Arguments

  • coordMatrix - Coordinate matrix

pointsToCoordArray(points)

Function that transform an array of points into a coordinates array as follows:

[x1, y1, .. , x2, y2, ..]

Arguments

  • points - Coordinate matrix

pointsToCoordMatrix(points)

Function that recieve an array of points and returns a coordinates matrix as follows:

[[x1, x2, ..], [y1, y2, ..], [ .. ]]

Arguments

  • points - Coordinate matrix

applyDotProduct(firstVector, secondVector)

Apply the dot product between the smaller vector and a subsets of the largest one, returns an array with all the results of each dot product.

Arguments

  • firstVector - Array
  • secondVector - Array

getEquallySpacedData(x, y, options)

Function that returns a Number array of equally spaced numberOfPoints containing a representation of intensities of the spectra arguments x and y.

The options parameter contains an object in the following form: from: starting point to: last point numberOfPoints: number of points between from and to variant: "slot" or "smooth" - smooth is the default option

The slot variant consist that each point in the new array is calculated averaging the existing points between the slot that belongs to the current value. The smooth variant is the same but takes the integral of the range of the slot and divide by the step size between two points in the new array.

Arguments

  • x - Array of positions in the x axis.
  • y - Array of positions in the y axis.
  • options - Options in the way described.

SNV(data)

Function that applies the standard normal variate (SNV) to an array of values.

Arguments

  • data - array of values.

Authors

License

MIT