Programmed a calculator that computes matrix expressions such as addition, multiplication, and transposition.
When working with matrices, students often have to spend lots of time evaluating the entire expression. Hence, to help students with their assignments, this program permits users to enter the matrix problems in a text file, which would be scanned and evaluated. This program could solve order operations involving addition, multiplication, and transposition. Every time the program creates a new matrix or solves an expression, it adds the result to a matrix binary search tree. The program prints out the solution of the latest expression when it reaches the end of the file.Notes/Warnings:
- Lines in the text file must not contain leading spaces
- Matrix name can only be an alphabetical letter
- Each matrix creation or expression in the text file must be written in the following format:
- Matrix Creation: [matrix name] = [number of rows] [number of columns] [elements listed in row-major format and enclosed with brackets] Example: A = 3 3 [1 2 3; 4 5 6; 7 8 9;]
- Matrix Expression: [matrix name] = [expression] Example: C = A + B
- Excluding all blank lines, the last line of the text file must not be a matrix creation
- Windows or Linux operating system
- GNU Compiler Collection (GCC)
- Text Editor or IDEs
- Notepad (Worst Case)
- Code::Blocks (Please download the one with GCC compiler)
- Eclipse
- Visual Studio Code
- Fork this repository by clicking the Fork button located on the top of the page
- Navigate to "Your Repositories" on GitHub and open the forked repo
- In the terminal, git clone the repo using the URL or SSH key
make
and make test
to run the test cases written in unit_tests.c. Individuals may use the existing code as an example and write their test cases.Note: To run your test cases, include your input file in tests.in and the expected output in tests.out.exp.
In the terminal, typegcc [source file]
. By default, this will produce an executable file named a.out (Linux) or a.exe (Windows). If you want the executable file to have a custom name, type gcc -o [name of the executable] [source file]
. After compiling the program, run the executable file by entering ./[executable file] [input file]
.
Zhen Wei Liao - @ZhenBuilts the main program and parts of MatrixCalc.h/unit_test.c. Professor Kevin McDonnell - @KevinMcDonnell
Builts the majority of unit_tests.c, unit_tests.h, makeFile, and .gitignore. This project is under the MIT License.
Please check the LICENSE.md file for more information.