The current operations implemented by NMatlib are:
| Operation | Description |
| Create | Creates a NMatrix object |
| Destroy | Destroys a NMatrix object |
| Clone | Creates a hard copy of an existent NMatrix object |
| Sum | Computes the sum of two matrices |
| Scalar Multiplication | Multiplies the matrix with a scalar |
| Product | Computes the product of two matrices |
| Secondary Diagonal | Returns the secondary diagonal of a matrix |
| Primary Diagonal | Returns the primary diagonal of a matrix |
| Minor | Returns the minor of a matrix |
| Determinant | Computes the determinant of a matrix |
| Transpose | Computes the transpose of a matrix |
| Adjugate | Computes the adjugate of a matrix |
| Inverse | Computes the inverse of a matrix |
| Minimum Element | Returns the smallest element of a matrix |
| Maximum Element | Returns the largest element of a matrix |
| Sum of all elements | Returns the sum of all elements |
| Product of all Elements | Returns the product of all elements |
| Number of Elements | Returns the total number of elements that exist in a matrix |
| Submatrix | Returns a submatrix specified by a start/end column/row |
| Arithmetic Mean | Returns the arithmetic mean of all elements from a matrix |
| Harmonic Mean | Returns the harmonic mean of all elements from a matrix |
| Geometric Mean | Returns the geometric mean of all elements from a matrix |
The NMatrix structure is implemented as:
typedef double real;
typedef int integer;
typedef struct
{
real** data;
integer rows;
integer columns;
}NMatrix;
The numeric matrix structure will contain information about the number of rows, columns and an dynamic 2D array to hold the data.The prototypes for the functions are:
| Operation | Prototype |
| Create | NMatrix* NMatrix_Create(integer rows, integer columns); |
| Destroy | NMatrix* NMatrix_Destroy(NMatrix *matrix); |
| Clone | NMatrix* NMatrix_Clone(const NMatrix *source); |
| Sum | NMatrix* NMatrix_Sum(const NMatrix* mat1,const NMatrix* mat2); |
| Scalar Multiplication | NMatrix* NMatrix_MultiplyWithScalar(const NMatrix* mat, real value); |
| Product | NMatrix* NMatrix_Product(const NMatrix* mat1,const NMatrix* mat2); |
| Secondary Diagonal | NMatrix* NMatrix_GetSecondaryDiagonal(NMatrix* mat); |
| Primary Diagonal | NMatrix* NMatrix_GetPrimaryDiagonal(NMatrix *mat); |
| Minor | NMatrix* NMatrix_Minor(const NMatrix *mat, integer row, integer column, Integer order); |
| Determinant | real NMatrix_Determinant(const NMatrix *mat, integer order); |
| Transpose | NMatrix* NMatrix_Transpose(const NMatrix* mat); |
| Adjugate | NMatrix* NMatrix_Adjugate(const NMatrix* mat); |
| Inverse | NMatrix* NMatrix_Inverse(const NMatrix* mat); |
| Minimum Element | real NMatrix_MinElement(const NMatrix* mat); |
| Maximum Element | real NMatrix_MaxElement(const NMatrix* mat); |
| Sum of all elements | real NMatrix_ElementSum(const NMatrix* mat); |
| Product of all Elements | real NMatrix_ElementProduct(const NMatrix* mat); |
| Number of Elements | integer NMatrix_ElementCount(const NMatrix* mat); |
| Submatrix | NMatrix* NMatrix_Submatrix(const NMatrix* mat, integer startRow, integer endRow, Integer startColumn, integer endColumn); |
| Arithmetic Mean | real NMatrix_ArithmeticMean(const NMatrix* mat); |
| Harmonic Mean | real NMatrix_HarmonicMean(const NMatrix* mat); |
| Geometric Mean | real NMatrix_GeometricMean(const NMatrix* mat); |
No comments:
Post a Comment
Got a question regarding something in the article? Leave me a comment and I will get back at you as soon as I can!