Solving PDEs in C++: Numerical Methods in a Unified Object-Oriented Approach

Appendix

A.1 Operations with Vectors

Here is the detailed implementation of some arithmetic operators of the "vector" class that have been left as an exercise in Chapter 2, Section 18:

templateconst vector&vector::operator-=(const vector&v){    for(int i = 0; i < N; i++)      component[i] -= v[i];    return *this;}  //  subtracting a vector from the current vectortemplateconst vector&vector::operator*=(const T& a){    for(int i = 0; i const vector&vector::operator/=(const T& a){    for(int i = 0; i < N; i++)      component[i] /= a;    return *this;}  //  multiplying the current vector by a scalartemplateconst vector<span class="beginpage"> pagenum="440"><a name="862"></a><a name="IDX-440"></a></span>operator-(const vector&u, const vector&v){  return vector(u) -= v;}  //  vector minus vectortemplateconst vectoroperator*(const vector&u, const T& a){  return vector(u) *= a;}  //  vector times scalartemplateconst vectoroperator*(const T& a, const vector&u){  return vector(u) *= a;}  //  T times vectortemplateconst vectoroperator/(const vector&u, const T& a){  return vector(u) /= a;}  //  vector times scalar

A.2 Operations with Matrices

Here is the actual implementation of the products of vector and matrix, matrix and vector, and matrix and matrix declared in Chapter 2, Section 20.

templateconst matrix&matrix::operator*=(const T&a){  for(int i=0; iconst matrix&matrix

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Vector Network Analyzers
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.