All Questions
24 questions
6
votes
1
answer
264
views
C++ Eigen/Mex function to perform two pagewise convolutions on a 3D matrix with a simple kernel
I am trying to accelerate an algorithm where I am computing a 2D variance of many complex matrices stored as pages of a 3D array in Matlab. My implementation uses a Mex function with the C++ Matlab ...
1
vote
0
answers
80
views
S_n covariance calculation function
I am trying to understand the estimator proposed in ["Multidimensional outlier detection and robust estimation using Sn covariance"][1]. I wrote the code in a basic line-by-line form which ...
3
votes
1
answer
423
views
Cosine similarity calculation in Rust, which is slower than NumPy
I'm running this in release mode. Currently, the following function takes around 6.7 seconds to run on my computer vs 3.7 seconds on Python. I know that Numpy is just calling to C, but I'm trying to ...
4
votes
1
answer
207
views
Parallel 3D Discrete Cosine Transformation Implementation in Matlab
I am trying to implement 3D Discrete Cosine Transformation calculation in Matlab with parallel computing parfor. The formula of 3D Discrete Cosine Transformation is ...
2
votes
3
answers
407
views
How can I optimize my Von Neumann neighborhood algorithm?
I am working on a small project that requires finding Von Neumann neighborhoods in a matrix. Basically, whenever there is a positive value in the array, I want to get the neighborhood for that value. ...
5
votes
1
answer
142
views
Naive Solver of Matrix with Periodic Boundary Conditions Feedback
I am creating an \$O(n)\$ solver for an \$Ax = b\$ system where \$A\$ has the form
\$
A = \begin{pmatrix}
a_1 & b_1 &&&d_{u}\\ c_1 & a_2 & b_2\\& \ddots & \ddots &...
5
votes
2
answers
495
views
A Matrix Library in C++;
I have written a Matrix library that contains all the main properties of matrices.
It's a relatively long project, I am hoping it is ok to post here since I really want to have it reviewed.
The ...
4
votes
1
answer
2k
views
Matrix Transpose in Golang
I have write a normal programm "Transpose the matrix" in go. Suppose input are always correct. I also read the article An Efficient Matrix Transpose in CUDA C/C++. So I keen to know how I can use Go-...
3
votes
1
answer
469
views
Transposing a square matrix (n x n)
I wish to transpose a square matrix, permanently overwriting it.
This is not the same as creating a 2nd matrix with the transposed contents of the 1st matrix.
I call the procedure with 3 parameters: ...
4
votes
1
answer
2k
views
Cache-optimized matrix multiplication algorithm in C
I am trying to optimize matrix multiplication on a single processor by optimizing cache use. I am implemented a block multiplication and used some loop unrolling, but I'm at a loss on how to optimize ...
5
votes
1
answer
4k
views
Determinant using Gauss Elimination
We had a question in examination to compute determinant of general square matrix.
Now I had made the normal program using Laplace Formula of determinant, ie, recursive solution.
Now I was thinking of ...
2
votes
1
answer
548
views
Solution to 90 degree rotation of an NxN matrix
The idea is picked up from here and the following is my PHP implementation of it. As it mentions, 90 degree matrix rotation basically shifts columns into rows. For example:
...
2
votes
1
answer
153
views
Competition - Qualifications - E - Matrix distance
2 types of query:
add value to x y
output the sum of \$value*(|a - x|+|b-y|)\$ for every pair(a, b, v).
In the start you are given \$n\$ (number of querys), \$m\$ (maximal dimension for square matrix)...
1
vote
1
answer
552
views
Map square coordinates in matrix to flat array indices without hurting performance
I'm more like playing and the problem I'm going to demonstrate is a learning task, so to speak, not something I really need to solve.
Imagine having a matrix of data. You chose square in it and ...
7
votes
2
answers
2k
views
Computing sum on column + sum on row + sum on each diagonal
I have the following problem:
I read from a file the dimension(n) of the matrix(which is n * n) and the matrix.
For each element ...