/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { UltraCalcFunctionTwoMatrixFunction } from "./UltraCalcFunctionTwoMatrixFunction";
import { ExcelCalcValue } from "./ExcelCalcValue";
import { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
import { markType } from "igniteui-angular-core";
/**
 * @hidden
 */
export class UltraCalcFunctionCovar extends UltraCalcFunctionTwoMatrixFunction {
    evaluate(a, b) {
        return UltraCalcFunctionCovar._as(a, b, false);
    }
    static _as(a, b, c) {
        let d;
        let e;
        let f;
        let g = UltraCalcFunctionTwoMatrixFunction._ao(a, d, e, f);
        d = g.p1;
        e = g.p2;
        f = g.p3;
        if (d != null) {
            return new ExcelCalcValue(d);
        }
        let h;
        let i;
        let j;
        let k = UltraCalcFunctionTwoMatrixFunction._ar(e, f, h, i, j);
        h = k.p2;
        i = k.p3;
        j = k.p4;
        if (h == 0 || (h == 1 && c)) {
            return new ExcelCalcValue(new ExcelCalcErrorValue(2));
        }
        let l = i / h;
        let m = j / h;
        let n = UltraCalcFunctionTwoMatrixFunction._am(e, f, (o, p) => (o - l) * (p - m));
        return new ExcelCalcValue(n / (h - (c ? 1 : 0)));
    }
    get_name() {
        return "covar";
    }
    get name() {
        return this.get_name();
    }
}
UltraCalcFunctionCovar.$t = markType(UltraCalcFunctionCovar, 'UltraCalcFunctionCovar', UltraCalcFunctionTwoMatrixFunction.$);
//# sourceMappingURL=UltraCalcFunctionCovar.js.map