Hi friends,
I am a final year Mechanical Student and I am doing my Final year project in C++. My project requires some complicated programming in C++..
Here are the details.
Initially I need to create a random matrix.
The user will give the no of rows and columns.
For example, if the user gives no of rows as 5 and no of columns as 5, the program must randomly generate 5*5 matrix.
Also the numbers must range from 0 to 1.5 only.. All are decimal numbers..
For example, if it is a 5*5 matrix, all 25 numbers should not be non zero. Almost 15 or 16 numbers should be zero. The rest of the non zero numbers should be dispersed such that no row contains all numbers as zeros..
This must work out for any number of row or column..
Next step is even more difficult.
The program must shuffle the rows and columns of this matrix and obtain 10 new matrices..
The initial matrix should be rearranged randomly to give these 10 matrices.
After this I have to apply PSO algorithm to these matrices. But that is only after this program.
Please Help friends.
Thank You.
Recommended Answers
Jump to PostI think the stl container template, std::vector<T> will help you with the dynamic allocation, and the STL algorithm std::random_shuffle() will help you obtain new matrices--as for the random number generation, if you have C++0x TR1 support on your compiler, you can use the new random number generation facilities which includes …
Jump to PostYou have not specified the problem fully enough to make it possible to think about how to solve it.
For example, first you say that the program should randomly generate 25 numbers, and then you say that "almost 15 or 16 numbers" (whatever that means) should be zero.
…
Jump to PostHave you written any code yet? If so, what do you have? It would be a good idea for you to share the relevant sections of it.
From an educational standpoint, it is better for you if you let us see it and discuss it with you and/or …
All 10 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.