/usr/share/pyshared/PyTrilinos/Komplex.py is in python-pytrilinos 10.4.0.dfsg-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.4
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
"""
PyTrilinos.Komplex is the python interface to the Trilinos complex
linear algebra package Komplex:
http://trilinos.sandia.gov/packages/komplex
The purpose of Komplex is to define complex (real + imaginary) linear
algebra problems using real-valued Epetra vectors and matrix
operators. The python version of the Komplex package supports the
following class:
* LinearProblem - Encapsulate all elements of a complex linear
algebra problem
"""
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_Komplex', [dirname(__file__)])
except ImportError:
import _Komplex
return _Komplex
if fp is not None:
try:
_mod = imp.load_module('_Komplex', fp, pathname, description)
finally:
fp.close()
return _mod
_Komplex = swig_import_helper()
del swig_import_helper
else:
import _Komplex
del version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
if (name == "thisown"): return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name,None)
if method: return method(self,value)
if (not static):
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self,class_type,name,value):
return _swig_setattr_nondynamic(self,class_type,name,value,0)
def _swig_getattr(self,class_type,name):
if (name == "thisown"): return self.this.own()
method = class_type.__swig_getmethods__.get(name,None)
if method: return method(self)
raise AttributeError(name)
def _swig_repr(self):
try: strthis = "proxy of " + self.this.__repr__()
except: strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
_object = object
_newclass = 1
except AttributeError:
class _object : pass
_newclass = 0
class SwigPyIterator(_object):
"""Proxy of C++ swig::SwigPyIterator class"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, SwigPyIterator, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, SwigPyIterator, name)
def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_destroy__ = _Komplex.delete_SwigPyIterator
__del__ = lambda self : None;
def value(self):
"""value(self) -> PyObject"""
return _Komplex.SwigPyIterator_value(self)
def incr(self, n = 1):
"""
incr(self, size_t n = 1) -> SwigPyIterator
incr(self) -> SwigPyIterator
"""
return _Komplex.SwigPyIterator_incr(self, n)
def decr(self, n = 1):
"""
decr(self, size_t n = 1) -> SwigPyIterator
decr(self) -> SwigPyIterator
"""
return _Komplex.SwigPyIterator_decr(self, n)
def distance(self, *args):
"""distance(self, SwigPyIterator x) -> ptrdiff_t"""
return _Komplex.SwigPyIterator_distance(self, *args)
def equal(self, *args):
"""equal(self, SwigPyIterator x) -> bool"""
return _Komplex.SwigPyIterator_equal(self, *args)
def copy(self):
"""copy(self) -> SwigPyIterator"""
return _Komplex.SwigPyIterator_copy(self)
def next(self):
"""next(self) -> PyObject"""
return _Komplex.SwigPyIterator_next(self)
def __next__(self):
"""__next__(self) -> PyObject"""
return _Komplex.SwigPyIterator___next__(self)
def previous(self):
"""previous(self) -> PyObject"""
return _Komplex.SwigPyIterator_previous(self)
def advance(self, *args):
"""advance(self, ptrdiff_t n) -> SwigPyIterator"""
return _Komplex.SwigPyIterator_advance(self, *args)
def __eq__(self, *args):
"""__eq__(self, SwigPyIterator x) -> bool"""
return _Komplex.SwigPyIterator___eq__(self, *args)
def __ne__(self, *args):
"""__ne__(self, SwigPyIterator x) -> bool"""
return _Komplex.SwigPyIterator___ne__(self, *args)
def __iadd__(self, *args):
"""__iadd__(self, ptrdiff_t n) -> SwigPyIterator"""
return _Komplex.SwigPyIterator___iadd__(self, *args)
def __isub__(self, *args):
"""__isub__(self, ptrdiff_t n) -> SwigPyIterator"""
return _Komplex.SwigPyIterator___isub__(self, *args)
def __add__(self, *args):
"""__add__(self, ptrdiff_t n) -> SwigPyIterator"""
return _Komplex.SwigPyIterator___add__(self, *args)
def __sub__(self, *args):
"""
__sub__(self, ptrdiff_t n) -> SwigPyIterator
__sub__(self, SwigPyIterator x) -> ptrdiff_t
"""
return _Komplex.SwigPyIterator___sub__(self, *args)
def __iter__(self): return self
SwigPyIterator_swigregister = _Komplex.SwigPyIterator_swigregister
SwigPyIterator_swigregister(SwigPyIterator)
def Version():
"""
Version() -> string
string Komplex_Version()
"""
return _Komplex.Version()
__version__ = Version().split()[2]
class Komplex_LinearProblem(_object):
"""
Komplex_LinearProblem: A class for forming an equivalent real
formulation of a complex valued problem.
The Komplex_LinearProblem class takes a complex linear problem,
separated into real and imaginary parts, and forms an equivalent real
valued system of twice the dimension. The resulting system can then be
solved with any Trilinos solver that understands Epetra objects.
KOMPLEX solves a complex-valued linear system Ax = b by solving an
equivalent real-valued system of twice the dimension. Specifically,
writing in terms of real and imaginary parts, we have
\\[ (A_r + i*A_i)*(x_r + i*x_i) = (b_r + i*b_i) \\]
or by separating into real and imaginary equations we have
\\[ \\left( \\begin{array}{rr} A_r & -A_i\\\\ A_i & A_r
\\end{array} \\right) \\left( \\begin{array}{r} x_r\\\\
x_i \\end{array} \\right) = \\left( \\begin{array}{r}
b_r\\\\ b_i \\end{array} \\right) \\] which is a real-valued
system of twice the size. If we find xr and xi, we can form the
solution to the original system as x = xr +i*xi.
KOMPLEX accepts the user linear system as two real-valued matrices
with no assumption about the structure of the matrices, except that
they have compatible RowMap, DomainMap and RangeMap distributions.
Each matrix is multiplied by user-supplied complex constants.
Although formally the system is a 2-by-2 block system, we actually
apply the interleaving at the matrix entry level such that the real
part of the first complex equation is followed by the imaginary part
of the first complex equation, and so on. This approach is documented
in:
David Day and Michael A. Heroux. Solving complex-valued linear systems
via equivalent real formulations. SIAM J. Sci. Comput., 23(2):480498,
2001.
C++ includes: Komplex_LinearProblem.h
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Komplex_LinearProblem, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Komplex_LinearProblem, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
__init__(self, double c0r, double c0i, Epetra_RowMatrix A0, double c1r,
double c1i, Epetra_RowMatrix A1, Epetra_MultiVector Xr,
Epetra_MultiVector Xi, Epetra_MultiVector Br,
Epetra_MultiVector Bi) -> Komplex_LinearProblem
Komplex_LinearProblem::Komplex_LinearProblem(double c0r, double c0i,
const Epetra_RowMatrix &A0, double c1r, double c1i, const
Epetra_RowMatrix &A1, const Epetra_MultiVector &Xr, const
Epetra_MultiVector &Xi, const Epetra_MultiVector &Br, const
Epetra_MultiVector &Bi)
Komplex_LinearProblem constructor.
Constructs the Komplex operator from the user definition of the
complex-valued matrix C = (c0r+i*c0i)*A0 +(c1r+i*c1i)*A1. Using this
general expression for the complex matrix allows easy formulation of a
variety of common complex problems.
Parameters:
-----------
c0r: (In) The real part of the complex coefficient multiplying A0.
c0i: (In) The imag part of the complex coefficient multiplying A0.
A0: (In) An Epetra_RowMatrix that is one of the matrices used to
define the true complex operator.
c1r: (In) The real part of the complex coefficient multiplying A1.
c1i: (In) The imag part of the complex coefficient multiplying A1.
A1: (In) An Epetra_RowMatrix that is the second of the matrices used
to define the true complex operator.
Xr: (In) The real part of the complex valued LHS.
Xi: (In) The imag part of the complex valued LHS.
Br: (In) The real part of the complex valued RHS.
Bi: (In) The imag part of the complex valued RHS.
"""
this = _Komplex.new_Komplex_LinearProblem(*args)
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _Komplex.delete_Komplex_LinearProblem
__del__ = lambda self : None;
def UpdateValues(self, *args):
"""
UpdateValues(self, double c0r, double c0i, Epetra_RowMatrix A0, double c1r,
double c1i, Epetra_RowMatrix A1, Epetra_MultiVector Xr,
Epetra_MultiVector Xi, Epetra_MultiVector Br,
Epetra_MultiVector Bi) -> int
int
Komplex_LinearProblem::UpdateValues(double c0r, double c0i, const
Epetra_RowMatrix &A0, double c1r, double c1i, const Epetra_RowMatrix
&A1, const Epetra_MultiVector &Xr, const Epetra_MultiVector &Xi, const
Epetra_MultiVector &Br, const Epetra_MultiVector &Bi)
Update the values of the equivalent real valued system.
This method allows the values of an existing Komplex_LinearProblem
object to be updated. Note that the update that there is no change to
the pattern of the matrices.
Error code, set to 0 if no error.
"""
return _Komplex.Komplex_LinearProblem_UpdateValues(self, *args)
def ExtractSolution(self, *args):
"""
ExtractSolution(self, Epetra_MultiVector Xr, Epetra_MultiVector Xi) -> int
int
Komplex_LinearProblem::ExtractSolution(Epetra_MultiVector &Xr,
Epetra_MultiVector &Xi)
Extrac a solution for the original complex-valued problem using the
solution of the Komplex problem.
After solving the komplex linear system, this method can be called to
extract the solution of the original problem, assuming the solution
for the komplex system is valid.
Parameters:
-----------
Xr: (Out) An existing Epetra_MultiVector. On exit it will contain the
real part of the complex valued solution.
Xi: (Out) An existing Epetra_MultiVector. On exit it will contain the
imag part of the complex valued solution.
"""
return _Komplex.Komplex_LinearProblem_ExtractSolution(self, *args)
def KomplexProblem(self):
"""
KomplexProblem(self) -> Epetra_LinearProblem
Epetra_LinearProblem* Komplex_LinearProblem::KomplexProblem() const
Returns pointer to the Epetra_LinearProblem object that defines the
Komplex formulation.
The pointer returned from this method will contain the address of a
fully-constructed Epetra_LinearProblem instance that can be used with
any Trilinos preconditioner or solver.
"""
return _Komplex.Komplex_LinearProblem_KomplexProblem(self)
Komplex_LinearProblem_swigregister = _Komplex.Komplex_LinearProblem_swigregister
Komplex_LinearProblem_swigregister(Komplex_LinearProblem)
LinearProblem = Komplex_LinearProblem
# This file is compatible with both classic and new-style classes.
|