/*
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 { __extends } from "tslib";
import { UltraCalcFunctionTwoMatrixFunction } from "./UltraCalcFunctionTwoMatrixFunction";
import { ExcelCalcValue } from "./ExcelCalcValue";
import { ExcelCalcErrorValue } from "./ExcelCalcErrorValue";
import { markType } from "igniteui-angular-core";
/**
 * @hidden
 */
var UltraCalcFunctionCovar = /** @class */ /*@__PURE__*/ (function (_super) {
    __extends(UltraCalcFunctionCovar, _super);
    function UltraCalcFunctionCovar() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    UltraCalcFunctionCovar.prototype.evaluate = function (a, b) {
        return UltraCalcFunctionCovar._as(a, b, false);
    };
    UltraCalcFunctionCovar._as = function (a, b, c) {
        var d;
        var e;
        var f;
        var g = UltraCalcFunctionTwoMatrixFunction._ao(a, d, e, f);
        d = g.p1;
        e = g.p2;
        f = g.p3;
        if (d != null) {
            return new ExcelCalcValue(d);
        }
        var h;
        var i;
        var j;
        var 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));
        }
        var l = i / h;
        var m = j / h;
        var n = UltraCalcFunctionTwoMatrixFunction._am(e, f, function (o, p) { return (o - l) * (p - m); });
        return new ExcelCalcValue(n / (h - (c ? 1 : 0)));
    };
    UltraCalcFunctionCovar.prototype.get_name = function () {
        return "covar";
    };
    Object.defineProperty(UltraCalcFunctionCovar.prototype, "name", {
        get: function () {
            return this.get_name();
        },
        enumerable: false,
        configurable: true
    });
    UltraCalcFunctionCovar.$t = markType(UltraCalcFunctionCovar, 'UltraCalcFunctionCovar', UltraCalcFunctionTwoMatrixFunction.$);
    return UltraCalcFunctionCovar;
}(UltraCalcFunctionTwoMatrixFunction));
export { UltraCalcFunctionCovar };
