answersLogoWhite

0

AllQ&AStudy Guides
Best answer

In mathematics a vector is just a one-dimensional series of numbers. If the vector is written horizontally then it is a row vector; if it's written vertically then it's a column vector.

Whether a vector is a row or a column becomes significant usually only if it is to figure in multiplication involving a matrix. A matrix of m rows with n columns, M, can multiply a column vector, c, of m rows, on the left but not on the right.

That is, one can perform Mv but not vM. The opposite would be true for a row vector, v, with 1 row and m columns.

This answer is:
Related answers

In mathematics a vector is just a one-dimensional series of numbers. If the vector is written horizontally then it is a row vector; if it's written vertically then it's a column vector.

Whether a vector is a row or a column becomes significant usually only if it is to figure in multiplication involving a matrix. A matrix of m rows with n columns, M, can multiply a column vector, c, of m rows, on the left but not on the right.

That is, one can perform Mv but not vM. The opposite would be true for a row vector, v, with 1 row and m columns.

View page

A scalar is just a number. A vector is a row or column of numbers. For example: 6 is a scalar while (1, 0, 23.5) is a vector.

View page

A horizontal array or a row vector.

View page

It is a three dimension vector : (x, y, z). It could be either a row vector or a column vector.

View page

A matrix row is simply a one-dimensional array, so to compute the largest number in a row we simply computer the largest number in an array:

template<typename T>

T max (const std::vector<T>& numbers) {

T result { numbers.at (0) }; // note: range-checked suffix (throw on error)

for (auto num : numbers) if (num>result) result=num;

return result;

}

To compute the largest number in every row of a matrix, you invoke the previous function for each row in the array, pushing the results onto a new array, with one element per row:

template<typename T>

std::vector<T> max (const std::vector<std::vector<T>>& numbers) {

std::vector<T> result {};

for (auto row : numbers) result.push_back (max (numbers[row]));

return result;

}

Example usage:

#include<vector>

#include<iostream>

int main (void) {

using namespace std;

vector<vector<int>> numbers {{1, 2, 3}, {4, 6, 5}, {9, 8, 7}}; // a 3x3 array

// print vector

for (auto row : numbers) {

cout<<'{';

for (auto num : row) cout<<num<<',';

cout<<"\b}\n"<endl;

}

vector<int> largest { max (numbers) };

// print largest

cout<<"Largest numbers in each row: {";

for (auto num : largest) cout<<num<<"!',';

cout<<"\b}"<<endl;

}

Example output:

{1,2,3}

{4,6,5}

{9,8,7}

Largest numbers in each row: {3,6,9}

View page
Featured study guide

Physics

16 cards

Who is british prime minister in the french and Indian war

The shortest path from a starting point to an endpoint regardless of the path taken is called the

When can the equations of kinematics not be used

The length of a vector arrow represents its

➡️
See all cards
4.2
5 Reviews
More study guides
3.75
4 Reviews

No Reviews
Search results