📄 matrixs.h
字号:
#pragma Matrixs
/* Points to a record that contains the actual matrix and information */
/* about it. */
typedef void *Matrix;
void OpenMatrix(Matrix &m, unsigned int rows, unsigned int columns);
/* OpenMatrix is called to create space for the Matrix pointer. */
/* Used to create matrices that are not obtained through a matrix operation */
void CloseMatrix(Matrix &m);
/* CloseMatrix is called to deallocate space from a Matrix pointer. */
/* Matrices that are intended to be reused ought to be closed before */
/* they are reopenned. */
void EnterElement(Matrix m, unsigned int row, unsigned int column, double element);
/* EnterElement enters a real element into the position described by */
/* row and column. */
double ReadElement(Matrix m, unsigned int row, unsigned int column);
/* ReadElement reads an element from the position in the matrix */
/* described by row and column and returns the real value from that */
/* position. */
void MatrixSize(Matrix m, unsigned int &rows, unsigned int &columns);
/* MatrixSize returns the size of the matrix */
void CopyMatrix(Matrix m, Matrix &new);
/* CopyMatrix copies a matrix to another pointer. */
/* This void will automatically create new, thus it should not be */
/* previously openned. */
void AppendRight(Matrix &m, Matrix addition);
/* AppendRight appends the columns of addition to the columns of m. */
/* Both matrices must have the same number of rows. */
void AppendBottom(Matrix &m, Matrix addition);
/* AppendBottom appends the rows of addition UNDER the rows of */
/* m. m and addition must have the same number of columns. */
void SplitColumns(Matrix &m, Matrix &new, unsigned int n);
/* SplitColumns splits the n columns on the right side of m and put into the */
/* new matrix, new. new should not be previously openned. */
void SplitRows(Matrix &m, Matrix &new, unsigned int n);
/* SplitRows splits the n rows on the bottom of m and put into the */
/* new matrix, new. new should not be previously openned. */
/*****************************************************************************/
/* In the following operations, result should not be opened with OpenMatrix */
/* result will be automatically created as the operation warrants */
/*****************************************************************************/
void Add(Matrix left, Matrix right, Matrix &result);
/*Add adds left to right and result is brought back. */
/* result = left + right. */
void Subtract(Matrix left, Matrix right, Matrix &result);
/* Subtract subtracts right from left and result is brought back. */
/* result = left - right */
void Multiply(Matrix left, Matrix right, Matrix &result);
/* Multiply performs matrix multiplication on left and right, result */
/* brought back. */
/* result = (left)(right) */
void MultiplyC(Matrix m, double c, Matrix &result);
/* MultiplyC performs scalar multiplication on matrix m with c. */
/* result = c(m) */
/*************************************************************************/
/* The following operations will change the contents of the given matrix */
/*************************************************************************/
void Transpose(Matrix &m);
/* Transpose "flips" the matrix making the rows the columns and the */
/* columns , the rows. */
void ReduceTriang(Matrix &m);
/* ReduceTriang uses Gaussian elimination to reduce m to */
/* tringular from. */
void ReduceDiag(Matrix &m);
/* ReduceDiag uses Gaussian elimination to reduce m to diagonal form */
/****************************************************************/
/* The following operations can be used only on square matrices */
/****************************************************************/
double Determinant(Matrix m);
/* Determinant finds the determinant of a square matrix. */
void Inverse(Matrix &m);
/* Inverse finds the inverse of a square matrix */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -