29. A Matrix Design

Never express yourself more clearly than you are able to think.

– Niels Bohr

Introduction

Basic Matrix Uses; Matrix Requirements

A Matrix Template

Construction and Assignment; Subscripting and Slicing

Matrix Arithmetic Operations

Scalar Operations; Addition; Multiplication

Matrix Implementation

slice; Matrix Slices; Matrix_ref; Matrix List Initialization; Matrix Access; Zero-Dimensional Matrix

Solving Linear Equations

Classical Gaussian Elimination; Pivoting; Testing; Advice

29.1. Introduction

A language feature in isolation is boring and useless. This chapter demonstrates how features can be used in combination to address a challenging design task: a general N-dimensional matrix.

I have never seen a perfect matrix ...

Get The C++ Programming Language, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.