vec_arith.h File Reference


Detailed Description

Vector and matrix arithmetic.

Todo:
Properly document the operators defined as macros
Idea for future:
Define operators for complex vector * real matrix
Idea for future:
These should be replaced by the BLAS routines where possible?

Definition in file vec_arith.h.

#include <iostream>
#include <complex>
#include <o2scl/cx_arith.h>
#include <o2scl/ovector_tlate.h>
#include <o2scl/omatrix_tlate.h>
#include <o2scl/uvector_tlate.h>
#include <o2scl/umatrix_tlate.h>
#include <o2scl/ovector_cx_tlate.h>
#include <o2scl/omatrix_cx_tlate.h>
#include <o2scl/uvector_cx_tlate.h>
#include <o2scl/umatrix_cx_tlate.h>

Go to the source code of this file.

Namespaces

namespace  o2scl_arith

Defines

#define O2SCL_OP_VEC_VEC_ADD(vec1, vec2, vec3)
 The header macro for vector-vector addition.
#define O2SCL_OP_VEC_VEC_SUB(vec1, vec2, vec3)
 The header macro for vector-vector subtraction.
#define O2SCL_OP_MAT_VEC_MULT(vec1, vec2, mat)
 The header macro for matrix-vector (right) multiplication.
#define O2SCL_OP_CMAT_CVEC_MULT(vec1, vec2, mat)
 The header macro for complex matrix-vector (right) multiplication.
#define O2SCL_OP_VEC_MAT_MULT(vec1, vec2, mat)
 The header macro for vector-matrix (left) multiplication.
#define O2SCL_OP_TRANS_MULT(vec1, vec2, mat)
 The header macro for the trans_mult form of vector * matrix.
#define O2SCL_OP_DOT_PROD(dtype, vec1, vec2)
 The header macro for vector scalar (dot) product.
#define O2SCL_OP_CX_DOT_PROD(dtype, vec1, vec2)
 The header macro for complex vector scalar (dot) product.
#define O2SCL_OP_SCA_VEC_MULT(dtype, vecv, vec)
 The header macro for scalar-vector multiplication.
#define O2SCL_OP_VEC_SCA_MULT(dtype, vecv, vec)
 The header macro for vector-scalar multiplication.
#define O2SCL_OP_VEC_VEC_PRO(vec1, vec2, vec3)
 The header macro for pairwise vector * vector (where either vector can be real or complex).
#define O2SCL_OPSRC_VEC_VEC_ADD(vec1, vec2, vec3)
 The source code macro for vector-vector addition.
#define O2SCL_OPSRC_VEC_VEC_SUB(vec1, vec2, vec3)
 The source code macro for vector-vector subtraction.
#define O2SCL_OPSRC_MAT_VEC_MULT(vec1, vec2, mat)
 The source code macro for matrix * vector.
#define O2SCL_OPSRC_CMAT_CVEC_MULT(vec1, vec2, mat)
 The source code macro for complex matrix * complex vector.
#define O2SCL_OPSRC_VEC_MAT_MULT(vec1, vec2, mat)
 The source code macro for the operator form of vector * matrix.
#define O2SCL_OPSRC_TRANS_MULT(vec1, vec2, mat)
 The source code macro for the trans_mult form of vector * matrix.
#define O2SCL_OPSRC_DOT_PROD(dtype, vec1, vec2)
 The source code macro for a vector dot product.
#define O2SCL_OPSRC_CX_DOT_PROD(dtype, vec1, vec2)
 The source code macro for a complex vector dot product.
#define O2SCL_OPSRC_SCA_VEC_MULT(dtype, vecv, vec)
 The source code macro for vector=scalar*vector.
#define O2SCL_OPSRC_VEC_SCA_MULT(dtype, vecv, vec)
 The source code macro for vector=vector*scalar.
#define O2SCL_OPSRC_VEC_VEC_PRO(vec1, vec2, vec3)
 The source code macro for pairwise vector * vector (where either vector can be real or complex).
#define O2SCL_OP_VEC_VEC_EQUAL(vec1, vec2)
 The header macro for vector==vector.
#define O2SCL_OPSRC_VEC_VEC_EQUAL(vec1, vec2)
 The source code macro vector==vector.
#define O2SCL_OP_VEC_VEC_NEQUAL(vec1, vec2)
 The header macro for vector!=vector.
#define O2SCL_OPSRC_VEC_VEC_NEQUAL(vec1, vec2)
 The source code macro vector!=vector.

Functions

template<class vec_t, class vec2_t>
void vector_copy (size_t N, vec_t &src, vec2_t &dest)
 Naive vector copy.
template<class mat_t, class mat2_t>
void matrix_copy (size_t M, size_t N, mat_t &src, mat2_t &dest)
 Naive matrix copy.
template<class vec_t, class vec2_t>
void vector_cx_copy (size_t N, vec_t &src, vec2_t &dest)
 Naive complex vector copy.
template<class mat_t, class mat2_t>
void matrix_cx_copy (size_t M, size_t N, mat_t &src, mat2_t &dest)
 Naive complex matrix copy.


Define Documentation

#define O2SCL_OP_CMAT_CVEC_MULT ( vec1,
vec2,
mat   ) 

Value:

vec1 operator*  \
    (const mat &m, const vec2 &x);
The header macro for complex matrix-vector (right) multiplication.

Given types vec1, vec2, and mat, this macro provides the function declaration for adding two vectors using the form

      vec1 operator*(const mat &m, const vec3 &x);

The corresponding definition is given in O2SCL_OPSRC_CMAT_CVEC_MULT.

By default, the following operators are defined:

Definition at line 265 of file vec_arith.h.

#define O2SCL_OP_CX_DOT_PROD ( dtype,
vec1,
vec2   ) 

Value:

dtype dot       \
    (const vec1 &x, const vec2 &y);
The header macro for complex vector scalar (dot) product.

Given types vec1, vec2, and dtype, this macro provides the function declaration for adding two vectors using the form

      dtype operator*(const vec1 &x, const vec2 &y);

The corresponding definition is given in O2SCL_OPSRC_CX_DOT_PROD.

Definition at line 382 of file vec_arith.h.

#define O2SCL_OP_DOT_PROD ( dtype,
vec1,
vec2   ) 

Value:

dtype dot       \
    (const vec1 &x, const vec2 &y);
The header macro for vector scalar (dot) product.

Given types vec1, vec2, and dtype, this macro provides the function declaration for adding two vectors using the form

      dtype operator*(const vec1 &x, const vec2 &y);

The corresponding definition is given in O2SCL_OPSRC_DOT_PROD.

Definition at line 351 of file vec_arith.h.

#define O2SCL_OP_MAT_VEC_MULT ( vec1,
vec2,
mat   ) 

Value:

vec1 operator*  \
    (const mat &m, const vec2 &x);
The header macro for matrix-vector (right) multiplication.

Given types vec1, vec2, and mat, this macro provides the function declaration for adding two vectors using the form

      vec1 operator*(const mat &m, const vec3 &x);

The corresponding definition is given in O2SCL_OPSRC_MAT_VEC_MULT.

By default, the following operators are defined:

Definition at line 223 of file vec_arith.h.

#define O2SCL_OP_SCA_VEC_MULT ( dtype,
vecv,
vec   ) 

Value:

vec operator*   \
    (const dtype &x, const vecv &y);
The header macro for scalar-vector multiplication.

Given types vecv, vec, and dtype, this macro provides the function declaration for adding two vectors using the form

      vec operator*(const dtype &x, const vecv &y);

The corresponding definition is given in O2SCL_OPSRC_SCA_VEC_MULT.

Definition at line 416 of file vec_arith.h.

#define O2SCL_OP_TRANS_MULT ( vec1,
vec2,
mat   ) 

Value:

vec1 trans_mult \
    (const vec2 &x, const mat &m);
The header macro for the trans_mult form of vector * matrix.

Definition at line 321 of file vec_arith.h.

#define O2SCL_OP_VEC_MAT_MULT ( vec1,
vec2,
mat   ) 

Value:

vec1 operator*  \
    (const vec2 &x, const mat &m);
The header macro for vector-matrix (left) multiplication.

Given types vec1, vec2, and mat, this macro provides the function declaration for adding two vectors using the form

      vec1 operator*(const vec3 &x, const mat &m);

The corresponding definition is given in O2SCL_OPSRC_VEC_MAT_MULT.

Definition at line 300 of file vec_arith.h.

#define O2SCL_OP_VEC_SCA_MULT ( dtype,
vecv,
vec   ) 

Value:

vec operator*   \
    (const vecv &x, const dtype &y);
The header macro for vector-scalar multiplication.

Given types vecv, vec, and dtype, this macro provides the function declaration for adding two vectors using the form

      vec operator*(const vecv &x, const dtype &y);

The corresponding definition is given in O2SCL_OPSRC_VEC_SCA_MULT.

Definition at line 444 of file vec_arith.h.

#define O2SCL_OP_VEC_VEC_ADD ( vec1,
vec2,
vec3   ) 

Value:

vec1 operator+  \
    (const vec2 &x, const vec3 &y);
The header macro for vector-vector addition.

Given types vec1, vec2, and vec_3, this macro provides the function declaration for adding two vectors using the form

      vec1 operator+(const vec2 &x, const vec3 &y);

The corresponding definition is given in O2SCL_OPSRC_VEC_VEC_ADD.

By default, the following operators are defined:

Definition at line 121 of file vec_arith.h.

#define O2SCL_OP_VEC_VEC_EQUAL ( vec1,
vec2   ) 

Value:

bool operator== \
      (const vec1 &x, const vec2 &y);
The header macro for vector==vector.

Given types vec1 and vec2, this macro provides the function declaration for vector equality comparisons using

        bool operator==(const vec1 &x, const vec2 &y);

Note:
Two vectors with different sizes are defined to be not equal, no matter what their contents.
The corresponding definition is given in O2SCL_OPSRC_VEC_VEC_EQUAL.

Definition at line 734 of file vec_arith.h.

#define O2SCL_OP_VEC_VEC_NEQUAL ( vec1,
vec2   ) 

Value:

bool operator!= \
    (const vec1 &x, const vec2 &y);
The header macro for vector!=vector.

Given types vec1 and vec2, this macro provides the function declaration for vector inequality comparisons using

      bool operator==(const vec1 &x, const vec2 &y);

Note:
Two vectors with different sizes are defined to be not equal, no matter what their contents.
The corresponding definition is given in O2SCL_OPSRC_VEC_VEC_NEQUAL.

Definition at line 816 of file vec_arith.h.

#define O2SCL_OP_VEC_VEC_PRO ( vec1,
vec2,
vec3   ) 

Value:

vec1 pair_prod  \
    (const vec2 &x, const vec3 &y);
The header macro for pairwise vector * vector (where either vector can be real or complex).

Given types vec1, vec2, and vec3, this macro provides the function declaration for adding two vectors using the form

      vec1 pair_prod(const vec2 &x, const vec3 &y);

The corresponding definition is given in O2SCL_OPSRC_VEC_VEC_PRO.

Definition at line 473 of file vec_arith.h.

#define O2SCL_OP_VEC_VEC_SUB ( vec1,
vec2,
vec3   ) 

Value:

vec1 operator-  \
    (const vec2 &x, const vec3 &y);
The header macro for vector-vector subtraction.

Given types vec1, vec2, and vec_3, this macro provides the function declaration for adding two vectors using the form

      vec1 operator-(const vec2 &x, const vec3 &y);

The corresponding definition is given in O2SCL_OPSRC_VEC_VEC_SUB.

By default, the following operators are defined:

Definition at line 174 of file vec_arith.h.

#define O2SCL_OPSRC_CMAT_CVEC_MULT ( vec1,
vec2,
mat   ) 

The source code macro for complex matrix * complex vector.

This define macro generates the function definition. See the function declaration O2SCL_OP_CMAT_CVEC_MULT

Definition at line 573 of file vec_arith.h.

#define O2SCL_OPSRC_CX_DOT_PROD ( dtype,
vec1,
vec2   ) 

The source code macro for a complex vector dot product.

This define macro generates the function definition. See the function declaration O2SCL_OP_CX_DOT_PROD

Definition at line 658 of file vec_arith.h.

#define O2SCL_OPSRC_DOT_PROD ( dtype,
vec1,
vec2   ) 

The source code macro for a vector dot product.

This define macro generates the function definition. See the function declaration O2SCL_OP_DOT_PROD

Definition at line 641 of file vec_arith.h.

#define O2SCL_OPSRC_MAT_VEC_MULT ( vec1,
vec2,
mat   ) 

The source code macro for matrix * vector.

This define macro generates the function definition. See the function declaration O2SCL_OP_MAT_VEC_MULT

Definition at line 552 of file vec_arith.h.

#define O2SCL_OPSRC_SCA_VEC_MULT ( dtype,
vecv,
vec   ) 

The source code macro for vector=scalar*vector.

This define macro generates the function definition. See the function declaration O2SCL_OP_SCA_VEC_MULT

Definition at line 675 of file vec_arith.h.

#define O2SCL_OPSRC_TRANS_MULT ( vec1,
vec2,
mat   ) 

The source code macro for the trans_mult form of vector * matrix.

This define macro generates the function definition. See the function declaration O2SCL_OP_TRANS_MULT

Definition at line 620 of file vec_arith.h.

#define O2SCL_OPSRC_VEC_MAT_MULT ( vec1,
vec2,
mat   ) 

The source code macro for the operator form of vector * matrix.

This define macro generates the function definition. See the function declaration O2SCL_OP_VEC_MAT_MULT

Definition at line 598 of file vec_arith.h.

#define O2SCL_OPSRC_VEC_SCA_MULT ( dtype,
vecv,
vec   ) 

The source code macro for vector=vector*scalar.

This define macro generates the function definition. See the function declaration O2SCL_OP_VEC_SCA_MULT

Definition at line 691 of file vec_arith.h.

#define O2SCL_OPSRC_VEC_VEC_ADD ( vec1,
vec2,
vec3   ) 

The source code macro for vector-vector addition.

This define macro generates the function definition. See the function declaration O2SCL_OP_VEC_VEC_ADD

Definition at line 518 of file vec_arith.h.

#define O2SCL_OPSRC_VEC_VEC_EQUAL ( vec1,
vec2   ) 

The source code macro vector==vector.

Note:
Two vectors with different sizes are defined to be not equal, no matter what their contents.
This define macro generates the function definition. See the function declaration O2SCL_OP_VEC_VEC_EQUAL

Definition at line 790 of file vec_arith.h.

#define O2SCL_OPSRC_VEC_VEC_NEQUAL ( vec1,
vec2   ) 

The source code macro vector!=vector.

Note:
Two vectors with different sizes are defined to be not equal, no matter what their contents.
This define macro generates the function definition. See the function declaration O2SCL_OP_VEC_VEC_NEQUAL

Definition at line 872 of file vec_arith.h.

#define O2SCL_OPSRC_VEC_VEC_PRO ( vec1,
vec2,
vec3   ) 

The source code macro for pairwise vector * vector (where either vector can be real or complex).

This define macro generates the function definition. See the function declaration O2SCL_OP_VEC_VEC_PRO

Definition at line 708 of file vec_arith.h.

#define O2SCL_OPSRC_VEC_VEC_SUB ( vec1,
vec2,
vec3   ) 

The source code macro for vector-vector subtraction.

This define macro generates the function definition. See the function declaration O2SCL_OP_VEC_VEC_SUB

Definition at line 535 of file vec_arith.h.


Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page