ARTS 2.5.9 (git: 825fa5f2)
matpackII.cc File Reference

Implementation of sparse matrices. More...

#include "matpackII.h"
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <set>
#include <vector>

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &os, const Sparse &M)
 Output operator for Sparse. More...
 
void abs (Sparse &A, const Sparse &B)
 Absolute value of sparse matrix elements. More...
 
void mult (VectorView y, const Sparse &M, ConstVectorView x)
 Sparse matrix - Vector multiplication. More...
 
void transpose_mult (VectorView y, const Sparse &M, ConstVectorView x)
 Sparse matrix - Vector multiplication. More...
 
void mult (MatrixView A, const Sparse &B, const ConstMatrixView &C)
 SparseMatrix - Matrix multiplication. More...
 
void mult (MatrixView A, const ConstMatrixView &B, const Sparse &C)
 Matrix - SparseMatrix multiplication. More...
 
void transpose (Sparse &A, const Sparse &B)
 Transpose of sparse matrix. More...
 
void mult (Sparse &A, const Sparse &B, const Sparse &C)
 Sparse - Sparse multiplication. More...
 
void add (Sparse &A, const Sparse &B, const Sparse &C)
 Sparse - Sparse addition. More...
 
void id_mat (Sparse &A)
 Sparse identity matrix. More...
 
void sub (Sparse &A, const Sparse &B, const Sparse &C)
 Sparse - Sparse subtraction. More...
 

Detailed Description

Implementation of sparse matrices.

Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Mattias Ekstroem
Oliver Lemke
Simon Pfreundschuh simon.nosp@m.pf@c.nosp@m.halme.nosp@m.rs.s.nosp@m.e (Eigen interface)
Date
Wed Jan 06 10:17:15 2016

Notes:

There are two different ways to index: S.rw(3,4) = 1; // Read and write cout << S.ro(3,4); // Read only

This distinction is necessary, because rw() creates elements if they don't already exist.

The normal index operator "()" correspondes to ro, so "S(3,4)" is the same as S.ro(3,4).

Definition in file matpackII.cc.

Function Documentation

◆ abs()

void abs ( Sparse A,
const Sparse B 
)

Absolute value of sparse matrix elements.

Computes the absolute values of the elements in sparse matrix B.

The output matrix A must have been initialized with the correct size.

Parameters
AOutput: Absolute value matrix.
BOriginal matrix.
Author
Mattias Ekstrom
Date
2005-03-21

Definition at line 394 of file matpackII.cc.

Referenced by abs(), nonstd::abs(), adjust_los(), antenna2d_gridded_dlos(), asymmetry_parameter(), atmgeom_checkedCalc(), bending_angle1d(), brent_zero(), calc_incang(), lm_hitran_2017::calcw(), cart2geodetic(), cart2pol(), cart2poslos(), cart2sph(), chk_if_equal(), cloud_ppath_update1D(), cloud_ppath_update1D_noseq(), cloud_ppath_update1D_planeparallel(), cloudbox_checkedCalc(), cloudbox_fieldUpdateSeq1D(), cloudboxSetFullAtm(), covmat1D(), covmat1DMarkov(), distance2D(), do_gridcell_2d_byltest(), do_gridcell_3d_byltest(), doit_conv_flagAbs(), doit_conv_flagAbsBT(), doit_scat_fieldNormalize(), MCAntenna::draw_los(), Zeeman::dsum(), ext_abs_pfun_from_tro(), GasAbsLookup::Extract(), find_new_grid_in_old_grid(), geodeticposlos2cart(), geometrical_ppc(), geompath_from_r1_to_r2(), geompath_lat_at_za(), geompath_r_at_lat(), geompath_r_at_za(), geompath_za_at_r(), get_dtauc_ssalb(), get_maximum_error(), get_pmom(), HydrotableCalc(), interp_scat_angle_temperature(), irradiance_fieldFromRadiance(), is_los_downwards(), is_same_within_epsilon(), iyIndependentBeamApproximation(), iyRadarSingleScat(), iySurfaceCallAgendaX(), iySurfaceLambertian(), main(), met_mm_polarisation_hmatrix(), nlte_fieldForSingleSpeciesNonOverlappingLines(), norm_inf(), particle_bulkpropRadarOnionPeeling(), pha_mat_1ScatElem(), pha_mat_labCalc(), pha_mat_sptFromScat_data(), pha_matTransform(), plevel_crossing_2d(), plevel_slope_3d(), pndFromPsd(), polint(), poslos2cart(), ppath_calc(), ppath_end_3d(), ppath_start_2d(), ppath_start_3d(), ppath_start_stepping(), ppathFixedLstep(), ppathFromRtePos2(), ppathPlaneParallel(), propmat_clearskyAddFaraday(), propmat_clearskyAddOnTheFlyLineMixing(), propmat_clearskyAddOnTheFlyLineMixingWithZeeman(), psdFieldEtAl07(), r_crossing_2d(), r_crossing_3d(), raytrace_2d_linear_basic(), raytrace_3d_linear_basic(), reduced_1datm(), refraction_ppc(), Absorption::LineMixing::LinearRovibErrorCorrectedSudden::relaxation_matrix_offdiagonal(), rslope_crossing2d(), rslope_crossing3d(), scat_angle(), scat_data_checkedCalc(), scat_dataCheck(), scat_dataReduceT(), sensor_responseFillFgrid(), spectral_irradiance_fieldFromSpectralRadianceField(), specular_losCalc(), sph2cart(), Zeeman::sum(), surface_rtpropCallAgendaX(), surface_specular_R_and_b(), surfaceFastem(), surfaceLambertianSimple(), surfaceSplitSpecularTo3beams(), surfaceTessem(), test01(), test48(), test_oem_gauss_newton(), test_oem_levenberg_marquardt(), test_sparse_unary_operations(), wigner3j_limits(), ybatchMetProfiles(), ybatchMetProfilesClear(), yCalcAppend(), za_gridOpt(), and ze_cfac().

◆ add()

void add ( Sparse A,
const Sparse B,
const Sparse C 
)

Sparse - Sparse addition.

Calculates A = B+C, where result A is sparse, and B and C are also sparse.

Output comes first!

Dimensions of B, and C must match. A will be resized.

Parameters
AOutput: Result matrix.
BFirst summand matrix.
CSecond summand matrix.
Author
Oliver Lemke
Date
2009-09-03

Definition at line 630 of file matpackII.cc.

Referenced by test49(), and test_sparse_arithmetic().

◆ id_mat()

void id_mat ( Sparse A)

Sparse identity matrix.

Set the given Sparse matrix object to the identity matrix. The matrix must be square.

Parameters
AThe matrix to be set to the identity matrix.

Definition at line 647 of file matpackII.cc.

◆ mult() [1/4]

void mult ( MatrixView  A,
const ConstMatrixView B,
const Sparse C 
)

Matrix - SparseMatrix multiplication.

Calculates the matrix product:

A = B*C, where C is sparse.

Output comes first!

Dimensions of A, B, and C must match. No memory reallocation takes place, only the data is copied.

Parameters
AOutput: Result matrix (full).
BFirst matrix to multiply (sparse).
CSecond matrix to multiply (full).
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Tue Jul 15 15:05:40 2003

Definition at line 539 of file matpackII.cc.

◆ mult() [2/4]

void mult ( MatrixView  A,
const Sparse B,
const ConstMatrixView C 
)

SparseMatrix - Matrix multiplication.

Calculates the matrix product:

A = B*C, where B is sparse.

Output comes first!

Dimensions of A, B, and C must match. No memory reallocation takes place, only the data is copied.

Parameters
AOutput: Result matrix (full).
BFirst matrix to multiply (sparse).
CSecond matrix to multiply (full).
Author
Stefan Buehler sbueh.nosp@m.ler@.nosp@m.ltu.s.nosp@m.e
Date
Tue Jul 15 15:05:40 2003

Definition at line 490 of file matpackII.cc.

◆ mult() [3/4]

void mult ( Sparse A,
const Sparse B,
const Sparse C 
)

Sparse - Sparse multiplication.

Calculates A = B*C, where result A is sparse, and B and C are also sparse.

Output comes first!

Dimensions of A, B, and C must match. No memory reallocation takes place, only the data is copied.

Parameters
AOutput: Result matrix.
BFirst product matrix.
CSecond product matrix.
Author
Mattias Ekstroem
Date
2003-08-06

Definition at line 606 of file matpackII.cc.

◆ mult() [4/4]

void mult ( VectorView  y,
const Sparse M,
ConstVectorView  x 
)

Sparse matrix - Vector multiplication.

This calculates the product

y = M*x, where M is sparse.

Output comes first!

Dimensions of y, M, and x must match. No memory reallocation takes place, only the data is copied.

Parameters
yOutput: The multiplication result.
MMatrix for multiplication (sparse).
xVector for multiplication.

Definition at line 417 of file matpackII.cc.

◆ operator<<()

std::ostream & operator<< ( std::ostream &  os,
const Sparse M 
)

Output operator for Sparse.

Parameters
osOutput stream.
vSparse matrix to print.
Returns
Output stream.

Definition at line 375 of file matpackII.cc.

◆ sub()

void sub ( Sparse A,
const Sparse B,
const Sparse C 
)

Sparse - Sparse subtraction.

Calculates A = B-C, where result A is sparse, and B and C are also sparse.

Output comes first!

Dimensions of B, and C must match. A will be resized.

Parameters
AOutput: Result matrix.
BFirst subtrahend matrix.
CSecond subtrahend matrix.
Author
Oliver Lemke
Date
2009-09-03

Definition at line 667 of file matpackII.cc.

Referenced by test49(), and test_sparse_arithmetic().

◆ transpose()

void transpose ( Sparse A,
const Sparse B 
)

Transpose of sparse matrix.

Computes the transpose of the sparse matrix B.

The output matrix A must have been initialized with the correct size.

Parameters
AOutput: Transposed matrix.
BOriginal matrix.
Author
Mattias Ekstroem
Date
2003-08-05

Definition at line 582 of file matpackII.cc.

◆ transpose_mult()

void transpose_mult ( VectorView  y,
const Sparse M,
ConstVectorView  x 
)

Sparse matrix - Vector multiplication.

This calculates the product

y = M*x, where M is sparse.

Output comes first!

Dimensions of y, M, and x must match. No memory reallocation takes place, only the data is copied.

Parameters
yOutput: The multiplication result.
MMatrix for multiplication (sparse).
xVector for multiplication.

Definition at line 452 of file matpackII.cc.

Referenced by test_sparse_multiplication().