The function composition(TF1,TF2)
returns a TransferFunction
that is
TF1
followed by TF2
.
Four equivalent infix operators are also available.
# S3 method for TransferFunction
composition( TF1, TF2 )# S3 method for TransferFunction
*( TF1, TF2 )
# S3 method for TransferFunction
%;%( TF1, TF2 )
# S3 method for TransferFunction
%X%( TF1, TF2 )
# S3 method for TransferFunction
%O%( TF2, TF1 )
identity.TF
# S3 method for TransferFunction
is.identity( TF )
composition(TF1,TF2)
returns a TransferFunction
object,
which applies TF1
followed by TF2
.
The individual objects TF1
and TF2
are stored inside the returned object.
In case of ERROR it returns NULL
.
The 4 infix operators above all invoke composition()
.
identity.TF
is a built-in global TransferFunction
object which is a
universal identity for composition.
This means that for any TransferFunction
TF
,
TF*identity.TF = identity.TF*TF = TF
.
Moreover, TF*TF^-1 = TF^1*TF = identity.TF
.
This is *not* the same as base::identity()
.
is.identity(TF)
tests whether TF
is the universal identity,
and returns TRUE
or FALSE
.
a TransferFunction
object
a TransferFunction
object
a TransferFunction
object
In order to be composed, the dimensions of TF1
and TF2
must be equal,
or the dimension of one of them must be 1.
In the latter case, the function is applied to each coordinate in exactly the same way.
All the above represent the function TF1
followed by TF2
.
In mathematics this operation is usually called composition of functions
(and composition of morphisms in category theory),
and in computer science and BT.2100 and BT.2390 it is called the concatenation.
In BT.2390 it is also called the cascade.
The ACES literature uses infix notation with the symbol '+'
which is unfortunate because in mathematics
the plus symbol is only used for commutative operations, which composition certainly is not.
The symbol '*'
is offered here as an alternative,
since '*'
does not imply commutativity (e.g. as in MATLAB's matrix multiplication).
In computer science the symbol ';'
is common, and so %;%
is offered as an alternative.
In BT.2100 and BT.2390 the symbol ⊗ is used, and so %X%
is offered as an alternative.
And finally, in mathematics ○ is used but in the opposite order,
so that TF2 %O% TF1
is identical to composition(TF1,TF2)
.
Each TransferFunction
object is actually a list of so-called elementary transfer functions.
If TF1
has \(M_1\) elementary functions and TF2
has \(M_2\) elementary functions,
then composition(TF1,TF2)
has \(\le M_1 + M_2\) elementary functions.
It can be strictly less if there is cancellation of elementary functions at the end of TF1
and the beginning of TF2
.
Technical Bulletin. TB-2018-002. ACES Output Transform Details. June 2018 (draft).
ACES Retrospective and Enhancements March 2017.
BT.2100. Image parameter values for high dynamic range television for use in production and international programme exchange. June 2017.
BT.2390. High dynamic range television for production and international programme exchange. April 2018.
TransferFunction
,
transfer()
,
inverse()
comp = power.OOTF(2.2) * power.OOTF(1.4)
x = 0:100 / 100
max( abs( transfer(comp,x) - transfer(power.OOTF(2.2*1.4),x) ) ) # 1.110223e-16
comp * comp^-1
## This is a universal identity TransferFunction.
is.identity(comp * comp^-1) # TRUE
identical( comp * identity.TF, comp ) # TRUE
Run the code above in your browser using DataLab