This repository contains C and Python implementations of matrix multiplication, along with a Bash script to run both implementations. The purpose of this comparison is to analyze the performance of each language in terms of execution time for this specific operation.
MatrixMultiplication.c
: C implementation of matrix multiplication.MatrixMultiplication.py
: Python implementation of matrix multiplication.execute.sh
: Bash script to compile and run the C program and run the Python script.
- For C: A C compiler (such as GCC) and a Unix-like environment (such as Linux or macOS) or Windows with MinGW installed.
- For Python: Python interpreter (version 3.x recommended) and a Unix-like environment (such as Linux or macOS) or Windows.
- For the Bash script: A Unix-like environment (such as Linux or macOS) or Windows with Git Bash installed.
- Make the script executable:
chmod +x execute.sh
- Run the script:
./execute.sh
The output will display the elapsed time in seconds for the matrix multiplication operation in both C and Python implementations.
- Compile the C code:
gcc MatrixMultiplication.c -o matrix
- Run the executable:
./matrix
The output will display the elapsed time in seconds for the matrix multiplication operation.
Run the Python script:
python MatrixMultiplication.py
The output will display the elapsed time in seconds for the matrix multiplication operation.
The performance comparison between C and Python for matrix multiplication is discussed in the following article:
A Performance Comparison Between C, Java, and Python
The article provides insights into the execution time differences between the two languages and discusses factors that contribute to these differences.
This project is licensed under the MIT License.