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

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.

Does your linear algebra text book describe a "less than" operation?

No.

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.