eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'FloatArray':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: FloatArray


Inheritance:

   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

Description:


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)


Related information:

    DoubleArray
    Array

Class protocol:

queries
o  elementByteSize
for bit-like containers, return the number of bytes stored per element.
Here, 4 is returned


Instance protocol:

copying
o  clone
return a copy of the receiver

o  copyFrom: start to: stop
return a partial copy of the receiver

o  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
o  primAbs
destructive absolute value of each element

o  primAddArray: floatArray
add the vector argument into the receiver (destructive).
The argument must be another vector

o  primAddScalar: aScalar
add the scalar argument into the receiver (destructive).

o  primDivArray: floatArray
divide the vector argument into the receiver (destructive).
The argument must be another vector

o  primDivScalar: aScalar
divide the scalar argument into the receiver (destructive).

o  primMulArray: floatArray
multiply the vector argument into the receiver (destructive).
The argument must be another vector

o  primMulScalar: aScalar
multiply the scalar argument into the receiver (destructive).

o  primNegated
destructive negative value of each element

o  primSubtractArray: floatArray
subtract the vector argument from the receiver (destructive).
The argument must be another vector

o  primSubtractScalar: aScalar
subtract the scalar argument from the receiver (destructive).

queries
o  defaultElement

o  isValidElement: anObject
return true, if I can hold this kind of object

o  minMax
return a Tuple holding the smallest and largest element;
redefined for speed

o  numFloats

vector arithmetic
o  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.

o  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.



ST/X 7.1.0.0; WebServer 1.663 at exept.de:8081; Fri, 22 Mar 2019 10:19:40 GMT