我是使用VSCode的Type Script的新手。
circuitgenerator.ts
...
import * as math from 'mathjs';
export class CircuitGenerator {
...
private circuitCurrentVector: math.Matrix;
private circuitVoltageVector: math.Matrix;
private circuitResistanceMatrix: math.Matrix;
...
public setCircuitCurrentVector(resistMatrix: math.Matrix, voltageVektor: math.Matrix): void{
this.circuitCurrentVector = math.matrix();
this.circuitCurrentVector = math.multiply(math.inv(resistMatrix),voltageVektor); //Error here
}
...
但这在main.ts中有效:
...
var c: CircuitGenerator = new CircuitGenerator();
c.generateCircuit(2);
var currentVector = math.multiply(math.inv(c.getCircuitResistanceMatrix()),c.getCircuitVoltageVector());
...
我们将不胜感激任何帮助。