-- original: 17/03/2013 17:45 - 17:53 (didn't use shj, two explict eqJoins) (8mins)
-- modified: 18/03/2014 10:31
-- new version: 19/03/2014 18:17 - 18:18 (copied from 2D and modified) (1min)
let N = 100 :: Int in
let jac = \X :: DArr Int Float ->
let shj = \(d,A) -> mapArrInv (fst, dup, addf.snd,
eqJoinArr (id, id, A, shiftArr (A, d))) in
let next = \A -> let A' = shj (-1, shj (1, A)) in
mapArrInv (id, id, \(_,x) -> divf (x, 2), A') in
while (\(V,k) -> ((next V, addi (k,1)), lti (k,N)), (X, 0))