Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ndarray-diagonal

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ndarray-diagonal

Get a view of the diagonal entries of an ndarray

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23K
decreased by-13.5%
Maintainers
1
Weekly downloads
 
Created
Source

ndarray-diagonal

Extract a view of the diagonal entries of an ndarray (no copying necessary!)

Example

var pack = require('ndarray-pack')
var diagonal = require('ndarray-diagonal')
var show = require('ndarray-show')

var M = pack([[1, 0, 2],
              [2, 3, 1],
              [4, 5, 0]])

var diag = diagonal(M)


console.log('diag=\n', show(diag))

//diag is actually a view of the entries of M

diag.set(2,  1e5)  //Update the 3rd diagonal entry
console.log('M=\n', show(M))

Output:

diag=
   1.000    3.000    0.000

M=
   1.000    2.000    4.000
   0.000    3.000    5.000
   2.000    1.000  1.00e+5

API

require('ndarray-diagonal')(M)

Construct a view of the diagonal entries of an ndarray

  • M is an ndarray

Returns A view of the diagonal entries of M

Credits

(c) 2014 Mikola Lysenko. MIT License

Keywords

FAQs

Package last updated on 27 Sep 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc