Skip to content

Commit

Permalink
Added demo to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
caph1993 committed Mar 20, 2024
1 parent 46226eb commit 4bb5c84
Show file tree
Hide file tree
Showing 189 changed files with 1,328 additions and 35,925 deletions.
8 changes: 5 additions & 3 deletions demo-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ <h3>Header:</h3>
<textarea id="codeHeader" disabled="true" style="width: 90vw; height:6.5em"></textarea>
<script>
(()=>{
$('#codeHeader').text(`
${'<'}script src="https://d3js.org/d3.v7.min.js">${'<'}/script>
${'<'}script src="https://cdn.jsdelivr.net/npm/ndarray-js@1.0.0/dist/index.js">${'<'}/script>
$('#codeHeader').text([
"https://d3js.org/d3.v7.min.js",
"https://cdn.jsdelivr.net/npm/@observablehq/plot@0.6/dist/plot.umd.min.js",
"https://cdn.jsdelivr.net/npm/ndarray-js@1.0.0/dist/index.js",
].map(s=>'<' + `script src="${s}"`+'>'+'<'+'/'+'script'+'>').join('')+`
// Or
let d3 = require('d3');
let np = require('caph1993-numpy-js');
Expand Down
15 changes: 15 additions & 0 deletions dist/NDArray-class.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/** @typedef {NumberConstructor | BooleanConstructor} DType */
export type DType = NumberConstructor | BooleanConstructor;
/** @typedef {NDArray | number | boolean} ArrayOrConstant */
export type ArrayOrConstant = NDArray | number | boolean;
declare class NDArray {
_flat: number[];
Expand Down Expand Up @@ -74,13 +76,26 @@ declare class NDArray {
get flat(): number[];
set flat(list: number[]);
get T(): NDArray;
/**
* @returns {Generator<any, void, unknown>}
*/
[Symbol.iterator](): Generator<any, void, unknown>;
get length(): number;
copy: () => NDArray;
/**
* @returns {number}
*/
item(): number;
}
import { SelfAssignmentOperator } from './NDArray/operators';
import { BinaryOperatorSignature, ReduceNormSignature, ReduceSignature, ReduceSignatureBool, ReduceStdSignature, RoundSignature, UnaryOperatorSignature } from './NDArray/kwargs';
export { NDArray };
export default NDArray;
/** @typedef {NumberConstructor | BooleanConstructor} DType */
/** @typedef {NDArray | number | boolean} ArrayOrConstant */
/** @typedef {"+" | "-" | "*" | "/" | "%" | "//" | "**" | "<" | ">" | ">=" | "<=" | "==" | "!=" | " | " | "&" | "^" | "<<" | ">>" | "or" | "and" | "xor" | "max" | "min"} BinaryOpSymbol */
/** @typedef {"=" | "+=" | "-=" | "*=" | "/=" | "%=" | "//=" | "**=" | "|=" | "&=" | "^=" | "<<=" | ">>=" | "max=" | "min=" | "or=" | "and="} AssignmentOpSymbol */
/** @typedef {"~" | "not" | "-"} UnaryOpSymbol */
/** @typedef {import("./NDArray/indexes").Where} Where */
/** @typedef {Object} Op */
//# sourceMappingURL=NDArray-class.d.ts.map
2 changes: 1 addition & 1 deletion dist/NDArray-class.d.ts.map

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

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

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

45 changes: 45 additions & 0 deletions dist/NDArray/basic.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @typedef {import('../NDArray-class')} NDArray */
import type NDArray from "../NDArray-class";
import { DType } from "../NDArray-class";
import { isarray, asarray, array, new_NDArray, _NDArray } from "./_globals";
Expand All @@ -8,15 +9,59 @@ export { isarray, asarray, array, new_NDArray, _NDArray };
* 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.
* @param {NDArray} arr
* @param {boolean} [expect=false]
* @returns {NDArray | number}
*/
export declare function number_collapse(arr: NDArray, expect?: boolean): NDArray | number;
/**
* @param {any} obj
* @returns {boolean}
*/
export declare function as_boolean(obj: any): boolean;
/**
* @param {any} obj
* @returns {number}
*/
export declare function as_number(obj: any): number;
/**
* @param {any} shape
* @returns {number[]}
*/
export declare function shape_shifts(shape: any): number[];
/**
* @param {number | number[] | NDArray} list
* @returns {number[]}
*/
export declare function parse_shape(list: number | number[] | NDArray): number[];
/**
* @param {NDArray} A
* @param {number | number[]} shape_or_first
* @param {...number} [more_shape]
* @returns {NDArray}
*/
export declare function reshape(A: NDArray, shape_or_first: number | number[], ...more_shape: number[]): NDArray;
/**
* @param {NDArray} A
* @returns {NDArray}
*/
export declare function ravel(A: NDArray): NDArray;
/**
* @param {any} shape
* @param {any} [f=undefined]
* @param {DType} [dtype=Number]
* @returns {NDArray}
*/
export declare function new_from(shape: any, f?: any, dtype?: DType): NDArray;
/**
* @param {any} shape
* @param {DType} [dtype=Number]
* @returns {NDArray}
*/
export declare function empty(shape: any, dtype?: DType): NDArray;
/**
* @param {NDArray} A
* @returns {NDArray}
*/
export declare function copy(A: NDArray): NDArray;
//# sourceMappingURL=basic.d.ts.map
2 changes: 1 addition & 1 deletion dist/NDArray/basic.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/elementwise.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
/** @typedef {import('../NDArray-class')} NDArray */
import type NDArray from "../NDArray-class";
/**
* @param {NDArray} A
* @param {any} func
* @param {any} dtype
* @param {NDArray} [out=null]
* @returns {NDArray}
*/
export declare function elementwise(A: NDArray, func: any, dtype: any, out?: NDArray): NDArray;
export declare const funcs: {
sign: (A: NDArray, out?: NDArray) => NDArray;
Expand Down
2 changes: 1 addition & 1 deletion dist/NDArray/elementwise.d.ts.map

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

2 changes: 1 addition & 1 deletion dist/NDArray/index.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 4bb5c84

Please sign in to comment.