Skip to content

Commit

Permalink
Fix optional argument for norm()
Browse files Browse the repository at this point in the history
  • Loading branch information
rotu committed Sep 1, 2023
1 parent bb02eb3 commit c0cfbf1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion matrix.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ export abstract class AbstractMatrix {
* Returns the norm of a matrix.
* @param type - Norm type. Default: `'frobenius'`.
*/
norm(type: 'frobenius' | 'max'): number;
norm(type?: 'frobenius' | 'max'): number;

/**
* Computes the cumulative sum of the matrix elements (in place, row by row).
Expand Down
3 changes: 2 additions & 1 deletion src/matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,8 @@ export class AbstractMatrix {
return diag;
}

norm(type = 'frobenius') {
norm(type) {
if (type === undefined) type = 'frobenius';
let result = 0;
if (type === 'max') {
return this.max();
Expand Down

0 comments on commit c0cfbf1

Please sign in to comment.