Linear Operators¶
BlockDiagonalLO
¶
Bases: LinearOperator
Explicit implementation of :math:A diag(N^{-1}) A^T
, in order to save time
in the application of the two matrices onto a vector (in this way the leading dimension will be :math:n_{pix}
instead of :math:n_t
).
.. note::
it is initialized as the :class:BlockDiagonalPreconditionerLO
since it involves
computation with the same matrices.
Source code in brahmap/interfaces/linearoperators.py
mult(x)
¶
Multiplication of :math:A diag(N^{-1}) A^T
on to a vector math:x
( :math:n_{pix}
array).
Source code in brahmap/interfaces/linearoperators.py
BlockDiagonalPreconditionerLO
¶
Bases: LinearOperator
Standard preconditioner defined as:
.. math::
M_{BD}=( A diag(N^{-1}) A^T)^{-1}
where :math:A
is the pointing matrix (see :class:SparseLO
).
Such inverse operator could be easily computed given the structure of the
matrix :math:A
. It could be sparse in the case of Intensity only analysis (pol=1
),
block-sparse if polarization is included (pol=3,2
).
Parameters
n
:{int} the size of the problem,npix
;CES
:{:class:ProcessTimeSamples
} the linear operator related to the data sample processing. Its members (counts
,masks
,sine
,cosine
, etc... ) are needed to explicitly compute the inverse of the :math:n_{pix}
blocks of :math:M_{BD}
.pol
:{int} the size of each block of the matrix.
Source code in brahmap/interfaces/linearoperators.py
mult(x)
¶
Action of :math:y=( A diag(N^{-1}) A^T)^{-1} x
,
where :math:x
is an :math:n_{pix}
array.
Source code in brahmap/interfaces/linearoperators.py
BlockLO
¶
Bases: BlockDiagonalLinearOperator
Derived class from :mod:blkop.BlockDiagonalLinearOperator
.
It basically relies on the definition of a block diagonal operator,
composed by nblocks
diagonal operators with equal size .
If it does not have any off-diagonal terms (default case ), each block is a multiple of
the identity characterized by the values listed in t
and therefore is
initialized by the :func:BlockLO.build_blocks
as a :class:linop.DiagonalOperator
.
Parameters
blocksize
: {int or list } size of each diagonal block, ifint
it is : :math:blocksize= n/nblocks
.t
: {array} noise values for each block-
offdiag
: {bool, defaultFalse
} strictly related to the way the arrayt
is passed (see notes )... note::
- True : ``t`` is a list of array, ``shape(t)= [nblocks,bandsize]``, to have a Toeplitz band diagonal operator, :math:`bandsize != blocksize` - False : ``t`` is an array, ``shape(t)=[nblocks]``. each block is identified by a scalar value in the diagonal.
Source code in brahmap/interfaces/linearoperators.py
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 |
|
isoffdiag
property
¶
Property saying whether or not the operator has off-diagonal terms.
build_blocks()
¶
Build each block of the operator either with or without off diagonal terms. Each block is initialized as a Toeplitz (either band or diagonal) linear operator.
.. see also::
self.diag
: {numpy array}
the array resuming the :math:diag(N^{-1})
.
Source code in brahmap/interfaces/linearoperators.py
InverseLO
¶
Bases: LinearOperator
Construct the inverse operator of a matrix :math:A
, as a linear operator.
Parameters
A
: {linear operator} the linear operator of the linear system to invert;method
: {function } the method to computeA^-1
(see below);P
: {linear operator } (optional) the preconditioner for the computation of the inverse operator.
Source code in brahmap/interfaces/linearoperators.py
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
|
converged
property
¶
provides convergence information:
- 0 : successful exit;
-
0 : convergence to tolerance not achieved, number of iterations;
- <0 : illegal input or breakdown.
method
property
¶
The method to compute the inverse of A. \
It can be any :mod:scipy.sparse.linalg
solver, namely :func:scipy.sparse.linalg.cg
,
:func:scipy.sparse.linalg.bicg
, etc.
preconditioner
property
¶
Preconditioner for the solver.
isconverged(info)
¶
It returns a Boolean value depending on the exit status of the solver.
Parameters
info
: {int} output of the solver method (usually :func:scipy.sparse.cg
).
Source code in brahmap/interfaces/linearoperators.py
mult(x)
¶
It returns :math:y=A^{-1}x
by solving the linear system :math:Ay=x
with a certain :mod:scipy
routine (e.g. :func:scipy.sparse.linalg.cg
)
defined above as method
.
Source code in brahmap/interfaces/linearoperators.py
SparseLO
¶
Bases: LinearOperator
Derived class from the one from the :class:LinearOperator
in :mod:linop
.
It constitutes an interface for dealing with the projection operator
(pointing matrix).
Since this can be represented as a sparse matrix, it is initialized \
by an array of observed pixels which resembles the (i,j)
positions \
of the non-null elements of the matrix,obs_pixs
.
Parameters
n
: {int} size of the pixel domain ;m
: {int} size of time domain; (or the non-null elements in a row of :math:A_{i,j}
);pix_samples
: {array} list of pixels observed in the time domain, (or the non-null elements in a row of :math:A_{i,j}
);pol
: {int,[defaultpol=1
]} process an intensity only (pol=1
), polarization onlypol=2
and intensity+polarization map (pol=3
);angle_processed
: {:class:ProcessTimeSamples
} the class (instantiated before :class:SparseLO
)has already computed the :math:\cos 2\phi
and :math:\sin 2\phi
, we link thecos
andsin
attributes of this class to the :class:ProcessTimeSamples
ones ;
Source code in brahmap/interfaces/linearoperators.py
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 |
|
maptype
property
¶
Return a string depending on the map you are processing
mult(v)
¶
Performs the product of a sparse matrix :math:Av
,\
with :math:v
a :mod:numpy
array (:math:dim(v)=n_{pix}
) .
It extracts the components of :math:v
corresponding to the non-null \
elements of the operator.
Source code in brahmap/interfaces/linearoperators.py
mult_iqu(v)
¶
Performs the product of a sparse matrix :math:Av
,
with v
a :mod:numpy
array containing the
three Stokes parameters [IQU] .
.. note::
Compared to the operation mult
this routine returns a
:math:n_t
-size vector defined as:
.. math::
d_t= I_p + Q_p \cos(2\phi_t)+ U_p \sin(2\phi_t).
with :math:`p` is the pixel observed at time :math:`t` with polarization angle
:math:`\phi_t`.
Source code in brahmap/interfaces/linearoperators.py
mult_qu(v)
¶
Performs :math:A * v
with :math:v
being a polarization vector.
The output array will encode a linear combination of the two Stokes
parameters, (whose components are stored contiguously).
.. math:: d_t= Q_p \cos(2\phi_t)+ U_p \sin(2\phi_t).
Source code in brahmap/interfaces/linearoperators.py
rmult(v)
¶
Performs the product for the transpose operator :math:A^T
.
rmult_iqu(v)
¶
Performs the product for the transpose operator :math:A^T
to get a IQU map-like vector.
Since this vector resembles the pixel of 3 maps it has 3 times the size Npix
.
IQU values referring to the same pixel are contiguously stored in the memory.
Source code in brahmap/interfaces/linearoperators.py
rmult_qu(v)
¶
Performs :math:A^T * v
. The output vector will be a QU-map-like array.
Source code in brahmap/interfaces/linearoperators.py
ToeplitzLO
¶
Bases: LinearOperator
Derived Class from a LinearOperator. It exploit the symmetries of an dim x dim
Toeplitz matrix.
This particular kind of matrices satisfy the following relation:
.. math::
A_{i,j}=A_{i+1,j+1}=a_{i-j}
Therefore, it is enough to initialize A
by mean of an array a
of size = dim
.
Parameters
a
: {array, list} the array which resembles all the elements of the Toeplitz matrix;size
: {int} size of the block.
Source code in brahmap/interfaces/linearoperators.py
mult(v)
¶
Performs the product of a Toeplitz matrix with a vector x
.