Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 14th, 2011, 8:47 PM   #1
rainbow9
Banned
 
Join Date: Jul 2011
Posts: 1
Rep Power: 0 rainbow9 is on a distinguished road
Post How to Perform Matrix Addition in C

As a C Programmer ,you need to deal with data structures likes an array.Programmers often needs to use a Multidimensional array in the form of matrix to do mathematical.Calculations.The Program Demonstrates how to Add any two matrices together and obtain the result in a new Matrix

The Core Operation performed here is C[i][j]=A[i][j]+B[i][j]

ie:Elements from two Multidimensional array are added in an order and placed in a new Multidimensional array.
You can get the complete source code from http://c-madeeasy.blogspot.com/2011/...-adding-2.html
rainbow9 is offline   Reply With Quote
Old Jul 15th, 2011, 12:03 AM   #2
sixstringartist
Programming Guru

 
Join Date: Jun 2005
Posts: 1,333
Rep Power: 13 sixstringartist will become famous soon enough
Re: How to Perform Matrix Addition in C

Is this meant to be an informational post? If so I suggest looking into more efficient algorithms. Large matrix operations are prone to causing cache thrashing and while the straightforward method works, it is not recommended.
sixstringartist is offline   Reply With Quote
Old Jul 24th, 2011, 12:36 PM   #3
th3d4rkl0rd
Newbie
 
Join Date: Jul 2011
Posts: 1
Rep Power: 0 th3d4rkl0rd is on a distinguished road
Re: How to Perform Matrix Addition in C

I've created my own library for matrix operations. i think that will be somewhat efficient.
http://niralaakam.blogspot.com/2011/...n-using-c.html
__________________
Vanangamudi
My Programming Blog
th3d4rkl0rd is offline   Reply With Quote
Old Jul 25th, 2011, 12:09 PM   #4
sixstringartist
Programming Guru

 
Join Date: Jun 2005
Posts: 1,333
Rep Power: 13 sixstringartist will become famous soon enough
Re: How to Perform Matrix Addition in C

Efficiency is relative to the problem at hand. For matrix operations, specifically a matrix mult, the baseline for efficiency is the most straightforward way to solve the problem. i.e. iterate through each column/row and perform the multiplication. For simple calculation this does the trick. But when you're dealing with large arrays as matrices often are, you will incur a lot of cache misses. There are much better ways of doing matrix multiplies to take advantage of spatial locality and limit your working set to fit into cache.

http://en.wikipedia.org/wiki/Strassen_algorithm
sixstringartist is offline   Reply With Quote
Reply

Bookmarks

Tags
add, matrices, matrix, operations, programming, sum, tc

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
matrix calculator. need help! i have no idea where to start rax_7 C++ 2 Oct 11th, 2010 3:16 PM
Another path matrix question. gammaman Software Design and Algorithms 6 Mar 24th, 2009 10:47 AM
Matrix Class ... Operator Problem Planet_EN C++ 10 Dec 6th, 2005 12:58 AM
Program which computes the determinant of an n x n matrix grimpirate C 4 Sep 14th, 2005 3:24 AM
Bizarre TI-89 matrix algebra error (not language specific) Generic Other Scripting Languages 0 Sep 7th, 2005 8:16 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:21 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC