0

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})

3
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by sarehu
0

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.

0

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 "*".

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.