COMPARATIVE LANGUAGES
Fall 2005
C Programming
Starter program for vectors and matrices in C:
vectors1.c,
vector1B.c - version with subroutines
C programming assignment 1: dot product (vectors), addition (matrices), multiplication (matrices)
We have C on the our workstations (gcc) and on the Cray (cc).
You can do these C programs on both the workstations and the Cray.
Try your matrix programs on large matrices and compare the speeds of
- Workstations vs Cray
- Fortran vs C vs MatLab
Workstations: compile this with: "gcc prog.c" (generates a.out as an executable)
or "gcc -o prog prog.c (generates "prog" as an executable)
ARRAY ELEMENTS START ON INDEX 0
To use the Cray SV1:
- ssh cray, your passwd should be astudentnum
- The only editor is vim. If you want to use the workstation's editor,
use gftp (with SSH) to connect to the Cray and copy files back and forth)
- Starter program for vectors and matrices in C:
vectors1.c,
vector1B.c - version with subroutines
- On the Cray: compile this with "cc prog.c" (generates a.out as an executable)
or "cc -o prog prog.c (generates "prog" as an executable)
Complete coding the program for:
- dot product of two vectors
- addition of two matrices
- multiplication of two matrices
- you can use square matrices