(axis1?: number, axis2?: number)
| 322 | get isDiagonal(): boolean { |
| 323 | // Diagonal = every off-diagonal entry is zero (diagonal entries are free). |
| 324 | if (!this.isSquare) return false; |
| 325 | const n = this.shape[0]; |
| 326 | const data = this.data; |
| 327 | const isZero = this.field.isZero.bind(this.field); |
| 328 | for (let i = 0; i < n; i++) |
| 329 | for (let j = 0; j < n; j++) |
| 330 | if (i !== j && !isZero(data[i * n + j])) return false; |
| 331 | return true; |
| 332 | } |
| 333 | |
| 334 | get isIdentity(): boolean { |
| 335 | if (!this.isSquare) return false; |
| 336 | const [_m, n] = this.shape; |
| 337 | const data = this.data; |
| 338 | const isOne = this.field.isOne.bind(this.field); |
| 339 | const isZero = this.field.isZero.bind(this.field); |
| 340 | for (let i = 0; i < n; i++) |
| 341 | for (let j = 0; j < n; j++) |
| 342 | if ( |
| 343 | (i === j && !isOne(data[i * n + j])) || |
| 344 | (i !== j && !isZero(data[i * n + j])) |
| 345 | ) |
| 346 | return false; |
| 347 | return true; |
| 348 | } |
| 349 | |
| 350 | get isZero(): boolean { |
| 351 | const isZero = this.field.isZero.bind(this.field); |
nothing calls this directly
no test coverage detected