By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,906 Members | 1,416 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,906 IT Pros & Developers. It's quick & easy.

Multiply, and add matrix with memory allocation

P: 2
Can You tell me, the alogarithm of multiply n add matrix with "malloc" or "memory allocation" ??....please help me...:(
May 30 '07 #1
Share this Question
Share on Google+
3 Replies


sicarie
Expert Mod 2.5K+
P: 4,677
Can You tell me, the alogarithm of multiply n add matrix with "malloc" or "memory allocation" ??....please help me...:(
I don't understand your question - malloc reserves memory space, it does not do addition/multiplication... Maybe your assignment asks for a multiply and add matrix, but also requests you use malloc to allocate the space for the matrix?

(PS - if I'm wrong, please don't hesitate to point it out - I haven't had my coffee yet, I might be missing something.)
May 30 '07 #2

P: 2
I mean, can u give me the alogarithm of addition n multiply of matrix, that user can give input size of matrix n user can create some matrix.
That matrix can be saved in memory n suddenly it can be accsess...
Jun 3 '07 #3

sicarie
Expert Mod 2.5K+
P: 4,677
I mean, can u give me the alogarithm of addition n multiply of matrix, that user can give input size of matrix n user can create some matrix.
That matrix can be saved in memory n suddenly it can be accsess...
Well, creation of the algorithm is pretty easy - you have two steps, so you're either going to have two functions (one for add, one for multiply), or you are going to do them sequentially. So knowing this, you can then write down the steps to fully add or multiply a matrix. (I'm not sure what the exact method is for each, but i'm sure you could Google "matrix addition" or "matrix multiplication" and figure them out pretty easily. From there, just make it into pseudocode (try to implement a loop or function for the parts that are repeated), and you have it.

If you come back with code or specific questions we can try to help you more, but we cannot just "give you" the answers. That should get you started anyway.
Jun 3 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.