Comparing version 0.13.1 to 0.13.2
{ | ||
"name": "numjs", | ||
"version": "0.13.1", | ||
"version": "0.13.2", | ||
"description": "Like NumPy, in JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -409,2 +409,5 @@ [![Build Status](https://travis-ci.org/nicolaspanel/numjs.png)](https://travis-ci.org/nicolaspanel/numjs) [![npm version](https://badge.fury.io/js/numjs.svg)](https://badge.fury.io/js/numjs) [![Bower version](https://badge.fury.io/bo/numjs.svg)](https://badge.fury.io/bo/numjs) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.svg)](http://gruntjs.com/) | ||
> | ||
> nj.log(nj.exp(a)) | ||
array([-1, 0, 1]) | ||
> | ||
> nj.sqrt(nj.abs(a)) | ||
@@ -411,0 +414,0 @@ array([ 1, 0, 1]) |
@@ -120,2 +120,11 @@ 'use strict'; | ||
/** | ||
* Calculate the natural logarithm of all elements in the input array, element-wise. | ||
* @param {(Array|NdArray|number)} x | ||
* @returns {NdArray} | ||
*/ | ||
function log (x) { | ||
return NdArray.new(x).log(); | ||
} | ||
/** | ||
* Calculate the positive square-root of all elements in the input array, element-wise. | ||
@@ -735,2 +744,3 @@ * @param {(Array|NdArray|number)} x | ||
exp: exp, | ||
log: log, | ||
sqrt: sqrt, | ||
@@ -737,0 +747,0 @@ power: power, |
@@ -503,2 +503,15 @@ 'use strict'; | ||
/** | ||
* Calculate the natural logarithm of all elements in the array, element-wise. | ||
* | ||
* @param {boolean} [copy=true] - set to false to modify the array rather than create a new one | ||
* @returns {NdArray} | ||
*/ | ||
NdArray.prototype.log = function (copy) { | ||
if (arguments.length === 0) { copy = true; } | ||
var arr = copy ? this.clone() : this; | ||
ops.logeq(arr.selection); | ||
return arr; | ||
}; | ||
/** | ||
* Calculate the positive square-root of all elements in the array, element-wise. | ||
@@ -562,3 +575,3 @@ * | ||
var variance = ops.sum(squares.selection) / (shapeSize - options.ddof) - mean * mean * shapeSize / (shapeSize - options.ddof); | ||
return variance > 0 ? Math.sqrt(Math.abs(variance)) : 0; | ||
@@ -565,0 +578,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
715733
2665
706