Skip to content

Commit c5468e2

Browse files
committed
docs: improve JSDoc across spectra-processing functions
Add missing @returns/@param descriptions and normalize phrasing across matrix, reim, utils, x, xy, xyArray, and xyObject modules.
1 parent 898eaad commit c5468e2

127 files changed

Lines changed: 384 additions & 376 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/matrix/matrixAbsoluteMedian.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { xMedian } from '../x/index.ts';
44

55
/**
66
* Returns the median of the absolute matrix.
7-
* @param matrix
7+
* @param matrix - input matrix.
88
*/
99
export function matrixAbsoluteMedian(matrix: DoubleMatrix): number {
1010
const nbColumns = matrix[0].length;

src/matrix/matrixApplyNumericalEncoding.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { matrixCreateEmpty } from './matrixCreateEmpty.ts';
44

55
/**
66
* Numerically encodes the strings in the matrix with an encoding dictionary.
7-
* @param matrixInitial - Original matrix before encoding.
8-
* @param dictionary - Dictionary against which to do the encoding.
9-
* @returns - Encoded matrix.
7+
* @param matrixInitial - original matrix before encoding.
8+
* @param dictionary - dictionary against which to do the encoding.
9+
* @returns encoded matrix.
1010
*/
1111
export function matrixApplyNumericalEncoding(
1212
matrixInitial: Array<Array<string | number>>,

src/matrix/matrixCheckRanges.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export interface SubmatrixBoundaries {
2121

2222
/**
2323
* Checks if the specified submatrix boundaries are within the valid range of the given matrix.
24-
* @param matrix - The matrix to check the boundaries against.
25-
* @param boundaries - The boundaries of the submatrix.
24+
* @param matrix - the matrix to check the boundaries against.
25+
* @param boundaries - the boundaries of the submatrix.
2626
* @throws {RangeError} If any of the specified boundaries are out of the matrix's range.
2727
*/
2828
export function matrixCheckRanges(

src/matrix/matrixCholeskySolver.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ import type { NumberArray } from 'cheminfo-types';
2727
/**
2828
* Solves a system of linear equations using the Cholesky decomposition method.
2929
* It is a direct conversion to TS from {@link https://github.com/scijs/cholesky-solve}
30-
* @param nonZerosArray - The matrix in triplet form (array of arrays), where each sub-array contains three elements: row index, column index, and value.
31-
* @param dimension - The order of the matrix (number of rows/columns).
32-
* @param permutationEncoded - Optional permutation array. If provided, it will be used to permute the matrix.
33-
* @returns A function that takes a right-hand side vector `b` and returns the solution vector `x`, or `null` if the decomposition fails.
30+
* @param nonZerosArray - the matrix in triplet form (array of arrays), where each sub-array contains three elements: row index, column index, and value.
31+
* @param dimension - the order of the matrix (number of rows/columns).
32+
* @param permutationEncoded - optional permutation array. If provided, it will be used to permute the matrix.
33+
* @returns a function that takes a right-hand side vector `b` and returns the solution vector `x`, or `null` if the decomposition fails.
3434
*/
3535
export function matrixCholeskySolver(
3636
nonZerosArray: NumberArray[],

src/matrix/matrixClone.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Clone a matrix.
3-
* @param matrix
3+
* @param matrix - input matrix.
44
*/
55
export function matrixClone<ValueType>(matrix: ValueType[][]): ValueType[][] {
66
return matrix.map((row) => row.slice(0));

src/matrix/matrixCreateEmpty.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export interface MatrixCreateEmptyOptions<
3535

3636
/**
3737
* Create a new matrix based on the size of the current one or by using specific dimensions.
38-
* @param options
38+
* @param options - options.
3939
*/
4040
export function matrixCreateEmpty<
4141
ArrayConstructorType extends NumberArrayConstructor = Float64ArrayConstructor,

src/matrix/matrixGetSubMatrix.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ export interface MatrixGetSubMatrixOptions {
3030
/**
3131
* Get a subMatrix from matrix, the function checks if the subMatrix
3232
* lies within the dimensions of the matrix.
33-
* @param matrix - The original matrix from which the subMatrix will be extracted.
34-
* @param options - Options to define the subMatrix boundaries and duplication behavior.
35-
* @returns The subMatrix extracted from the original matrix.
33+
* @param matrix - the original matrix from which the subMatrix will be extracted.
34+
* @param options - options to define the subMatrix boundaries and duplication behavior.
35+
* @returns the subMatrix extracted from the original matrix.
3636
*/
3737
export function matrixGetSubMatrix(
3838
matrix: Float64Array[],

src/matrix/matrixHistogram.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export interface MatrixHistogramOptions {
5656
* Calculates a histogram of defined number of slots.
5757
* @param matrix - matrix [rows][cols].
5858
* @param options - options
59-
* @returns - Result of the histogram.
59+
* @returns result of the histogram.
6060
*/
6161
export function matrixHistogram(
6262
matrix: DoubleMatrix,

src/matrix/matrixMedian.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { matrixToArray } from './matrixToArray.ts';
66

77
/**
88
* Returns the median of the matrix.
9-
* @param matrix
9+
* @param matrix - input matrix.
1010
*/
1111
export function matrixMedian(matrix: DoubleMatrix): number {
1212
return xMedian(matrixToArray(matrix));

src/matrix/matrixNoiseStandardDeviation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { matrixToArray } from './matrixToArray.ts';
88
* Determine noise level using MAD https://en.wikipedia.org/wiki/Median_absolute_deviation
99
* Constant to convert mad to sd calculated using https://www.wolframalpha.com/input?i=sqrt%282%29+inverse+erf%280.5%29
1010
* This assumes a gaussian distribution of the noise.
11-
* @param matrix
12-
* @returns Noise level corresponding to one standard deviation.
11+
* @param matrix - input matrix.
12+
* @returns noise level corresponding to one standard deviation.
1313
*/
1414
export function matrixNoiseStandardDeviation(matrix: DoubleMatrix) {
1515
return xNoiseStandardDeviation(matrixToArray(matrix));

0 commit comments

Comments
 (0)