Matrix Class Reference

The Matrix class. More...

#include <matpackI.h>

Inheritance diagram for Matrix:

Inheritance graph
[legend]
Collaboration diagram for Matrix:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Matrix ()
 Default constructor.
 Matrix (Index r, Index c)
 Constructor setting size.
 Matrix (Index r, Index c, Numeric fill)
 Constructor setting size and filling with constant value.
 Matrix (const ConstMatrixView &v)
 Copy constructor from MatrixView.
 Matrix (const Matrix &v)
 Copy constructor from Matrix.
Matrixoperator= (const Matrix &x)
 Assignment operator from another matrix.
Matrixoperator= (Numeric x)
 Assignment operator from scalar.
Matrixoperator= (const ConstVectorView &v)
 Assignment from a vector.
void resize (Index r, Index c)
 Resize function.
virtual ~Matrix ()
 Destructor for Matrix.
Numericget_raw_data ()


Detailed Description

The Matrix class.

This is a MatrixView that also allocates storage automatically, and deallocates it when it is destroyed. We take all the functionality from MatrixView. Additionally defined here are:

1. Constructors and destructor. 2. Assignment operator from scalar. 3. Resize function.

Definition at line 758 of file matpackI.h.


Constructor & Destructor Documentation

Matrix::Matrix (  ) 

Default constructor.

Definition at line 1416 of file matpackI.cc.

Matrix::Matrix ( Index  r,
Index  c 
)

Constructor setting size.

This constructor has to set the stride in the row range correctly!

Definition at line 1427 of file matpackI.cc.

Matrix::Matrix ( Index  r,
Index  c,
Numeric  fill 
)

Constructor setting size and filling with constant value.

Definition at line 1436 of file matpackI.cc.

References ConstMatrixView::mdata.

Matrix::Matrix ( const ConstMatrixView m  ) 

Copy constructor from MatrixView.

This automatically sets the size and copies the data.

Definition at line 1450 of file matpackI.cc.

References MatrixView::begin(), ConstMatrixView::begin(), copy(), and ConstMatrixView::end().

Matrix::Matrix ( const Matrix m  ) 

Copy constructor from Matrix.

This automatically sets the size and copies the data.

Definition at line 1460 of file matpackI.cc.

References MatrixView::begin(), copy(), and MatrixView::end().

Matrix::~Matrix (  )  [virtual]

Destructor for Matrix.

This is important, since Matrix uses new to allocate storage.

Definition at line 1562 of file matpackI.cc.

References ConstMatrixView::mdata.


Member Function Documentation

Matrix & Matrix::operator= ( const Matrix m  ) 

Assignment operator from another matrix.

While dimensions of MatrixViews can not be adjusted, dimensions of matrices *can* be adjusted. Hence, the behavior of the assignment operator is different.

In this case the size of the target is automatically adjusted. This is important, so that structures containing matrices are copied correctly.

This is a deviation from the old ARTS paradigm that sizes must match exactly before copying!

Note: It is sufficient to have only this one version of the assignment (Matrix = Matrix). It implicitly covers the cases Matrix=MatrixView, etc, because there is a default constructor for Matrix from MatrixView. (See C++ Primer Plus, page 571ff.)

Parameters:
m The other matrix to assign to this one.
Returns:
This matrix, by tradition.
Author:
Stefan Buehler
Date:
2002-12-19

Reimplemented from MatrixView.

Definition at line 1497 of file matpackI.cc.

References MatrixView::begin(), copy(), MatrixView::end(), ConstMatrixView::mcr, Range::mextent, ConstMatrixView::mrr, and resize().

Matrix & Matrix::operator= ( Numeric  x  ) 

Assignment operator from scalar.

Assignment operators also seem to be not inherited.

Reimplemented from MatrixView.

Definition at line 1510 of file matpackI.cc.

References MatrixView::begin(), copy(), and MatrixView::end().

Matrix & Matrix::operator= ( const ConstVectorView v  ) 

Assignment from a vector.

This copies the data from a VectorView to this MatrixView.

The dimension is adjusted automatically.

Parameters:
v The vector to assign to this matrix.
Returns:
This matrix, by tradition.
Author:
Stefan Buehler
Date:
2002-12-19

Reimplemented from MatrixView.

Definition at line 1529 of file matpackI.cc.

References MatrixView::begin(), copy(), ConstVectorView::nelem(), and resize().

void Matrix::resize ( Index  r,
Index  c 
)

Numeric* Matrix::get_raw_data (  )  [inline]

Definition at line 778 of file matpackI.h.

References ConstMatrixView::mdata.


The documentation for this class was generated from the following files:

Generated on Mon Mar 23 14:07:01 2009 for ARTS by  doxygen 1.5.6