• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • Maritime HMIs
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - Simulator
  • Matrix1D
  • 5.0.0

Matrix1D Class

(CDPSim::Matrix1D)

The Matrix1D provides basic vector functionality. More...

Header: #include <Matrix1D>
  • List of all members, including inherited members

Public Functions

Matrix1D()
Matrix1D(int rows)
Matrix1D(const Matrix1D &m)
virtual ~Matrix1D()
void Add(Matrix1D &output, double scalar) const
void Add(Matrix1D &output, const Matrix1D &increment) const
void Div(Matrix1D &output, double scalar) const
double *GetDatavaluesPointer() const
double Max() const
double Min() const
void Mult(Matrix1D &output, double scalar) const
void Print(const std::string &name, bool lineFeedAfter = true) const
void Reset(double value = 0.0)
int Rows() const
void SetDataPointersAndSize(double *datavalues, int size)
void SetDataPointersSizeAndInit(double *datavalues, int size, double value = 0.0)
bool operator!=(const Matrix1D &m2) const
double &operator()(int row) const
Matrix1D &operator*=(double value)
Matrix1D &operator+=(const Matrix1D &m)
Matrix1D &operator+=(double value)
Matrix1D &operator-=(const Matrix1D &m)
Matrix1D &operator-=(double value)
Matrix1D &operator/=(double value)
Matrix1D &operator=(const Matrix1D &m)
bool operator==(const Matrix1D &m2) const

Detailed Description

The Matrix1D provides basic vector functionality.

Operators:

  • () : Subscript operator to get or set individual matrix elements, A(i) = value, value = A(i).
  • +, -, *, /, +=, -=, *=, /=: Matrix or scalar operation.

Element index starts at 0.

Member Function Documentation

Matrix1D::Matrix1D()

Default constructs an instance of Matrix1D.

Matrix1D::Matrix1D(int rows)

Default constructs an instance of Matrix1D.

Matrix1D::Matrix1D(const Matrix1D &m)

Copy constructor.

[virtual] Matrix1D::~Matrix1D()

Destroys the instance of Matrix1D. The destructor is virtual.

void Matrix1D::Add(Matrix1D &output, double scalar) const

Adds every element of this matrix with scalar and stores the result in output

void Matrix1D::Add(Matrix1D &output, const Matrix1D &increment) const

Adds this matrix with the increment matrix and stores the result in output

void Matrix1D::Div(Matrix1D &output, double scalar) const

Divides each element of this matrix with scalar and stores the result in output

double *Matrix1D::GetDatavaluesPointer() const

Returns pointer to internal storage array.

double Matrix1D::Max() const

Returns the highest value in the matrix.

double Matrix1D::Min() const

Returns the smallest value in the matrix.

void Matrix1D::Mult(Matrix1D &output, double scalar) const

Multiplies this matrix with scalar and stores the result in output

void Matrix1D::Print(const std::string &name, bool lineFeedAfter = true) const

Outputs the content of this matrix to standard output.

void Matrix1D::Reset(double value = 0.0)

Resets all values in the matrix to value.

int Matrix1D::Rows() const

Get number of rows (size) in the matrix.

void Matrix1D::SetDataPointersAndSize(double *datavalues, int size)

Makes the matrix use as internal storage an array of datavalues of length specified by size.

void Matrix1D::SetDataPointersSizeAndInit(double *datavalues, int size, double value = 0.0)

Makes the matrix use as internal storage an array of datavalues of length specified by size. Values in the array are initialized to value.

bool Matrix1D::operator!=(const Matrix1D &m2) const

Test if A != B

double &Matrix1D::operator()(int row) const

Subscript operator for one dimensional matrix (that is, returns reference to first column).

Usage: value = A(i);, or A(i) = newValue;

Matrix1D &Matrix1D::operator*=(double value)

A *= value;

Matrix1D &Matrix1D::operator+=(const Matrix1D &m)

A += B;

Matrix1D &Matrix1D::operator+=(double value)

A += value;

Matrix1D &Matrix1D::operator-=(const Matrix1D &m)

A -= B;

Matrix1D &Matrix1D::operator-=(double value)

A -= value;

Matrix1D &Matrix1D::operator/=(double value)

A /= value;

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

Assignment operator (A = B)

bool Matrix1D::operator==(const Matrix1D &m2) const

Test if A == B

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2025 CDP Technologies. Privacy and cookie policy.

Return to top