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