Over and Fold from different initialization values

charset=utf-8

Mime-Version: 1.0 (Mac OS X Mail 11.5 (3445.9.5))
Subject: Over and Fold from different initialization values
Message-Id:
Date: Fri, 10 Jul 2020 19:34:00 -0400
To: personal-kdbplus@googlegroups.com
X-Mailer: Apple Mail (2.3445.9.5)

Hi everyone:

I need some help from you guys.

I=E2=80=99m trying to iterate a function until either the tolerance =
of convergence is met or the maximum number of iterations is reached. =
I’ve done it in the way as below. I also would like to start the =
iteration from 20 different initialization values, value:til 20f Is =<br>there anyway to do it without do loop?=20<br><br>f:{[argument]<br> valueTmp:2*argument[value];
counterTmp:argument[counter]+:1;<br> :valuecounter!(valueTmp;counterTmp);=09<br>}<br><br>constraint{[constr; cnt; argument] (argument[value](argument[`counter]
(f/)[constraint[10.0;10;];`value`counter!(2.0;0)]

Thanks!
=20
=20=

Provided you don’t want to vectorize the function “f” and want to iterate separately for each value, you can club the over with an each as follows.

q)constraint[10.0;10;] f/’ flip valuecounter!(til 10;0)
value counter

0     10    
16    4      
16    3      
12    2      
16    2      
10    1      
12    1      
14    1      
16    1      
18    1      
q)