|
Ublas : |
From: Sourabh (sourabh_at_[hidden])
Date: 2007-03-03 08:39:58
On Sat, 3 Mar 2007, Gunter Winkler wrote:
> Sourabh schrieb:
> > On Fri, 2 Mar 2007, Gunter Winkler wrote:
> >
> > The program (see below), after some modifications is still taking around
> > 8 minutes for the arguments 1 200000 100.
> >
> > Even if I remove solve, and addition methods, the statement
> > lembda1.assign (ident-lembda) is causing the program to take 1 minute.
> >
> 1) You can avoid the assign if you fill lembda with the negative values,
> such that you have to solve with (I+lemda).
Do you mean that I fill lembda with negative values and use this
statement:
solve (lembda, omega, unit_lower_tag ()) ?
will it solve the equation treating lemda as (I+lembda)
Will it be equivalent to the following statement ?
lembda = I - lembda
solve (lembda, omega, lower_tag ())
> 2) you should try the current CVS head of boost.
> 3) use inplace_solve_lower<true>(A, x, row_major_tag()); from my examples.
Please see the below program.
int main ( int argc, char* argv[])
{
int iterations = atoi (argv[1]);
int gatesperpath = atoi (argv[2]);
boost::timer t;
t.restart();
unsigned int i = 0;
double j;
identity_matrix<double> ident (gatesperpath);
compressed_matrix<double> lembda1 (gatesperpath, gatesperpath);
lembda1 (3, 1) = -0.1;
vector <double> omegas(gatesperpath);
vector<double> slopes;
while (iterations--) {
slopes = solve (lembda1, omegas, lower_tag ());
}
std::cout << t.elapsed () << std::endl;
return 0;
}
When I run this with arguments 200000 100 , the program takes 1.5 seconds
on my machine. If I change solve to
inplace_solve_lower<true>(lembda1, omegas, row_major_tag());
it takes 35 seconds.
What is wrong in my way of using ? I think I not getting your point
properly.