Tutorial: Matrix Structure
Tutorial: Using Matrix Structure
This tutorial explains how to use a Matrix structure for solving linear equations.
For the assignment, you must use the given Matrix structure and follow instructions for saving and modifying the data.
Preparation
Download
Download data files:
Download tutorial source and header files:
Create Data Folder (상대경로 방법)
Create a data folder in the workspace name the folder as NP_Data
..\repos\NP\NP_Data
For each assignment, create the assignment folder and save the dataset.
Example: Assignment999
\NP\NP_Data\Assignment999
For this tutorial, unzip the downloaded data files and copy them under the data folder Assignment999
Create Data Folder (절대경로 방법, not recommended)
Create a folder in C:\ Drive and name the folder as NP_Data
C:\NP_Data
For each assignment, create the assignment folder and save the dataset.
Example: Assignment999
C:\NP_Data\Assignment999
For this tutorial, unzip the downloaded data files and copy them under the data folder Assignment999

Create Project
Create a new empty project in Visual Studio Community. Name the project as TU_MatrixTemplate
e.g ) C:\Users\yourID\source\repos\NP\tutorial\TU_MatrixTemplate
Create a new C/C++ source file for main()
Name the source file as
TU_matrixTemplate.cppUse the downloaded source code : TU_matrixTemplate_student.cpp
Save the downloaded library header files in your \include\ folder
Write your name in the comment section
Re-name the header files as:
myMatrix.h, myMatrix.cpp
Then, you need to change in
myMatrix.cppas#include "myMatrix.h"
Create and Modify Dataset
For each assignment, create the assignment folder and save the dataset.
Example: Assignment000
\NP\NP_Data\Assignment000
Use the text file and file name as instructed in each assignment.
You must use the same name for the text files as instructed. Otherwise, it will not be graded
Example:
Make Text File

How to modify in the data file
Change Row : Enter
Change Column: Tap
Example :
Type:
1 tab 3 tab -2 tab 4 enter .... 3 tab -1 tab 6 tab 2 ctrl+s (저장)

For Vector, type:
-11 enter 6 enter -9 enter 15 ctrl+s (저장)

Using Matrix Structure Library
Matrix structure library
Provided library: myMatrix.h
Example Code
What to change for Assignment
Initially, change the assignment number for
#define ASGNDO NOT modify other code lines
Read data text files. You must use the given file names.
Then, apply your numerical programming algorithm.
Prints vector or matrix results. You have to give a brief description for each print.
Free memory allocated to a matrix.
Even if you omit the free process, the code will work. However, it can cause memory leaks.
Assignment
Declare and define the following functions in myMatrix.h and myMatrix.cpp
Last updated
Was this helpful?