scifir-units 2.0.0
scifir-units is a library of units of measurement, angles, coordinates, fields, and related data, all lightweight, that help in the development of scientific software and scientific machines
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
matrix.hpp File Reference
#include "../units/scalar_unit.hpp"
#include <iostream>
#include <sstream>
#include <vector>
Include dependency graph for matrix.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  scifir::matrix< T, M, N >
 

Namespaces

namespace  scifir
 The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
 

Functions

template<typename T , int M, int N>
bool operator== (const scifir::matrix< T, M, N > &x, const scifir::matrix< T, M, N > &y)
 
template<typename T , int M, int N>
bool operator!= (const scifir::matrix< T, M, N > &x, const scifir::matrix< T, M, N > &y)
 
template<typename T , int M, int N>
ostream & operator<< (ostream &os, const scifir::matrix< T, M, N > &x)
 

Function Documentation

◆ operator!=()

template<typename T , int M, int N>
bool operator!= ( const scifir::matrix< T, M, N > &  x,
const scifir::matrix< T, M, N > &  y 
)

Definition at line 275 of file matrix.hpp.

276{
277 return !(x == y);
278}

◆ operator<<()

template<typename T , int M, int N>
ostream & operator<< ( ostream &  os,
const scifir::matrix< T, M, N > &  x 
)

Definition at line 281 of file matrix.hpp.

282{
283 ostringstream output;
284 output << "[";
285 for(int i = 1; i <= x.row_size(); i++)
286 {
287 for(int j = 1; j <= x.column_size(); j++)
288 {
289 output << x(i, j);
290 if(j < x.column_size())
291 {
292 output << ", ";
293 }
294 }
295 if(i < x.row_size())
296 {
297 output << endl;
298 }
299 }
300 output << "]";
301 return os << output.str();
302}

◆ operator==()

template<typename T , int M, int N>
bool operator== ( const scifir::matrix< T, M, N > &  x,
const scifir::matrix< T, M, N > &  y 
)

Definition at line 259 of file matrix.hpp.

260{
261 for(int i = 0; i < x.row_size(); i++)
262 {
263 for(int j = 0; j < x.column_size(); j++)
264 {
265 if (x(i,j) != y(i,j))
266 {
267 return false;
268 }
269 }
270 }
271 return true;
272}