Hardware floating-point arrays
MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
DOM_HFARRAY is a multidimensional container
type, storing hardware floating-point numbers at integer indices.
Unlike generic arrays, objects
DOM_HFARRAY are containers of hardware
floating-point numbers, real or complex. They take up considerably
less space than the corresponding arrays of software floats (
would, but the range of hardware floating-point numbers is much more
Using an hf-array as the symbol of a function call returns that hf-array unchanged. The arguments of the call are not evaluated.
Read and write access to an hf-array is performed using indexed
access, as in
A, which automatically converts
between hardware and software floats. Trying to write a value which
cannot be converted into a hardware float into an hf-array causes
an error to be raised, as does accessing an element out of bounds.
some function or transformation to each element of an hf-array, returning
an hf-array of the same format as its input, with the results of the
calls as its entries. If a result cannot be converted to a hardware
float, an error is raised.
A is an hf-array,
the number of elements in
Basic arithmetic works on hf-arrays: Addition and subtraction of hf-arrays of identical format combines the containers element-wise, addition and subtraction of constants is applied to the main diagonal. For two-dimensional hf-arrays, multiplication performs matrix multiplication. Division is possible for completeness, but should be avoided, as it numerically inverts the dividend first, and this is hardly ever the algorithmically “right” way to handle a numerical problem.
A is an hf-array, the 0th
op(A, 0), will
be the sequence starting with the number of dimensions (an integer n)
followed by n ranges
of integers, which denote the acceptable ranges of indices for each
dimension, including both numbers listed in the range.
For 1 ≤ i ≤ nops(A),
A is the ith
A, in the lexicographic order of indices.
One-dimensional hf-arrays are displayed as row vectors, two-dimensional hf-arrays as matrices. Higher-dimensional hf-arrays are written in functional form, writing the entries as a flat list, and do not have a typesetting version. This also causes typesetting to be disabled for any surrounding expression in the same output.
The primary way of creating hf-arrays is the function
hfarray. Other important
functions (optionally) returning hardware float arrays include several
functions of the
numeric library and