# HG changeset patch # User Claus Gittinger # Date 1452859356 -3600 # Node ID 0b7682f30ead99b429d329acef8dcaeb62125fe5 # Parent 483e4c9cdaf70f2b4e66f71b99192a9c455c6f33 #DOCUMENTATION class: AbstractNumberVector removed: #dot: changed: #length #squaredLength diff -r 483e4c9cdaf7 -r 0b7682f30ead AbstractNumberVector.st --- a/AbstractNumberVector.st Fri Jan 15 13:02:19 2016 +0100 +++ b/AbstractNumberVector.st Fri Jan 15 13:02:36 2016 +0100 @@ -11,6 +11,8 @@ " "{ Package: 'stx:libbasic' }" +"{ NameSpace: Smalltalk }" + UninterpretedBytes subclass:#AbstractNumberVector instanceVariableNames:'' classVariableNames:'' @@ -383,54 +385,38 @@ !AbstractNumberVector methodsFor:'vector arithmetic'! -dot:aFloatVector - "Return the dot product of the receiver and the argument. - Fail if the argument is not of the same size as the receiver." - - |mySize result| - - mySize := self size. - mySize = aFloatVector size ifFalse:[^self error:'Must be of equal size']. - result := 0.0. - 1 to: mySize do:[:i| - result := result + ((self at: i) * (aFloatVector at: i)). - ]. - ^result - - " - |v| - - v := #(2.0 2.0 1.0) asDoubleArray. - v dot:v. - " -! - length "Return the length of the receiver interpreted as vector (that is the length of the vector from 0.0 @ 0.0 @ ... @ 0.0 - to the point in the n-dimensional space represented by the receiver)" + to the point in the n-dimensional space represented by the receiver). + Obsolete: the name 'length' may lead to confusion. + therefore renamed to vectorLength" - ^ self squaredLength sqrt + self obsoleteMethodWarning:'use vectorLength'. + ^ self squaredVectorLength sqrt " - #(10.0 10.0) asFloatArray length - #(10.0 10.0 10.0) asFloatArray length + #(10.0 10.0) asFloatArray vectorLength + #(10.0 10.0 10.0) asFloatArray vectorLength " ! squaredLength - "Return the squared length of the receiver interpreted as vector" + "Return the squared length of the receiver interpreted as vector. + Obsolete: the name 'squaredLength' may lead to confusion. + therefore renamed to squaredVectorLength" + self obsoleteMethodWarning:'use squaredVectorLength'. ^ self dot: self ! ! !AbstractNumberVector class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/AbstractNumberVector.st,v 1.5 2014-12-08 17:29:27 cg Exp $' + ^ '$Header$' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/AbstractNumberVector.st,v 1.5 2014-12-08 17:29:27 cg Exp $' + ^ '$Header$' ! !