Re: Efficient Vector Comparison
- From: Yao Qi <qiyaoltc@xxxxxxxxx>
- Date: Fri, 29 Jun 2007 21:56:38 +0800
cri@xxxxxxxx (Richard Harter) writes:
On Thu, 28 Jun 2007 16:48:49 +0800, Yao Qi <qiyaoltc@xxxxxxxxx> wrote:
the
In our program, we will compare every two vectors. In current
implementation, we compare every element of that vector until we get
comparison result. It is not any more efficient way to do this?
b.t.w the length of vector is variable.
Your description is inadequate. Here are questions you need to answer.
1. What kind of comparison result do you need? Is a equal/not equal
result
satisfactory, or do you need a less than/equal/greater than result based
on
some ordering, or do you need to know the first element at which the two
vectors differ, or what?
equal/not equal is not enough for me.
I need a less than/equal/greater than/uncomparable result.
I do not need to know the first different element.
For example,
v1 = (1, 1, 0), v2 = (1, 1, 0, 0), v3 = (2, 0, 1) , v4 = (1, 2, 0)
v2 is equal to v1.
v4 is greater than v1.
v3 and v1 is not comparable.
2. When you say "we will compare every two vectors" what do you
actually
mean by that? Does that mean that you have a set of vectors and that
you
will do a comparison on every pair from the set? If not, what do you
mean?
Yeah, I have a list of vectors, and we have to compare every two of them.
There are a number of methods for managing and classifying set of data
elements (vectors in your case) such as hash tables and patricia trees.
They might be relevant or might not. There is no way of knowing from
your
description.
We tried to use hash table, but we could not figure out how to write a
hash function in this case. I could have a try on Patricia tree.
Thanks for your reply, and sorry for my unclear description.
Best Regards
--
Yao Qi <qiyaoltc@xxxxxxxxx> GNU/Linux Developer
http://duewayqi.googlepages.com/
Change your thoughts and you change your world.
.
- Follow-Ups:
- Re: Efficient Vector Comparison
- From: CBFalconer
- Re: Efficient Vector Comparison
- References:
- Efficient Vector Comparison
- From: Yao Qi
- Re: Efficient Vector Comparison
- From: Richard Harter
- Efficient Vector Comparison
- Prev by Date: Re: The software I wish I had
- Next by Date: Re: Efficient Vector Comparison
- Previous by thread: Re: Efficient Vector Comparison
- Next by thread: Re: Efficient Vector Comparison
- Index(es):
Relevant Pages
|