Skip to content

Programmed a calculator that would compute a series of matrix operations, such as addition, multiplication, and transposition.

License

Notifications You must be signed in to change notification settings

zhen69/Matrix-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Matrix-Calculator

Programmed a calculator that computes matrix expressions such as addition, multiplication, and transposition.

Description

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

Get Started

Dependencies

Installing

Reference: https://docs.github.com/en/get-started/quickstart/fork-a-repo
  1. Fork this repository by clicking the Fork button located on the top of the page
  2. Navigate to "Your Repositories" on GitHub and open the forked repo
  3. In the terminal, git clone the repo using the URL or SSH key

Executing Program

Run with makeFile:

In the terminal, type 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.

Run with GCC:

In the terminal, type gcc [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].

Author

Zhen Wei Liao - @Zhen
Builts the main program and parts of MatrixCalc.h/unit_test.c.

Contributor:

Professor Kevin McDonnell - @KevinMcDonnell
Builts the majority of unit_tests.c, unit_tests.h, makeFile, and .gitignore.

License

This project is under the MIT License.
Please check the LICENSE.md file for more information.

Releases

No releases published

Packages

No packages published