[GiNaC-list] matrix::solve(): how to use?

Marco Andre Ferreira Dias mdias at ift.unesp.br
Wed Jun 29 18:31:15 CEST 2005


Thanks. I will implement this



Marco Andre Ferreira Dias

On Wed, 29 Jun 2005, Jens Vollinga wrote:

> Hi Marco,
>
> On Tue, Jun 28, 2005 at 04:05:46PM -0300, mdias at ift.unesp.br wrote:
>> I am tryng to solve a linear system with lsove(), with many variables
>> being zero, so lsolve() tell that is indeterminate, but some of these
>> entries are of interest.
>> So, I am looking for matrix::solve and construct a matrix to solve this.
>> Somebody have a piece of code how to make a linear system a matrix to
>> matrix::solve ?
>
> I don't completely understand your question concerning these "entries of
> interest", but maybe you want to have something like this:
>
> #include <iostream>
> using namespace std;
> #include <ginac/ginac.h>
> using namespace GiNaC;
>
> int main()
> {
> 	symbol f1("f1"), f2("f2");
> 	symbol A("A"), B("B");
>
> 	matrix M(2, 2, lst(f1, f1*f2,
> 	                    0,    f2));
>
> 	matrix x(2, 1, lst(A, B));
>
> 	matrix b(2, 1, lst(5, 10));
>
> 	// M x = b
> 	matrix result = M.solve(x, b);
>
> 	cout << result << endl;
>
> 	return 0;
> }
>
> Just a small example that can easily be adapted to bigger systems.
>
> Regards,
> Jens
>
>
> _______________________________________________
> GiNaC-list mailing list
> GiNaC-list at ginac.de
> http://thep.physik.uni-mainz.de/mailman/listinfo/ginac-list
>




More information about the GiNaC-list mailing list