On this page:
6.15.1 Flonum Arrays
Fl Array
flarray
array->flarray
flarray-data
flarray-map
inline-flarray-map
flarray+
flarray*
flarray-
flarray/
flarray-min
flarray-max
flarray-scale
flarray-abs
flarray-sqr
flarray-sqrt
6.15.2 Float-Complex Arrays
FCArray
fcarray
array->fcarray
fcarray-real-data
fcarray-imag-data
fcarray-map
inline-fcarray-map
fcarray+
fcarray*
fcarray-
fcarray/
fcarray-scale
fcarray-sqr
fcarray-sqrt
fcarray-conjugate
fcarray-real-part
fcarray-imag-part
fcarray-make-rectangular
fcarray-magnitude
fcarray-angle
fcarray-make-polar

6.15 Subtypes

6.15.1 Flonum Arrays

syntax

FlArray

The type of flonum arrays, a subtype of (Settable-Array Flonum) that stores its elements in an FlVector. A flonum array is always strict.

syntax

(flarray #[#[...] ...])

Like array, but creates flonum arrays. The listed elements must be real numbers, and may be exact.

Examples:

> (flarray 0.0)

- : FlArray

(flarray 0.0)

> (flarray #['x])

Type Checker: Expected Real, but got 'x

  in: #%top-interaction

> (flarray #[#[1 2] #[3 4]])

- : FlArray

(flarray #[#[1.0 2.0] #[3.0 4.0]])

procedure

(array->flarray arr)  FlArray

  arr : (Array Real)
Returns a flonum array that has approximately the same elements as arr. Exact elements will likely lose precision during conversion.

procedure

(flarray-data arr)  FlVector

  arr : FlArray
Returns the elements of arr in a flonum vector, in row-major order.

Example:

> (flarray-data (flarray #[#[1 2] #[3 4]]))

- : FlVector

(flvector 1.0 2.0 3.0 4.0)

procedure

(flarray-map f arrs ...)  FlArray

  f : (Flonum ... -> Flonum)
  arrs : FlArray
Maps the function f over the arrays arrs. If the arrays do not have the same shape, they are broadcast first. If the arrays do have the same shape, this operation can be quite fast.

The function f is meant to accept the same number of arguments as the number of its following flonum array arguments. However, a current limitation in Typed Racket requires f to accept any number of arguments. To map a single-arity function such as fl+, for now, use inline-flarray-map or array-map.

syntax

(inline-flarray-map f arrs ...)

 
  f : (Flonum ... -> Flonum)
  arrs : FlArray
Like inline-array-map, but for flonum arrays.

This is currently unavailable in untyped Racket.

procedure

(flarray+ arr0 arr1)  FlArray

  arr0 : FlArray
  arr1 : FlArray

procedure

(flarray* arr0 arr1)  FlArray

  arr0 : FlArray
  arr1 : FlArray

procedure

(flarray- arr)  FlArray

  arr : FlArray
(flarray- arr0 arr1)  FlArray
  arr0 : FlArray
  arr1 : FlArray

procedure

(flarray/ arr)  FlArray

  arr : FlArray
(flarray/ arr0 arr1)  FlArray
  arr0 : FlArray
  arr1 : FlArray

procedure

(flarray-min arr0 arr1)  FlArray

  arr0 : FlArray
  arr1 : FlArray

procedure

(flarray-max arr0 arr1)  FlArray

  arr0 : FlArray
  arr1 : FlArray

procedure

(flarray-scale arr x)  FlArray

  arr : FlArray
  x : Flonum

procedure

(flarray-abs arr)  FlArray

  arr : FlArray

procedure

(flarray-sqr arr)  FlArray

  arr : FlArray

procedure

(flarray-sqrt arr)  FlArray

  arr : FlArray
Arithmetic lifted to flonum arrays.

6.15.2 Float-Complex Arrays

syntax

FCArray

The type of float-complex arrays, a subtype of (Settable-Array Float-Complex) that stores its elements in a pair of FlVectors. A float-complex array is always strict.

syntax

(fcarray #[#[...] ...])

Like array, but creates float-complex arrays. The listed elements must be numbers, and may be exact.

Examples:

> (fcarray 0.0)

- : FCArray

(fcarray 0.0+0.0i)

> (fcarray #['x])

Type Checker: Expected Number, but got 'x

  in: #%top-interaction

> (fcarray #[#[1 2+1i] #[3 4+3i]])

- : FCArray

(fcarray #[#[1.0+0.0i 2.0+1.0i] #[3.0+0.0i 4.0+3.0i]])

procedure

(array->fcarray arr)  FCArray

  arr : (Array Number)
Returns a float-complex array that has approximately the same elements as arr. Exact elements will likely lose precision during conversion.

procedure

(fcarray-real-data arr)  FlVector

  arr : FCArray

procedure

(fcarray-imag-data arr)  FlVector

  arr : FCArray
Return the real and imaginary parts of arr’s elements in flonum vectors, in row-major order.

Examples:

> (define arr (fcarray #[#[1 2+1i] #[3 4+3i]]))
> (fcarray-real-data arr)

- : FlVector

(flvector 1.0 2.0 3.0 4.0)

> (fcarray-imag-data arr)

- : FlVector

(flvector 0.0 1.0 0.0 3.0)

procedure

(fcarray-map f arrs ...)  FCArray

  f : (Float-Complex ... -> Float-Complex)
  arrs : FCArray
Maps the function f over the arrays arrs. If the arrays do not have the same shape, they are broadcast first. If the arrays do have the same shape, this operation can be quite fast.

The function f is meant to accept the same number of arguments as the number of its following float-complex array arguments. However, a current limitation in Typed Racket requires f to accept any number of arguments. To map a single-arity function, for now, use inline-fcarray-map or array-map.

syntax

(inline-fcarray-map f arrs ...)

 
  f : (Float-Complex ... -> Float-Complex)
  arrs : FCArray
Like inline-array-map, but for float-complex arrays.

This is currently unavailable in untyped Racket.

procedure

(fcarray+ arr0 arr1)  FCArray

  arr0 : FCArray
  arr1 : FCArray

procedure

(fcarray* arr0 arr1)  FCArray

  arr0 : FCArray
  arr1 : FCArray

procedure

(fcarray- arr)  FCArray

  arr : FCArray
(fcarray- arr0 arr1)  FCArray
  arr0 : FCArray
  arr1 : FCArray

procedure

(fcarray/ arr)  FCArray

  arr : FCArray
(fcarray/ arr0 arr1)  FCArray
  arr0 : FCArray
  arr1 : FCArray

procedure

(fcarray-scale arr z)  FCArray

  arr : FCArray
  z : Float-Complex

procedure

(fcarray-sqr arr)  FCArray

  arr : FCArray

procedure

(fcarray-sqrt arr)  FCArray

  arr : FCArray

procedure

(fcarray-conjugate arr)  FCArray

  arr : FCArray
Arithmetic lifted to float-complex arrays.

procedure

(fcarray-real-part arr)  FlArray

  arr : FCArray

procedure

(fcarray-imag-part arr)  FlArray

  arr : FCArray

procedure

(fcarray-make-rectangular arr0 arr1)  FCArray

  arr0 : FlArray
  arr1 : FlArray

procedure

(fcarray-magnitude arr)  FlArray

  arr : FCArray

procedure

(fcarray-angle arr)  FlArray

  arr : FCArray

procedure

(fcarray-make-polar arr0 arr1)  FCArray

  arr0 : FlArray
  arr1 : FlArray
Conversions to and from complex numbers, lifted to flonum and float-complex arrays.