Skip to content
Ishan Khatri edited this page Dec 27, 2017 · 5 revisions

Welcome to the c-matrix wiki!

If you're looking at this, then I assume that you have decided to use the c-matrix library knowing that it is an unfinished hobby project that is slower than proper linear algebra libraries such as Eigen.

This wiki contains all the documentation required to use the c-matrix library and is split up into multiple parts. Please see the table of contents below to find what you're looking for.

Table of contents:

The cmatrix class

The cmatrix class:

The cmatrix class is defined in cmatrix.h with implementation in cmatrix.cpp. It is structured as follows:

Protected data:

  • vals - A generic vector (of type T) that stores the values of the matrix
  • rows - An int that represents the number of rows in the matrix
  • cols - An int that represents the number of columns in the matrix

Public functions:

  • num_rows() - A function that returns the number of rows as an int
  • num_cols() - A function that returns the number of columns as an int
  • print() - A void function that prints out the vector vals
  • get_row(int i) - A function that returns a vector containing the elements in row i of the matrix
  • dot(vector<T> x, vector<T> y) - A function that dots two vectors and returns a single value of type T

Operator overrides:

  • Addition - The addition of two cmatrix objects (must be of the same size)
  • Subtraction - The subtraction of two cmatrix objects (must be of the same size)
  • Multiplication - The multiplication of two cmatrix objects (the number of rows in the first matrix must be the number of columns in the second)