• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Matrix Determinant using Thread

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello to everyone,

I know that can be a stupid question, but i kindly ask you if you have a code for matrix multiplication with thread. My problem is that i need to generate n thread one for each cells of the matrix result.

This is the function that i had produce, it works but it doesn't do what i need



Anyone can help me please? I know that probably i ll have less fast of the program, but it is an exercise.

Thanks a lot for your cooperation and looking forward into your answer

best Regards
 
Lionel Rossi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I've got a big problem for calculate matrix determinant using thread, is anyone have a code that can pass me for see in which way i can use thread for resolve this problem?

Best Regards
 
Bartender
Posts: 15741
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lionel, welcome to CodeRanch!

We don't hand out solutions here, but try to help you to get it on your own. I see you already made a topic about this that contains code, so I merged those two topics.
 
Stephan van Hulst
Bartender
Posts: 15741
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you explain to us what the problem is that you're experiencing? We can't help you if we don't know what's wrong.
 
Lionel Rossi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Can you explain to us what the problem is that you're experiencing? We can't help you if we don't know what's wrong.



I've got two different problems:

1) I need to create a software for calculate the product of two matrix in which i need to use n thread one for each cells of the matrix result (For this problem i posted a code that calculate the product of matrix but not using n thread for each cells of the matrix result)
2) I need to create a software for calculate the determinant of the matrix using thread (I don't have any idea to how to create a software that do this)

 
Marshal
Posts: 80649
475
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch (again)

Why do you say you need several threads?
What is the algorithm for calculating a matrix determinant?
 
Lionel Rossi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Welcome to the Ranch (again)

Why do you say you need several threads?
What is the algorithm for calculating a matrix determinant?



Hi Campbell,

1) For the first point (Product of Matrix) it is the exercise that impose me to use n thread one for each cells i know that is not a good solution but i must do it
2) For calculate the matrix determinant i think that first i need to check the dimension of the matrix (If is 2x2 is simply). For matrix that have a dimension bigger than 2x2 i need to calculate minor complementary so for each step i need to eliminate one row and one column
 
Stephan van Hulst
Bartender
Posts: 15741
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, so before you start working with threads, why don't you start by creating a Matrix class that models a single matrix, which contains a multiply(Matrix other) method that returns a new Matrix. You should also add a method determinant() that returns an int.

Try getting this code to work (hint, use unit tests!) and then show us your code, or show us where you get stranded with an explanation of the problem. Don't worry about threads yet!
 
Lionel Rossi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:Okay, so before you start working with threads, why don't you start by creating a Matrix class that models a single matrix, which contains a multiply(Matrix other) method that returns a new Matrix. You should also add a method determinant() that returns an int.

Try getting this code to work (hint, use unit tests!) and then show us your code, or show us where you get stranded with an explanation of the problem. Don't worry about threads yet!



I just finish the code of Matrix product



I don't have no idea to how implement the method of determinant
 
Stephan van Hulst
Bartender
Posts: 15741
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Like I said, you will benefit from implementing a Matrix class with some simple operations on it:
 
Lionel Rossi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your help! I understood what did you told to me

Maybe at the moment i'm looking only for write the correct methods that works without think about the correct way in which i need to write software but i've got exam in these days on Java and i must clear all doubt if i want pass. Then next week i ll start to write good code for the final test (I ll create a programm with all UML diagram).

Best Regards
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic