Skip to main content

All Questions

Tagged with
2 votes
1 answer
89 views

Transpose matrix in ANSI C

Is there a way to transpose a matrix in ANSI C way much better than this ANSI C code? Can I do transpose in a different and ...
euraad's user avatar
  • 183
2 votes
1 answer
123 views

Matrix led 7x10 with arduino

Good afternoon, a few days ago I finished a personal project of a 7x10 led matrix programmed with the ATMEGA328p microcontroller. To control the matrix I use 2 74HC595 shift registers in cascade in ...
Lucio Mazzini's user avatar
4 votes
1 answer
427 views

Need for matrix multiplication speed

I need help to make matrix multiplication in C run as fast as possible. On my AMD Phenom(tm) II X6 1090T, my program multiplies two square singe precision 4096x4096 matrices in about 6.9 seconds. ...
Gaslight Deceive Subvert's user avatar
5 votes
1 answer
81 views

Striping a matrix concentrically, anticlockwise

Given a matrix you shall stripe the matrix, such that every number that has equal distance to the matrix border will be filled into an array. For examples see code comments. ...
TVSuchty's user avatar
  • 595
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 ...
qscott86's user avatar
  • 141
2 votes
0 answers
114 views

CUDA kernel to compare matrix entries, weighted with a pattern

I wonder if it's possible to optimize this code in CUDA. Could I get any hints how to? Equivalent algorithm runs faster in Matlab for me, but there I'm doing matrix operations. Compution I'm not ...
yourstruly's user avatar
6 votes
3 answers
201 views

Finding black cluster size distribution for square grid at different probabilities of black elements (averaged over a certain number of iterations)

Context: I had asked a related question on Stack Overflow. On receiving several helpful hints from the commentators there, I could successfully implement averaging of the size distribution over a ...
user avatar
6 votes
1 answer
581 views

Encryption/decryption by matrix multiplication in C

I need to encrypt and decrypt text, image and video with a program in C with a matrix. My program is working but it's really slow, how can I improve its speed ? specially for the decrypt part. Each ...
Jilu's user avatar
  • 63
5 votes
3 answers
7k views

Matrix Implementation using struct in C

Follow up on this post. I have refactored my code and created a matrix_t struct and implemented various functions to create, delete, modify and perform arithmetic on them. ...
Hungry Blue Dev's user avatar
10 votes
2 answers
17k views

AVX SIMD in matrix multiplication

I have coded the following C function for multiplying two NxN matrices and using AVX vectors to speed up the calculation. It works but the speedup is not what is to be expected(some scalar code is ...
Henrik Ståhlberg's user avatar
9 votes
2 answers
357 views

Implementing a tensor product formula

I would like to use C to implement the following formula: $$\mathbf S(u,v)=\sum_{r=i-p}^{i}\sum_{s=j-q}^{j}N_{r,p}(u)N_{s,q}(v)\mathbf P_{r,s}$$ Namely, $$ \left(N_{i-p,p}(u),\cdots,N_{i,p}(u)\...
xyz's user avatar
  • 227
4 votes
1 answer
1k views

Multiplying square matrix with C pthreads (POSIX threads)

I'm a student, and I'm trying to make the product of two square matrix with some threads in the soup. I've already worked on some fast single-threaded product (with some cache-friendly tricks), and I'...
Dallas's user avatar
  • 43
5 votes
1 answer
135 views

Mean of the squares of differences for a large matrix

I have tried to obtain speed gains by transferring Matlab calculations to C and call it using .mex. My goal is to operate on a matrix \$B\$ which has roughly the dimension 10000x1000 $$ \frac{1}{\...
Phun's user avatar
  • 153
5 votes
1 answer
529 views

Sparse matrix multiplication for billion by billion matrices

I have to do multiplication of two billion by billion sparse matrices (on a CPU), hence any help or hints in optimizing the below given code would be extremely useful. Note: I am only showing the ...
Vineet Yadav's user avatar
4 votes
2 answers
5k views

4x4 Sudoku solver performance

The code is for a 4x4 Sudoku solver. It works fine when there are a small number of unfilled spaces (0's) but when I give the whole matrix input as 0's or so the solver takes a very long time. I need ...
Vishal's user avatar
  • 41

15 30 50 per page