// Copyright (C) 1999 Jean-Marc Valin #include "BufferedNode.h" #include "Buffer.h" #include "Vector.h" #include #include "fmath.h" using namespace std; namespace FD { class Exp; DECLARE_NODE(Exp) /*Node * * @name Exp * @category DSP:Base * @description Computes the exponential (base-e) of a vector * * @input_name INPUT * @input_type Vector * @input_description The input of the exponential * * @output_name OUTPUT * @output_type Vector * @output_description Result of the exponential * * @parameter_name FAST * @parameter_type bool * @parameter_description Should we use exponential approximation * END*/ class Exp : public BufferedNode { int inputID; int outputID; bool fast_exp; public: Exp(string nodeName, ParameterSet params) : BufferedNode(nodeName, params) { inputID = addInput("INPUT"); outputID = addOutput("OUTPUT"); if (parameters.exist("FAST")) fast_exp = dereference_cast (parameters.get("FAST")); else fast_exp = false; } void calculate(int output_id, int count, Buffer &out) { ObjectRef inputValue = getInput(inputID, count); const Vector &in = object_cast > (inputValue); int inputLength = in.size(); Vector &output = *Vector::alloc(inputLength); out[count] = &output; if (fast_exp) for (int i=0;i