Re: sum and avg on Vector<Float>

36 views
Skip to first unread message

Richard Morris

unread,
Jun 12, 2013, 4:38:25 AM6/12/13
to jep-...@googlegroups.com
Bruno,

Yes you should use the vsum rather than sum. Vsum flattern its arguments but sum does not so

    sum([1,2],[3,4]); gives [4.0, 6.0]

and

    vsum([1,2],[3,4]); gives 10.0

Since Jep 3.4 min, max and avg also flattern the arguments, so they will work for your situation.

Richard


On Monday, June 10, 2013 5:00:25 PM UTC+1, Bruno B wrote:
Hi,

I've coded a range() method that returns a Vector of float. range(2,5) = Vector(2,3,4,5);

Now i'm trying to mix it with min, max, sum and avg methods.

avg(1,2,3) => 2
avg(range(1,3)) => 2

sum(1,2,3) => 6
sum(range(1,3)) => [1,2,3]

What can I do to fix this problem ? Should I use vsum method or create mine ?

Thanks


Reply all
Reply to author
Forward
0 new messages