Comparing version 0.12.0 to 0.12.1
@@ -98,4 +98,4 @@ 'use strict'; | ||
grunt.registerTask('test', ['simplemocha:full', 'browserify', 'karma:dist', 'uglify', 'karma:min']); | ||
grunt.registerTask('travis', ['exec:test-semistandard', 'simplemocha:full', 'karma:dist', 'karma:min']); | ||
grunt.registerTask('travis', ['simplemocha:full', 'karma:dist', 'karma:min']); | ||
grunt.registerTask('doc', ['jsdoc', 'gh-pages']); | ||
}; |
{ | ||
"name": "numjs", | ||
"version": "0.12.0", | ||
"version": "0.12.1", | ||
"description": "Like NumPy, in JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -232,4 +232,4 @@ 'use strict'; | ||
* Gives a new shape to the array without changing its data. | ||
* @param {Array} shape | ||
* @returns {NdArray} | ||
* @param {Array|number} The new shape should be compatible with the original shape. If an integer, then the result will be a 1-D array of that length. One shape dimension can be -1. In this case, the value is inferred from the length of the array and remaining dimensions. | ||
* @returns {NdArray} a new view object if possible, a copy otherwise, | ||
*/ | ||
@@ -240,2 +240,5 @@ NdArray.prototype.reshape = function (shape) { | ||
} | ||
if (arguments.length === 1 && _.isNumber(shape) && shape === -1) { | ||
shape = [_.shapeSize(this.shape)]; | ||
} | ||
if (arguments.length === 1 && _.isNumber(shape)) { | ||
@@ -247,2 +250,7 @@ shape = [shape]; | ||
} | ||
if (shape.filter(function (s) { return s === -1; }).length > 1) { | ||
throw new errors.ValueError('can only specify one unknown dimension'); | ||
} | ||
var currentShapeSize = _.shapeSize(shape); | ||
shape = shape.map(function (s) { return s === -1 ? -1 * this.size / currentShapeSize : s; }.bind(this)); | ||
if (this.size !== _.shapeSize(shape)) { | ||
@@ -249,0 +257,0 @@ throw new errors.ValueError('total size of new array must be unchanged'); |
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
712659
2595