Gaussian Elimination of a Singular Matrix [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
So i've been struggling to find code which can solve a set of simultaneous equations and also handle possibilities of Infinite Solutions, i.e. a singular Matrix. From all the sample code Gaussian Elimination in C that i've encountered the problem arises when dividing by zero in one of the steps for row reduction. Surely there must be some numerical ways to counter this problem.

Gaussian elimination[1] does not work on singular matrices. As you noticed numerically this usually leads to devision by zero or some other problem. If you suspect that a the matrix you want to diagonalize might be singular (or numerically close to singular) you should check out Singular Value Decomposition (SVD) which either provides you with the inverse matrix or something close. A nice resource is Numerical Recipes[1] or GSL[2] if you want to look into the how and why.
[1] http://www.haoli.org/nr/bookcpdf.html (Chap. 2.1)
[2] http://www.gnu.org/software/gsl/

Related

How to invert a matrix [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
I need to solve a system of n-linear equations with n-unknown variables in C++ using the gaussian method of elimnation. Any hints how to achieve that? I'll be probably using rand(); for the amount of n, since isn't available, because C++11 I can't use.
to solve a linear system
AX=B
you need to invert a matrix A, which results in A^(-1) and multiply A^(-1) * B to obtain X.
This is the example code to invert non-singular matrix using Gauss - Jordan elimination algorithm (complexity is O(n^3)):
matrix inversion using Gauss-Jordan elimination

Calculating large numbers in C++ without external libraries [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I need to write a program that will perform operations on float numbers higher than 10^100.
I can't use any arbitrary precision mathematics libraries that are not included in GCC package by default.
I have NO idea how how to go about it.
Can you point me in the right direction?
You can create a class that can store larger numbers. 12345678 equals to 1234 * 10e4 + 5678.
For large numbers I use string buffers and do manual computation on it. It is much overhead and slow but you get infinite precision.

External library treating polygons and calculating their fractal dimension [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm looking at a physical problem on an hexagonal 2d lattice. It's now a geometrical problem, only a subset of the edges of the lattice are of interest, I'm given this set. I should then restrict myself to the closed curves that I can compose with these edges. From these polygons I'd like to extract information such as their diameters (maximal distance between two of its points)) and their fractal dimension.
I still don't see how to it from the raw initial data (unordered array of edges) and so I'd like to know if there are packages/library that could help me. From drawing each one of these edges they could return the closed loops they form and after that, analyzing each of these polygons individually.
Thank you.
You can use the box-counting algorithm to compute the fractal dimension:http://en.m.wikipedia.org/wiki/Minkowski%E2%80%93Bouligand_dimension.

Unbelievably Large Numbers in C++ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Like the title says I'm in need of someway to store and compute with Integers in excess of 500,000 digits in C++. The operations that this program needs are: Divide(Integer), add, subtract, and modulus. Does anyone know of a library out there that can help me accomplish this?
GMP is what you want. There is no practical size limit to processing large integers or floating point numbers. GMP is capable of processing billions of digits, so you are well within the realistic range. It is primarily dependent on your system's architecture and available memory limitations.
http://gmplib.org/

Best Package for Sparse Matrix Multiplication [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am looking for the best package for sparse matrix multiplication on single core solution.
I am not looking for CUDA, MPI or OpenMP solutions.
My preference for languages in decreasing order : Matlab, Python, C/C++.
Matlab has its own matrix multiplication function which can be used for sparse matrix multiplication. But are there any better package(s) available ?
I have to multiply two large matrices which are in sparse format.
Eg., one matrix is 677000-by-48000 and another is 48000-by-8192. Here, n-by-d means n : # of rows, d : # of columns
I'm no expert for sparse matrices but I do know the renowned 'eigen' C++ library.
They have a tutorial on sparse matrices, reachable from the documentation page.