diff --git a/src/ts/impl/tensor.ts b/src/ts/impl/tensor.ts index 6e48979e..06bc11df 100644 --- a/src/ts/impl/tensor.ts +++ b/src/ts/impl/tensor.ts @@ -39,7 +39,8 @@ export default class Tensor { add(tensor: Tensor): Tensor { this.matrix = this.matrix.map((v, i) => v * this.r + tensor.matrix[i] * tensor.r); - this.r = 2; + this.r = Math.hypot(...this.matrix); + this.matrix = this.matrix.map(v => v / this.r); this.oldTheta = true; return this; }