1 USING: arrays bit-arrays vectors strings sbufs
2 kernel help.markup help.syntax math ;
5 ARTICLE: "float-arrays" "Float arrays"
6 "Float arrays are fixed-size mutable sequences (" { $link "sequence-protocol" } ") whose elements are instances of " { $link float } ". Elements are unboxed, hence the memory usage is lower than an equivalent " { $link array } " of floats. The literal syntax is covered in " { $link "syntax-float-arrays" } "."
8 "Float array words are in the " { $vocab-link "float-arrays" } " vocabulary."
10 "Float arrays play a special role in the C library interface; they can be used to pass binary data back and forth between Factor and C. See " { $link "c-byte-arrays" } "."
12 "Float arrays form a class of objects."
13 { $subsection float-array }
14 { $subsection float-array? }
15 "There are several ways to construct float arrays."
16 { $subsection >float-array }
17 { $subsection <float-array> }
18 "Creating a float array from several elements on the stack:"
19 { $subsection 1float-array }
20 { $subsection 2float-array }
21 { $subsection 3float-array }
22 { $subsection 4float-array } ;
27 { $description "The class of float arrays. See " { $link "syntax-float-arrays" } " for syntax and " { $link "float-arrays" } " for general information." } ;
29 HELP: <float-array> ( n initial -- float-array )
30 { $values { "n" "a non-negative integer" } { "initial" float } { "float-array" "a new float array" } }
31 { $description "Creates a new float array holding " { $snippet "n" } " floats with the specified initial element." } ;
34 { $values { "seq" "a sequence" } { "float-array" float-array } }
35 { $description "Outputs a freshly-allocated float array whose elements have the same floating-point values as a given sequence." }
36 { $errors "Throws an error if the sequence contains elements other than real numbers." } ;
39 { $values { "x" object } { "array" float-array } }
40 { $description "Create a new float array with one element." } ;
42 { 1array 2array 3array 4array } related-words
45 { $values { "x" object } { "y" object } { "array" float-array } }
46 { $description "Create a new float array with two elements, with " { $snippet "x" } " appearing first." } ;
49 { $values { "x" object } { "y" object } { "z" object } { "array" float-array } }
50 { $description "Create a new float array with three elements, with " { $snippet "x" } " appearing first." } ;
53 { $values { "w" object } { "x" object } { "y" object } { "z" object } { "array" float-array } }
54 { $description "Create a new float array with four elements, with " { $snippet "w" } " appearing first." } ;