Hardware floating-point arrays


DOM_HFARRAY is a multidimensional container type, storing hardware floating-point numbers at integer indices.

Unlike generic arrays, objects of type 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 (DOM_FLOAT) would, but the range of hardware floating-point numbers is much more limited.

Function Calls

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[1], 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.

The function map applies 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.

If A is an hf-array, nops(A) returns the number of elements in A.

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.





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.

Element Creation

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 import::readbitmap.

See Also

MuPAD Domains

MuPAD Functions

Was this topic helpful?