Skip to content

feat: add blas/ext/base/greplicate#11303

Open
headlessNode wants to merge 1 commit intostdlib-js:developfrom
headlessNode:blas/greplicate
Open

feat: add blas/ext/base/greplicate#11303
headlessNode wants to merge 1 commit intostdlib-js:developfrom
headlessNode:blas/greplicate

Conversation

@headlessNode
Copy link
Copy Markdown
Member

Resolves stdlib-js/metr-issue-tracker#249.

Description

What is the purpose of this pull request?

This pull request:

  • add blas/ext/base/greplicate

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

Primarily written by Claude Code.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS). Needs Review A pull request which needs code review. labels Apr 4, 2026
@stdlib-bot
Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
blas/ext/base/greplicate $\color{green}286/286$
$\color{green}+100.00%$
$\color{green}18/18$
$\color{green}+100.00%$
$\color{green}3/3$
$\color{green}+100.00%$
$\color{green}286/286$
$\color{green}+100.00%$

The above coverage report was generated for the changes in this PR.

@headlessNode headlessNode added Feature Issue or pull request for adding a new feature. METR Pull request associated with the METR project. labels Apr 4, 2026
@headlessNode headlessNode requested a review from kgryte April 4, 2026 21:55
/**
* Input array.
*/
type InputArray = Collection<number> | AccessorArrayLike<number>;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we restricting strided array elements to number?

Suggested change
type InputArray = Collection<number> | AccessorArrayLike<number>;
type InputArray<T> = Collection<T> | AccessorArrayLike<T>;

/**
* Output array.
*/
type OutputArray = Collection<number> | AccessorArrayLike<number>;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type OutputArray = Collection<number> | AccessorArrayLike<number>;
type OutputArray<T> = Collection<T> | AccessorArrayLike<T>;

* greplicate( x.length, 2, x, 1, out, 1 );
* // out => [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ]
*/
<T extends OutputArray>( N: number, k: number, x: InputArray, strideX: number, out: T, strideOut: number ): T;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<T extends OutputArray>( N: number, k: number, x: InputArray, strideX: number, out: T, strideOut: number ): T;
<T = unknown, U extends InputArray<T> = InputArray<T>, V extends OutputArray<T> = OutputArray<T>>( N: number, k: number, x: U, strideX: number, out: V, strideOut: number ): V;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same applies below.

* var x = [ 1.0, 2.0, 3.0 ];
* var out = [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ];
*
* greplicate.ndarray( 3, 2, x, 1, 0, out, 1, 0 );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* greplicate.ndarray( 3, 2, x, 1, 0, out, 1, 0 );
* greplicate.ndarray( x.length, 2, x, 1, 0, out, 1, 0 );

* Replicates each strided array element a specified number of times.
*
* @param {PositiveInteger} N - number of indexed elements
* @param {PositiveInteger} k - number of times to replicate
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param {PositiveInteger} k - number of times to replicate
* @param {PositiveInteger} k - number of times to replicate each element

Applies here and elsewhere in this PR.


// TESTS //

// The function returns a numeric array...
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description needs to be updated.

Copy link
Copy Markdown
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left initial comments.

@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Apr 5, 2026
@github-actions github-actions bot mentioned this pull request Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BLAS Issue or pull request related to Basic Linear Algebra Subprograms (BLAS). Feature Issue or pull request for adding a new feature. METR Pull request associated with the METR project. Needs Changes Pull request which needs changes before being merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: add blas/ext/base/greplicate

3 participants