From 70b20524b811f051d993f54b92cebab0f9240b32 Mon Sep 17 00:00:00 2001 From: Jonathan Wright Date: Wed, 25 Apr 2007 16:28:00 +1200 Subject: [PATCH] Fixing Sequence dotProduct(seq). Returned self instead of the dot product Io> vector(3,4) dotProduct(vector(3,4)) sqrt ==> 5 Instead of Io> vector(3,4) dotProduct(vector(3,4)) sqrt ==> [1.732051, 2.000000] --- libs/basekit/source/UArray_math.c | 3 +-- libs/iovm/source/IoSeq_mutable.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libs/basekit/source/UArray_math.c b/libs/basekit/source/UArray_math.c index 42437a2..056e638 100644 --- a/libs/basekit/source/UArray_math.c +++ b/libs/basekit/source/UArray_math.c @@ -125,8 +125,7 @@ void UArray_divide_(UArray *self, const UArray *other) double UArray_dotProduct_(const UArray *self, const UArray *other) { - DUARRAY_OP(UARRAY_DOT, NULL, self, other); - return 0; + return DUARRAY_OP(UARRAY_DOT, NULL, self, other); } // basic scalar math diff --git a/libs/iovm/source/IoSeq_mutable.c b/libs/iovm/source/IoSeq_mutable.c index 9f45482..e1a617a 100644 --- a/libs/iovm/source/IoSeq_mutable.c +++ b/libs/iovm/source/IoSeq_mutable.c @@ -919,8 +919,7 @@ IoObject *IoSeq_dotProduct(IoSeq *self, IoObject *locals, IoMessage *m) { IoSeq *other = IoMessage_locals_seqArgAt_(m, locals, 0); IO_ASSERT_NOT_SYMBOL(self); - UArray_dotProduct_(DATA(self), DATA(other)); - return self; + return IONUMBER(UArray_dotProduct_(DATA(self), DATA(other))); } IoObject *IoSeq_setItemsToLong_(IoSeq *self, IoObject *locals, IoMessage *m) -- 2.11.4.GIT