You're right, I should have included that.  The J version can be preceded by

z =: 1  NB. markov order
M =: 2  NB. number of sites
L =: 10 NB. conditioning-window length

mu =: ? (2*M) $ 0  NB. means in the 1st time slice
B  =: ? ((2*M),(z*2*M)) $ 0  NB. regression matrix
Q  =: ? ((2*M),(2*M)) $ 0  NB. intra time slice covariance

z, M, and L can be any integers >= 1.  You're right it builds a square
matrix, but the dimensions equal to '8' in the three submatrices below grow
by #Q  (4 in this example) for each application of absorbNode.

+-------+---+
|       |   |
|  8x8  |8x4|
|       |   |
+-------+---+
|  4x8  |4x4|
+-------+---+

The MATLAB version is a bit messier to provide the set up for, and perhaps
uninteresting.  I'll omit unless you'd like to see.  It involves a for-loop
where the J version has ^: , which I should have included originally since I
said the 2 code snippets were equivalent.

Thanks,

Chris


On Wed, Mar 17, 2010 at 8:31 AM, Raul Miller <[email protected]> wrote:

> On Wed, Mar 17, 2010 at 2:34 AM, Chris Barber <[email protected]>
> wrote:
> > padB =. {."1&B@:-@:#
> >
> > mu_W =: ,((padB mu)&(+/ .*)^:(i. L)) mu
> >
> > s11 =. [
> > s12 =. padB@:[ (+/ .*) [
> > s21 =. |:@:s12
> > s22 =. ] + ((padB@:[ (+/ .*) [) (+/ .*) |:@:padB@:[)
> > absorbNode =: ((s11 , s12) ,. (s21 , s22)) f.
> > sigma_W =: absorbNode&Q^:(L-1) Q
>
> I do not know if this will help, but in my experience, code becomes
> much easier to understand when we know its domain.  (Or when we
> have sample data.)
>
> I can try guessing, here, (this looks like matrix oriented code and
> absorbNode probably creates a 2x2 matrix), but experiments could add
> useful insights.
>
> Thank you,
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to