All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jscl.math.operator.matrix.Trace Maven / Gradle / Ivy

There is a newer version: 2.4.17
Show newest version
package jscl.math.operator.matrix;

import jscl.math.Generic;
import jscl.math.Matrix;
import jscl.math.Variable;
import jscl.math.operator.Operator;

public class Trace extends Operator {
    public Trace(Generic matrix) {
        super("trace",new Generic[] {matrix});
    }

    public Generic compute() {
        if(parameter[0] instanceof Matrix) {
            Matrix matrix=(Matrix)parameter[0];
            return matrix.trace();
        }
        return expressionValue();
    }

    protected Variable newinstance() {
        return new Trace(null);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy