linop
package¶
linop
module¶
BaseLinearOperator
¶
Bases: object
Base class defining the common interface shared by all linear operators.
A linear operator is a linear mapping x -> A(x) such that the size of the
input vector x is nargin
and the size of the output is nargout
. It can
be visualized as a matrix of shape (nargout
, nargin
). Its type is any
valid Numpy dtype
. By default, it has dtype
numpy.float
but this can
be changed to, e.g., numpy.complex
via the dtype
keyword argument and
attribute.
A logger may be attached to the linear operator via the logger
keyword
argument.
Source code in brahmap/linop/linop.py
dtype
property
¶
The data type of the operator.
nMatvec
property
¶
The number of products with vectors computed so far.
nargin
property
¶
The size of an input vector.
nargout
property
¶
The size of an output vector.
shape
property
¶
The shape of the operator.
symmetric
property
¶
Indicate whether the operator is symmetric or not.
dot(x)
¶
DiagonalOperator
¶
Bases: LinearOperator
Class representing a diagonal operator.
A diagonal linear operator defined by its diagonal diag
(a Numpy array.)
The type must be specified in the diag
argument, e.g.,
np.ones(5, dtype=np.complex)
or np.ones(5).astype(np.complex)
.
Source code in brahmap/linop/linop.py
IdentityOperator
¶
Bases: LinearOperator
Class representing the identity operator of size nargin
.
Source code in brahmap/linop/linop.py
LinearOperator
¶
Bases: BaseLinearOperator
Generic linear operator class.
A linear operator constructed from a matvec
and (possibly) a
rmatvec
function. If symmetric
is True
, rmatvec
is
ignored. All other keyword arguments are passed directly to the superclass.
Source code in brahmap/linop/linop.py
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 351 352 353 354 355 356 357 358 359 360 |
|
H
property
¶
The adjoint operator.
T
property
¶
The transpose operator.
.. note:: this is an alias to the adjoint operator
__mul_linop(op)
¶
Product between two linear operators.
Source code in brahmap/linop/linop.py
__mul_scalar(x)
¶
Product between a linear operator and a scalar.
Source code in brahmap/linop/linop.py
__mul_vector(x)
¶
matvec(x)
¶
Matrix-vector multiplication.
The matvec property encapsulates the matvec routine specified at construct time, to ensure the consistency of the input and output arrays with the operator's shape.
Source code in brahmap/linop/linop.py
MatrixLinearOperator
¶
Bases: LinearOperator
Class representing a matrix operator.
A linear operator wrapping the multiplication with a matrix and its
transpose (real) or conjugate transpose (complex). The operator's dtype
is the same as the specified matrix
argument.
.. versionadded:: 0.3
Source code in brahmap/linop/linop.py
ShapeError
¶
Bases: Exception
Exception class for handling shape mismatch errors.
Exception raised when defining a linear operator of the wrong shape or multiplying a linear operator with a vector of the wrong shape.
Source code in brahmap/linop/linop.py
ZeroOperator
¶
Bases: LinearOperator
Class representing the zero operator of shape nargout
-by-nargin
.
Source code in brahmap/linop/linop.py
PysparseLinearOperator(A)
¶
Return a linear operator from a Pysparse sparse matrix.
.. deprecated:: 0.6
Use :func:aslinearoperator
instead.
Source code in brahmap/linop/linop.py
ReducedLinearOperator(op, row_indices, col_indices)
¶
Implement reduction of a linear operator (non symmetrical).
Reduce a linear operator by limiting its input to col_indices
and its
output to row_indices
.
Source code in brahmap/linop/linop.py
SymmetricallyReducedLinearOperator(op, indices)
¶
Implement reduction of a linear operator (symmetrical).
Reduce a linear operator symmetrically by reducing boths its input and
output to indices
.
Source code in brahmap/linop/linop.py
aslinearoperator(A)
¶
Return A as a LinearOperator.
'A' may be any of the following types: - linop.LinearOperator - scipy.LinearOperator - ndarray - matrix - sparse matrix (e.g. csr_matrix, lil_matrix, etc.) - any object with .shape and .matvec attributes
See the :class:LinearOperator
documentation for additonal information.
.. versionadded:: 0.4
Source code in brahmap/linop/linop.py
630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 |
|
linop_from_ndarray(A)
¶
Return a linear operator from a Numpy ndarray
.
.. deprecated:: 0.4
Use :class:MatrixLinearOperator
or :func:aslinearoperator
instead.
Source code in brahmap/linop/linop.py
blkop
module¶
BlockDiagonalLinearOperator
¶
Bases: LinearOperator
A block diagonal linear operator.
Each block must be a linear operator.
The blocks may be specified as one list, e.g., [A, B, C]
.
Source code in brahmap/linop/blkop.py
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 |
|
blocks
property
¶
The list of blocks defining the block diagonal operator.
BlockDiagonalPreconditioner
¶
Bases: BlockDiagonalLinearOperator
An alias for BlockDiagonalLinearOperator
.
Holds an additional solve
method equivalent to __mul__
.
Source code in brahmap/linop/blkop.py
BlockHorizontalLinearOperator
¶
Bases: BlockLinearOperator
A block horizontal linear operator.
Each block must be a linear operator.
The blocks must be specified as one list, e.g., [A, B, C]
.
Source code in brahmap/linop/blkop.py
BlockLinearOperator
¶
Bases: LinearOperator
A linear operator defined by blocks. Each block must be a linear operator.
blocks
should be a list of lists describing the blocks row-wise.
If there is only one block row, it should be specified as
[[b1, b2, ..., bn]]
, not as [b1, b2, ..., bn]
.
If the overall linear operator is symmetric, only its upper triangle
need be specified, e.g., [[A,B,C], [D,E], [F]]
, and the blocks on the
diagonal must be square and symmetric.
Source code in brahmap/linop/blkop.py
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 |
|
blocks
property
¶
The list of blocks defining the block operator.
BlockPreconditioner
¶
Bases: BlockLinearOperator
An alias for BlockLinearOperator
.
Holds an additional solve
method equivalent to __mul__
.
Source code in brahmap/linop/blkop.py
BlockVerticalLinearOperator
¶
Bases: BlockLinearOperator
A block vertical linear operator.
Each block must be a linear operator.
The blocks must be specified as one list, e.g., [A, B, C]
.