Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help with matrixes access

Status
Not open for further replies.

ghostridergr

Member level 1
Member level 1
Joined
Nov 22, 2011
Messages
41
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,590
Hello, i need your help.

The probelm is this: i have lets say 2 matrixes with data, the first one to have N rows and the second one M rows. what i want is for every row of the first matrix apply a function for every row of the second, then move on the next row of the first matrix and apply the function to all the rows of the second and so on. The problem is if i do it in that way it's not quite effective cause i end up reading same values more then one (i read each row of the second matrix N times) , Can anyone suggest me how can o do it faster and effective in what i use (memory, hardware whatever)?

the equivalent pseudo-code in C will look like this:

for (i=1;i<N, i++)
for (j=1<j<M;j++)
f(i,j) //where the arguments are whole rows
end
end
 

You could trade memory for time by traversing the first matrix and compiling the "functions" being applied to each row. Once you have an aggregate of functions in a new vector (single row), you apply that vector to each row of M. Thereby traversing each matrix only once.

You didn't define what each "function" was, so I'm not sure if this is possible to implement.
 

you dont define where you're trying to implement this. FPGA, DSP, VHDL, Verilog?
 

well i want to do this: compute the min of the sum of square difference...

for example, if matrix A is [a b ; c d] and matrix B is [e f ; g h] i want to do this:
for row [a b] find s1=(a-e)^2 + (b-f)^2, s2=(a-g)^2 + (b-h)^2 and then find the minimum of s1,s2.. then go to the next row and so on...

first of all i will implement on vhdl and see thats is is working, and my code is synthesizable on FPGA. I am working on it.. But i want to start thinking from now the next step that requires to fasten it.. I think i have to use some techniques i learned in my Computer Architectyre lesson sush as blocking, but i am a bit confused on how i wiil do it.. In my opinion, one problem is that the row [e f] must be read twice (N times, where N the number of rows of matrix A).
 

you're thinking too much like a software programmer. You can access the elements as many times as you like and in parrallel.
Show us what code you have so far.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top