Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kbinani/lusolve


https://github.com/kbinani/lusolve

Last synced: 8 days ago
JSON representation

Awesome Lists containing this project

README

        

# lusolve

C++ port of ruby's `LUSolve` module, solves `A・x = b` for `x`, using LU decomposition.

# usage

```c++
#include "lusolve.hpp"
#include

int main()
{
int const kSize = 3;

std::vector> a;
a.resize(kSize);
std::fill_n(a.begin(), kSize, std::vector(kSize));
a[0][0] = 1;
a[0][1] = 2;
// setup matrix "a".
// ...

std::vector b;
b.resize(kSize);
// setup vector "b".
// ...

std::vector x;
try {
x = LUSolve::lusolve(a, b);
} catch (std::runtime_error const&) {
// in case singular matrix
}

return 0;
}
```

# license

Same as ruby's license.

* https://github.com/ruby/ruby/blob/2cd6800fd8437b1f862f3f5c44db877159271d17/COPYING