stencil : size of window

General APL language issues

stencil : size of window

Postby Yves on Sat Aug 19, 2017 9:09 pm

Dear All,

with
      {⊂⍵} ⌺ 2 ⊢ 'mississippi'
┌→──────────────────────────────────────────────────┐
│ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ │
│ │mi│ │is│ │ss│ │si│ │is│ │ss│ │si│ │ip│ │pp│ │pi│ │
│ └──┘ └──┘ └──┘ └──┘ └──┘ └──┘ └──┘ └──┘ └──┘ └──┘ │
└∊──────────────────────────────────────────────────┘

result is exactly what we expect.

but with
      {⊂⍵} ⌺ 3 ⊢ 'mississippi'
┌→──────────────────────────────────────────────────────────────────┐
│ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ │
│ │ mi│ │mis│ │iss│ │ssi│ │sis│ │iss│ │ssi│ │sip│ │ipp│ │ppi│ │pi │ │
│ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ │
└∊──────────────────────────────────────────────────────────────────┘

i need to correct by
      1↓ ¯1↓ {⊂⍵} ⌺ 3 ⊢ 'mississippi'
┌→──────────────────────────────────────────────────────┐
│ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ │
│ │mis│ │iss│ │ssi│ │sis│ │iss│ │ssi│ │sip│ │ipp│ │ppi│ │
│ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ │
└∊──────────────────────────────────────────────────────┘


Everything gets worse when i change 'mississippi' to ' mississippi '.
i dont search same information with one or other.

one more good with
      {⊂⍵} ⌺ 2 ⊢ ' mississippi '
┌→────────────────────────────────────────────────────────────┐
│ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ ┌→─┐ │
│ │ m│ │mi│ │is│ │ss│ │si│ │is│ │ss│ │si│ │ip│ │pp│ │pi│ │i │ │
│ └──┘ └──┘ └──┘ └──┘ └──┘ └──┘ └──┘ └──┘ └──┘ └──┘ └──┘ └──┘ │
└∊────────────────────────────────────────────────────────────┘

and desastrous with
      {⊂⍵} ⌺ 3 ⊢ ' mississippi '
┌→──────────────────────────────────────────────────────────────────────────────┐
│ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ ┌→──┐ │
│ │ m│ │ mi│ │mis│ │iss│ │ssi│ │sis│ │iss│ │ssi│ │sip│ │ipp│ │ppi│ │pi │ │i │ │
│ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ └───┘ │
└∊──────────────────────────────────────────────────────────────────────────────┘


i hope for another time to choose if i accept (or not) to add information to center window over string vector or image matrix.

Regards,
Yves
Yves
 
Posts: 39
Joined: Mon Nov 30, 2015 11:33 am

Re: stencil : size of window

Postby Veli-Matti on Sun Aug 20, 2017 5:40 pm

Hi,
afaik, the stencil operator has been designed to work just out of the border as in your examples (see e.g. Roger's blog). If you need only the vector subsets of a certain length, the n-wise reduction would be what you need:
      3,/'mississippi'
┌───┬───┬───┬───┬───┬───┬───┬───┬───┐
│mis│iss│ssi│sis│iss│ssi│sip│ipp│ppi│
└───┴───┴───┴───┴───┴───┴───┴───┴───┘


-Veli-Matti
Veli-Matti
 
Posts: 93
Joined: Sat Nov 28, 2009 3:12 pm

Re: stencil : size of window

Postby Yves on Sat Aug 26, 2017 11:06 am

Great thanks Veli-Matti ! i don't know this possibility of "n-wise". now, i use it.

With your comment
the stencil operator has been designed to work just out of the border


first, stencil operator is build to optimize browse of a structure AND apply a transformation ON each spot.

second, window is only "how you see univers".
actually, you're right, window's stencil work out of the border. for some application of filter to picture, you'll need "a short local apply" without alteration on "global part". example, at the TV, you blur only head of people, not all of images.

third point wellknow about a different universe is like game of life.
you work out of the border, but you fill with the other side of your structure.

at this time, i know only these 3 windows. i don't exclude other possibilty, may be as unusual as strange.

Yves
Yves
 
Posts: 39
Joined: Mon Nov 30, 2015 11:33 am


Return to Language

Who is online

Users browsing this forum: No registered users and 1 guest