From f4ddccf8646163bc601f2d6e8c3cd2d56110a071 Mon Sep 17 00:00:00 2001 From: gururaj1512 Date: Tue, 1 Sep 2026 02:21:52 +0530 Subject: [PATCH] feat: add float16 dtype support to array/take --- 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_pkg_readmes status: na - task: lint_markdown_docs status: na - 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: passed - task: lint_license_headers status: passed --- --- .../@stdlib/array/take/docs/types/index.d.ts | 19 ++++++++++++++++++- .../@stdlib/array/take/docs/types/test.ts | 2 ++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/array/take/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/take/docs/types/index.d.ts index c8d65c5a315e..6de8891d4c96 100644 --- a/lib/node_modules/@stdlib/array/take/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/array/take/docs/types/index.d.ts @@ -20,7 +20,7 @@ /// -import { Collection, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array'; +import { Collection, AccessorArrayLike, Float16Array, Complex128Array, Complex64Array } from '@stdlib/types/array'; import { Mode } from '@stdlib/types/ndarray'; /** @@ -72,6 +72,23 @@ declare function take( x: Float64Array, indices: IndexArray, options?: Options ) */ declare function take( x: Float32Array, indices: IndexArray, options?: Options ): Float32Array; +/** +* Takes elements from an array. +* +* @param x - input array +* @param indices - list of element indices +* @param options - function options +* @returns output array +* +* @example +* var Float16Array = require( '@stdlib/array/float16' ); +* +* var x = new Float16Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var y = take( x, [ 1, 3 ] ); +* // returns [ 2.0, 4.0 ] +*/ +declare function take( x: Float16Array, indices: IndexArray, options?: Options ): Float16Array; + /** * Takes elements from an array. * diff --git a/lib/node_modules/@stdlib/array/take/docs/types/test.ts b/lib/node_modules/@stdlib/array/take/docs/types/test.ts index 6eadd58a3143..54cbd876ca87 100644 --- a/lib/node_modules/@stdlib/array/take/docs/types/test.ts +++ b/lib/node_modules/@stdlib/array/take/docs/types/test.ts @@ -16,6 +16,7 @@ * limitations under the License. */ +import Float16Array = require( '@stdlib/array/float16' ); import Complex128Array = require( '@stdlib/array/complex128' ); import Complex64Array = require( '@stdlib/array/complex64' ); import take = require( './index' ); @@ -32,6 +33,7 @@ import take = require( './index' ); take( new Float64Array( 10 ), [ 1, 3 ] ); // $ExpectType Float64Array take( new Float32Array( 10 ), [ 1, 3 ] ); // $ExpectType Float32Array + take( new Float16Array( 10 ), [ 1, 3 ] ); // $ExpectType Float16ArrayFallback take( new Int32Array( 10 ), [ 1, 3 ] ); // $ExpectType Int32Array take( new Int16Array( 10 ), [ 1, 3 ] ); // $ExpectType Int16Array take( new Int8Array( 10 ), [ 1, 3 ] ); // $ExpectType Int8Array