FloatArray.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 20:55:17 +0200
changeset 24417 03b083548da2
parent 24333 e6d6a165972d
child 24436 e4f6ee192c0c
permissions -rw-r--r--
#REFACTORING by exept class: Smalltalk class changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels: Transcript showCR:(... bindWith:...) -> Transcript showCR:... with:...
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22257
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
     1
"{ Encoding: utf8 }"
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
     2
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     3
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
 COPYRIGHT (c) 1993 by Claus Gittinger
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
     5
              All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    13
"
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    14
"{ Package: 'stx:libbasic' }"
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    15
18577
72ff8078cb76 class: FloatArray
Stefan Vogel <sv@exept.de>
parents: 17198
diff changeset
    16
"{ NameSpace: Smalltalk }"
72ff8078cb76 class: FloatArray
Stefan Vogel <sv@exept.de>
parents: 17198
diff changeset
    17
23806
c2dcab4ec688 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23798
diff changeset
    18
UnboxedFloatArray variableFloatSubclass:#FloatArray
21081
7c7d1c059ce9 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20313
diff changeset
    19
	instanceVariableNames:''
7c7d1c059ce9 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20313
diff changeset
    20
	classVariableNames:''
7c7d1c059ce9 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20313
diff changeset
    21
	poolDictionaries:''
7c7d1c059ce9 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20313
diff changeset
    22
	category:'Collections-Arrayed'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    23
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    24
88
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    25
!FloatArray class methodsFor:'documentation'!
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    26
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    27
copyright
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    28
"
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    29
 COPYRIGHT (c) 1993 by Claus Gittinger
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
    30
              All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    31
88
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    32
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    33
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    35
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    36
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    37
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    38
"
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    39
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    40
88
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    41
documentation
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    42
"
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    43
    FloatArrays store floats (and nothing else).
16638
45cb03e85f6a class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 15935
diff changeset
    44
    They have been added to support heavy duty number crunching and
19003
6ac2cb393fd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18577
diff changeset
    45
    data exchange with openGL frameworks and other mass data libraries.
88
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    46
    See documentation in DoubleArray for more information.
1263
92c1db6b0776 commentary
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
    47
4062
4959de96b06f documentation
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
    48
    [memory requirements:]
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
    49
        OBJ-HEADER + (size * float-size)
4062
4959de96b06f documentation
Claus Gittinger <cg@exept.de>
parents: 1290
diff changeset
    50
1263
92c1db6b0776 commentary
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
    51
    [See also:]
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
    52
        DoubleArray Array
1290
15ba3221b89b documentation
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
    53
15ba3221b89b documentation
Claus Gittinger <cg@exept.de>
parents: 1263
diff changeset
    54
    [author:]
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
    55
        Claus Gittinger
88
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
    56
"
628
7aa563e4c64a version at the end
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
    57
! !
7aa563e4c64a version at the end
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
    58
13707
a8f395adfac2 faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents: 12577
diff changeset
    59
!FloatArray class methodsFor:'queries'!
a8f395adfac2 faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents: 12577
diff changeset
    60
a8f395adfac2 faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents: 12577
diff changeset
    61
elementByteSize
16849
c20bd756c33b class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16638
diff changeset
    62
    "for bit-like containers, return the number of bytes stored per element.
c20bd756c33b class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16638
diff changeset
    63
     Here, 4 is returned"
c20bd756c33b class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16638
diff changeset
    64
13707
a8f395adfac2 faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents: 12577
diff changeset
    65
    ^ 4
a8f395adfac2 faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents: 12577
diff changeset
    66
a8f395adfac2 faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents: 12577
diff changeset
    67
    "Created: / 15-09-2011 / 14:12:39 / cg"
a8f395adfac2 faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents: 12577
diff changeset
    68
! !
a8f395adfac2 faster elementByteSize query
Claus Gittinger <cg@exept.de>
parents: 12577
diff changeset
    69
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    70
!FloatArray methodsFor:'copying'!
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    71
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    72
clone
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    73
    "return a copy of the receiver"
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    74
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    75
    |newArr|
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    76
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    77
    newArr := self class new:(self size).
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    78
%{
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 7220
diff changeset
    79
    if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
    80
        INT _sz = __floatArraySize(self);
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    81
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
    82
        bcopy(__FloatArrayInstPtr(self)->f_element,
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
    83
              __FloatArrayInstPtr(newArr)->f_element,
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
    84
              sizeof(float) * _sz);
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    85
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
    86
        RETURN (newArr);
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    87
    }
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    88
%}.
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    89
    newArr replaceFrom:1 to:self size with:self startingAt:1.
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    90
    ^ newArr
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    91
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    92
    "
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    93
     |f1 f2|
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    94
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    95
     f1 := FloatArray withAll:#(1 2 3 4 5).
14692
98e7a51e5d17 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 13826
diff changeset
    96
     f1 clone
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    97
    "
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    98
!
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
    99
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   100
copyFrom:start to:stop
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   101
    "return a partial copy of the receiver"
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   102
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   103
%{
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 7220
diff changeset
   104
    if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   105
        if (__bothSmallInteger(start, stop)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   106
            INT __start = __intVal(start) - 1;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   107
            INT __stop = __intVal(stop) - 1 ;
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   108
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   109
            if (__stop >= __start) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   110
                INT __sz = __floatArraySize(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   111
                // printf("o_size=%d floatArraySize=%d\n", __qSize(self), __sz);
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   112
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   113
                if (((unsigned INT)__start < __sz)
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   114
                 && ((unsigned INT)__stop < __sz)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   115
                    INT __n = __stop - __start + 1;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   116
                    OBJ __nObj;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   117
                    int nBytes;
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   118
22263
13169b366d63 #BUGFIX by sr
sr
parents: 22257
diff changeset
   119
                    // here we need to differ 32bit and 64bit
13169b366d63 #BUGFIX by sr
sr
parents: 22257
diff changeset
   120
                    // because on 32bit machines we need to take care about the alignment
13169b366d63 #BUGFIX by sr
sr
parents: 22257
diff changeset
   121
                    // but sadly, the same code is wrong for 64bit machines
13169b366d63 #BUGFIX by sr
sr
parents: 22257
diff changeset
   122
                    if (__POINTER_SIZE__ == 8) {
13169b366d63 #BUGFIX by sr
sr
parents: 22257
diff changeset
   123
                        nBytes = OHDR_SIZE + (__n * sizeof(float));
13169b366d63 #BUGFIX by sr
sr
parents: 22257
diff changeset
   124
                    } else {
13169b366d63 #BUGFIX by sr
sr
parents: 22257
diff changeset
   125
                        nBytes = sizeof(struct __FloatArray) + (__n - 1) * sizeof(float);
13169b366d63 #BUGFIX by sr
sr
parents: 22257
diff changeset
   126
                    }
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20300
diff changeset
   127
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   128
                    // printf("__n=%d nBytes=%d\n", __n, nBytes);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   129
                    __nObj = __STX___new(nBytes);
22257
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
   130
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   131
                    if (__nObj != nil) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   132
                        __objPtr(__nObj)->o_class = __qClass(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   133
                        __STORE(__nObj, __qClass(self));
22257
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
   134
                        // bcopy is marked as deprecated
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
   135
                        // bcopy(
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
   136
                        //     __FloatArrayInstPtr(self)->f_element,   
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
   137
                        //     __FloatArrayInstPtr(__nObj)->f_element + __start,  
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
   138
                        //     __n * sizeof(float));
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
   139
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
   140
                        memcpy(
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
   141
                            __FloatArrayInstPtr(__nObj)->f_element + __start,
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
   142
                            __FloatArrayInstPtr(self)->f_element,
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
   143
                            __n * sizeof(float));
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
   144
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   145
                        RETURN(__nObj);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   146
                    }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   147
                }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   148
            }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   149
        }
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   150
    }
14692
98e7a51e5d17 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 13826
diff changeset
   151
%}.
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   152
    ^ super copyFrom:start to:stop
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   153
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   154
    "
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   155
     |f1 f2|
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   156
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   157
     f1 := FloatArray withAll:#(1 2 3 4 5 6).
22257
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
   158
     f2 := f1 copyFrom:1 to:3.
9ce7e373cf91 #BUGFIX by sr
sr
parents: 21081
diff changeset
   159
     f2                      
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   160
    "
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   161
!
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   162
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   163
replaceFrom:start to:stop with:aCollection startingAt:replStart
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   164
%{
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 7220
diff changeset
   165
    if ((__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0))
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   166
         && __isFloats(aCollection)
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   167
         && (__ClassInstPtr(__qClass(aCollection))->c_ninstvars == __mkSmallInteger(0))
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   168
         && __bothSmallInteger(start, stop)
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   169
         && __isSmallInteger(replStart)
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   170
         && !__isImmutable(self)
18577
72ff8078cb76 class: FloatArray
Stefan Vogel <sv@exept.de>
parents: 17198
diff changeset
   171
    ) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   172
        INT __start = __intVal(start) - 1;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   173
        INT __stop = __intVal(stop) - 1 ;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   174
        INT __replStart = __intVal(replStart) - 1 ;
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   175
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   176
        if (__stop >= __start) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   177
            INT __sz = __floatArraySize(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   178
            INT __otherSz = __floatArraySize(aCollection);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   179
            INT __replStop = __replStart + (__stop-__start);
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   180
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   181
            if (((unsigned INT)__start < __sz)
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   182
             && ((unsigned INT)__stop < __sz)
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   183
             && ((unsigned INT)__replStart < __otherSz)
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   184
             && ((unsigned INT)__replStop < __otherSz)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   185
                INT __n = __stop - __start + 1;
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   186
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   187
                if (aCollection == self) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   188
                    memmove(&(__FloatArrayInstPtr(self)->f_element[__start]),
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   189
                            &(__FloatArrayInstPtr(aCollection)->f_element[__replStart]),
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   190
                            sizeof(float) * __n);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   191
                } else {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   192
                    memcpy(&(__FloatArrayInstPtr(self)->f_element[__start]),
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   193
                           &(__FloatArrayInstPtr(aCollection)->f_element[__replStart]),
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   194
                           sizeof(float) * __n);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   195
                }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   196
                RETURN(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   197
            }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   198
        }
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   199
    }
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   200
%}.
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   201
    "/ arrive here only in case of an error
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   202
    self isImmutable ifTrue:[
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   203
        self noModificationError
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   204
    ].    
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   205
    ^ super replaceFrom:start to:stop with:aCollection startingAt:replStart
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   206
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   207
    "
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   208
     |f1 f2|
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   209
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   210
     f1 := (1 to:5) asFloatArray.
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   211
     f2 := #(10 9 8 7 6) asFloatArray.
14692
98e7a51e5d17 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 13826
diff changeset
   212
     f1 replaceFrom:1 to:3 with:f2 startingAt:3
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   213
    "
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   214
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   215
    "Modified: / 09-06-2019 / 15:33:14 / Claus Gittinger"
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   216
! !
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   217
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   218
!FloatArray methodsFor:'destructive arithmetic support'!
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   219
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   220
primAbs
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   221
    "destructive absolute value of each element;
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   222
     does not check for immutability: only use internally after cloning"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   223
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   224
%{
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   225
    if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   226
        INT _sz = __floatArraySize(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   227
        INT i;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   228
        float *_p = __FloatArrayInstPtr(self)->f_element;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   229
        float prev_p;
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   230
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   231
        if (_sz > 0) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   232
            /* how about inline-mmx-asm for this ... */
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   233
            prev_p = _p[0];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   234
            for (i=1; i<_sz; i++) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   235
                float next_p = _p[i];
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   236
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   237
                if (prev_p < 0) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   238
                    _p[i-1] = -prev_p;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   239
                }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   240
                prev_p = next_p;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   241
            }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   242
            if (prev_p < 0) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   243
                _p[i-1] = -prev_p;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   244
            }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   245
        }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   246
        RETURN (self);
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   247
    }
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   248
%}.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   249
    super primAbs
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   250
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   251
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   252
     |f|
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   253
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   254
     f := FloatArray withAll:#(-1 2 -3 4 -5).
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   255
     f abs.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   256
     f
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   257
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   258
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   259
    "Created: / 30-05-2007 / 17:50:17 / cg"
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   260
    "Modified (comment): / 09-06-2019 / 15:34:21 / Claus Gittinger"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   261
!
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   262
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   263
primAddArray: floatArray
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   264
    "add the vector argument into the receiver (destructive).
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   265
     The argument must be another vector.
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   266
     does not check for immutability: only use internally after cloning"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   267
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   268
%{
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   269
    if ((__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0))
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   270
     && __isFloats(floatArray)
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   271
     && (__ClassInstPtr(__qClass(floatArray))->c_ninstvars == __mkSmallInteger(0))) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   272
        INT _sz1 = __floatArraySize(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   273
        INT _sz2 = __floatArraySize(floatArray);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   274
        INT i;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   275
        float *_p1 = __FloatArrayInstPtr(self)->f_element;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   276
        float *_p2 = __FloatArrayInstPtr(floatArray)->f_element;
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   277
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   278
        if (_sz1 > 0) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   279
            if (_sz2 >= _sz1) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   280
                /* how about inline-mmx-asm for this ... */
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   281
                float prev_p1 = _p1[0];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   282
                float prev_p2 = _p2[0];
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   283
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   284
                for (i=1; i<_sz1; i++) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   285
                    float next_p1 = _p1[i];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   286
                    float next_p2 = _p2[i];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   287
                    _p1[i-1] = prev_p1 + prev_p2;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   288
                    prev_p1 = next_p1;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   289
                    prev_p2 = next_p2;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   290
                }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   291
                _p1[i-1] = prev_p1 + prev_p2;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   292
            }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   293
        }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   294
        RETURN (self);
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   295
    }
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   296
%}.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   297
    super primAddArray:floatArray
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   298
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   299
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   300
     |f1 f2|
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   301
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   302
     f1 := FloatArray withAll:#(1 2 3 4 5).
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   303
     f2 := FloatArray withAll:#(2 2 2 3 3).
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   304
     f1 += f2.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   305
     f1
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   306
    "
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   307
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   308
    "Modified (comment): / 09-06-2019 / 15:34:31 / Claus Gittinger"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   309
!
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   310
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   311
primAddScalar: aScalar
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   312
    "add the scalar argument into the receiver (destructive).
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   313
     does not check for immutability: only use internally after cloning"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   314
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   315
%{
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   316
    if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   317
        INT _sz1 = __floatArraySize(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   318
        INT i;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   319
        float *_p1 = __FloatArrayInstPtr(self)->f_element;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   320
        float v;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   321
        float prev_p1;
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   322
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   323
        if (_sz1 > 0) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   324
            if (__isFloat(aScalar)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   325
                v = (float)(__floatVal(aScalar));
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   326
            } else  if (__isShortFloat(aScalar)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   327
                v = __shortFloatVal(aScalar);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   328
            } else if (__isSmallInteger(aScalar)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   329
                v = (float)(__intVal(aScalar));
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   330
            } else
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   331
                goto badArg;
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   332
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   333
            /* how about inline-mmx-asm for this ... */
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   334
            prev_p1 = _p1[0];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   335
            for (i=1; i<_sz1; i++) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   336
                float next_p1 = _p1[i];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   337
                _p1[i-1] = prev_p1 + v;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   338
                prev_p1 = next_p1;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   339
            }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   340
            _p1[i-1] = prev_p1 + v;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   341
        }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   342
        RETURN (self);
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   343
    }
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   344
    badArg: ;
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   345
%}.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   346
    super primAddScalar:aScalar
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   347
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   348
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   349
     |f1 f2|
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   350
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   351
     f1 := FloatArray withAll:#(1 2 3 4 5).
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   352
     f1 += 2.0.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   353
     Transcript showCR:f1.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   354
     f1 += 2.0 asShortFloat.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   355
     Transcript showCR:f1.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   356
     f1 += 2.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   357
     Transcript showCR:f1.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   358
    "
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   359
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   360
    "Modified (comment): / 09-06-2019 / 15:34:37 / Claus Gittinger"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   361
!
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   362
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   363
primDivArray: floatArray
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   364
    "divide the vector argument into the receiver (destructive).
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   365
     The argument must be another vector.
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   366
     does not check for immutability: only use internally after cloning"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   367
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   368
%{
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   369
    if ((__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0))
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   370
     && __isFloats(floatArray)
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   371
     && (__ClassInstPtr(__qClass(floatArray))->c_ninstvars == __mkSmallInteger(0))) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   372
        INT _sz1 = __floatArraySize(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   373
        INT _sz2 = __floatArraySize(floatArray);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   374
        INT i;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   375
        float *_p1 = __FloatArrayInstPtr(self)->f_element;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   376
        float *_p2 = __FloatArrayInstPtr(floatArray)->f_element;
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   377
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   378
        if (_sz1 > 0) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   379
            if (_sz2 >= _sz1) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   380
                /* how about inline-mmx-asm for this ... */
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   381
                float prev_p1 = _p1[0];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   382
                float prev_p2 = _p2[0];
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   383
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   384
                for (i=1; i<_sz1; i++) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   385
                    float next_p1 = _p1[i];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   386
                    float next_p2 = _p2[i];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   387
                    _p1[i-1] = prev_p1 / prev_p2;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   388
                    prev_p1 = next_p1;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   389
                    prev_p2 = next_p2;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   390
                }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   391
                _p1[i-1] = prev_p1 / prev_p2;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   392
            }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   393
        }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   394
        RETURN (self);
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   395
    }
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   396
%}.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   397
    super primDivArray: floatArray
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   398
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   399
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   400
     |f1 f2|
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   401
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   402
     f1 := FloatArray withAll:#(1 2 3 4 5).
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   403
     f2 := FloatArray withAll:#(2 2 2 3 3).
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   404
     f1 /= f2.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   405
     f1
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   406
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   407
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   408
    "Modified: / 29-05-2007 / 16:01:34 / cg"
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   409
    "Modified (comment): / 09-06-2019 / 15:34:43 / Claus Gittinger"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   410
!
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   411
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   412
primDivScalar: aScalar
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   413
    "divide the scalar argument into the receiver (destructive).
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   414
     does not check for immutability: only use internally after cloning"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   415
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   416
%{
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   417
    if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   418
        INT _sz1 = __floatArraySize(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   419
        INT i;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   420
        float *_p1 = __FloatArrayInstPtr(self)->f_element;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   421
        float v;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   422
        float prev_p1;
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   423
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   424
        if (_sz1 > 0) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   425
            if (__isFloat(aScalar)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   426
                v = (float)(__floatVal(aScalar));
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   427
            } else  if (__isShortFloat(aScalar)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   428
                v = __shortFloatVal(aScalar);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   429
            } else if (__isSmallInteger(aScalar)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   430
                v = (float)(__intVal(aScalar));
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   431
            } else
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   432
                goto badArg;
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   433
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   434
            /* how about inline-mmx-asm for this ... */
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   435
            prev_p1 = _p1[0];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   436
            for (i=1; i<_sz1; i++) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   437
                float next_p1 = _p1[i];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   438
                _p1[i-1] = prev_p1 / v;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   439
                prev_p1 = next_p1;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   440
            }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   441
            _p1[i-1] = prev_p1 / v;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   442
        }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   443
        RETURN (self);
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   444
    }
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   445
    badArg: ;
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   446
%}.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   447
    super primDivScalar:aScalar
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   448
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   449
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   450
     |f1 f2|
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   451
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   452
     f1 := FloatArray withAll:#(1 2 3 4 5).
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   453
     f1 /= 2.0.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   454
     Transcript showCR:f1.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   455
     f1 /= 2.0 asShortFloat.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   456
     Transcript showCR:f1.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   457
     f1 /= 2.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   458
     Transcript showCR:f1.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   459
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   460
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   461
    "Modified: / 29-05-2007 / 16:01:39 / cg"
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   462
    "Modified (comment): / 09-06-2019 / 15:34:48 / Claus Gittinger"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   463
!
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   464
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   465
primMulArray: floatArray
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   466
    "multiply the vector argument into the receiver (destructive).
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   467
     The argument must be another vector.
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   468
     does not check for immutability: only use internally after cloning"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   469
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   470
%{
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   471
    if ((__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0))
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   472
     && __isFloats(floatArray)
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   473
     && (__ClassInstPtr(__qClass(floatArray))->c_ninstvars == __mkSmallInteger(0))) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   474
        INT _sz1 = __floatArraySize(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   475
        INT _sz2 = __floatArraySize(floatArray);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   476
        INT i;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   477
        float *_p1 = __FloatArrayInstPtr(self)->f_element;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   478
        float *_p2 = __FloatArrayInstPtr(floatArray)->f_element;
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   479
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   480
        if (_sz1 > 0) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   481
            if (_sz2 >= _sz1) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   482
                float prev_p1 = _p1[0];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   483
                float prev_p2 = _p2[0];
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   484
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   485
                for (i=1; i<_sz1; i++) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   486
                    float next_p1 = _p1[i];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   487
                    float next_p2 = _p2[i];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   488
                    _p1[i-1] = prev_p1 * prev_p2;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   489
                    prev_p1 = next_p1;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   490
                    prev_p2 = next_p2;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   491
                }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   492
                _p1[i-1] = prev_p1 * prev_p2;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   493
            }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   494
        }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   495
        RETURN (self);
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   496
    }
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   497
%}.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   498
    super primMulArray: floatArray
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   499
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   500
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   501
     |f1 f2|
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   502
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   503
     f1 := FloatArray withAll:#(1 2 3 4 5).
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   504
     f2 := FloatArray withAll:#(2 2 2 3 3).
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   505
     f1 *= f2.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   506
     f1
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   507
    "
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   508
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   509
    "Modified (comment): / 09-06-2019 / 15:34:53 / Claus Gittinger"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   510
!
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   511
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   512
primMulScalar: aScalar
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   513
    "multiply the scalar argument into the receiver (destructive).
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   514
     does not check for immutability: only use internally after cloning"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   515
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   516
%{
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   517
    if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   518
        INT _sz1 = __floatArraySize(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   519
        INT i;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   520
        float *_p1 = __FloatArrayInstPtr(self)->f_element;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   521
        float v;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   522
        float prev_p1;
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   523
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   524
        if (_sz1 > 0) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   525
            if (__isFloat(aScalar)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   526
                v = (float)(__floatVal(aScalar));
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   527
            } else  if (__isShortFloat(aScalar)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   528
                v = __shortFloatVal(aScalar);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   529
            } else if (__isSmallInteger(aScalar)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   530
                v = (float)(__intVal(aScalar));
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   531
            } else
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   532
                goto badArg;
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   533
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   534
            /* how about inline-mmx-asm for this ... */
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   535
            prev_p1 = _p1[0];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   536
            for (i=1; i<_sz1; i++) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   537
                float next_p1 = _p1[i];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   538
                _p1[i-1] = prev_p1 * v;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   539
                prev_p1 = next_p1;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   540
            }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   541
            _p1[i-1] = prev_p1 * v;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   542
        }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   543
        RETURN (self);
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   544
    }
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   545
    badArg: ;
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   546
%}.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   547
    super primMulScalar:aScalar
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   548
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   549
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   550
     |f1 f2|
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   551
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   552
     f1 := FloatArray withAll:#(1 2 3 4 5).
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   553
     f1 *= 2.0.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   554
     Transcript showCR:f1.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   555
     f1 *= 2.0 asShortFloat.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   556
     Transcript showCR:f1.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   557
     f1 *= 2.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   558
     Transcript showCR:f1.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   559
    "
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   560
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   561
    "Modified (comment): / 09-06-2019 / 15:35:00 / Claus Gittinger"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   562
!
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   563
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   564
primNegated
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   565
    "destructive negative value of each element.
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   566
     does not check for immutability: only use internally after cloning"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   567
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   568
%{
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   569
    if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   570
        INT _sz = __floatArraySize(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   571
        INT i;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   572
        float *_p = __FloatArrayInstPtr(self)->f_element;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   573
        float prev_p;
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   574
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   575
        if (_sz > 0) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   576
            /* how about inline-mmx-asm for this ... */
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   577
            prev_p = _p[0];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   578
            for (i=1; i<_sz; i++) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   579
                float next_p = _p[i];
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   580
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   581
                _p[i-1] = -prev_p;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   582
                prev_p = next_p;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   583
            }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   584
            _p[i-1] = -prev_p;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   585
        }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   586
        RETURN (self);
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   587
    }
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   588
%}.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   589
    super primNegated
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   590
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   591
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   592
     |f|
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   593
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   594
     f := FloatArray withAll:#(-1 2 -3 4 -5).
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   595
     f negated.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   596
     f
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   597
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   598
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   599
    "Created: / 30-05-2007 / 17:51:29 / cg"
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   600
    "Modified (comment): / 09-06-2019 / 15:35:04 / Claus Gittinger"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   601
!
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   602
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   603
primSubtractArray: floatArray
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   604
    "subtract the vector argument from the receiver (destructive).
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   605
     The argument must be another vector.
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   606
     does not check for immutability: only use internally after cloning"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   607
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   608
%{
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   609
    if ((__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0))
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   610
     && __isFloats(floatArray)
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   611
     && (__ClassInstPtr(__qClass(floatArray))->c_ninstvars == __mkSmallInteger(0))) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   612
        INT _sz1 = __floatArraySize(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   613
        INT _sz2 = __floatArraySize(floatArray);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   614
        INT i;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   615
        float *_p1 = __FloatArrayInstPtr(self)->f_element;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   616
        float *_p2 = __FloatArrayInstPtr(floatArray)->f_element;
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   617
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   618
        if (_sz1 > 0) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   619
            if (_sz2 >= _sz1) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   620
                float prev_p1 = _p1[0];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   621
                float prev_p2 = _p2[0];
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   622
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   623
                for (i=1; i<_sz1; i++) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   624
                    float next_p1 = _p1[i];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   625
                    float next_p2 = _p2[i];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   626
                    _p1[i-1] = prev_p1 - prev_p2;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   627
                    prev_p1 = next_p1;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   628
                    prev_p2 = next_p2;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   629
                }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   630
                _p1[i-1] = prev_p1 - prev_p2;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   631
            }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   632
        }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   633
        RETURN (self);
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   634
    }
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   635
%}.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   636
    super primSubtractArray: floatArray
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   637
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   638
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   639
     |f1 f2|
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   640
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   641
     f1 := FloatArray withAll:#(1 2 3 4 5).
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   642
     f2 := FloatArray withAll:#(2 2 2 3 3).
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   643
     f1 -= f2.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   644
     f1
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   645
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   646
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   647
    "Created: / 30-05-2007 / 17:42:41 / cg"
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   648
    "Modified (comment): / 09-06-2019 / 15:35:08 / Claus Gittinger"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   649
!
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   650
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   651
primSubtractScalar: aScalar
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   652
    "subtract the scalar argument from the receiver (destructive).
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   653
     does not check for immutability: only use internally after cloning"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   654
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   655
%{
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   656
    if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   657
        INT _sz1 = __floatArraySize(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   658
        INT i;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   659
        float *_p1 = __FloatArrayInstPtr(self)->f_element;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   660
        float v;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   661
        float prev_p1;
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   662
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   663
        if (_sz1 > 0) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   664
            if (__isFloat(aScalar)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   665
                v = (float)(__floatVal(aScalar));
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   666
            } else  if (__isShortFloat(aScalar)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   667
                v = __shortFloatVal(aScalar);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   668
            } else if (__isSmallInteger(aScalar)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   669
                v = (float)(__intVal(aScalar));
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   670
            } else
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   671
                goto badArg;
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   672
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   673
            /* how about inline-mmx-asm for this... ? */
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   674
            prev_p1 = _p1[0];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   675
            for (i=1; i<_sz1; i++) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   676
                float next_p1 = _p1[i];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   677
                _p1[i-1] = prev_p1 - v;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   678
                prev_p1 = next_p1;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   679
            }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   680
            _p1[i-1] = prev_p1 - v;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   681
        }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   682
        RETURN (self);
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   683
    }
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   684
    badArg: ;
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   685
%}.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   686
    super primSubtractScalar:aScalar
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   687
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   688
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   689
     |f1 f2|
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   690
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   691
     f1 := FloatArray withAll:#(1 2 3 4 5).
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   692
     f1 -= 2.0.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   693
     Transcript showCR:f1.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   694
     f1 -= 2.0 asShortFloat.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   695
     Transcript showCR:f1.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   696
     f1 -= 2.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   697
     Transcript showCR:f1.
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   698
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   699
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   700
    "Created: / 30-05-2007 / 17:43:06 / cg"
24318
6c2c7bd1c70c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24308
diff changeset
   701
    "Modified (comment): / 09-06-2019 / 15:35:13 / Claus Gittinger"
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   702
! !
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   703
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   704
!FloatArray methodsFor:'queries'!
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   705
7220
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   706
defaultElement
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   707
    ^ ShortFloat zero
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   708
!
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   709
20300
b67a6d272129 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 19032
diff changeset
   710
isValidElement:anObject
b67a6d272129 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 19032
diff changeset
   711
    "return true, if I can hold this kind of object"
b67a6d272129 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 19032
diff changeset
   712
b67a6d272129 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 19032
diff changeset
   713
    ^ anObject isNumber
b67a6d272129 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 19032
diff changeset
   714
!
b67a6d272129 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 19032
diff changeset
   715
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   716
minMax
11212
8a6590cc1f4a comments
Claus Gittinger <cg@exept.de>
parents: 10580
diff changeset
   717
    "return a Tuple holding the smallest and largest element;
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   718
     redefined for speed"
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   719
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   720
    |min max empty|
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   721
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   722
%{
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 7220
diff changeset
   723
    if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   724
        INT _sz = __floatArraySize(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   725
        
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   726
        if (_sz > 0) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   727
            INT _i;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   728
            float *_p = __FloatArrayInstPtr(self)->f_element;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   729
            float _min, _max;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   730
            OBJ retVal;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   731
            
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   732
            _min = _max = _p[0];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   733
            for (_i=_sz-1; _i>0; _i-=2) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   734
                float _v1 = _p[_i];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   735
                float _v2 = _p[_i-1];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   736
                if (_v1 < _v2) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   737
                    if (_v1 < _min) _min = _v1;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   738
                    if (_v2 > _max) _max = _v2;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   739
                } else {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   740
                    if (_v2 < _min) _min = _v2;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   741
                    if (_v1 > _max) _max = _v1;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   742
                }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   743
            }
21081
7c7d1c059ce9 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20313
diff changeset
   744
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   745
            min = __MKFLOAT(_min);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   746
            __PROTECT__(min);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   747
            max = __MKFLOAT(_max);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   748
            __UNPROTECT__(min);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   749
            RETURN (__ARRAY_WITH2(min, max));
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   750
        }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   751
        empty = true;
7220
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   752
    }
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   753
%}.
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   754
    empty == true ifTrue:[
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   755
        ^ self emptyCollectionError.
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   756
    ].
21081
7c7d1c059ce9 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20313
diff changeset
   757
    ^ Array with:(self min) with:(self max)
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   758
7220
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   759
    "
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   760
     |f1|
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   761
13774
f36d336cc5c0 changed: #minMax
Claus Gittinger <cg@exept.de>
parents: 13707
diff changeset
   762
     f1 := (1 to:10000) asFloatArray.
14692
98e7a51e5d17 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 13826
diff changeset
   763
     Time millisecondsToRun:[ 1000 timesRepeat:[ f1 minMax ] ]
7220
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   764
    "
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   765
    "
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   766
     |f1|
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   767
7220
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   768
     f1 := FloatArray withAll:#(1 2 3 4 5).
14692
98e7a51e5d17 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 13826
diff changeset
   769
     f1 minMax
7220
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   770
    "
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   771
    "
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   772
     |f1|
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
   773
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   774
     f1 := FloatArray withAll:#(1 2 3 4).
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   775
     f1 minMax
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   776
    "
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   777
    "
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   778
     |f1|
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   779
7220
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   780
     f1 := FloatArray withAll:#(5 4 3 2 1).
14692
98e7a51e5d17 64bit fixes
Claus Gittinger <cg@exept.de>
parents: 13826
diff changeset
   781
     f1 minMax
7220
5225d13b2d57 inheritance & documentation
Claus Gittinger <cg@exept.de>
parents: 5816
diff changeset
   782
    "
13774
f36d336cc5c0 changed: #minMax
Claus Gittinger <cg@exept.de>
parents: 13707
diff changeset
   783
f36d336cc5c0 changed: #minMax
Claus Gittinger <cg@exept.de>
parents: 13707
diff changeset
   784
    "Modified (comment): / 07-10-2011 / 13:03:30 / cg"
10561
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   785
!
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   786
12577
a3224998ea6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11212
diff changeset
   787
numFloats
a3224998ea6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11212
diff changeset
   788
    ^ self size
10561
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   789
! !
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   790
23798
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   791
!FloatArray methodsFor:'testing'!
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   792
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   793
isFloatArray
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   794
    "return true if the receiver has float elements.
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   795
     These are Float, Double- and HalfFloat arrays"
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   796
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   797
    ^ true
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   798
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   799
    "Created: / 02-03-2019 / 23:13:51 / Claus Gittinger"
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   800
!
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   801
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   802
isUnboxedFloatArray
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   803
    "return true if the receiver has float elements.
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   804
     These are Float, Double- and HalfFloat arrays"
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   805
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   806
    ^ true
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   807
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   808
    "Created: / 02-03-2019 / 23:13:26 / Claus Gittinger"
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   809
! !
300f01ecb7f0 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 22263
diff changeset
   810
10561
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   811
!FloatArray methodsFor:'vector arithmetic'!
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   812
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   813
dot: aFloatVector
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   814
    "Return the dot product of the receiver and the argument.
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   815
     Raises an error, if the argument is not of the same size as the receiver."
10561
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   816
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   817
    | mySize result |
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   818
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   819
"/    <primitive:'primitiveDotProduct' module: 'FloatArrayPlugin'>
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   820
%{
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   821
    if ((__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0))
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   822
     && (__ClassInstPtr(__qClass(aFloatVector))->c_ninstvars == __mkSmallInteger(0))) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   823
        INT __mySize = __floatArraySize(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   824
        double __result = 0.0;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   825
        float *__p1 = __FloatArrayInstPtr(self)->f_element;
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   826
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   827
        if (__mySize > 0) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   828
            if (__isFloats(aFloatVector)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   829
                INT __otherSize = __floatArraySize(aFloatVector);
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   830
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   831
                if (__mySize == __otherSize) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   832
                    float *__p2 = __FloatArrayInstPtr(aFloatVector)->f_element;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   833
                    INT __i;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   834
                    /* how about inline-mmx-asm for this ... */
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   835
                    for (__i=0; __i<__mySize; __i++) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   836
                        __result += (__p1[__i] * __p2[__i]);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   837
                    }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   838
                    RETURN (__MKFLOAT(__result));
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   839
                }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   840
            } else if (__isDoubles(aFloatVector)) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   841
                INT __otherSize = __doubleArraySize(aFloatVector);
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   842
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   843
                if (__mySize == __otherSize) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   844
                    double *__p2 = __DoubleArrayInstPtr(aFloatVector)->d_element;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   845
                    INT __i;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   846
                    /* how about inline-mmx-asm for this ... */
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   847
                    for (__i=0; __i<__mySize; __i++) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   848
                        __result += (__p1[__i] * __p2[__i]);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   849
                    }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   850
                    RETURN (__MKFLOAT(__result));
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   851
                }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   852
            }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   853
        }
10561
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   854
    }
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   855
%}.
15935
35582e2e065c class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 14692
diff changeset
   856
    ^ super dot:aFloatVector
10561
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   857
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   858
    "
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   859
     |v|
11212
8a6590cc1f4a comments
Claus Gittinger <cg@exept.de>
parents: 10580
diff changeset
   860
     v := #(2.0 2.0 1.0) asFloatArray.
19003
6ac2cb393fd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18577
diff changeset
   861
     v dot:v.
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   862
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   863
     |v|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   864
     v := #(2.0 2.0 1.0) asDoubleArray.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   865
     v dot:v.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   866
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   867
     |v|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   868
     v := #(2.0 2.0 1.0).
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   869
     v dot:v.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   870
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   871
     |v1 v2|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   872
     v1 := #(2.0 2.0 1.0) asFloatArray.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   873
     v2 := #(2.0 2.0 1.0) asDoubleArray.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   874
     v1 dot:v2.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   875
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   876
     |v1 v2|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   877
     v1 := #(2.0 2.0 1.0) asDoubleArray.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   878
     v2 := #(2.0 2.0 1.0) asFloatArray.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   879
     v1 dot:v2.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   880
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   881
     |v1 v2|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   882
     v1 := #(2.0 2.0 1.0).
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   883
     v2 := #(2.0 2.0 1.0) asFloatArray.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   884
     v1 dot:v2.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   885
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   886
     |v1 v2|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   887
     v1 := #(2.0 2.0 1.0) asFloatArray.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   888
     v2 := #(2.0 2.0 1.0).
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   889
     v1 dot:v2.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   890
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   891
     |v1 v2|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   892
     v1 := #(2.0 2.0 1.0).
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   893
     v2 := #(2.0 2.0 1.0) asDoubleArray.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   894
     v1 dot:v2.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   895
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   896
     |v1 v2|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   897
     v1 := #(2.0 2.0 1.0) asDoubleArray.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   898
     v2 := #(2.0 2.0 1.0).
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   899
     v1 dot:v2.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   900
    "
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20300
diff changeset
   901
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   902
    "
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   903
     |v1 v2|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   904
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   905
     v1 := Array new:10000 withAll:2.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   906
     v2 := Array new:10000 withAll:3.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   907
     Time millisecondsToRun:[
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   908
        10000 timesRepeat:[
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   909
          v1 dot:v2.
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   910
        ]
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   911
     ]
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   912
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   913
    "
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   914
     |v1 v2|
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   915
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   916
     v1 := FloatArray new:10000 withAll:2.
19003
6ac2cb393fd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18577
diff changeset
   917
     v2 := FloatArray new:10000 withAll:3.
17198
7518cd20d9d3 class: FloatArray
Claus Gittinger <cg@exept.de>
parents: 16849
diff changeset
   918
     Time millisecondsToRun:[
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   919
        10000 timesRepeat:[
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   920
          v1 dot:v2.
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
   921
        ]
19003
6ac2cb393fd7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 18577
diff changeset
   922
     ]
10561
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   923
    "
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   924
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   925
    "
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   926
     |v1 v2|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   927
     v1 := #(2.0 2.0 1.0) asFloatArray.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   928
     v2 := #(2.0 2.0 1.0 0.0) asDoubleArray.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   929
     v1 dot:v2.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   930
    "
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   931
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20300
diff changeset
   932
10561
6987bd25c09d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   933
    "Created: / 29-05-2007 / 13:13:39 / cg"
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   934
!
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   935
24306
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   936
esum
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   937
    "Return the (double) sum of the elements.
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   938
     Reduces accumulated rounding errors.
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   939
     This is an experimental algorithm"
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   940
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   941
%{
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   942
    if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) {
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   943
        INT __mySize = __floatArraySize(self);
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   944
        double __sum = 0.0;
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   945
        float *__pf = __FloatArrayInstPtr(self)->f_element;
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   946
        #define NBITS_EXP 11
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   947
        #define NIDX_EXP  ((1<<NBITS_EXP))
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   948
        #define MASK_EXP  (NIDX_EXP-1)
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   949
        double sumsPerE[ NIDX_EXP];
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   950
        int __i, __minIdx = MASK_EXP, __maxIdx = 0;
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   951
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   952
        memset(sumsPerE, 0, sizeof(double)*NIDX_EXP);
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   953
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   954
        for (__i=0; __i<__mySize; __i++) {
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   955
            union {
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   956
                double f;
24333
e6d6a165972d Replace uint32_t (not known in mingw)
Stefan Vogel <sv@exept.de>
parents: 24318
diff changeset
   957
                unsigned int32 ui32[2];
24306
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   958
            } u;
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   959
            int exp;
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   960
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   961
            u.f = (double)__pf[__i];
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   962
#ifdef __LSBFIRST__
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   963
            exp = (u.ui32[1] >> (32-1-NBITS_EXP)) & MASK_EXP;
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   964
#else
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   965
            exp = (u.ui32[0] >> ((32-1-NBITS_EXP)) & MASK_EXP;
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   966
#endif
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   967
            // printf("f:%04x %04x %04x %04x\n", u.ui32[0], u.ui32[1], u.ui32[2], u.ui32[3]); 
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   968
            // printf("e:%d %lf + %lf -> %lf\n", exp, sumsPerE[exp], u.f, (sumsPerE[exp]+u.f)); 
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   969
            sumsPerE[exp] += u.f;
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   970
            __minIdx = exp < __minIdx ? exp : __minIdx;
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   971
            __maxIdx = exp > __maxIdx ? exp : __maxIdx;
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   972
        }
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   973
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   974
        // printf("low:%d high:%d\n", __minIdx, __maxIdx);
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   975
        for (__i=__maxIdx; __i>=__minIdx; __i--) {
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   976
            __sum += sumsPerE[__i];
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   977
        }
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   978
        RETURN (__MKFLOAT(__sum));
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   979
    }
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   980
%}.
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   981
    ^ super sum
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   982
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   983
    "here, sum and esum both deliver the same result
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   984
    
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   985
     |v|
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   986
     v := #(2.0 2.0 1.0 1.0) asFloatArray.
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   987
     v sum.
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   988
     v esum.
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   989
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   990
     |v|
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   991
     v := #(1e38 1.0 -1e38 1.0) asFloatArray.
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   992
     v sum.
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   993
     v esum.
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   994
    "
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   995
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   996
    "Created: / 09-06-2019 / 14:10:58 / Claus Gittinger"
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   997
!
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
   998
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
   999
hornerMultiplyAndAdd:x
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1000
    "primitive support for horner's-method computation of polynomials.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1001
     The vector is interpreted as providing the factors for a polynomial,
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1002
        an*x^n + (an-1)*x^(n-1) + ... + a2(x) + a1
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1003
     where the ai are the elements of the Array.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1004
     The highest rank factor is at the first position, the 0-rank constant at last.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1005
     This is inlined c-code, which may get compiled to fast machine code,
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1006
     using multiply-and-add or vector instructions, if the CPU/Compiler support them."
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1007
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1008
    | mySize result |
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1009
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1010
%{
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1011
    double __x;
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20300
diff changeset
  1012
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1013
    if (__isFloat(x)) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1014
        __x = __floatVal(x);
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1015
    } else if (__isShortFloat(x)) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1016
        __x = (double)__shortFloatVal(x);
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1017
    } else if (__isSmallInteger(x)) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1018
        __x = (double)(__intVal(x));
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1019
    } else {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1020
        goto getOutOfHere;
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1021
    }
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20300
diff changeset
  1022
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1023
    if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) {
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1024
        INT __mySize = __floatArraySize(self);
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1025
        float *__elements = __FloatArrayInstPtr(self)->f_element;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1026
        double __result = __elements[0];
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1027
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1028
        if (__mySize > 1) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1029
            INT __i;
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1030
            /* how about inline-mmx-asm for this ... */
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1031
            for (__i=1; __i<__mySize; __i++) {
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1032
                __result = (__result * __x) + __elements[__i];
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1033
            }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1034
        }
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1035
        RETURN (__MKFLOAT(__result));
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1036
    }
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20300
diff changeset
  1037
getOutOfHere: ;
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1038
%}.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1039
    ^ super hornerMultiplyAndAdd:x
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1040
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1041
    "
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1042
     |v|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1043
     v := #(2.0 3.0 4.0) asFloatArray.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1044
     v  hornerMultiplyAndAdd:10.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1045
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1046
     |v|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1047
     v := Array new:100 withAll:2.0.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1048
     v hornerMultiplyAndAdd:10
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1049
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1050
     |v|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1051
     v := FloatArray new:100 withAll:2.0.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1052
     v hornerMultiplyAndAdd:10
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1053
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1054
     |v|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1055
     v := Array new:100 withAll:2.0.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1056
     Time millisecondsToRun:[
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1057
        10000 timesRepeat:[ v hornerMultiplyAndAdd:10]
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1058
     ]
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1059
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1060
     |v|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1061
     v := FloatArray new:100 withAll:2.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1062
     Time millisecondsToRun:[
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1063
        10000 timesRepeat:[ v hornerMultiplyAndAdd:10]
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1064
     ]
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1065
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1066
     |v|
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1067
     v := DoubleArray new:100 withAll:2.
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1068
     Time millisecondsToRun:[
20313
1280e2eafb73 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  1069
        10000 timesRepeat:[ v hornerMultiplyAndAdd:10]
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1070
     ]
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1071
    "
24306
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1072
!
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1073
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1074
sum
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1075
    "Return the (double) sum of the elements.
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1076
     May suffer from accumulated rounding error"
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1077
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1078
%{
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1079
    if (__ClassInstPtr(__qClass(self))->c_ninstvars == __mkSmallInteger(0)) {
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1080
        INT __mySize = __floatArraySize(self);
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1081
        double __sum = 0.0;
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1082
        float *__pf = __FloatArrayInstPtr(self)->f_element;
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1083
        int __i;
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1084
        
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1085
        /* how about inline-mmx-asm for this ... */
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1086
        for (__i=0; __i<__mySize; __i++) {
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1087
            __sum += __pf[__i];
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1088
        }
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1089
        RETURN (__MKFLOAT(__sum));
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1090
    }
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1091
%}.
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1092
    ^ super sum
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1093
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1094
    "
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1095
     |v|
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1096
     v := #(2.0 2.0 1.0) asFloatArray.
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1097
     v sum.
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1098
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1099
     |v|
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1100
     v := #(1e30 1 -1e30 1) asFloatArray.
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1101
     v sum.
24308
c18e6b171db6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24306
diff changeset
  1102
     v esum.
24306
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1103
    "
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1104
ee7c9f895369 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23806
diff changeset
  1105
    "Created: / 09-06-2019 / 10:41:12 / Claus Gittinger"
24308
c18e6b171db6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24306
diff changeset
  1106
    "Modified (comment): / 09-06-2019 / 14:14:47 / Claus Gittinger"
5737
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
  1107
! !
1e4a1b0c294e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4062
diff changeset
  1108
628
7aa563e4c64a version at the end
Claus Gittinger <cg@exept.de>
parents: 603
diff changeset
  1109
!FloatArray class methodsFor:'documentation'!
603
72bdeb24ccba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1110
72bdeb24ccba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
  1111
version
18577
72ff8078cb76 class: FloatArray
Stefan Vogel <sv@exept.de>
parents: 17198
diff changeset
  1112
    ^ '$Header$'
12577
a3224998ea6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11212
diff changeset
  1113
!
a3224998ea6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11212
diff changeset
  1114
a3224998ea6c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11212
diff changeset
  1115
version_CVS
18577
72ff8078cb76 class: FloatArray
Stefan Vogel <sv@exept.de>
parents: 17198
diff changeset
  1116
    ^ '$Header$'
88
81dacba7a63a *** empty log message ***
claus
parents: 3
diff changeset
  1117
! !
19032
67c02dbf742d #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19003
diff changeset
  1118