| |||||||||||
JAVA_Problem Posted by poutchi1 (poutchi1), 14 April 2005 Hi all, my knowledge of java language isnt great, so would appricviete it if any of you could help me out with this problem as soon as possible . im trying to propose an application java multi process (threads) implementing the algorithm of the calculation of the "standard line" of a matrix A and B. This standard line called Z and its defined by : z=?C? or C=A*B; A=(a ik)//ik are the indices of matrix A. B = (B kj)// kj are the indices of the matrix B. C = (C ij)// ij are the indices of the matrix C. ij = ?a (ik) * B (kj)// K of 1 A p. D (i) = ??C (ij) ? J of 1 A m. Z = max (D (I))// I of 1 A N. N, m, p, A, B should be read I have been given this methode that im trying to use , but i am still not sure how to impliment it ( so, will need help with that): steps are: To calculate "Z" of a matrix C how its: 1- C is calculated from the product of A and B 2- make the sum of each line of the matrix C and put it in tables named D. 3- from there take the maximum of this table and the max of D it is standard Z of the matrix B the indication to be added in relation to the java language 1 in the program will use 3 threads that we call: T1, T2, T3. ** the first thread T1 will carry out the product of both matrix A and B. ** the second thread T2 makes the sum of the lines of the matrix C. ** the third thread T3 will do the maximum of tables D. 2 if the matrix C result of product A and B has a dimension of (n*m) and for precise parallelism we will make of the first thread (n*m) other thread each will deal with the product of only one element of the matrix C. i.e. if have a matrix C of (4*4) we will have 16 threads created of the first thread T1, the 16 thrads each will make the product of only one element of the matrix C. 3-Entering matrix A and B will not be done using the interface in javas but its the console which will deal with entering them i.e. it is the computer which gives the values of the two matrices in a random way by using the methods randome "for(int I = 0; I < N; i++ for(int J = 0; J < m; j++) A[i][j ] = Math.random(); initialization of matrix A. for(int I = 0; I < N; i++) For(int j=0;j<m;j++) B[i][j ] = Math.random(); initialization of the matrix B "and the dimensions used will be " int N = A.length; "for the lines and int m = A[0].length;for the columns. we enter them and use for example "system.in.readln(n)" and "system.in.readln(m)". 4- after having implemented the methods run() and start() of the three thread we add the key word (synchroniserd) for the 3 threads since thread T2 cannot work except if it has the elements from the first thread T1 and similarly for the third thread T3. NOTES: - do not use the method stop() for the 3 threads notices - matriecs A and B are created and of same dimension.(n*m) . Sorry for such a long problem, but really need help . THANKS IN ADVANCE Posted by admin (Graham Ellis), 14 April 2005 Hello and welcome.I notice you say "as soon as possible". Do have a look at our FAQ and assistance with these boards - I say that I'll attempt to get back within 24 hours and, as a free service, you really shouldn't expect / request anything better but I'll see what I can do. Long question though, so it may take a bit longer. Posted by admin (Graham Ellis), 14 April 2005 See my further reply on the Java board where this was cross-posted. That's the right place for it, so I'm locking this thread.This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |