Sunday March 8, 2009
The SquareDeal problem challenges students to correctly code a mathematically-oriented problem efficiently.
One of the typical tasks facing a computational scientist is writing code and porting code. The prime directive is to ensure the integrity of the computation. Of secondary, but almost equal importance is to ensure the resultant code executes as fast as needed. These are the directives under which you must operate.

As is typical the problem facing you may be expressed in a mixed manner, requiring indirectly referenced knowledge. With this problem, you will need to understand linear algebraic language and comprehend an algorithm expressed in both the programming language C and in the language of science: mathematics.

You are to code a program to represent a matrix and then multiply it times itself.

Problem Description:

Run the folowing problem and report on the result you obtain.

Square the following square matrix S. Each element of the 52x52 matrix with s(i,j) is defined by the following C code:

int s(int i, int j)
{
int a, b;
a = i < j? j-i : i-j;
b = (a + 51) / 52;
return (1-b)*A(a,a);
}

where
(n+1),if m = 0
A(m,n) =A(m-1, 1),if m > 0 and n = 0;
A(m-1, A(m-1,n-1)),if m > 0 and n > 0


Notes:
The topics of matrix multiplication and recursion play a large role in this problem. If you are unfamiliar with either of these, respective tutorials can be found at http://mathworld.wolfram.com/Matrix.html and at http://www.doc.ic.ac.uk/~wjk/C++Intro/RobMillerL8.html.
Show solution
Challenge Resources:
©1994-2014   |   Shodor   |   Privacy Policy   |   NSDL   |   XSEDE   |   Blue Waters   |   ACM SIGHPC   |   facebook  |   facebook   |   twitter   |   rss   |   youtube Not Logged In. Login