~ubuntu-branches/ubuntu/saucy/rheolef/saucy

« back to all changes in this revision

Viewing changes to skit/lib/gmres.h

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito, Pierre Saramito, Sylvestre Ledru
  • Date: 2012-05-14 14:02:09 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120514140209-dzbdlidkotyflf9e
Tags: 6.1-1
[ Pierre Saramito ]
* New upstream release 6.1 (minor changes):
  - support arbitrarily polynomial order Pk
  - source code supports g++-4.7 (closes: #671996)

[ Sylvestre Ledru ]
* update of the watch file

Show diffs side-by-side

added added

removed removed

Lines of Context:
158
158
#endif // TO_CLEAN
159
159
 
160
160
 
 
161
template<class Real> 
 
162
void GeneratePlaneRotation(Real &dx, Real &dy, Real &cs, Real &sn)
 
163
{
 
164
  if (dy == Real(0)) {
 
165
    cs = 1.0;
 
166
    sn = 0.0;
 
167
  } else if (abs(dy) > abs(dx)) {
 
168
    Real temp = dx / dy;
 
169
    sn = 1.0 / ::sqrt( 1.0 + temp*temp );
 
170
    cs = temp * sn;
 
171
  } else {
 
172
    Real temp = dy / dx;
 
173
    cs = 1.0 / ::sqrt( 1.0 + temp*temp );
 
174
    sn = temp * cs;
 
175
  }
 
176
}
 
177
template<class Real> 
 
178
void ApplyPlaneRotation(Real &dx, Real &dy, Real &cs, Real &sn)
 
179
{
 
180
  Real temp  =  cs * dx + sn * dy;
 
181
  dy = -sn * dx + cs * dy;
 
182
  dx = temp;
 
183
}
161
184
template < class Operator, class Vector, class Preconditioner,
162
185
           class Matrix, class Real, class Int >
163
186
int 
228
251
  delete [] v;
229
252
  return 1;
230
253
}
231
 
template<class Real> 
232
 
void GeneratePlaneRotation(Real &dx, Real &dy, Real &cs, Real &sn)
233
 
{
234
 
  if (dy == Real(0)) {
235
 
    cs = 1.0;
236
 
    sn = 0.0;
237
 
  } else if (abs(dy) > abs(dx)) {
238
 
    Real temp = dx / dy;
239
 
    sn = 1.0 / ::sqrt( 1.0 + temp*temp );
240
 
    cs = temp * sn;
241
 
  } else {
242
 
    Real temp = dy / dx;
243
 
    cs = 1.0 / ::sqrt( 1.0 + temp*temp );
244
 
    sn = temp * cs;
245
 
  }
246
 
}
247
 
template<class Real> 
248
 
void ApplyPlaneRotation(Real &dx, Real &dy, Real &cs, Real &sn)
249
 
{
250
 
  Real temp  =  cs * dx + sn * dy;
251
 
  dy = -sn * dx + cs * dy;
252
 
  dx = temp;
253
 
}
254
254
//>gmres:
255
255
}// namespace rheolef
256
256
# endif // _SKIT_GMRES_H