# Re: How to find the intersection of two vectors?

• posted

Given the assumption that there is at most one intersection, you can actually combine the two vectors into an 1x50 vector and count which number appears twice.

Jim Wu snipped-for-privacy@yahoo.com

Since you can describe it so easily, yes it can be implemented in

hardware.

> The question left unanswered is how much speed do you want at the cost of > size? > > If the vectors are loaded a byte at a time, the comparisons could be made

as

the vectors are loaded. > A broad-side identity compare of 20 values versus 30 values could be done

in

one clock but the number of compares are huge. > > Stepping through each comparison - one per clock cycle - would take up to > 600 clock cycles to achieve a match. > > Does this homework have a desired outcome in area or speed? > > > > I have a question: > > There are two vectors, V1 and V2. V1 is a 1*20 vector and V2 is a 1*30 > > vector. V is the intersection of V1 and V2. We already have known that > > V only can be either a null vector or a 1*1 vector(that is at most > > there is one element in V1 and V2 is the same). for example:V1 = > > [2,5,6,8,9,42,...], V2=[21,24,4,9,35...]then V=. > > So the input is: V1 , V2, > > output: V (0, if the intersection is null) > > Can this function be implemented in hardware? Can it be implemented in > > a chip? which chip can I use? what is the cost? what is the delay? > > Thanks, > >