public interface

ScalarFunction

es.usc.citius.hipster.model.function.ScalarFunction<T>
Known Indirect Subclasses

Class Overview

A scalar function takes an object and modifies its magnitude by a numeric factor without changing its type.

This interface can be used to do abstract definitions of the scaling operation for algorithms that need it without explicitly defining them inside the algorithms, making them easily replaceable when the cost definition changes.

The definition of scalar functions requires the implementation of the scale(Object, double). Here is an example for the Double scaling operation:
     new ScalarFunction<Double>(){
              Double scale(Double a, double b){
                  return a*b;
              
          }
     }
 
To create a default scalar function to operate with doubles, simple use Product.

Summary

Public Methods
abstract T scale(T a, double b)
Scale operation.

Public Methods

public abstract T scale (T a, double b)

Scale operation.

Parameters
a value to be scaled
b scale factor
Returns
  • a scaled by a factor of b.