Bill, That is the problem. Here is the code I want to work. In jqt it is
good unless you include the line which is commented out.
In jhs it will produce a similar error in the line after the one commented
out. (also the one above it)
It seemsviewmat doesn't like PAL6 because it matches the palette that is the
default in viemat
load 'viewmat'
]A=:+/~ i:3
viewmat A
at2=: 13 :'([:{:"1 *.) j./"1 y'
]D=:at2"0 /~ i:3
viewmat D
]PAL6=:6 3$0 0 255 0 255 255 0 255 0 255 255 0 255 0 0 255 0 255
NB.PAL6 viewmat D;'PAL6'
PAL6 viemat D;'PAL6'
RGB=:( #:i.8){0 255
RGB viewmat D;'RGB'
GRB=:1 0 2{"1 RGB
GRB viewmat D;'GRB'
However here is the code I used for my phone demo. Very strange!
load 'viewmat'
PAL=:6 3$0 0 255 0 255 255 0 255 0 255 255 0 255 0 0 255 0 255
RGB=:( #:i.8){0 255
GRB=:1 0 2{"1 RGB
([:{:"1 *.) j./"1 i:5
at2=: 13 :'([:{:"1 *.) j./"1 y'
at2 i:5
at2"0 /~ i:5
D=:at2"0 /~ i:300
ro=: 13 :'<.0.5+y'
we=: 13 :'+/"1[0.3 0.59 0.11*"1 y'
gray=: 13 :'3#"0 ro we y'
(gray GRB) viewmat D;'gray GRB'
GRB viewmat D;'GRB'
(gray RGB) viewmat D;'gray RGB'
RGB viewmat D;'RGB'
(gray PAL) viewmat D;'gray PAL'
PAL viewmat D;'PAL'
(gray GRB) viewmat D;'gray GRB'
Have fun... Linda
This is it! I want to be able to insert my own palette in viewmat. I
thought the problem might be the decimals, but that is not the case. I have
convinced myself that viewmeat always uses a six color palette. I want to
change to an 8 color palette to include black and white. It should be
possible to do that.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of bill lam
Sent: Tuesday, August 05, 2014 9:51 PM
To: Programming forum
Subject: Re: [Jprogramming] Dyadic viewmat
Or did you mean both monad and dyad viewmat work on jqt, but only monad
works on jhs?
jhs uses its own viewmat codes which is limited compared to viewmat addon.
On Aug 6, 2014 9:46 AM, "bill lam" <[email protected]> wrote:
> I tested it work fine on android.
> It gave 2 viewmats, both of them looked the same. To make PAL6 somewhat
> different,
>
> > PAL6=: |. 6 3$0 0 255 0 255 255 0 255 0 255 255 0 255 0 0 255 0 255
>
> then the red and blue components swapped. Is that the expected result?
> On Aug 6, 2014 9:28 AM, "Linda Alvord" <[email protected]> wrote:
>
>> Bill,
>>
>> Here's the code: It works fine in jqt. I was surprised it worked at
all
>> in jhs. The monadic version of viewmat is good and the dyadic version
>> doesn't work. I did omit the PAL6 in the post.
>>
>> oad 'viewmat'
>> i.5
>> +/i.5
>> >:i.5
>> +/>:i.5
>> i:5
>> +/i:5
>> i.0
>> i:0
>> i."0 i.5
>> i."0>:i.5
>> ]D=:i:"0>:i:5
>> $D
>> $,D
>> <./,D
>>
>> ]PAL6=:6 3$0 0 255 0 255 255 0 255 0 255 255 0 255 0 0 255 0 255
>> viewmat D;'viewmat D'
>> PAL6 viewmat D;'PAL6'
>>
>> Linda
>>
>> e-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of bill lam
>> Sent: Tuesday, August 05, 2014 9:26 AM
>> To: Programming forum
>> Subject: Re: [Jprogramming] Dyadic viewmat
>>
>> What is PAL6 ? Did you forget to define it?
>> On Aug 5, 2014 9:05 PM, "Linda Alvord" <[email protected]> wrote:
>>
>> > load 'viewmat'
>> >
>> > i.5
>> >
>> > 0 1 2 3 4
>> >
>> > +/i.5
>> >
>> > 10
>> >
>> > >:i.5
>> >
>> > 1 2 3 4 5
>> >
>> > +/>:i.5
>> >
>> > 15
>> >
>> > i:5
>> >
>> > _5 _4 _3 _2 _1 0 1 2 3 4 5
>> >
>> > +/i:5
>> >
>> > 0
>> >
>> > i.0
>> >
>> > i:0
>> >
>> > 0
>> >
>> > i."0 i.5
>> >
>> > 0 0 0 0
>> > 0 0 0 0
>> > 0 1 0 0
>> > 0 1 2 0
>> > 0 1 2 3
>> >
>> > i."0>:i.5
>> >
>> > 0 0 0 0 0
>> > 0 1 0 0 0
>> > 0 1 2 0 0
>> > 0 1 2 3 0
>> > 0 1 2 3 4
>> >
>> > ]D=:i:"0>:i:5
>> >
>> > 4 3 2 1 0 _1 _2 _3 _4 0 0 0 0
>> > 3 2 1 0 _1 _2 _3 0 0 0 0 0 0
>> > 2 1 0 _1 _2 0 0 0 0 0 0 0 0
>> > 1 0 _1 0 0 0 0 0 0 0 0 0 0
>> > 0 0 0 0 0 0 0 0 0 0 0 0 0
>> > _1 0 1 0 0 0 0 0 0 0 0 0 0
>> > _2 _1 0 1 2 0 0 0 0 0 0 0 0
>> > _3 _2 _1 0 1 2 3 0 0 0 0 0 0
>> > _4 _3 _2 _1 0 1 2 3 4 0 0 0 0
>> > _5 _4 _3 _2 _1 0 1 2 3 4 5 0 0
>> > _6 _5 _4 _3 _2 _1 0 1 2 3 4 5 6
>> >
>> > $D
>> >
>> > 11 13
>> >
>> > $,D
>> >
>> > 143
>> >
>> > <./,D
>> >
>> > _6
>> >
>> > >./,D
>> >
>> > 6
>> >
>> > viewmat D;'viewmat D'
>> >
>> >
>> >
>> >
>> >
>> > This works differently than yesterday. No bitmap but image is in
>> terminal
>> >
>> >
>> >
>> > PAL6 viewmat D;'PAL6'
>> >
>> > |domain error: viewmat
>> > | PAL6 viewmat D;'PAL6'
>> > |[-18] c:\users\owner\j802-user\temp\a strategy 4.ijs
>> >
>> >
>> >
>> >
>> >
>> > Linda
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>> >
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm