comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Help
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Help [message #15534 is a reply to message #5724] Fri, 21 May 1999 00:00 Go to previous messageGo to previous message
Pavel Romashkin is currently offline  Pavel Romashkin
Messages: 166
Registered: April 1999
Senior Member
The task is not strictly defined: the two matrices Tri provided are
different in size. Therefore, I treated it as a general problem. Here is
a 1-line solution for any size matrix:

print, (bindgen(k*m+m-1, x) mod m) eq 0

Here,
m is the length of the cycle within a row,
k is an integer multiplier to obtain the necessary row length,
x - arbitrary number of rows.

Example with m=4, k=3, x=5:
IDL> print, (bindgen(3*4+3, 5) mod 4) eq 0
1 0 0 0 1 0 0 0 1 0 0 0 1 0 0
0 1 0 0 0 1 0 0 0 1 0 0 0 1 0
0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
0 0 0 1 0 0 0 1 0 0 0 1 0 0 0
1 0 0 0 1 0 0 0 1 0 0 0 1 0 0

Resulting matrix can be trimmed in any fashion you desire. Or, maybe I
could just type matrices in, if they were needed precisely and only in the
way Tri sent them?...
Cheers,
Pavel

Tri VU KHAC wrote:

> Hi folks,
>
> I'm looking for an efficient way to produce the matrix of type (I woulk
> like to be able to avoid the FOR statement)
>
> 0 1 0 1 0 1 0 1
> 1 0 1 0 1 0 1 0
> 0 1 0 1 0 1 0 1
> 1 0 1 0 1 0 1 0
>
> OR
>
> 1 0 0 1 0 0 1
> 0 1 0 0 1 0 0
> 0 0 1 0 0 1 0
> 1 0 0 1 0 0 1
>
> ETC.
>
> Best regards,
> Tri.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Point data
Next Topic: JOIN POINTS IN A PLOT

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:12:01 PDT 2025

Total time taken to generate the page: 0.00425 seconds