View structurepadding.cpp
#include <iostream> | |
void printTypeSize() { | |
std::cout << "Size of char = " << sizeof(char) << " byte" << std:: endl; | |
std::cout << "Size of short = " << sizeof(short) << " byte" << std:: endl; | |
std::cout << "Size of int = " << sizeof(int) << " byte" << std:: endl; | |
std::cout << "Size of long = " << sizeof(long) << " byte" << std:: endl; | |
} | |
struct S1 { |
View doxygen.yml
name: Documentation | |
on: #(1) | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
page_build: |
View ctest2JUnit.py
from lxml import etree | |
import io | |
import sys | |
TAGfile = open(sys.argv[1]+"/Testing/TAG", 'r') #(1) | |
dirname = TAGfile.readline().strip() | |
xslfile = open(sys.argv[2], 'r') | |
xslcontent = xslfile.read() |
View Dockerfile
FROM debian:stable-slim #(1) | |
LABEL maintainer="ben.mahr@gmail.com" \ | |
description="Image which consists of C++ related build tools." \ | |
version="1.0" | |
RUN apt-get update -y && \ | |
apt-get install -y --no-install-recommends \ #(2) | |
git \ | |
openssh-server \ |
View config.yml
version: 2.1 | |
executors: #(1) | |
exectr: | |
docker: | |
- image: dockerben/cpptemplate:latest #(2) | |
jobs: | |
build: | |
executor: exectr #(1) | |
steps: |
View choleskyDecomposition.h
namespace CholeskyDecomposition { | |
template<typename T> | |
Matrix<T> SimplifySymmetricMatrix(Matrix<T> matrix) { | |
const size_t nbRows = matrix.rows(); | |
const size_t nbColumns = matrix.columns(); | |
for(size_t row = 0; row < nbRows; ++row) { | |
for(size_t column = row + 1; column < nbColumns; ++column) { | |
matrix(row, column) = 0; | |
} |
View pivotLUDecomposition.h
namespace PivotLUDecomposition { | |
template<typename T> | |
struct Decomposition { | |
Matrix<T> P; | |
Matrix<T> L; | |
Matrix<T> U; | |
Decomposition(const Matrix<T> &matrix) : P(matrix.rows(), matrix.columns()), L(matrix.rows(), matrix.columns()), U(matrix) {} | |
}; |
View luDecomposition.h
template<typename T> | |
Decomposition<T> Decompose(const Matrix<T> &matrix) { | |
const size_t nbRows = matrix.rows(); | |
const size_t nbColumns = matrix.columns(); | |
if(nbRows != nbColumns) { | |
throw std::domain_error("Matrix is not square."); | |
} | |
Decomposition<T> decomposition(matrix); |
View matrix.h
template<typename T> | |
class Matrix { | |
static_assert(std::is_arithmetic<T>::value, "T must be numeric"); | |
public: | |
~Matrix() = default; | |
Matrix(size_t rows, size_t columns, T *m) | |
: nbRows(rows), nbColumns(columns), matrix(std::make_unique<T[]>(rows*columns)) | |
{ | |
const size_t size = nbRows*nbColumns; |
View stdArray.h
struct __array_traits | |
{ | |
typedef _Tp _Type[_Nm]; //(1) | |
typedef __is_swappable<_Tp> _Is_swappable; | |
typedef __is_nothrow_swappable<_Tp> _Is_nothrow_swappable; | |
static constexpr _Tp& | |
_S_ref(const _Type& __t, std::size_t __n) noexcept | |
{ return const_cast<_Tp&>(__t[__n]); } |
NewerOlder