• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Comparing of two huge lists containing sublists

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 142
  • Views 7178
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Comparing of two huge lists containing sublists

Slawa
Slawa over 14 years ago

Hello

At me the following problem
There are 2 big lists (> 10^6 elements) a type:

list1=(
list(x11 x12 x13 x14 x15)
list(x21 x22 x23 x24 x25)
list(x31 x32 x33 x34 x35)
....................................
list(xn1 xn2 xn3 xn4 xn5)
)

list2=(
list(y11 y12 y13 y14 y15)
list(y21 y22 y23 y24 y25)
list(y31 y32 y33 y34 y35)
....................................
list(yn1 yn2 yn3 yn4 yn5)

)

It is necessary to compare and receive them the member list which are present both there and there. Comparing to lead only on
to first four elements of sublists
That is on a condition that:

xn1 == yn1 && xn2 == yn2 && xn3 == yn3 && xn4 == yn4

 

I have made it as follows:

list_overlap=nil

foreach(item1 list1
x11=nth(0 item1)
x12=nth(1 item1)
x13=nth(2 item1)
x14=nth(3 item1)

x15=nth(4 item1)
foreach(item2 list2
y11=nth(0 item2)
y12=nth(1 item2)
y13=nth(2 item2)
y14=nth(3 item2)

y15=nth(4 item2)
if(x11==y11 && x12==y12  && x13==y13 && x14==y14  then

list_overlap=cons (list(x11 x12 x13 x14 x15) list_overlap)

))

But this operation occupies too much time.
Whether there are methods to carry out it faster?

 

Regards

Slawa

  • Cancel
Parents
  • Slawa
    Slawa over 14 years ago

    Unfortunately additional records are present at lists... For this reason I concretized:

    "Comparing to lead only on to first four elements of sublists
    That is on a condition that:
    xn1 == yn1 && xn2 == yn2 && xn3 == yn3 && xn4 == yn4"

    From here it is visible that xn5 and yn5 in comparing don't participate

     

     

    Andrew Beckett said:
    ; use setof to iterate over list2 and then check if that key is in the second list
    list_overlap=setof(item list1 hash2[list1]) 

    list_overlap=setof(item list1 hash2[item])  <-Possibly you were mistaken

    Best Regards,

    Slawa

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Slawa
    Slawa over 14 years ago

    Unfortunately additional records are present at lists... For this reason I concretized:

    "Comparing to lead only on to first four elements of sublists
    That is on a condition that:
    xn1 == yn1 && xn2 == yn2 && xn3 == yn3 && xn4 == yn4"

    From here it is visible that xn5 and yn5 in comparing don't participate

     

     

    Andrew Beckett said:
    ; use setof to iterate over list2 and then check if that key is in the second list
    list_overlap=setof(item list1 hash2[list1]) 

    list_overlap=setof(item list1 hash2[item])  <-Possibly you were mistaken

    Best Regards,

    Slawa

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information