|  |  | 
| Bugzilla Link | 309 | 
| Created on | Oct 18, 2006 10:44 | 
| Resolution | FIXED | 
| Resolved on | Oct 18, 2006 16:36 | 
| Version | 1.00beta | 
| OS | Linux | 
| Architecture | PC | 
Extended Description
The program matmul.sac can not be compiled!
/*****************************************************************************
 *
 * file:   matmul.sac
 *
 * description:
 *
 *   SAC demo program.
 *
 *   This SAC demo program implements matrix multiplication for two matrices
 *   A and B of double precision floating point numbers.
 *
 *   The sizes of A and B are preset as follows:
 *     A is of size SIZE1 x SIZE2, and
 *     B is of size SIZE2 x SIZE3.
 *   These parameters may be set at compile time.
 *
 *   The pragma given in the matmul function forces the compiler to introduce
 *   a blocking of squares containing 32 by 32 elements. Though these numbers
 *   seem to work well on many architectures, it might be worthwhile to vary
 *   them for getting better execution times.
 *
 *   On SUN-SOLARIS systems cc should be used instead of gcc for achieving
 *   much better runtime performance. To do so, specify "-target suncc" as
 *   compiler option!
 *
 *****************************************************************************/
#ifndef SIZE1
#define SIZE1 1024
#endif
#ifndef SIZE2
#define SIZE2 1024
#endif
#ifndef SIZE3
#define SIZE3 1024
#endif
use Array:all;
use SimplePrint:all;
inline
double[.,.] transpose( double[.,.] A)
{
  res = with( . <= [i,j] <= .) {
       } genarray( [shape(A)[[1]], shape(A)[[0]]], A[[j,i]], 0d);
  return( res);
}
double[.,.] matmul( double[.,.] A, double[.,.] B)
{
  sa = shape(A);
  sb = shape(B);
  B = reshape( [sa[[1]], sb[[1]]], B);
  BT = transpose( B);
  C = #pragma wlcomp BvL0( [16,16], Default) 
      with ( . <= [i,j] <= .)
      genarray( [ sa[[0]], sb[[1]] ], sum( A[[i]] * BT[[j]]));
  return( C);
}
int main()
{
  A = genarray( [SIZE1,SIZE2], 1.0);
  B = genarray( [SIZE2,SIZE3], 1.0);
  C = matmul( A, B);
#if 0
  printf( "C[0,0] = %f\n", C[0,0]);
  return(0);
#else
  a = print( C[0,0]);
  return( a);
#endif
}