Loading the script results in the following:
caa VPA f_term;f_full_ages
|index error: BACKCAL
| f=.f,ccc_index {y2
----- Original Message -----
From: Robert O'Boyle <[EMAIL PROTECTED]>
Date: Sunday, April 27, 2008 7:11
Subject: RE: [Jprogramming] Calculations on matrices
To: 'Programming forum' <[email protected]>
> Here is the whole script. It is a work in progress so to speak.
>
> NB.============================================================
> caa=: 210796 26450 232147 49752 10592 1693 561 54 37
> caa=: caa,: 43630 270068 58591 308775 45479 13970 7722 1690 215
> caa=: caa, 47948 68430 238394 109814 159203 57948 4497 409 296
> caa=: caa, 751706 79933 65107 274518 72827 90617 31977 15441 5668
> caa=: caa, 70536 384467 118960 160723 110852 62506 22595 6345 2693
> caa=: caa, 106916 58166 285361 201097 120223 111911 41257 21271 7039
> caa=: caa, 144167 173662 106170 113561 75593 93620 50022 36618 7536
> caa=: caa, 649254 71984 148516 77207 75384 49065 48700 26055 13792
> caa=: caa, 29656 562616 109530 34422 25562 19361 17604 19836 9661
> caa=: caa, 118301 45600 616206 53199 15254 8120 5313 10964 5787
> caa=: caa, 235590 158941 92356 384646 50599 9357 3239 3481 2842
> caa=: caa, 19922 161637 130597 72334 219788 18960 4967 3556 1835
> caa=: caa, 55634 19468 192823 106061 55066 150588 12466 2873 1253
> caa =: |."2 caa
> nat_m =: 13 9$
> 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2
> f_term =: (0.3
> 0.41 0.76 0.9 1 1 1 1 1) * 0.4
> full_ages =: (7 8 9) - 0.2
> f_full_ages =: |. 0.139 0.351 0.372 0.525 0.340 0.514 0.562 0.773
> 0.564 0.358 0.389 0.352
>
> NVPA =: 4 : '(x*(y+m))%(y*(1-^-(y+m)))'
>
> FVPA =: 4 : '((}:x)*(y+}:m))%(((}.n)*^(y+}:m))*(1-^-(y+}:m)))'
>
> BACKCAL =: 4 : 0
> n =: x
> for_ccc. y
> do.
> m =: ccc_index { mm
> f =. ccc
> (FVPA ^:_) 0.3
> f =. f,
> ccc_index { y2
> faa =: faa, f
> n =: ccc NVPA f
> naa =: naa, n
> end.
> )
>
> VPA =: 4 : 0
> y1 =. > 0{y
> y2 =: > 1{y
> m =: 0{ nat_m
> faa =: ,: y1
> naa =: ,: (0{x) NVPA y1
> mm =: }."2 nat_m
> (,naa) BACKCAL (}."2 x)
> naa =: |. naa
> faa =: |. faa
> )
>
> caa VPA f_term;f_full_ages
>
> NB.==================================================
>
> The first bit is just data entry. VPA calls NVPA to set up the
> startingconditions. Then it calls BACKCAL which undertakes the
> row by row
> calculations, the main one (FVPA) being an iteration to find
> roots. You will
> note that I have declared a number of variables global. This is
> to speed up
> performance because this routine is part of a bigger
> optimization which
> loops through these calculations literally thousands of times.
> As I stated
> in my previous post, I initially configured BACKCAL to work with
> insert /.
> This was OK if nat_m is a list, not a matrix as it is here.
> Also, the speed
> gains were not great. Anyway, this code works. I'd just like to
> know if
> there is a way in J to really speed up the row by row processing.
>
> Bob
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm