#include "eval_mul.h"

tensor eval_mul::compute(const tensor &a, const tensor &b) {
    // these use our tensor operator* overload
    tensor c = a * b; 
    return c;
}

void eval_mul::eval(vars_type &variables, const kwargs_type &kwargs) {
    assert(inputs_.size() == 2);
    auto ita = variables.find(inputs_[0]);
    auto itb = variables.find(inputs_[1]);
    // handle errors for ita and itb
    // we handle these in the operator* override instead of here
    variables[expr_id_] = compute(ita->second,itb->second);
}

std::shared_ptr<eval_op> eval_mul::clone(const expression &expr) {
    return std::make_shared<eval_mul>(expr);
}