Commit 5882648a by Francois Gygi

rel1_34_4


git-svn-id: http://qboxcode.org/svn/qb/trunk@565 cba15fb0-1239-40c8-b417-11db7ca47a34
parent 054cdbd8
--------------------------------------------------------------------------------
rel1_34_4
Base64Transcoder.C: modif print functions to use larger string buffer for I/O.
SampleReader.C, SampleWriter.C: added timer.
Corrected lda arg in various BLACS calls. Did cause errors on
AIX/pessl. (Not a bug when using blacs lib compiled from netlib distribution).
--------------------------------------------------------------------------------
rel1_34_3
Wavefunction.C: fixed incorrect XML comments
Basis.C: fixed warning message printed by all tasks when k out of BZ.
......
......@@ -3,10 +3,10 @@
// release.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: release.C,v 1.41 2007-12-15 00:59:56 fgygi Exp $
// $Id: release.C,v 1.42 2008-01-13 23:05:47 fgygi Exp $
#include "release.h"
std::string release(void)
{
return std::string("1.34.3");
return std::string("1.34.4");
}
......@@ -3,10 +3,11 @@
// testAndersonMixer.C
//
////////////////////////////////////////////////////////////////////////////////
// $Id: testAndersonMixer.C,v 1.2 2007-10-19 16:24:06 fgygi Exp $
// $Id: testAndersonMixer.C,v 1.3 2008-01-13 23:05:47 fgygi Exp $
#include <iostream>
#include <vector>
using namespace std;
#include "Context.h"
......@@ -25,6 +26,7 @@ int main(int argc, char** argv)
PMPI_Get_processor_name(processor_name,&namelen);
cout << " Process " << ctxt.mype() << " on " << processor_name << endl;
const double alpha = 1.0;
vector<double> x,f,xlast,fbar;
double theta;
x.resize(3);
......@@ -32,23 +34,28 @@ int main(int argc, char** argv)
f.resize(3);
fbar.resize(3);
AndersonMixer mixer(x.size(),ctxt);
AndersonMixer mixer(x.size(),&ctxt);
x[0] = 1.0 + 0.2 * ctxt.mype();
x[1] = 2.0 + 0.2 * ctxt.mype();
x[2] = 3.0 + 0.2 * ctxt.mype();
for ( int iter = 0; iter < 100; iter++ )
xlast = x;
for ( int iter = 0; iter < 20; iter++ )
{
f[0] = - 2.0 * x[0] - 3.0 * x[0]*x[0]*x[0];
f[1] = - 1.0 * x[1] - 1.5 * x[1]*x[1]*x[1];
//f[0] = - 2.0 * x[0] - 3.0 * x[0]*x[0]*x[0];
//f[1] = - 1.0 * x[1] - 1.5 * x[1]*x[1]*x[1];
//f[2] = - 4.0 * x[2];
f[0] = - 2.0 * x[0];
f[1] = - 1.0 * x[1];
f[2] = - 4.0 * x[2];
double resnorm = 0.0;
for ( int i = 0; i < x.size(); i++ )
{
resnorm += f[i]*f[i];
f[i] *= 0.1;
// f[i] *= 0.1;
}
ctxt.dsum(1,1,&resnorm,1);
......@@ -56,13 +63,14 @@ int main(int argc, char** argv)
<< " resnorm: " << resnorm << endl;
mixer.update(&f[0],&theta,&fbar[0]);
cout << ctxt.mype() << ": theta: " << theta << endl;
for ( int i = 0; i < x.size(); i++ )
{
// xbar = x + theta * ( x - xlast )
// x = xbar + fbar
double xtmp = x[i];
x[i] += theta * ( x[i] - xlast[i] ) + fbar[i];
x[i] += theta * ( x[i] - xlast[i] ) + alpha * fbar[i];
xlast[i] = xtmp;
}
}
......
......@@ -127,7 +127,7 @@ int main(int argc, char **argv)
// test ft (small grid)
cout << ctxt.mype() << ": ft.np2_loc(): " << ft.np2_loc() << endl;
cout << " test ft: ";
cout << " test ft: ";
ft.forward(&f1[0],&x[0]);
cout << " forward done ";
ft.backward(&x[0],&f1[0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment