Vector to scalar measures: private API

Summary statistics

Some estimators and constraints reduce a vector to one number. A field of type Num_VecToScaM can hold a fixed number, a VectorToScalarMeasure, or a function that does the reduction.

PortfolioOptimisers.Num_VecToScaM — Type
const Num_VecToScaM = Union{<:Number, <:VectorToScalarMeasure, <:Function}

Union type representing a numeric value, a VectorToScalarMeasure, or a Function.

This type lets functions and fields accept all three, so a caller can give a fixed number, an object that implements the VectorToScalarMeasure interface, or a plain reduction function. vec_to_real_measure returns a Number unchanged, dispatches a VectorToScalarMeasure to its reduction, and applies a Function to the vector.

Related

source