Skip to content

Commit f67f870

Browse files
committed
docs: add ts declaration file
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 4745c79 commit f67f870

File tree

1 file changed

+316
-0
lines changed
  • lib/node_modules/@stdlib/blas/ext/base/wasm/dasumpw/docs/types

1 file changed

+316
-0
lines changed
Lines changed: 316 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,316 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 4.1
20+
21+
/// <reference types="@stdlib/types"/>
22+
23+
import { ModuleWrapper, Memory } from '@stdlib/types/wasm';
24+
25+
/**
26+
* Interface defining a module constructor which is both "newable" and "callable".
27+
*/
28+
interface ModuleConstructor {
29+
/**
30+
* Returns a new WebAssembly module wrapper instance which uses the provided WebAssembly memory instance as its underlying memory.
31+
*
32+
* @param mem - WebAssembly memory instance
33+
* @returns module wrapper instance
34+
*
35+
* @example
36+
* var Memory = require( '@stdlib/wasm/memory' );
37+
* var oneTo = require( '@stdlib/array/one-to' );
38+
*
39+
* // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB):
40+
* var mem = new Memory({
41+
* 'initial': 10,
42+
* 'maximum': 100
43+
* });
44+
*
45+
* // Create a BLAS routine:
46+
* var mod = new dasumpw.Module( mem );
47+
* // returns <Module>
48+
*
49+
* // Initialize the routine:
50+
* mod.initializeSync();
51+
*
52+
* // Define a vector data type:
53+
* var dtype = 'float64';
54+
*
55+
* // Specify a vector length:
56+
* var N = 3;
57+
*
58+
* // Define a pointer (i.e., byte offset) to the first vector element:
59+
* var xptr = 0;
60+
*
61+
* // Write vector values to module memory:
62+
* mod.write( xptr, oneTo( N, dtype ) );
63+
*
64+
* // Perform computation:
65+
* var out = mod.main( N, 5.0, xptr, 1 );
66+
* // returns 21.0
67+
*/
68+
new( mem: Memory ): Module; // newable
69+
70+
/**
71+
* Returns a new WebAssembly module wrapper instance which uses the provided WebAssembly memory instance as its underlying memory.
72+
*
73+
* @param mem - WebAssembly memory instance
74+
* @returns module wrapper instance
75+
*
76+
* @example
77+
* var Memory = require( '@stdlib/wasm/memory' );
78+
* var oneTo = require( '@stdlib/array/one-to' );
79+
*
80+
* // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB):
81+
* var mem = new Memory({
82+
* 'initial': 10,
83+
* 'maximum': 100
84+
* });
85+
*
86+
* // Create a BLAS routine:
87+
* var mod = dasumpw.Module( mem );
88+
* // returns <Module>
89+
*
90+
* // Initialize the routine:
91+
* mod.initializeSync();
92+
*
93+
* // Define a vector data type:
94+
* var dtype = 'float64';
95+
*
96+
* // Specify a vector length:
97+
* var N = 3;
98+
*
99+
* // Define a pointer (i.e., byte offset) to the first vector element:
100+
* var xptr = 0;
101+
*
102+
* // Write vector values to module memory:
103+
* mod.write( xptr, oneTo( N, dtype ) );
104+
*
105+
* // Perform computation:
106+
* var out = mod.main( N, 5.0, xptr, 1 );
107+
* // returns 21.0
108+
*/
109+
( mem: Memory ): Module; // callable
110+
}
111+
112+
/**
113+
* Interface describing a `dasumpw` WebAssembly module.
114+
*/
115+
interface Module extends ModuleWrapper {
116+
/**
117+
* Computes the sum of absolute values (L1 norm) of double-precision floating-point strided array elements using pairwise summation.
118+
*
119+
* @param N - number of indexed elements
120+
* @param xptr - input array pointer (i.e., byte offset)
121+
* @param strideX - stride length
122+
* @returns sum
123+
*
124+
* @example
125+
* var Memory = require( '@stdlib/wasm/memory' );
126+
* var oneTo = require( '@stdlib/array/one-to' );
127+
*
128+
* // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB):
129+
* var mem = new Memory({
130+
* 'initial': 10,
131+
* 'maximum': 100
132+
* });
133+
*
134+
* // Create a BLAS routine:
135+
* var mod = new dasumpw.Module( mem );
136+
* // returns <Module>
137+
*
138+
* // Initialize the routine:
139+
* mod.initializeSync();
140+
*
141+
* // Define a vector data type:
142+
* var dtype = 'float64';
143+
*
144+
* // Specify a vector length:
145+
* var N = 3;
146+
*
147+
* // Define a pointer (i.e., byte offset) to the first vector element:
148+
* var xptr = 0;
149+
*
150+
* // Write vector values to module memory:
151+
* mod.write( xptr, oneTo( N, dtype ) );
152+
*
153+
* // Perform computation:
154+
* var out = mod.main( N, xptr, 1 );
155+
* // returns 6.0
156+
*/
157+
main( N: number, xptr: number, strideX: number ): number;
158+
159+
/**
160+
* Computes the sum of absolute values (L1 norm) of double-precision floating-point strided array elements using pairwise summation and alternative indexing semantics.
161+
*
162+
* @param N - number of indexed elements
163+
* @param xptr - input array pointer (i.e., byte offset)
164+
* @param strideX - stride length
165+
* @param offsetX - starting index
166+
* @returns sum
167+
*
168+
* @example
169+
* var Memory = require( '@stdlib/wasm/memory' );
170+
* var oneTo = require( '@stdlib/array/one-to' );
171+
*
172+
* // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB):
173+
* var mem = new Memory({
174+
* 'initial': 10,
175+
* 'maximum': 100
176+
* });
177+
*
178+
* // Create a BLAS routine:
179+
* var mod = new dasumpw.Module( mem );
180+
* // returns <Module>
181+
*
182+
* // Initialize the routine:
183+
* mod.initializeSync();
184+
*
185+
* // Define a vector data type:
186+
* var dtype = 'float64';
187+
*
188+
* // Specify a vector length:
189+
* var N = 3;
190+
*
191+
* // Define a pointer (i.e., byte offset) to the first vector element:
192+
* var xptr = 0;
193+
*
194+
* // Write vector values to module memory:
195+
* mod.write( xptr, oneTo( N, dtype ) );
196+
*
197+
* // Perform computation:
198+
* var out = mod.ndarray( N, xptr, 1, 0 );
199+
* // returns 6.0
200+
*/
201+
ndarray( N: number, xptr: number, strideX: number, offsetX: number ): number;
202+
}
203+
204+
/**
205+
* Interface describing `dasumpw`.
206+
*/
207+
interface Routine extends ModuleWrapper {
208+
/**
209+
* Computes the sum of absolute values (L1 norm) of double-precision floating-point strided array elements using pairwise summation.
210+
*
211+
* @param N - number of indexed elements
212+
* @param x - input array
213+
* @param strideX - stride length
214+
* @returns sum
215+
*
216+
* @example
217+
* var Float64Array = require( '@stdlib/array/float64' );
218+
*
219+
* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
220+
*
221+
* var out = dasumpw.main( 3, x, 1 );
222+
* // returns 5.0
223+
*/
224+
main( N: number, alpha: number, x: Float64Array, strideX: number ): number;
225+
226+
/**
227+
* Computes the sum of absolute values (L1 norm) of double-precision floating-point strided array elements using pairwise summation and alternative indexing semantics.
228+
*
229+
* @param N - number of indexed elements
230+
* @param x - input array
231+
* @param strideX - stride length
232+
* @param offsetX - starting index
233+
* @returns sum
234+
*
235+
* @example
236+
* var Float64Array = require( '@stdlib/array/float64' );
237+
*
238+
* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
239+
*
240+
* var out = dasumpw.ndarray( 4, x, 2, 1 );
241+
* // returns 9.0
242+
*/
243+
ndarray( N: number, x: Float64Array, strideX: number, offsetX: number ): number;
244+
245+
/**
246+
* Returns a new WebAssembly module wrapper instance which uses the provided WebAssembly memory instance as its underlying memory.
247+
*
248+
* @param mem - WebAssembly memory instance
249+
* @returns module wrapper instance
250+
*
251+
* @example
252+
* var Memory = require( '@stdlib/wasm/memory' );
253+
* var oneTo = require( '@stdlib/array/one-to' );
254+
*
255+
* // Create a new memory instance with an initial size of 10 pages (640KiB) and a maximum size of 100 pages (6.4MiB):
256+
* var mem = new Memory({
257+
* 'initial': 10,
258+
* 'maximum': 100
259+
* });
260+
*
261+
* // Create a BLAS routine:
262+
* var mod = new dasumpw.Module( mem );
263+
* // returns <Module>
264+
*
265+
* // Initialize the routine:
266+
* mod.initializeSync();
267+
*
268+
* // Define a vector data type:
269+
* var dtype = 'float64';
270+
*
271+
* // Specify a vector length:
272+
* var N = 3;
273+
*
274+
* // Define a pointer (i.e., byte offset) to the first vector element:
275+
* var xptr = 0;
276+
*
277+
* // Write vector values to module memory:
278+
* mod.write( xptr, oneTo( N, dtype ) );
279+
*
280+
* // Perform computation:
281+
* var out = mod.main( N, xptr, 1 );
282+
* // returns 6.0
283+
*/
284+
Module: ModuleConstructor;
285+
}
286+
287+
/**
288+
* Adds a scalar constant to each double-precision floating-point strided array element and computes the sum using an improved Kahan–Babuška algorithm.
289+
*
290+
* @param N - number of indexed elements
291+
* @param x - input array
292+
* @param strideX - stride length
293+
* @returns sum
294+
*
295+
* @example
296+
* var Float64Array = require( '@stdlib/array/float64' );
297+
*
298+
* var x = new Float64Array( [ 1.0, -2.0, 2.0 ] );
299+
*
300+
* var out = dasumpw.main( 3, x, 1 );
301+
* // returns 5.0
302+
*
303+
* @example
304+
* var Float64Array = require( '@stdlib/array/float64' );
305+
*
306+
* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0 ] );
307+
*
308+
* var out = dasumpw.ndarray( 4, x, 2, 1 );
309+
* // returns 9.0
310+
*/
311+
declare var dasumpw: Routine;
312+
313+
314+
// EXPORTS //
315+
316+
export = dasumpw;

0 commit comments

Comments
 (0)