• 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
  • Andrew Beckett
    Andrew Beckett over 14 years ago
    Hi Slawa,

    The reason I was confused was because your code had changed between looking at the email sent by the forum system, and when I looked on the web - so you'd presumably edited it.

    Maybe you could use another way to build a list of the first four list elements, but I doubt it would end up being much faster. Detailed profiling would be necessary.

    Potential candidates could be:

    list(car(item) cadr(item) caddr(item) cadddr(item))

    Or

    let(((n 4) setof(_i item plusp(n--)))

    I'd be surprised if the last one was faster though.

    Regards,

    Andrew
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 14 years ago
    Hi Slawa,

    The reason I was confused was because your code had changed between looking at the email sent by the forum system, and when I looked on the web - so you'd presumably edited it.

    Maybe you could use another way to build a list of the first four list elements, but I doubt it would end up being much faster. Detailed profiling would be necessary.

    Potential candidates could be:

    list(car(item) cadr(item) caddr(item) cadddr(item))

    Or

    let(((n 4) setof(_i item plusp(n--)))

    I'd be surprised if the last one was faster though.

    Regards,

    Andrew
    • 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