An individual project for C Programing Lecture, KMITL Software Engineering, Year 1, Semester 1
Created by Dulapah Vibulsanti (64011388)
This README is separated into 3 parts:
This project aims to create a matrix computing program that runs in the terminal. The key features are:
-
Wide variety of operations
- Addition
- Subtraction
- Multiplication
- Scalar Multiplication
- Exponentiation
- Determinant
- Transposition
- Inverse
- Adjoint
*Program will also automatically detect matrix compatibility when performing certain operations.
-
User can choose to input matrix through terminal/command line or from an
input.txt
andinput.csv
file with a user-specifiable delimiter. -
Answer is automatically output in the
output.txt
file with proper matrix brackets and also generates LaTeX code for the user. The program also outputs answers in theoutput.csv
file as a comma-separated value. -
Answer is automatically stored in
Matrix Answer
so that it can be used to compute or perform further operations later on. -
User can view each stored matrix value
- Select
Define Matrix
- Select a matrix to define.
To input through the terminal/command line, select the first option. Then specify rows
and columns
and value
of your matrix.
To input through a file, select the second option. Make sure there is only 1 input file named input.txt
or input.csv
in the program's directory. Then specify the delimiter and the program will automatically preview the matrix it reads from as well as defining it.
*Maximum dimensions for reading matrix from a file is 100 x 100 with a maximum of 255 characters per delimiter (delimiter cannot contain .
character as it will be determined as a decimal point instead)
Suppose we have a file containing comma-separated values
We just specify the delimiter as a ,
and simply press enter.
- Select
View Matrix
- Select a matrix to view and the value of that matrix will appear.
- Select
Compute Matrix
- Select an operation you would like to perform.
- Suppose we select
Addition
, then we just select 2 matrixes to be added together and the result will appear. After pressing any key to continue, the result will be outputted intooutput.txt
andoutput.csv
which we will take a look here.
*Answer is automatically stored in Matrix Answer
so that it can be used to compute or perform further operations later on.
In the output.txt
, there will be an answer with proper matrix brackets and a generated LaTeX code for the answer.
In the output.csv
, there will be a comma-separated answer. The output.csv
file is separated so that it can be imported into other programs right away.
Suppose matrix A
is
4 7
2 6
Adding matrix A
together must give out
8 14
4 12
And subtracting the sum of matrix A
with matrix A
must give out the original value of matrix A
4 7
2 6
Finding the inverse of matrix A
must give out
0.60 -0.70
-0.20 0.40
And multiplying the the inverse of matrix A
with matrix A
must give out identity matrix
1 0
0 1
Finding the determinant of matrix A
must give out
10
Finding adjoint of matrix A
must give out
6 -7
-2 4
Multiplying 1/det(A)
with the adjoint of matrix A
must give out the inverse of matrix A
0.60 -0.70
-0.20 0.40
Suppose matrix B
is
1 2 3
4 5 6
7 8 9
Adding/subtracting/multiplying matrix A
with matrix B
must give out incompatible matrix dimension error
Incompatible matrix dimension!
Finding determinant/inverse of a matrix with unequal row and column must give out unequal matrix dimension error
Matrix dimension must be equal!
Finding the inverse of matrix B
must give out det equal 0 error because an inverse of a matrix with det = 0 does not exist (singular matrix)
Cannot find inverse of singular matrix!
Reading matrix from empty input file must give out input file is empty error
Input file is empty!
Deleting input.txt
or input.csv
and reading matrix from it must give out error accessing input file error
Error accessing input file!
Setting output.txt
or output.csv
to read-only and outputting matrix to it must give out error accessing output file error
Error accessing output file!