# summary real vectors

Frank Dzaak fd at kolibri.fm.bs.dlr.de
Mon Feb 1 09:04:05 UTC 1993

```Dear self users,

Following the solutions pointed out by James "kjx" Noble and Bay Chung
I implemented a solution like the third suggestion by James though the
fourth seems to be easier but I do not understand it completely and
were not able to make it work.

My object "realVector":

traits _AddSlotsIfAbsent: (| realVector = () |)
traits realVector _Define: (|
parent*			= traits clonable.
copy			= (resend.copy contents: contents copy).
size			= (contents size).
copySize: n FillingWith: x	= (
resend.copy contents: contents copySize: n FillingWith: x).
at: index Put: value	= (contents at: index Put: value).
at: index 		= (contents at: index).
_ doArith: o With:op	= (| erg. oper |
oper: op asRealVector: size.
erg: copySize:size.
size do:[|:i| erg at:i Put:o value:(at:i) With:(oper at:i) ].
erg.
).
asRealVector: n	= (
(size=n) ifFalse:[error:'Dimensionen sind ungleich']. self).
+ op		= (doArith:[|:a. :b | (a+b) ] With:op ).
- op		= (doArith:[|:a. :b | (a-b) ] With:op ).
* op		= (doArith:[|:a. :b | (a*b) ] With:op ).
/ op		= (doArith:[|:a. :b | (a/b) ] With:op ).
|)

prototypes _AddSlotsIfAbsent: (| realVector = () |)
prototypes realVector _Define: (|
parent* = traits realVector.
contents ** <- vector.
|)

_ vectorConvert*** = traits realVector.
asRealVector: n	= (| erg |
erg: realVector copySize:n.
n do:[|:i| erg at:i Put:self ].
erg.
)
|)

Perhaps realVectors should be renamed to arithVector. Something like

Regards							Frank Dzaak.

_______________________________________________________________________________

Deutsche Forschungsanstalt fuer Luft- und Raumfahrt e.V.
Institut fuer Flugmechanik
Frank.Dzaak at kolibri.fm.bs.dlr.de
Flughafen
3300 Braunschweig
Deutschland
_______________________________________________________________________________

```