Write C function to compute inverse matrix of square matrix, such that
if Y = M^-1 then M * Y = E.
Function must have following interface:
double* inv_matrix(const double* M, const size_t N);
N - size of matrix side
M - matrix data (standard C array of N * N)
Function must allocate memory with malloc(), compute inverse matrix,
store it in the newly allocated area and return it. If inverse matrix does not exist,
function must deallocate that memory and return NULL.
Function must also return NULL if memory allocation failed, or if n is zero.
In the latter case, memory should not be allocated at all.
Function is NOT allowed to modify its input.
- You are not allowed to use any third-party libraries. Maximum you can use
is functions available in the standard header file math.h
- Function must use most effective algorithm that will work well for matrix sizes N up to 10000.
- Function must be failsafe and memory leak free.
- Function must be written in the plain C language (STRICTLY NO C++!!!) and comply to C99 language standard.
- Function must compile without any warnings or errors on GCC 4.8.5 using following set of compiler options:
-std=c99 -Wall -Wextra -pedantic -Werror
- All code must be formatted according to Linux Kernel coding standard
(see here for more details: [url removed, login to view])
- You must provide small test program that execute at least 10 test cases to prove correctness
(we strongly recommend you to use Matlab or Octave to precompute your test data).
Please be careful and accurate in your bidding, we will require you to complete the project exactly in the time you have indicated in your bid.