Skip to content

scijs/ndarray-trace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ndarray-trace

Computes the trace of an ndarray (the sum of all diagonal entries of the array).

Example

var pack  = require('ndarray-pack')
var trace = require('ndarray-trace')

var M = pack([[1, 2, 3],
              [4, 5, 6],
              [7, 8, 9]])

console.log(trace(M))

Output:

15

Install

npm install ndarray-trace

API

require('ndarray-trace')(M)

Computes the sum of all diagonal entries in the ndarray M

  • M is an ndarray

Returns The sum of all diagonal entries

Credits

(c) 2014 Mikola Lysenko. MIT License

About

Compute trace of an ndarray

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published