@openchemistry/utils
Advanced tools
Comparing version 0.3.3 to 0.4.0
@@ -6,2 +6,13 @@ # Change Log | ||
<a name="0.4.0"></a> | ||
# [0.4.0](https://github.com/OpenChemistry/oc-web-components/compare/@openchemistry/utils@0.3.3...@openchemistry/utils@0.4.0) (2018-08-10) | ||
### Features | ||
* **utils:** Add a function similar to numpy.linspace ([e70627e](https://github.com/OpenChemistry/oc-web-components/commit/e70627e)) | ||
<a name="0.3.3"></a> | ||
@@ -8,0 +19,0 @@ ## [0.3.3](https://github.com/OpenChemistry/oc-web-components/compare/@openchemistry/utils@0.3.2...@openchemistry/utils@0.3.3) (2018-08-01) |
export declare function rowMaj2colMaj3d(scalars: number[], dims: [number, number, number]): Float32Array; | ||
export declare function makeBins(scalars: number[], nBins?: number, range?: number[] | undefined): number[]; | ||
export declare function linearSpace(start: number, stop: number, num: number, endPoint?: boolean): number[]; |
@@ -33,1 +33,13 @@ export function rowMaj2colMaj3d(scalars, dims) { | ||
} | ||
export function linearSpace(start, stop, num, endPoint) { | ||
if (endPoint === void 0) { endPoint = true; } | ||
// Function similar to numpy.linspace | ||
var arr = []; | ||
var delta = stop - start; | ||
var denom = endPoint ? num - 1 : num; | ||
for (var i = 0; i < num; ++i) { | ||
var val = start + delta * (i / denom); | ||
arr.push(val); | ||
} | ||
return arr; | ||
} |
{ | ||
"name": "@openchemistry/utils", | ||
"version": "0.3.3", | ||
"version": "0.4.0", | ||
"description": "Utilities to validate and convert cjson chemical data", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -13,4 +13,4 @@ export function rowMaj2colMaj3d(scalars: number[], dims: [number, number, number]) : Float32Array { | ||
export function makeBins(scalars: number[], nBins = 50, range: number[] | undefined = undefined) { | ||
let h = []; | ||
export function makeBins(scalars: number[], nBins = 50, range: number[] | undefined = undefined) : number[] { | ||
let h: number[] = []; | ||
for (let i = 0; i <= nBins; ++i) { | ||
@@ -35,2 +35,14 @@ h.push(0); | ||
return h; | ||
} | ||
} | ||
export function linearSpace(start: number, stop: number, num: number, endPoint: boolean = true) : number[] { | ||
// Function similar to numpy.linspace | ||
let arr: number[] = []; | ||
let delta = stop - start; | ||
let denom = endPoint ? num - 1 : num; | ||
for (let i = 0; i < num; ++i) { | ||
let val = start + delta * (i / denom); | ||
arr.push(val); | ||
} | ||
return arr; | ||
} |
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
36769
868