|
Class: FloatArray
Object
|
+--Collection
|
+--SequenceableCollection
|
+--ArrayedCollection
|
+--UninterpretedBytes
|
+--AbstractNumberVector
|
+--FloatArray
- Package:
- stx:libbasic
- Category:
- Collections-Arrayed
- Version:
- rev:
1.44
date: 2017/09/18 08:48:44
- user: sr
- file: FloatArray.st directory: libbasic
- module: stx stc-classLibrary: libbasic
- Author:
- Claus Gittinger
FloatArrays store floats (and nothing else).
They have been added to support heavy duty number crunching and
data exchange with openGL frameworks and other mass data libraries.
See documentation in DoubleArray for more information.
[memory requirements:]
OBJ-HEADER + (size * float-size)
DoubleArray
Array
queries
-
elementByteSize
-
for bit-like containers, return the number of bytes stored per element.
Here, 4 is returned
copying
-
clone
-
return a copy of the receiver
-
copyFrom: start to: stop
-
return a partial copy of the receiver
-
replaceFrom: start to: stop with: aCollection startingAt: replStart
-
|f1 f2|
f1 := (1 to:5) asFloatArray.
f2 := #(10 9 8 7 6) asFloatArray.
f1 replaceFrom:1 to:3 with:f2 startingAt:3
destructive arithmetic support
-
primAbs
-
destructive absolute value of each element
-
primAddArray: floatArray
-
add the vector argument into the receiver (destructive).
The argument must be another vector
-
primAddScalar: aScalar
-
add the scalar argument into the receiver (destructive).
-
primDivArray: floatArray
-
divide the vector argument into the receiver (destructive).
The argument must be another vector
-
primDivScalar: aScalar
-
divide the scalar argument into the receiver (destructive).
-
primMulArray: floatArray
-
multiply the vector argument into the receiver (destructive).
The argument must be another vector
-
primMulScalar: aScalar
-
multiply the scalar argument into the receiver (destructive).
-
primNegated
-
destructive negative value of each element
-
primSubtractArray: floatArray
-
subtract the vector argument from the receiver (destructive).
The argument must be another vector
-
primSubtractScalar: aScalar
-
subtract the scalar argument from the receiver (destructive).
queries
-
defaultElement
-
-
isValidElement: anObject
-
return true, if I can hold this kind of object
-
minMax
-
return a Tuple holding the smallest and largest element;
redefined for speed
-
numFloats
-
vector arithmetic
-
dot: aFloatVector
-
Return the dot product of the receiver and the argument.
Raises an error, if the argument is not of the same size as the receiver.
-
hornerMultiplyAndAdd: x
-
primitive support for horner's-method computation of polynomials.
The vector is interpreted as providing the factors for a polynomial,
an*x^n + (an-1)*x^(n-1) + ... + a2(x) + a1
where the ai are the elements of the Array.
The highest rank factor is at the first position, the 0-rank constant at last.
This is inlined c-code, which may get compiled to fast machine code,
using multiply-and-add or vector instructions, if the CPU/Compiler support them.
|