Create identity matrix with fixed-point properties
I = eye('like',
returns
the scalar 1 with the same fixed-point properties and complexity (real
or complex) as the prototype argument, p
)p
. The
output, I
, contains the same numerictype
and fimath
properties as p
.
Using the b = cast(a,'like',p)
syntax to
specify data types separately from algorithm code allows you to:
Reuse your algorithm code with different data types.
Keep your algorithm uncluttered with data type specifications and switch statements for different data types.
Improve readability of your algorithm code.
Switch between fixed-point and floating-point data types to compare baselines.
Switch between variations of fixed-point settings without changing the algorithm code.