class rgpot::types::AtomMatrix

Overview

A lightweight row-major matrix class for atomic data. More…

#include 

class AtomMatrix {
public:
    // construction

    AtomMatrix();
    AtomMatrix(std::initializer_list> list);
    AtomMatrix(size_t rows, size_t cols);

    // methods

    double& operator()(size_t row, size_t col);
    const double& operator()(size_t row, size_t col) const;
    size_t rows() const;
    size_t cols() const;
    size_t size() const;
    double* data();
    const double* data() const;
    static AtomMatrix Zero(size_t rows, size_t cols);
};

Detailed Documentation

A lightweight row-major matrix class for atomic data.

Construction

AtomMatrix()

Default constructor.

AtomMatrix(std::initializer_list> list)

Constructor for list initialization.

Parameters:

list

The nested initializer list.

AtomMatrix(size_t rows, size_t cols)

Constructor for a matrix of given dimensions.

Parameters:

rows

Number of rows.

cols

Number of columns.

Methods

double& operator()(size_t row, size_t col)

Access element for mutation.

Parameters:

row

Row index.

col

Column index.

Returns:

Reference to the element.

const double& operator()(size_t row, size_t col) const

Access element for reading.

Parameters:

row

Row index.

col

Column index.

Returns:

Const reference to the element.

size_t rows() const

Fetches the number of rows.

Returns:

Row count.

size_t cols() const

Fetches the number of columns.

Returns:

Column count.

size_t size() const

Fetches the total number of elements.

Returns:

Size of the underlying data vector.

double* data()

Fetches a pointer to the raw data for mutation.

Returns:

Raw pointer to memory.

const double* data() const

Fetches a pointer to the raw data for reading.

Returns:

Const raw pointer to memory.

static AtomMatrix Zero(size_t rows, size_t cols)

Creates a matrix initialized with zeroes.

Parameters:

rows

Number of rows.

cols

Number of columns.

Returns:

A zero-initialized AtomMatrix.