Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tpoisseau authored and targos committed Jun 10, 2024
1 parent 637598e commit 32bd7d2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/__tests__/matrix/utility.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ describe('utility methods', () => {
matrix.set(0, 0, 10);
let called = 0;

/**
* @this {Matrix}
* @param i
* @param j
*/
function cb(i, j) {
called++;
expect(this).toBeInstanceOf(Matrix);
Expand Down
4 changes: 4 additions & 0 deletions src/inspect.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const indent = ' '.repeat(2);
const indentData = ' '.repeat(4);

/**
* @this {Matrix}
* @returns {string}
*/
export function inspectMatrix() {
return inspectMatrixWithOptions(this);
}
Expand Down
4 changes: 2 additions & 2 deletions src/mathOperations.js
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ export function installMathOperations(AbstractMatrix, Matrix) {
AbstractMatrix.prototype.powS = function powS(value) {
for (let i = 0; i < this.rows; i++) {
for (let j = 0; j < this.columns; j++) {
this.set(i, j, Math.pow(this.get(i, j), value));
this.set(i, j, this.get(i, j) ** value);
}
}
return this;
Expand All @@ -815,7 +815,7 @@ export function installMathOperations(AbstractMatrix, Matrix) {
}
for (let i = 0; i < this.rows; i++) {
for (let j = 0; j < this.columns; j++) {
this.set(i, j, Math.pow(this.get(i, j), matrix.get(i, j)));
this.set(i, j, this.get(i, j) ** matrix.get(i, j));
}
}
return this;
Expand Down
6 changes: 3 additions & 3 deletions src/stat.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export function getScaleByRow(matrix) {
for (let i = 0; i < matrix.rows; i++) {
let sum = 0;
for (let j = 0; j < matrix.columns; j++) {
sum += Math.pow(matrix.get(i, j), 2) / (matrix.columns - 1);
sum += matrix.get(i, j) ** 2 / (matrix.columns - 1);
}
scale.push(Math.sqrt(sum));
}
Expand All @@ -177,7 +177,7 @@ export function getScaleByColumn(matrix) {
for (let j = 0; j < matrix.columns; j++) {
let sum = 0;
for (let i = 0; i < matrix.rows; i++) {
sum += Math.pow(matrix.get(i, j), 2) / (matrix.rows - 1);
sum += matrix.get(i, j) ** 2 / (matrix.rows - 1);
}
scale.push(Math.sqrt(sum));
}
Expand All @@ -197,7 +197,7 @@ export function getScaleAll(matrix) {
let sum = 0;
for (let j = 0; j < matrix.columns; j++) {
for (let i = 0; i < matrix.rows; i++) {
sum += Math.pow(matrix.get(i, j), 2) / divider;
sum += matrix.get(i, j) ** 2 / divider;
}
}
return Math.sqrt(sum);
Expand Down

0 comments on commit 32bd7d2

Please sign in to comment.