Skip to content

Commit e09860d

Browse files
committed
fix: update type definitions to support accessor arrays
--- 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: passed - 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: passed - 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 c217016 commit e09860d

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

lib/node_modules/@stdlib/blas/ext/base/gfill/docs/types/index.d.ts

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,31 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { Collection } from '@stdlib/types/array';
23+
import { Collection, AccessorArrayLike } from '@stdlib/types/array';
2424

2525
/**
2626
* Interface describing `gfill`.
2727
*/
2828
interface Routine {
29+
/**
30+
* Fills a strided array with a specified scalar constant.
31+
*
32+
* @param N - number of indexed elements
33+
* @param alpha - scalar constant
34+
* @param x - input array
35+
* @param strideX - stride length
36+
* @returns `x`
37+
*
38+
* @example
39+
* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
40+
*
41+
* var x = [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
42+
*
43+
* gfill( x.length, 5.0, toAccessorArray( x ), 1 );
44+
* // x => [ 5.0, 5.0, 5.0, 0.0, 5.0, 5.0, 5.0, 5.0 ]
45+
*/
46+
<T = unknown, U = unknown>( N: number, alpha: T, x: AccessorArrayLike<U>, strideX: number ): AccessorArrayLike<T | U>;
47+
2948
/**
3049
* Fills a strided array with a specified scalar constant.
3150
*
@@ -43,6 +62,26 @@ interface Routine {
4362
*/
4463
<T = unknown, U = unknown>( N: number, alpha: T, x: Collection<U>, strideX: number ): Collection<T | U>;
4564

65+
/**
66+
* Fills a strided array with a specified scalar constant using alternative indexing semantics.
67+
*
68+
* @param N - number of indexed elements
69+
* @param alpha - scalar constant
70+
* @param x - input array
71+
* @param strideX - stride length
72+
* @param offsetX - starting index
73+
* @returns `x`
74+
*
75+
* @example
76+
* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
77+
*
78+
* var x = [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ];
79+
*
80+
* gfill.ndarray( x.length, 5.0, toAccessorArray( x ), 1, 0 );
81+
* // x => [ 5.0, 5.0, 5.0, 0.0, 5.0, 5.0, 5.0, 5.0 ]
82+
*/
83+
ndarray<T = unknown, U = unknown>( N: number, alpha: T, x: AccessorArrayLike<U>, strideX: number, offsetX: number ): AccessorArrayLike<T | U>;
84+
4685
/**
4786
* Fills a strided array with a specified scalar constant using alternative indexing semantics.
4887
*

lib/node_modules/@stdlib/blas/ext/base/gfill/docs/types/test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* limitations under the License.
1717
*/
1818

19+
import AccessorArray = require( '@stdlib/array/base/accessor' );
1920
import gfill = require( './index' );
2021

2122

@@ -26,6 +27,7 @@ import gfill = require( './index' );
2627
const x = new Float64Array( 10 );
2728

2829
gfill( x.length, 5.0, x, 1 ); // $ExpectType Collection<number>
30+
gfill( x.length, 5.0, new AccessorArray( x ), 1 ); // $ExpectType AccessorArrayLike<number>
2931
}
3032

3133
// The compiler throws an error if the function is provided a first argument which is not a number...
@@ -84,6 +86,7 @@ import gfill = require( './index' );
8486
const x = new Float64Array( 10 );
8587

8688
gfill.ndarray( x.length, 5.0, x, 1, 0 ); // $ExpectType Collection<number>
89+
gfill.ndarray( x.length, 5.0, new AccessorArray( x ), 1, 0 ); // $ExpectType AccessorArrayLike<number>
8790
}
8891

8992
// The compiler throws an error if the `ndarray` method is provided a first argument which is not a number...

lib/node_modules/@stdlib/blas/ext/base/gfill/lib/accessors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
* gfill( data.length, alpha, x, 1, 0 );
5555
*
5656
* var view = reinterpret64( x.data, 0 );
57-
* // view => <Float32Array>[ 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0 ]
57+
* // returns <Float32Array>[ 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0 ]
5858
*/
5959
function gfill( N, alpha, x, strideX, offsetX ) {
6060
var xbuf;

0 commit comments

Comments
 (0)