Basic Operations
Vector Equality
Vector Addition
In other words, the vectors are added element-wise, yielding a new vector of the same size.
Geometric Interpretation
Vector Scaling
Vector Subtraction
Geometric Interpretation
Scaled Vector Addition
It is often referred to as the AXPY
operation, which stands for alpha times x plus y. We emphasize that it is typically used in situations where the output vector overwrites the input vector y.
Counting Flops & Memops
Consider the following scaled vector addition:
Now, imagine all the data for this scaled vector addition starts by being stored in the main memory of a computer. Further, in order to compute, data must be brought into registers and there are only a few registers available.
Now, we know that the scaling factor 2 in the above example is going to be used many times. So, we store it in a register and keep it there during the entire computation. This costs us 1 memory operation (memops).
Vector Function
A vector (valued) function is a mathematical function of one or more scalars and/or vectors whose output is a vector.
For example,
Another example can be,
The AXPY
and DOT
operations are also examples of vector functions.
Vector Functions That Map a Vector to a Vector
We will now focus on vector functions as functions that map a vector to another vector:
For example,
Another example can be,
Do note the following:
Matrix Product
For given matrices A and B, their product is given by:
Hadamard Product
Hadamard product is element-wise multiplication. Following equations provide details of how the this product operation is calculated for given matrices A and B:
Dot (Inner) Product
The dot (inner) product between two vectors a and b is given by:
Alternatively,
Cost
Transpose
The transpose of a matrix A is given by:
Inverse
The following equation provides the deifnition of inverse of a matrix:
Not all square matrices have an inverse.
For such cases, and non-square matrices, "pseudoinverse" is defined.
Last updated