SP1 Exercise 4 Index   <<   >>


 

Use cmpx to check a few of the special codes in stencil,
that they are in fact faster than the equivalent stencils without special code.

  {⊢⍵}      {,⍵}      {⊂⍵}

  {+/,⍵}
  {∧/,⍵}    {∨/,⍵}    {=/,⍵}    {≠/,⍵}
        
  {  +/,A×⍵}    {  +/⍪A×⍤2⊢⍵}
  {C<+/,A×⍵}    {C<+/⍪A×⍤2⊢⍵}

C:   a single number of a variable whose value is a single number
A:   a variable whose value is a rank-2 or -3 array

The comparison can be < ≤ ≥ > = ≠

odd window size; movement 1; matrix argument

For example:

   b←1=?100 128⍴5
   cmpx '{ +/,⍵}⌺5 5⊢b' '{⊢+/,⍵}⌺5 5⊢b'