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

Header file for sparse matrices. More...

#include <iostream>
#include <Eigen/Core>
#include <Eigen/SparseCore>
#include "array.h"
#include "matpackI.h"

Go to the source code of this file.

## Classes

struct  Sparse
The Sparse class. More...

## Typedefs

using ArrayOfSparse = Array< Sparse >
An array of sparse matrices. More...

## Functions

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 mult (Sparse &A, const Sparse &B, const Sparse &C)
Sparse - Sparse multiplication. More...

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

void sub (Sparse &A, const Sparse &B, const Sparse &C)
Sparse - Sparse subtraction. More...

void transpose (Sparse &A, const Sparse &B)
Transpose of sparse matrix. More...

void id_mat (Sparse &A)
Sparse identity matrix. More...

## Detailed Description

Date
Tue Jul 15 15:05:40 2003

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.h.

## ◆ ArrayOfSparse

 using ArrayOfSparse = Array

An array of sparse matrices.

Definition at line 181 of file matpackII.h.

## ◆ abs()

 void abs ( Sparse & A, const Sparse & B )

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

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
 A Output: Result matrix. B First summand matrix. C Second summand matrix.
Date
2009-09-03

Definition at line 150 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
 A The matrix to be set to the identity matrix.

Definition at line 153 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
 A Output: Result matrix (full). B First matrix to multiply (sparse). C Second matrix to multiply (full).
Date
Tue Jul 15 15:05:40 2003

Definition at line 1139 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
 A Output: Result matrix (full). B First matrix to multiply (sparse). C Second matrix to multiply (full).
Date
Tue Jul 15 15:05:40 2003

Definition at line 1138 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
 A Output: Result matrix. B First product matrix. C Second product matrix.
Date
2003-08-06

Definition at line 149 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
 y Output: The multiplication result. M Matrix for multiplication (sparse). x Vector for multiplication.

Definition at line 605 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
 A Output: Result matrix. B First subtrahend matrix. C Second subtrahend matrix.
Date
2009-09-03

Definition at line 151 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
 A Output: Transposed matrix. B Original matrix.
Date
2003-08-05

Definition at line 152 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
 y Output: The multiplication result. M Matrix for multiplication (sparse). x Vector for multiplication.

Definition at line 606 of file matpackII.cc.

Referenced by test_sparse_multiplication().