vector (1xm array) comparisons

Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
Reply

Join Date: Sep 2007
Posts: 12
Reputation: drichird is an unknown quantity at this point 
Solved Threads: 0
drichird drichird is offline Offline
Newbie Poster

vector (1xm array) comparisons

 
0
  #1
Apr 22nd, 2008
In linear algebra a 1 by m array of (let's say integers) can be considered a vector (row or column). Given 2 row vectors of the same size, can they be compared using <,> ? If so, what relation between individual elements in the arrays is required for "less than" to be true?

Is vector {2,3,3} < vector {2,3,4}...

...or does every element have to be less (i.e. {1,2,3} < {2,3,4} but not so for {2,3,3})
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: vector (1xm array) comparisons

 
0
  #2
Apr 23rd, 2008
Does your linear algebra text book describe a "less than" operation?

If so, then it would be perfectly possible to write some code to do the same thing.

Now whether std::vector implements that or not is for you to research, or maybe you can implement your own vector class.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 269
Reputation: sarehu is on a distinguished road 
Solved Threads: 22
sarehu's Avatar
sarehu sarehu is offline Offline
Posting Whiz in Training

Re: vector (1xm array) comparisons

 
0
  #3
Apr 23rd, 2008
Originally Posted by Salem View Post
Does your linear algebra text book describe a "less than" operation?
No.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 12
Reputation: drichird is an unknown quantity at this point 
Solved Threads: 0
drichird drichird is offline Offline
Newbie Poster

Re: vector (1xm array) comparisons

 
0
  #4
Apr 23rd, 2008
Originally Posted by Salem View Post
Does your linear algebra text book describe a "less than" operation?

If so, then it would be perfectly possible to write some code to do the same thing.

Now whether std::vector implements that or not is for you to research, or maybe you can implement your own vector class.
I had not thought of looking at C++ vector class, that was a good point. It would appear std::vector supports comparisons on a lexicographic basis, in which cas {2,3,3} is less than {2,3,4}. That's fine, but what I was really wondering is not how to implement comparisons programatically but if "<" or ">" are defined (for row/column vectors) from a mathematical, linear algebra standpoint. I don't think so, I don't see anything in any books I have. They only talk about "=", "+", "-", and "*".
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 269
Reputation: sarehu is on a distinguished road 
Solved Threads: 22
sarehu's Avatar
sarehu sarehu is offline Offline
Posting Whiz in Training

Re: vector (1xm array) comparisons

 
0
  #5
Apr 23rd, 2008
There are no standard mathematical definitions for the comparison of vectors. You could compare properties of vectors -- by 'property' I mean functions that take vectors and produce real numbers. You could compare vectors' lengths, their first coordinates, etc.

The thing is, as long as you're measuring a property represented by a continuous function, you're going to have vectors that compare equally (for example, if their lengths are equal). There are also some comparison functions that don't correspond to any 'property' that can be measured by real numbers. Lexicographical ordering would be one of these.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Computer Science Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC