mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
Resolve merge conflict
This commit is contained in:
34
ndarray/index.d.ts
vendored
Normal file
34
ndarray/index.d.ts
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// Type definitions for ndarray v1.0.18
|
||||
// Project: https://github.com/scijs/ndarray
|
||||
// Definitions by: Giff Song <https://github.com/pawsong/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
type Data = Array<number> | Int8Array | Int16Array | Int32Array |
|
||||
Uint8Array | Uint16Array | Uint32Array |
|
||||
Float32Array | Float64Array | Uint8ClampedArray;
|
||||
|
||||
interface ndarray {
|
||||
data: Data;
|
||||
shape: number[];
|
||||
stride: number[];
|
||||
offset: number;
|
||||
dtype: 'int8' | 'int16' | 'int32' | 'uint8' | 'uint16' |'uint32' |
|
||||
'float32' | 'float64' | 'array'| 'uint8_clamped' | 'buffer' | 'generic';
|
||||
size: number;
|
||||
order: number[];
|
||||
dimension: number;
|
||||
get(...args: number[]): number;
|
||||
set(...args: number[]): number;
|
||||
index(...args: number[]): number;
|
||||
lo(...args: number[]): ndarray;
|
||||
hi(...args: number[]): ndarray;
|
||||
step(...args: number[]): ndarray;
|
||||
transpose(...args: number[]): ndarray;
|
||||
pick(...args: number[]): ndarray;
|
||||
}
|
||||
|
||||
declare function ndarray(
|
||||
data: Data, shape?: number[], stride?: number[], offset?: number
|
||||
): ndarray;
|
||||
|
||||
export = ndarray;
|
||||
@@ -1,6 +1,5 @@
|
||||
/// <reference path="ndarray.d.ts" />
|
||||
|
||||
import * as ndarray from 'ndarray';
|
||||
import ndarray = require('ndarray');
|
||||
|
||||
const data = new Int32Array(2 * 2 * 2 + 10);
|
||||
const a = ndarray(data, [2, 2, 2], [1, 2, 4], 5);
|
||||
@@ -24,4 +23,3 @@ console.log(a.get(0, 0, 0) === 1);
|
||||
console.log(a.index(1, 1, 1) === 12);
|
||||
|
||||
const b = a.lo(0, 0, 0).hi(1, 1, 1);
|
||||
const c = b.step(0).transpose(0, 0, 0).pick(null, null, 0);
|
||||
|
||||
19
ndarray/tsconfig.json
Normal file
19
ndarray/tsconfig.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ndarray-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user