Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve quantileSeq typings #3198

Merged
merged 3 commits into from
May 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2655,7 +2655,7 @@ export interface MathJsInstance extends MathJsFactory {
*/
max(...args: MathScalarType[]): MathScalarType
/**
* @param A A single matrix
* @param A An array of scalar values
* @param dimension The maximum over the selected dimension
* @returns The maximum value
*/
Expand Down Expand Up @@ -2685,7 +2685,7 @@ export interface MathJsInstance extends MathJsFactory {
*/
mean(...args: MathScalarType[]): MathScalarType
/**
* @param A A single matrix
* @param A An array of scalar values
* @param dimension The mean over the selected dimension
* @returns The mean value
*/
Expand Down Expand Up @@ -2742,7 +2742,7 @@ export interface MathJsInstance extends MathJsFactory {
*/
min(...args: MathScalarType[]): MathScalarType
/**
* @param A A single matrix
* @param A An array of scalar values
* @param dimension The minimum over the selected dimension
* @returns The minimum value
*/
Expand Down Expand Up @@ -2771,7 +2771,7 @@ export interface MathJsInstance extends MathJsFactory {
*/
mode(...args: MathScalarType[]): MathScalarType[]
/**
* @param A A single matrix
* @param A An array of scalar values
* @returns The mode value
*/
mode<T extends MathScalarType>(A: T[] | T[][]): T[]
Expand All @@ -2795,7 +2795,7 @@ export interface MathJsInstance extends MathJsFactory {
*/
prod(...args: MathScalarType[]): MathScalarType
/**
* @param A A single matrix
* @param A An array of scalar values
* @returns The product of all values
*/
prod<T extends MathScalarType>(A: T[] | T[][]): T
Expand All @@ -2805,6 +2805,19 @@ export interface MathJsInstance extends MathJsFactory {
*/
prod(A: MathCollection): MathScalarType

/**
* @param A An array of scalar values
* @param probOrN prob is the order of the quantile, while N is the
* amount of evenly distributed steps of probabilities; only one of
* these options can be provided
* @param sorted =false is data sorted in ascending order
* @returns Quantile(s)
*/
quantileSeq<T extends MathScalarType>(
A: T[] | T[][],
prob: number | BigNumber | MathArray,
sorted?: boolean
): T
/**
* Compute the prob order quantile of a matrix or a list with values.
* The sequence is sorted and the middle value is returned. Supported
Expand All @@ -2823,7 +2836,7 @@ export interface MathJsInstance extends MathJsFactory {
A: MathCollection,
prob: number | BigNumber | MathArray,
sorted?: boolean
): number | BigNumber | Unit | MathArray
): MathScalarType | MathArray

/**
* Compute the standard deviation of a matrix or a list with values. The
Expand Down Expand Up @@ -2901,7 +2914,7 @@ export interface MathJsInstance extends MathJsFactory {
*/
sum(...args: MathScalarType[]): MathScalarType
/**
* @param A A single matrix
* @param A An array of scalar values
* @param dimension The sum over the selected dimension
* @returns The sum of all values
*/
Expand Down