Linear extension of a function