📄 matrix.tex
字号:
\rhead{Class MATRIX}
\section{MATRIX : Simple matrix calculation}
{\tt Matrix} class provides advanced matrix manipulation routines which include addition, substraction, multiplication, tranpose and inversion for an IMAGE object. {\tt Matrix} is inherited with extra methods from {\tt IMAGE} class.
\begin{verbatim}
class MATRIX : public IMAGE {
/* no extra variable */
};
\end{verbatim}
%
\subsection{Print matrix data}
\subsubsection*{Synopsis}
\begin{verbatim}
void MATRIX::dump(char *header = NULL)
\end{verbatim}
\subsubsection*{Arguments}
\tb
{\tt header} & Title of matrix
\te
\subsubsection*{Description}
{\tt print} display on the screen all the value of matrix data, as well as the title of matrix if it is specified.
%
\subsection{Initializing matrix}
\subsubsection*{Synopsis}
\begin{verbatim}
MATRIX::init(short _row, short _col, char identity = 0)
\end{verbatim}
\subsubsection*{Arguments}
\tb
{\tt \_row, \_col} & The size of matrix, \_row x \_col.\\
{\tt identity} & A flag (1:on and 0:off) to indicate whether to create
an identity matrix.
\te
\subsubsection*{Returns}
\tb
{\tt NOERROR} & Successful memory allocation. \\
{\tt MEMORYERROR} & Otherwise.
\te
\subsubsection*{Description}
{\tt init} allocates memory of type float and size \_row x \_col to a matrix. If {\tt identity} is on, an identity matrix will be created.
%
\subsection{Matrix transpose}
\subsubsection*{Synopsis}
\begin{verbatim}
MATRIX * MATRIX::transpose(void)
\end{verbatim}
\subsubsection*{Returns}
Pointer to a transposed matrix. Returns NULL if memory allocation fails.
\subsubsection*{Description}
{\tt transpose} creates a new matrix of size col x row and transposes the image data from row to column and visa versa.
%
\subsection{Matrix addition}
\subsubsection*{Synopsis}
\begin{verbatim}
MATRIX * MATRIX::operator+ (MATRIX& mtx)
\end{verbatim}
\subsubsection*{Arguments}
\tb
{\tt mtx} & Matrix for addition.
\te
\subsubsection*{Returns}
Pointer to an added matrix. Returns NULL if memory allocation fails or the size of {\tt mtx} is different from the size of original matrix.
\subsubsection*{Description}
{\tt +} performs addtion between the {\tt mtx} and the original matrix.
%
\subsection{Matrix substraction}
\subsubsection*{Synopsis}
\begin{verbatim}
MATRIX * MATRIX::operator- (MATRIX& mtx)
\end{verbatim}
\subsubsection*{Arguments}
\tb
{\tt mtx} & Matrix for substraction.
\te
\subsubsection*{Returns}
Pointer to a substracted matrix. Returns NULL if memory allocation fails or the size of {\tt mtx} is different from the size of original matrix.
\subsubsection*{Description}
{\tt -} substracts the original matrix from {\tt mtx}.
%
\subsection{Matrix multiplication}
\subsubsection*{Synopsis}
\begin{verbatim}
MATRIX * MATRIX::operator* (MATRIX& mtx)
\end{verbatim}
\subsubsection*{Arguments}
\tb
{\tt mtx} & Matrix for multiplication.
\te
\subsubsection*{Returns}
Pointer to a multipled matrix. Returns NULL if memory allocation fails or the row of {\tt mtx} is different from the column of original matrix.
\subsubsection*{Description}
{\tt *} performs multiplication between the {\tt mtx} and the original matrix.
%
\subsection{Swapping rows of matrix}
\subsubsection*{Synopsis}
\begin{verbatim}
MATRIX::swapRow(short i, short j)
\end{verbatim}
\subsubsection*{Arguments}
\tb
{\tt i, j} & Rows to be swapped.
\te
\subsubsection*{Returns}
\tb
{\tt NOERROR} & Successful operation. \\
{\tt PARAMERROR} & Invalid row or out of range.
\te
\subsubsection*{Description}
{\tt swapRow} swap the matrix data of row i and j.
%
\subsection{Matrix inversion}
\subsubsection*{Synopsis}
\begin{verbatim}
MATRIX * MATRIX::inverse(void)
\end{verbatim}
\subsubsection*{Returns}
Pointer to a inversed matrix. Returns NULL if memory allocation fails or the original matrix data is of a singular matrix or not a square matrix.
\subsubsection*{Description}
{\tt inverse} applies Gaussian elimination algorithm to perform matrix inversion.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -