Skip to content

Commit

Permalink
test for submission to NPM with package name ndarray-js
Browse files Browse the repository at this point in the history
  • Loading branch information
caph1993 committed Mar 19, 2024
1 parent 3ca336c commit fe3aa5c
Show file tree
Hide file tree
Showing 51 changed files with 1,510 additions and 435 deletions.
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*
!readme.md
!src/**
# !src/**
!dist/**
!LICENSE
!package.json
86 changes: 86 additions & 0 deletions dist/NDArray-class.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
export type DType = NumberConstructor | BooleanConstructor;
export type ArrayOrConstant = NDArray | number | boolean;
declare class NDArray {
_flat: number[];
shape: number[];
dtype: DType;
index: (...where: any[]) => any;
reshape: (shape: any, ...more_shape: any[]) => any;
modules: typeof import("./NDArray").modules;
any: ReduceSignatureBool;
all: ReduceSignatureBool;
sum: ReduceSignature;
product: ReduceSignature;
max: ReduceSignature;
min: ReduceSignature;
argmax: ReduceSignature;
argmin: ReduceSignature;
mean: ReduceSignature;
var: ReduceSignature;
std: ReduceStdSignature;
norm: ReduceNormSignature;
add: BinaryOperatorSignature;
subtract: BinaryOperatorSignature;
multiply: BinaryOperatorSignature;
divide: BinaryOperatorSignature;
mod: BinaryOperatorSignature;
divide_int: BinaryOperatorSignature;
pow: BinaryOperatorSignature;
maximum: BinaryOperatorSignature;
minimum: BinaryOperatorSignature;
bitwise_or: BinaryOperatorSignature;
bitwise_and: BinaryOperatorSignature;
bitwise_shift_right: BinaryOperatorSignature;
logical_xor: BinaryOperatorSignature<boolean>;
logical_or: BinaryOperatorSignature<boolean>;
logical_and: BinaryOperatorSignature<boolean>;
greater: BinaryOperatorSignature;
less: BinaryOperatorSignature;
greater_equal: BinaryOperatorSignature;
less_equal: BinaryOperatorSignature;
equal: BinaryOperatorSignature;
not_equal: BinaryOperatorSignature;
isclose: (A: any, B: any, rtol?: number, atol?: number, equal_nan?: boolean) => number | boolean | NDArray;
allclose: (A: any, B: any, rtol?: number, atol?: number, equal_nan?: boolean) => boolean;
abs: UnaryOperatorSignature;
negative: UnaryOperatorSignature;
logical_not: UnaryOperatorSignature;
bitwise_not: UnaryOperatorSignature;
assign: SelfAssignmentOperator;
add_assign: SelfAssignmentOperator;
subtract_assign: SelfAssignmentOperator;
multiply_assign: SelfAssignmentOperator;
divide_assign: SelfAssignmentOperator;
mod_assign: SelfAssignmentOperator;
pow_assign: SelfAssignmentOperator;
divide_int_assign: SelfAssignmentOperator;
maximum_assign: SelfAssignmentOperator;
minimum_assign: SelfAssignmentOperator;
bitwise_and_assign: SelfAssignmentOperator;
bitwise_or_assign: SelfAssignmentOperator;
logical_or_assign: SelfAssignmentOperator;
bitwise_shift_right_assign: SelfAssignmentOperator;
bitwise_shift_left_assign: SelfAssignmentOperator;
logical_and_assign: SelfAssignmentOperator;
tolist: () => any;
round: RoundSignature;
sort: (axis?: number) => NDArray;
transpose: (axes?: number[]) => NDArray;
op: (...args: any[]) => NDArray;
ravel: () => NDArray;
constructor(flat: number[], shape: number[], dtype?: any);
_simpleIndexes: import("./NDArray/indexes").AxesIndex | null;
get size(): number;
get flat(): number[];
set flat(list: number[]);
get T(): NDArray;
[Symbol.iterator](): Generator<any, void, unknown>;
get length(): number;
copy: () => NDArray;
item(): number;
}
import { SelfAssignmentOperator } from './NDArray/operators';
import { BinaryOperatorSignature, ReduceNormSignature, ReduceSignature, ReduceSignatureBool, ReduceStdSignature, RoundSignature, UnaryOperatorSignature } from './NDArray/kwargs';
export { NDArray };
export default NDArray;
//# sourceMappingURL=NDArray-class.d.ts.map
1 change: 1 addition & 0 deletions dist/NDArray-class.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions dist/NDArray/_globals.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type NDArray from "../NDArray-class";
import { DType } from "../NDArray-class";
export declare const _NDArray: typeof NDArray;
export declare function isarray(A: any): A is NDArray;
export declare const new_NDArray: (flat: number[], shape: number[], dtype: DType) => NDArray;
export declare function asarray(A: any): NDArray;
export declare function array(A: any): NDArray;
//# sourceMappingURL=_globals.d.ts.map
1 change: 1 addition & 0 deletions dist/NDArray/_globals.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions dist/NDArray/basic.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type NDArray from "../NDArray-class";
import { DType } from "../NDArray-class";
import { isarray, asarray, array, new_NDArray, _NDArray } from "./_globals";
export { isarray, asarray, array, new_NDArray, _NDArray };
/**
* If the array is 0D, it returns it's unique element (number or boolean).
* The signature is kept as NDArray for type consistency, even though the
* output is a number or a boolean. This is consistent with the facts that
* (1) all functions requiring arrays work with numbers as well because they call asarray,
* and (2) semantically, a constant is an array.
*/
export declare function number_collapse(arr: NDArray, expect?: boolean): NDArray | number;
export declare function as_boolean(obj: any): boolean;
export declare function as_number(obj: any): number;
export declare function shape_shifts(shape: any): number[];
export declare function parse_shape(list: number | number[] | NDArray): number[];
export declare function reshape(A: NDArray, shape_or_first: number | number[], ...more_shape: number[]): NDArray;
export declare function ravel(A: NDArray): NDArray;
export declare function new_from(shape: any, f?: any, dtype?: DType): NDArray;
export declare function empty(shape: any, dtype?: DType): NDArray;
export declare function copy(A: NDArray): NDArray;
//# sourceMappingURL=basic.d.ts.map
1 change: 1 addition & 0 deletions dist/NDArray/basic.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions dist/NDArray/elementwise.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import type NDArray from "../NDArray-class";
export declare function elementwise(A: NDArray, func: any, dtype: any, out?: NDArray): NDArray;
export declare const funcs: {
sign: (A: NDArray, out?: NDArray) => NDArray;
sqrt: (A: NDArray, out?: NDArray) => NDArray;
square: (A: NDArray, out?: NDArray) => NDArray;
exp: (A: NDArray, out?: NDArray) => NDArray;
log: (A: NDArray, out?: NDArray) => NDArray;
log2: (A: NDArray, out?: NDArray) => NDArray;
log10: (A: NDArray, out?: NDArray) => NDArray;
log1p: (A: NDArray, out?: NDArray) => NDArray;
sin: (A: NDArray, out?: NDArray) => NDArray;
cos: (A: NDArray, out?: NDArray) => NDArray;
tan: (A: NDArray, out?: NDArray) => NDArray;
asin: (A: NDArray, out?: NDArray) => NDArray;
acos: (A: NDArray, out?: NDArray) => NDArray;
atan: (A: NDArray, out?: NDArray) => NDArray;
cosh: (A: NDArray, out?: NDArray) => NDArray;
sinh: (A: NDArray, out?: NDArray) => NDArray;
tanh: (A: NDArray, out?: NDArray) => NDArray;
acosh: (A: NDArray, out?: NDArray) => NDArray;
asinh: (A: NDArray, out?: NDArray) => NDArray;
atanh: (A: NDArray, out?: NDArray) => NDArray;
};
export declare const ops: {
"~": (A: NDArray, out?: NDArray) => NDArray;
not: (A: NDArray, out?: NDArray) => NDArray;
"+": (A: NDArray, out?: NDArray) => NDArray;
"-": (A: NDArray, out?: NDArray) => NDArray;
round: (arr: NDArray, decimals: number, out?: NDArray) => NDArray;
negative: (A: NDArray, out?: NDArray) => NDArray;
bitwise_not: (A: NDArray, out?: NDArray) => NDArray;
logical_not: (A: NDArray, out?: NDArray) => NDArray;
valueOf: (A: NDArray, out?: NDArray) => NDArray;
abs: (A: NDArray, out?: NDArray) => NDArray;
};
export declare const kw_ops: {
bitwise_not: {
as_function: (arr: number | boolean | NDArray, out?: NDArray) => NDArray;
as_method: (out?: NDArray) => NDArray;
};
logical_not: {
as_function: (arr: number | boolean | NDArray, out?: NDArray) => NDArray;
as_method: (out?: NDArray) => NDArray;
};
negative: {
as_function: (arr: number | boolean | NDArray, out?: NDArray) => NDArray;
as_method: (out?: NDArray) => NDArray;
};
abs: {
as_function: (arr: number | boolean | NDArray, out?: NDArray) => NDArray;
as_method: (out?: NDArray) => NDArray;
};
round: {
as_function: (arr: number | boolean | NDArray, decimals?: number) => NDArray;
as_method: (decimals?: number) => NDArray;
};
};
//# sourceMappingURL=elementwise.d.ts.map
1 change: 1 addition & 0 deletions dist/NDArray/elementwise.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions dist/NDArray/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import './_globals';
import * as basic from './basic';
import * as indexes from './indexes';
import * as jsInterface from './js-interface';
import * as elementwise from './elementwise';
import * as print from './print';
import * as reduce from './reduce';
import * as operators from './operators';
import * as transform from './transform';
export declare const modules: {
basic: typeof basic;
jsInterface: typeof jsInterface;
indexes: typeof indexes;
elementwise: typeof elementwise;
print: typeof print;
reduce: typeof reduce;
operators: typeof operators;
transform: typeof transform;
};
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions dist/NDArray/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 73 additions & 0 deletions dist/NDArray/indexes.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import type NDArray from "../NDArray-class";
export type RangeSpec = string;
export type indexSpec = ':' | number | RangeSpec | NDArray | number[];
export type GeneralIndexSpec = ':' | '...' | 'None' | null | indexSpec;
export type Where = null | GeneralIndexSpec[];
export declare function index(arr: NDArray, where: Where): number | NDArray;
export declare class AxesIndex {
shape: any;
internalShape: any;
axisIndexes: AxisIndex[];
private _indices;
private _size;
isSimple: boolean;
isConstant: boolean;
parse: (shape: number[], where: Where) => AxesIndex;
/**
* @param {AxisIndex[]} axisIndexes
*/
constructor(apparentShape: any, internalShape: any, axisIndexes: AxisIndex[]);
get indices(): number[];
get __slices(): any[];
get size(): number;
}
export declare function __parse_sliceRange(axis_size: any, { start, stop, step }: {
start: any;
stop: any;
step: any;
}): any[];
export type AxisIndexSpec = {
type: ':';
size: number;
} | {
type: 'number';
index: number;
} | {
type: 'range';
range: {
start: number;
step: number;
nSteps: number;
};
} | {
type: 'array';
indices: number[];
};
export declare class AxisIndex {
spec: AxisIndexSpec;
private _indices;
isSimple: boolean;
isConstant: boolean;
parse: (indexSpec: indexSpec | undefined, size: number) => {
axisIndex: AxisIndex;
span: number;
};
parse_range: (size: number, start?: number, stop?: number, step?: number) => {
start: number;
step: number;
nSteps: number;
};
parse_range_spec: (rangeString: string) => {
start: number;
stop: number;
step: number;
};
/**
* Invariant: Immutable
* @param {AxisIndexSpec} spec
*/
constructor(spec: AxisIndexSpec);
get indices(): any;
get size(): number;
}
//# sourceMappingURL=indexes.d.ts.map
1 change: 1 addition & 0 deletions dist/NDArray/indexes.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions dist/NDArray/js-interface.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export declare function fromlist(arr: any, dtype?: any): import("../NDArray-class").NDArray;
export declare function tolist(arr: any): any;
//# sourceMappingURL=js-interface.d.ts.map
1 change: 1 addition & 0 deletions dist/NDArray/js-interface.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fe3aa5c

Please sign in to comment.