A powerful Android application for performing matrix operations with a clean, intuitive Material 3 UI built with Jetpack Compose and enhanced with native C++ computation.
- Matrix Operations: Add, subtract, multiply, and divide matrices
- Independent Matrix Dimensions: Configure different dimensions for each matrix
- Advanced Matrix Division: Implements division as multiplication by inverse (B⁻¹)
- Dynamic Sizing: Easily adjust matrix dimensions on-the-fly
- High Performance: Matrix operations performed in native C++ code using Eigen library
- Clean UI: Material 3 design with intuitive interface
- Error Handling: Comprehensive validation and error messages
- Responsive Layout: Works well on different screen sizes
- Addition & Subtraction: Both matrices must have the same dimensions
- Multiplication: Columns of Matrix A must equal rows of Matrix B
- Division: Second matrix must be square (for computing inverse) and columns of first matrix must equal rows of second matrix
- UI Framework: Jetpack Compose
- Design System: Material 3
- Architecture: Modern Android architecture
- Language: Kotlin + C++ (via JNI)
- Native Binding: Java Native Interface (JNI)
- Matrix Library: Eigen (C++ library for linear algebra)
- Android Studio (latest version recommended)
- Android SDK 24 or higher
- NDK (Native Development Kit)
- CMake
-
Clone the repository:
git clone https://github.com/aryanGupta-09/MC_A3.git
-
Open the project in Android Studio
-
Sync Gradle files and ensure NDK is properly set up
-
Build and run the application on an emulator or physical device
-
Set Matrix Dimensions: Use the separate dimension controls for each matrix to set their individual rows and columns
-
Input Values: Enter numerical values in both Matrix A and Matrix B
-
Select Operation: Choose from Add, Subtract, Multiply, or Divide operations
-
Calculate: Press the Calculate button to perform the selected operation
-
View Result: The resulting matrix will be displayed in the Result section
-
Error Handling: If an operation cannot be performed (e.g., incompatible dimensions for multiplication), an error message will be displayed
The application uses Jetpack Compose to create a modern, reactive UI with Material 3 design components. The interface is organized into cards for different sections:
- Matrix A input with its own dimensions
- Matrix B input with its own dimensions
- Operation selection
- Results display
Matrix operations are implemented in C++ for performance:
- Uses the Eigen library for efficient matrix operations
- The native code is accessed through JNI (Java Native Interface)
- Four core operations are provided: add, subtract, multiply, and divide
- Matrix division is implemented as multiplication by the inverse of the second matrix
- The implementation handles proper validation of matrix dimensions for each operation
The application provides robust error handling for:
- Invalid numeric inputs
- Incompatible matrix dimensions for different operations
- Singular matrices in division operations (when the determinant is close to zero)
- Other edge cases