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

ndarray-blas-level1-complex

v1.0.3

Published

BLAS Level 1 operations for complex ndarrays

Downloads

7

Readme

ndarray-blas-level1-complex

Build Status npm version

BLAS Level 1 operations for complex-valued ndarrays

Usage

This library implements the basic vector operations of the Level 1 Basic Linear Algebra Subprograms (BLAS). Many of these functions are also implemented in ndarray-ops—which also has functions that are not included in BLAS. So the right answer is probably some blend of the two. This library exists mainly to frame things in a relatively standard, coherent framework.

NB: This library performs no checks to ensure you're only passing one-dimensional vectors. That's either a bug or a feature, depending on how you think about it.

| Function | Operation | Description | | -------- | --------- | ----------- | | swap(x_r,x_i,y_r,y_i) | swap | Swap the elements of x and y | | scal(alpha_r,alpha_i,x_r,x_i) | scal | Multiple vector x by scalar alpha | | copy(x_r,x_i,y_r,y_i) | copy | Copy x into y | | axpy(alpha_r,alpha_i, x_r,x_i, y_r,y_i) | axpy | Multiple x by alpha and add it to y | | cpsc(alpha_r,alpha_i, x_r,x_i, y_r,y_i) | cpsc | Multiply x by alpha and assign it to y | | dotu(x_r,x_i,y_r,y_i) | dot | Calculate the product transpose(x) * y. | | doth(x_r,x_i,y_r,y_i) | dot | Calculate the product conj(x) * y. | | nrm2(x_r,x_i) | nrm2 | Calculate the 2-norm of x | | asum(x_r,x_i) | asum | Calculate the 1-norm of x | | iamax(x_r,x_i) | | Not yet implemented |

A note on working with complex ndarrays

ndarrays only hold real numbers of varying types and javascript has no native complex type, so the best we can do for now is to try to encapsulate a decent amount of that. This library deals with vectors, but to start with the more general case of storing, for example, the matrix

sample matrix,

here are two methods:

  • Store the real and imaginary components in multiple arrays:
var a_r = ndarray([1,3,7, -2,1,-5], [2,3]),
    a_i = ndarray([2,4,8,  4,-2,6], [2,3]);
  • Interleave the real and imaginary components:
var a = ndarray([1,2,3,4,7,8,-2,4,1,-2,-5,6], [2,3,2]),
    a_r = a.pick(null,null,0),
    a_i = a.pick(null,null,1);

In this example, there's an additional final dimension of the array. This applies to vectors, matrices, and higher-dimensional arrays.

I won't comment on the relative effiency of each method.

Example

Usage should be pretty straightforward. There aren't really any options or variations.

var cblas1 = require('ndarray-blas-level1-complex');

var x = ndarray([1,2,3,5,6,7],[3,2]);
var y = ndarray([3,4,5,2,3,1],[3,2]);

var x_r = x.pick(null,0),
    x_i = x.pick(null,1),
    y_r = y.pick(null,0),
    y_i = y.pick(null,1);

cblas1.axpy( 2, 3, x_r, x_i, y_r, y_i );

Credits

(c) 2015 Ricky Reusser. MIT License