Example #1
0
def array_operation(array_a, array_b, calc):
    a = np.asarray(Common.from_json(array_a))
    b = np.asarray(Common.from_json(array_b))
    if calc == "add":
        return str(a + b)
    elif calc == "sub":
        return str(a - b)
    elif calc == "mul":
        return str(a * b)
    elif calc == "div":
        return str(a / b)
    else:
        return str(a.dot(b))
Example #2
0
def numpy_inverse():
    if request.method == "POST":
        coef = request.form["coefficients"]
        coefficients = Common.from_json(coef)
        return render_template("numpy_array_inverse.html",
                               result=numpy_module.array_inverse(coefficients),
                               coef=coef)
    else:
        return render_template("numpy_array_inverse.html", result="", coef="")
Example #3
0
def api_numpy_function():
    kind = request.args.get("kind")
    xdata = Common.from_json("[" + request.args.get("xdata") + "]")
    result = numpy_module.numpy_function(kind, xdata)
    return jsonify(result)