Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Dot products
[Non-member C-style functions]

Collaboration diagram for Dot products:

External methods that compute the dot product between two objects. More...

Functions

template<typename T>
dot (const Vector< T > &v1, const Vector< T > &v2)
 Returns the dot product between v1 and v2: $\vec{v_1}\cdot\vec{v_2}=\sum_i{(v_1)_i (v_2)_i}$ .
template<typename T>
c_dot (const Vector< T > &v1, const Vector< T > &v2)
 Returns the conjugate dot product between v1 and v2: $\vec{v_1}^*\cdot\vec{v_2}=\sum_i{(v_1)_i^* (v_2)_i}$ .
template<typename T>
dot (const Matrix< T > &m1, const Matrix< T > &m2)
 Returns the Hilbert-Schmidt dot product between m1 and m2: $m_1\cdot m_2 = \mathrm{Tr}m_1^Tm_2 = \sum_{i,j}{(m_1)_{i,j} (m_2)_{i,j}} $ .
template<typename T>
c_dot (const Matrix< T > &m1, const Matrix< T > &m2)
 Returns the Hilbert-Schmidt conjugate dot product between m1 and m2: $ m_1\cdot m_2 = \mathrm{Tr}m_1^\dagger m_2 = \sum_{i,j}{(m_1)_{i,j}^* (m_2)_{i,j}}$ .
template<typename T>
dot (const DenseVector< T > &v1, const DenseVector< T > &v2)
 Returns the dot product between v1 and v2: $\vec{v_1}\cdot\vec{v_2}=\sum_i{(v_1)_i (v_2)_i}$ .
template<typename T>
dot (const DenseMatrix< T > &m1, const DenseMatrix< T > &m2)
 Returns the Hilbert-Schmidt dot product between m1 and m2: $m_1\cdot m_2 = \mathrm{Tr}m_1^Tm_2 = \sum_{i,j}{(m_1)_{i,j} (m_2)_{i,j}}$ .
template<typename T>
c_dot (const DenseMatrix< T > &m1, const DenseMatrix< T > &m2)
 Returns the Hilbert-Schmidt conjugate dot product between m1 and m2: $m_1\cdot m_2 = \mathrm{Tr}m_1^\dagger m_2 = \sum_{i,j}{(m_1)_{i,j}^* (m_2)_{i,j}}$ .
template<>
double dot (const DenseVector< double > &v1, const DenseVector< double > &v2)
 Computes the dot product between two DenseVector<double> objects. Uses BLAS if possible.
template<>
double c_dot (const DenseVector< double > &v1, const DenseVector< double > &v2)
 Computes the conjugate dot product between two DenseVector<double> objects. Uses BLAS if possible.
template<>
complex dot (const DenseVector< complex > &v1, const DenseVector< complex > &v2)
 Computes the dot product between two DenseVector<complex> objects. Uses BLAS if possible.
template<>
complex c_dot (const DenseVector< complex > &v1, const DenseVector< complex > &v2)
 Computes the conjugate dot product between two DenseVector<complex> objects. Uses BLAS if possible.
template<>
double dot (const DenseMatrix< double > &m1, const DenseMatrix< double > &m2)
 Computes the Hilbert-Schmidt dot product of two DenseMatrix<double> objects. Uses BLAS if possible.
template<>
double c_dot (const DenseMatrix< double > &m1, const DenseMatrix< double > &m2)
 Computes the Hilbert-Schmidt conjugate dot product of two DenseMatrix<double> objects. Uses BLAS if possible.
template<>
complex dot (const DenseMatrix< complex > &m1, const DenseMatrix< complex > &m2)
 Computes the dot product of two DenseMatrix<complex> objects. Uses BLAS if possible.
template<>
complex c_dot (const DenseMatrix< complex > &m1, const DenseMatrix< complex > &m2)
 Computes the conjugate dot product of two DenseMatrix<complex> objects. Uses BLAS if possible.

Detailed Description

External methods that compute the dot product between two objects.


Function Documentation

template<typename T>
T c_dot const Vector< T > &  v1,
const Vector< T > &  v2
 

Returns the conjugate dot product between v1 and v2: $\vec{v_1}^*\cdot\vec{v_2}=\sum_i{(v_1)_i^* (v_2)_i}$ .

This is usually the appropriate dot product to use for complex vectors, but it is not symmetric with respect to the arguments -- the first one is the one that gets conjugated!

template<>
double c_dot const DenseVector< double > &  v1,
const DenseVector< double > &  v2
 

Computes the conjugate dot product between two DenseVector<double> objects. Uses BLAS if possible.

For vectors of double, conjugation is trivial. Therefore, this simply duplicates the functionality of dot( v1, v2 ).

template<>
complex dot const DenseVector< complex > &  v1,
const DenseVector< complex > &  v2
 

Computes the dot product between two DenseVector<complex> objects. Uses BLAS if possible.

This is probably not the function you're looking for; complex vectors should usually be conjugate dotted.

template<>
complex c_dot const DenseVector< complex > &  v1,
const DenseVector< complex > &  v2
 

Computes the conjugate dot product between two DenseVector<complex> objects. Uses BLAS if possible.

This is usually the correct way to compute the dot product of two complex vectors, as a sesquilinear form.

template<>
double c_dot const DenseMatrix< double > &  m1,
const DenseMatrix< double > &  m2
 

Computes the Hilbert-Schmidt conjugate dot product of two DenseMatrix<double> objects. Uses BLAS if possible.

Since conjugation is trivial for real numbers, this duplicates the functionality of dot( m1, m2).

template<>
complex dot const DenseMatrix< complex > &  m1,
const DenseMatrix< complex > &  m2
 

Computes the dot product of two DenseMatrix<complex> objects. Uses BLAS if possible.

This is computed as $ \mathrm{Tr}(M_1^T M_2) $ , which is usually not a very meaningful quantity for complex matrices. Consider whether you really want to use c_dot( m1, m2 ) instead.

template<>
complex c_dot const DenseMatrix< complex > &  m1,
const DenseMatrix< complex > &  m2
 

Computes the conjugate dot product of two DenseMatrix<complex> objects. Uses BLAS if possible.

This is computed as $ \mathrm{Tr}(M_1^\dagger M_2) $ , which is usually the right way to compute the dot product of two complex matrices.


Generated on Wed Jun 14 22:25:33 2006 for linalg by  doxygen 1.4.4