A class that implements vector-scalar addition, inheriting from MLFunction.
More...
#include <functions.h>
|
| | VectorScalarAddition (float *weights, int size) |
| | Constructor that initializes the vector-scalar addition with weights and size.
|
| |
| void | apply (const SelectivityVector &rows, std::vector< VectorPtr > &args, const TypePtr &type, exec::EvalCtx &context, VectorPtr &output) const override |
| | Applies vector-scalar addition to the input array.
|
| |
| float * | getTensor () const override |
| | Returns the tensor associated with this function.
|
| |
| std::string | getFuncName () |
| | Returns the name of the function.
|
| |
|
virtual | ~MLFunction ()=default |
| | Virtual destructor.
|
| |
| virtual std::vector< int > | getDims () |
| | Returns the dimensions of the function.
|
| |
| virtual int | getNumDims () |
| | Returns the number of dimensions of the function.
|
| |
| virtual CostEstimate | getCost (std::vector< int > inputDims) |
| | Estimates the computational cost of applying the function.
|
| |
|
| static std::vector< std::shared_ptr< exec::FunctionSignature > > | signatures () |
| | Returns the function signatures supported by this class.
|
| |
| static std::string | getName () |
| | Static method to return the name of the function.
|
| |
|
| double | getWeightedCost (std::string name, float cost) |
| | Calculates the weighted cost of the function.
|
| |
| std::vector< double > | getCoefficientVector (std::string name) |
| | Retrieves the cost coefficients for the function.
|
| |
|
std::vector< int > | dims |
| | Dimensions of the function.
|
| |
A class that implements vector-scalar addition, inheriting from MLFunction.
This class provides functionality to add a scalar value to each element of a vector.
◆ VectorScalarAddition()
| VectorScalarAddition::VectorScalarAddition |
( |
float * | weights, |
|
|
int | size ) |
|
inline |
Constructor that initializes the vector-scalar addition with weights and size.
- Parameters
-
| weights | A pointer to the scalar values to add. |
| size | The size of the vector. |
◆ apply()
| void VectorScalarAddition::apply |
( |
const SelectivityVector & | rows, |
|
|
std::vector< VectorPtr > & | args, |
|
|
const TypePtr & | type, |
|
|
exec::EvalCtx & | context, |
|
|
VectorPtr & | output ) const |
|
inlineoverride |
Applies vector-scalar addition to the input array.
This method processes the input array, adds the scalar values, and stores the result in the output vector.
- Parameters
-
| rows | A SelectivityVector specifying the rows to process. |
| args | A vector of input arguments (e.g., the input array). |
| type | The type of the output vector. |
| context | The execution context. |
| output | The output vector where the result will be stored. |
◆ getFuncName()
| std::string VectorScalarAddition::getFuncName |
( |
| ) |
|
|
inlinevirtual |
Returns the name of the function.
- Returns
- The name of the function as a string.
Reimplemented from MLFunction.
◆ getName()
| static std::string VectorScalarAddition::getName |
( |
| ) |
|
|
inlinestatic |
Static method to return the name of the function.
- Returns
- The name of the function as a string ("vec_scal_add").
◆ getTensor()
| float * VectorScalarAddition::getTensor |
( |
| ) |
const |
|
inlineoverridevirtual |
Returns the tensor associated with this function.
- Returns
- A pointer to the scalar values.
Implements MLFunction.
◆ signatures()
| static std::vector< std::shared_ptr< exec::FunctionSignature > > VectorScalarAddition::signatures |
( |
| ) |
|
|
inlinestatic |
Returns the function signatures supported by this class.
- Returns
- A vector of shared pointers to FunctionSignature objects.
The documentation for this class was generated from the following file: