Skip to content

sanjay219/matrix_multiplication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Matrix Multiplication Repository

Welcome to the Matrix Multiplication repository! This repository contains three implementations of matrix multiplication algorithms in C. Each file showcases a different approach: using BLAS, a standard matrix multiplication, and Strassen's algorithm. Explore each implementation to understand the differences and efficiencies in matrix multiplication techniques.

Contents

  1. BLAS Implementation (blas.c)
  2. Standard Matrix Multiplication (mat_mul.c)
  3. Strassen's Algorithm (stressen.c)

BLAS Implementation (blas.c)

The blas.c file demonstrates matrix multiplication using the BLAS (Basic Linear Algebra Subprograms) library.

Key Features

  • Matrix Size: 1000 x 1000

  • Library Used: BLAS for optimized matrix operations.

  • Function: Uses cblas_dgemm to perform matrix multiplication.

    • Execution:
    gcc -o blas blas.c -lcblas -llapacke
    ./blas
    

Standard Matrix Multiplication (mat_mul.c)

A classic approach to matrix multiplication using a straightforward triple nested loop.

  • Key Features:

    • Implements standard matrix multiplication.
    • Handles matrix size of 1000 x 1000.
    • Measures and prints computation time.
  • Execution:

    gcc -o mat_mul mat_mul.c
    ./mat_mul
    

Strassen's Algorithm (stressen.c)

An advanced implementation using Strassen's algorithm for matrix multiplication, which is more efficient for larger matrices.

  • Key Features:

    • Uses Strassen's divide-and-conquer approach.
    • Includes helper functions for matrix operations: add_matrices, subtract_matrices, split_matrix, join_matrices.
    • Handles matrix size of 1000 x 1000.
    • Measures and prints computation time.
  • Execution:

    gcc -o stressen stressen.c
    ./stressen
    

Feel free to customize this further based on your needs!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages