Questions tagged [matrix-multiplication]
Questions related to matrix multiplication, especially implementation. Mathematical questions should consider the [linear-algebra] tag.
matrix-multiplication
2,989
questions
-2
votes
0
answers
46
views
rotating image using webGL in a wide canvas
i am developing a web app that will be able to do some image transformations one of them is image rotation, the problem is: as long as the canvas is square ( width = height ) every thing is ok, but ...
0
votes
0
answers
14
views
PyTorch & DGL Matrix Multiplication Error: "mat1 and mat2 shapes cannot be multiplied (1x4581 and 1x4581)"
My code to train the ML model is as follows:
import dgl
from dgl.nn import GraphConv
import torch
import torch.nn as nn
import torch.nn.functional as F
class GCN(nn.Module):
def __init__(self, ...
-1
votes
1
answer
77
views
NumPy successive matrix multiplication vectorization [duplicate]
I have a NumPy array ar of shape (M, L, 2, 2). M is usually in the hundreds or thousands, L is usually <= 5.
I want to multiply the L (N, N) matrices successively (multiplied_ar[m] = ar[m, 0, :, :] ...
0
votes
0
answers
11
views
Get Transformed Box Coordinates in Javascript (getBoxQuads)
I've created a polyfill for the getBoxQuads API (https://hacks.mozilla.org/2014/03/introducing-the-getboxquads-api/), but it does not work if I use transform in css with perspective in it. (see my ...
2
votes
5
answers
73
views
How do I generate a matrix which shows if pairs of elements in a vector are equal
I have a vector in which elements are assigned as either 1 or 0
For example
V1 <- c(1,0,1,1,0)
I want to generate a matrix M of size V1 x V1 in which each element is coded 1 if the values of the ...
0
votes
0
answers
31
views
element by element matrix multiplication on polyBasis- MATLAB
on MATLAB I am trying to use polyBasis on a bunch of vector matrices, but i want to require that all multiplication is element by element. is this possible, if so, how? specifically, i have this
V = ...
0
votes
0
answers
59
views
Incorrect Matrix Multiplication Not Producing Segmentation Fault
I am working on homework assignment 1 for the Performance Engineering of Software Systems course on MIT OCW. The assignment involves debugging some C code designed to multiply matrices. Matrices are ...
1
vote
1
answer
90
views
Matrix multiplication on Python to find a polynomial
I wish to find a method to multiply matrices (with other matrices and vectors) whose elements contain polynomial expressions and to obtain the final results in polynomial format.
I have a 10 by 10 ...
1
vote
1
answer
146
views
Why is the computation speed of double in the Eigen library 3 times faster than that of float?
Here is my code. I created a set of matrix and vector multiplications using double type, and another set using float type. Both sets of multiplications are executed 3 million times in a for loop, and ...
0
votes
0
answers
73
views
CUDA memory access analysis confusion for naive matrix multiplication
Consider the following matrix multiply kernel:
__global__ void mmNaive(int numArows, int numBCols, int Width, float** A, float** B, float* C) {
int tx = threadIdx.x;
int ty = threadIdx.y;
...
1
vote
1
answer
38
views
How is nn.Linear applied to a higher dimensional data?
I'm trying to understand what values are being multiplied when I have higher dimensional tensors:
inp = torch.rand(1,2,3) # B,C,W
linear = nn.Linear(3,4)
out = linear(inp)
print(out.shape)
>>>...
-1
votes
1
answer
42
views
numpy.dot function and by-hand calculation
I am working on calculating pcov from a Jacobian matrix by hand, and understand most of it but am struggling to understand how the .dot function works from numpy in python. I have looked at the manual ...
1
vote
1
answer
40
views
Why is Flax Linear layer not identical to matrix multiplication?
Due to the novelty of Flax, NNX, and JAX, there’s not a lot of resources available. I’m running into the following peculiarity:
x = jnp.random.normal((1,512), key=KEY)
layer = nnx.Linear(512, 512, ...
1
vote
0
answers
34
views
Matrix multiplication with 2nd matrix repeated
I'm trying to do matrix multiplication in torch. It goes like this
Operation 1
Shape of A -> 1,384
Shape of B -> 384,39000
Output shape -> 1, 39000
Shape of A -> 10,384
Shape of B -> ...
0
votes
0
answers
17
views
What algorithm will perform this matrix decomposition?
I am new to the algorithms of matrix decomposition and I am looking for a way to perform it on this matrix (see Fig 1).
I would like one of the factors to be a particular matrix (see Fig 2), and I do ...