How to multiply Matrix and Vector?
See original GitHub issuevar bArray = new Entity[size];
Array.Fill(bArray, Entity.Number.Integer.One);
var bVector = MathS.Matrices.Vector(bArray);
for (int i = 0; i < 10000; i++)
{
var product = MathS.Matrices.ScalarProduct(bVector, bVector);
var normedVector = (bVector / MathS.Sqrt(product)).EvalTensor();
var vector = MatrixVectorMultiplication(tensor, normedVector);
bVector = vector;
}
I see no way to implement MatrixVectorMultiplication
(N*M x M*1 = N*1
), except for manual row iteration and dot products. I tried overriden operator*
and TensorVectorDotProduct
, both are inapplicable (unless I create a copy of the vector as matrix with 1 column). I’d expect both GenericTensor and AngouriMath to support such basic operation.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Multiplying matrices and vectors
Although it may look confusing at first, the process of matrix-vector multiplication is actually quite simple. One takes the dot product of x...
Read more >Multiplying a Vector by a Matrix
Let us define the multiplication between a matrix A and a vector x in which the number of columns in A equals the...
Read more >Matrix-vector multiplication
As a “row-wise”, vector-generating process: Matrix-vector multiplication defines a process for creating a new vector using an existing vector ...
Read more >Matrix-Vector Multiplication
We can only multiply an m × n matrix by a vector in Rn. That is, in Ax the matrix must have as...
Read more >Matrix multiplication
In mathematics, particularly in linear algebra, matrix multiplication is a binary operation that produces a matrix from two matrices.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In case you missed, the new version is published. Wiki for it is here.
Now you can create matrices and vectors in a more convenient way, as well as work with them. Say,
To perform scalar product of two vectors, simply transpose one of them
P. S. These updates will be relevant since 1.3-preview.2. But they’re already on the master branch