matrix-multiplication Questions

3

Solved

I have a program whose main performance bottleneck involves multiplying matrices which have one dimension of size 1 and another large dimension, e.g. 1000: large_dimension = 1000 a = np.random.ran...
Psia asked 23/4, 2021 at 12:39

3

Solved

I've been using GPU for a while without questioning it but now I'm curious. Why can GPU do matrix multiplication much faster than CPU? Is it because of parallel processing? But I didn't write any...

1

I want to perform the following least squares minimization problem in python using cvxpy: import numpy as np import cvxpy as cp # Generate the data m = 20 n = 15 A = np.random.randn(m, n+2) b = np...
Arakawa asked 12/2, 2021 at 1:45

3

Solved

I'm wondering what the most compact and efficient way to multiple 2 double[][] arrays matrices using streams. The approach should follow matrix multiplication rules as illustrated here: Matrix Mult...
Incarnation asked 13/1, 2016 at 18:32

2

Solved

I am trying to parallelize the multiplication of two matrix A,B. Unfortunately the serial implementation is still faster than the parallel one or the speedup is too low. (with matrix dimension = 51...
Clairclairaudience asked 25/11, 2020 at 14:54

2

Solved

I need to multiply two boolean matrices in Julia. Doing simply A*A or A^2 returns an Int64 Matrix. Is there a way how to multiply efficiently boolean matrices?
Polybasite asked 21/11, 2020 at 2:15

3

I am struggling a bit trying to figure out if it is possible to create a single combined gesture recognizer that combines UIPinchGestureRecognizer with UIPanGestureRecognizer. I am using pan for v...

3

Solved

I am struggling with an issue to fit pragmatically transformed SVG element into the given rect bounds. Destination rect is given and not transformed. Input rect has any type of transformations. In...
Underwater asked 14/9, 2020 at 9:5

2

Solved

I want to do the element-wise outer product of two 2d arrays in numpy. A.shape = (100, 3) # A numpy ndarray B.shape = (100, 5) # A numpy ndarray C = element_wise_outer_product(A, B) # A function ...

3

I understand that the algorithm uses 8 multiplications and 4 additions with time-complexity: The multiplication is done on every n/2 * n/2 matrices. I have few questions on this : Does every n...
Intolerance asked 14/7, 2016 at 7:55

3

Solved

In R, matrix multiplication is very optimized, i.e. is really just a call to BLAS/LAPACK. However, I'm surprised this very naive C++ code for matrix-vector multiplication seems reliably 30% faster....
Overlarge asked 27/6, 2018 at 3:41

5

Solved

I have been playing around with numba and numexpr trying to speed up a simple element-wise matrix multiplication. I have not been able to get better results, they both are basically (speedwise) equ...

4

Solved

With numpy, I can do a simple matrix multiplication like this: a = numpy.ones((3, 2)) b = numpy.ones((2, 1)) result = a.dot(b) However, this does not work with PyTorch: a = torch.ones((3, 2)) b = ...
Incriminate asked 13/6, 2017 at 14:50

4

Solved

Say we have a single channel image (5x5) A = [ 1 2 3 4 5 6 7 8 9 2 1 4 5 6 3 4 5 6 7 4 3 4 5 6 2 ] And a filter K (2x2) K = [ 1 1 1 1 ] An example of applying convolution (let us take th...
Admittedly asked 8/5, 2016 at 3:3

6

Solved

I recently moved to Python 3.5 and noticed the new matrix multiplication operator (@) sometimes behaves differently from the numpy dot operator. In example, for 3d arrays: import numpy as np a = ...
Ellerey asked 7/12, 2015 at 20:23

2

Solved

I need to invert a large, dense matrix which I hoped to use Scipy's gmres to do. Fortunately, the dense matrix A follows a pattern and I do not need to store the matrix in memory. The LinearOperato...
Uhlan asked 27/11, 2013 at 17:51

7

I'm trying to create a Java program with threads for matrix multiplication. This is the source code: import java.util.Random; public class MatrixTest { //Creating the matrix static int[][] mat =...

3

Solved

I need to multiply a matrix A with n matrices, and get n matrices back. For example, multiply a 2x2 matrix with 3 2x2 matrices stacked as a 2x2x3 Matlab array. bsxfun is what I usually use for such...
Cindacindee asked 13/1, 2014 at 10:20

2

Solved

I'm so far out of my league on this one, so I'm hoping someone can point me in the right direction. I think this is an optimization problem, but I have been confused by scipy.optimize and how it fi...
Straphanger asked 9/4, 2020 at 16:35

1

Solved

Hello I am trying to run the example from here: http://rtutorial.altervista.org/lp_solvers.html A snippet and test where it goes wrong: library(CVXR) #create Variable objects that can be manipula...
Briefcase asked 29/3, 2020 at 3:42

4

Solved

I need to take the matrix product of two NumPy matrices (or other 2d arrays) containing log probabilities. The naive way np.log(np.dot(np.exp(a), np.exp(b))) is not preferred for obvious reasons. ...
Splasher asked 13/5, 2014 at 11:40

1

I am new to tensor quantization, and tried doing something as simple as import torch x = torch.rand(10, 3) y = torch.rand(10, 3) [email protected] with PyTorch quantized tensors running on C...
Uncertainty asked 20/2, 2020 at 17:53

3

Solved

My problem is the following, I have an iterative algorithm such that at each iteration it needs to perform several matrix-matrix multiplications dot(A_i, B_i), for i = 1 ... k. Since these multipli...
Apology asked 15/12, 2019 at 20:28

3

Solved

I am trying to multiply two columns (ActualSalary * FTE) within the dataframe (OPR) to create a new column (FTESalary), but somehow it has stopped at row 21357, I don't understand what went wrong o...
Imitable asked 12/12, 2019 at 23:39

2

Solved

I have a dataframe which looks a bit as produced by the following code (but much larger) set.seed(10) mat <- matrix(rbinom(200, size=1, prob = .5), ncol = 10) In the columns are issues and 1...
Thorr asked 30/10, 2019 at 10:48

© 2022 - 2024 — McMap. All rights reserved.