🚀 Launch Week Day 3:Introducing Supply Chain Attack Campaigns Tracking.Learn More →
Socket
Book a DemoInstallSign in
Socket

ndarray-function-basis

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ndarray-function-basis

Construct an basis ndarray given a list of values and functions

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
3
Created
Source

ndarray-function-basis

Build Status npm version Dependency Status

Construct an basis ndarray given a list of values and functions

Introduction

This module extends the Vandermonde matrix to a list of numbers or functions. It constructs a set of basis vectors that can be used in a least squares curve fit. It's little more than a thin convenience wrapper around ndarray-fill.

Usage

require([dest, ]x, inputs)

  • dest: a destination array. If not provided, an ndarray of type 'array' will be created. If provided, the first dimension must match the length of x, and the second must match the length of inputs.
  • x: a ndarray of numbers at which the inputs are evaluated
  • inputs: an Array of either Functions or Numbers. If a Function, it is evaluated at x; if a Number, x is ignored for this input.

Example

For example, to construct a sinusoidal basis with period 2 * π and a constant offset,

var basis = require('ndarray-function-basis');
var ndarray = require('ndarray');

basis(ndarray([1, 2, 3, 4]), [1, Math.sin, Math.cos]);
// => 
//  1.000    0.841    0.540
//  1.000    0.909   -0.416
//  1.000    0.141   -0.990
//  1.000   -0.757   -0.654

See also:

Credits

(c) 2015 Ricky Reusser. MIT License

Keywords

linearalgebra

FAQs

Package last updated on 26 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts