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

update2 #258

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@
},
"homepage": "https://github.com/mljs/spectra-processing#readme",
"devDependencies": {
"@vitest/coverage-v8": "^2.0.5",
"@vitest/coverage-v8": "^2.1.1",
"cheminfo-build": "^1.2.0",
"eslint": "^8.57.0",
"eslint-config-cheminfo-typescript": "^15.0.0",
"eslint-config-cheminfo-typescript": "^15.0.1",
"jest-matcher-deep-close-to": "^3.0.2",
"jscpd": "^4.0.5",
"ml-spectra-fitting": "^4.2.3",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"spectrum-generator": "^8.0.11",
"typescript": "^5.5.4",
"vitest": "^2.0.5"
"typescript": "^5.6.2",
"vitest": "^2.1.1"
},
"dependencies": {
"binary-search": "^1.3.6",
Expand Down
2 changes: 1 addition & 1 deletion src/matrix/matrixAbsoluteMedian.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { DoubleMatrix } from '../types';
import { xMedian } from '../x';

/**

Check warning on line 4 in src/matrix/matrixAbsoluteMedian.ts

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc @returns declaration
* Returns the median of the absolute matrix.
* @param matrix

Check warning on line 6 in src/matrix/matrixAbsoluteMedian.ts

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Missing JSDoc @param "matrix" description
*/
export function matrixAbsoluteMedian(matrix: DoubleMatrix): number {
const nbColumns = matrix[0].length;
Expand All @@ -12,7 +12,7 @@
const currentRow = row * nbColumns;
for (let column = 0; column < nbColumns; column++) {
const value = matrix[row][column];
flatten[currentRow + column] = value < 0 ? -value : value;
flatten[currentRow + column] = Math.abs(value);
}
}
return xMedian(flatten);
Expand Down
3 changes: 1 addition & 2 deletions src/matrix/matrixMaxAbsoluteZ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ export function matrixMaxAbsoluteZ(matrix: NumberArray[]): number {

for (let column = 0; column < nbColumns; column++) {
for (let row = 0; row < nbRows; row++) {
let value = matrix[row][column];
if (value < 0) value *= -1;
const value = Math.abs(matrix[row][column]);
if (value > max) max = value;
}
}
Expand Down
6 changes: 1 addition & 5 deletions src/x/xAbsoluteSum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ export function xAbsoluteSum(

let sum = 0;
for (let i = fromIndex; i <= toIndex; i++) {
if (array[i] < 0) {
sum -= array[i];
} else {
sum += array[i];
}
sum += Math.abs(array[i]);
}

return sum;
Expand Down
1 change: 1 addition & 0 deletions src/x/xAdd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { isAnyArray } from 'is-any-array';
* This function xAdd the first array by the second array or a constant value to each element of the first array
* @param array1 - the first array
* @param array2 - the second array or number
* @returns the result of the addition
*/
export function xAdd(
array1: NumberArray,
Expand Down
1 change: 1 addition & 0 deletions src/xyObject/xyObjectMaxYPoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { xyObjectCheck } from './xyObjectCheck';
/**
* Finds the max y value and return a {x,y,index} point
* @param points - Object that contains property x (an ordered increasing array) and y (an array)
* @returns max point
*/
export function xyObjectMaxYPoint(points: Point[] = []): Point {
xyObjectCheck(points);
Expand Down
Loading