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

Home » Public Forums » archive » Set Operations on A and B
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: Set Operations on A and B [message #45895 is a reply to message #45793] Fri, 07 October 2005 18:22 Go to previous messageGo to previous message
mxd1007 is currently offline  mxd1007
Messages: 3
Registered: October 2005
Junior Member
Ben Tupper wrote:
> mxd1007@cs.rit.edu wrote:
>
>> which refers to Colorclass[h]. So I guess since this is only a
>> numerical value, I need to somehow convert it to an array.
>> ColorClass[h] is the set of vertices with color h, and is constructed
>> as follows:
>>
>> ColorClass[h] = {i is an element of the set of vertices : color[i] = h}
>> for 0 <= h <= k-1
>>
>
> Hi,
>
> My first guess is that IDL is changing your selection from a subset of
> an array to a scalar. This happens when you extract one element from an
> array. Use REFORM to force IDL to treat your value as an array of one
> element.
>
> IDL> ColorClass = BINDGEN(12)
> IDL> i = 7
>
> Now extract the ith element - raw and reformed...
>
> IDL> help, ColorClass[i], REFORM(ColorClass[i],1)
> <Expression> BYTE = 7
> <Expression> BYTE = Array[1]
>
> Try it with your set operators.
>
> Cheers,
> Ben

Thanks Ben

I changed the set of adjacent vertices to a larger graph, 11 vertices,
and the structure of the graph is as follows, where i is the vertex and
A[i] is the set of vertices adjacent to vertex i, however A[i] had to
be a struct instead of an array


setA = {vertex0:[1,5,8],vertex1:[0,2,7],vertex2:[,3,6,7},$
vertex3:[2,4,10],vertex4:[3,5,10],vertex5:[0,4,6,8],$
vertex6:[2,5,9],vertex7:[1,2,9,10],vertex8:[0,5,9,10],$
vertex9:[6,7,8,10],vertex10:[3,4,7,8,9]}

knowing that this graph can have at least 3 different colors on
vertices(a color must not be connected to the same color on any vertex,
so vertex 0 would be green, vertex 1 would be red, vertex 2 would be
blue, any adjacent vertices have to be of different colors) so I
constructed an array called colorClass,

colorclass=make_array(3,1, value=-1)

where initially this array has to be NULL or empty.

so to pass in colorClass[h] into the setIntersection function, I used
the reform function,

k=0
FOR i = 0, 10 DO BEGIN
h = 0

;retrieve subarray from structure setA
newSetA = setA.(i)

sizeColorClass = SIZE(colorClass[h], /n_dimensions)

WHILE( h LT k AND SetIntersection(newSetA, REFORM(colorClass[h],$
sizeColorClass) NE -1) DO.........

my question is, colorClass[h], h = 0,1,.....10 is going to change in
size, perhaps colorclass[0] = {0,2,4}, colorClass[1] = {1,3,5,8},
colorClass[2] = {6,7,9,10} but the highest h will be is 2, so with
that, am I passing in the correct numeric value for the reform fucntion
for colorClass? I keep getting this error and trying to figure out how
to pass colorClass[h] to my setIntersection function where
colorClass[h] could be an empty set, a set with 1 elements, or 2
elements, or 3 elements, etc etc...

REFORM: New subscripts must not change the number elements in <INT
Array[1]>.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: PDF manual on 6.1
Next Topic: Stackplot without axis?

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

Current Time: Wed Dec 03 06:43:43 PST 2025

Total time taken to generate the page: 2.24048 seconds