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

PermScaleMatrix< T > Class Template Reference
[Linear Algebra library]

A class for square matrices with exactly one entry in each row and in each column. More...

#include <permscale.h>

Inherits ScalingPermutation< T >< T >, and Matrix< T >< T >.

Inheritance diagram for PermScaleMatrix< T >:

Inheritance graph
[legend]
Collaboration diagram for PermScaleMatrix< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PermScaleMatrix ()
 Default constructor; constructs a null permutation.
 PermScaleMatrix (itype n)
 Constructs the identity permutation on n elements.
 PermScaleMatrix (const Permutation &other)
 Constructs the PermScaleMatrix corresponding to a given permutation, with identity scaling.
 PermScaleMatrix (const ScalingPermutation< T > &other)
 Quasi-copy Constructor; constructs the PermScaleMatrix corresponding to a given scaling permutation.
 PermScaleMatrix (const PermScaleMatrix< T > &other)
 Copy Constructor; constructs a PermScaleMatrix identical to other.
 PermScaleMatrix (const std::vector< itype > &vec)
 Constructs a permutation from a STL vector of indices.
 PermScaleMatrix (const std::vector< itype > &vec, const std::vector< T > &scal)
 Constructs a permutation from a STL vector of indices, and an STL vector of scaling coefficients.
virtual ~PermScaleMatrix ()
 The destructor doesn't do anything.
virtual itype Rows () const
 Returns the number of rows = size of permutation. (Mandatory override of pure virtual from Matrix).
virtual itype Columns () const
 Returns the number of columns = size of permutation. (Mandatory override of pure virtual from Matrix).
virtual itype Size () const
 Returns the number of nonzero elements = size of permutation. (Mandatory override of pure virtual from Matrix).
virtual T & operator() (itype r, itype c)
 Returns a dummy copy of the requested element. (Mandatory override of pure virtual from Matrix).
virtual T operator() (itype r, itype c) const
 Returns a copy of the requested element. (Mandatory override of pure virtual from Matrix).
bool isSquare () const
 Identifies the matrix as being square. (Mirrors a method in DenseMatrix).
Trace () const
 Returns the trace, or sum of the diagonal elements. (Mirrors a method in DenseMatrix).
PermScaleMatrix< typename
linalg_traits< T >::conjugate_type > & 
Conjugate ()
 Conjugates the matrix in place, and returns a reference to it. (Mirrors a method in DenseMatrix).
linalg_traits< T >::norm_type Norm ()
 Returns the square of the 2-norm = Tr( Adjoint(M).M). (Mirrors a method in DenseMatrix).
linalg_traits< T >::abs_type Abs ()
 Returns the 2-norm = sqrt( Tr( Adjoint(M).M) ). (Mirrors a method in DenseMatrix).
PermScaleMatrix< T > & Normalize ()
 Normalizes the matrix, so that Norm() and Abs() will return 1. (Mirrors a method in DenseMatrix).
PermScaleMatrix< T > & operator *= (T scalar)
 Multiplies the matrix by a scalar, and returns a reference. (Mirrors a method in DenseMatrix).
PermScaleMatrix< T > & operator/= (T scalar)
 Divides the matrix by a scalar, and returns a reference. (Mirrors a method in DenseMatrix).
Scale (itype i) const
void SetScale (itype i, complex s)
ScalingPermutationreset ()
ScalingPermutationreset (itype newsize)
ScalingPermutationswap (itype i, itype j)
ScalingPermutationoperator *= (const ScalingPermutation &other)
ScalingPermutationoperator *= (const Permutation &other)
ScalingPermutation inverse () const
void Print (std::ostream &out=std::cout) const
bool operator== (const Permutation &other) const
bool operator== (const ScalingPermutation &other) const
ScalingPermutation operator * (const Permutation &two) const
ScalingPermutation operator * (const ScalingPermutation &two) const
itype operator[] (itype n) const
void PrintCycles (std::ostream &out=std::cout) const
Permutationrandomize ()
virtual void print (std::ostream &os=std::cout) const
 Prettyprints the Matrix to a stream, but without justification.

Protected Member Functions

bool badrange (itype i) const
bool valid () const

Protected Attributes

T * scale
itypemap
 C-style array containing the action of the permutation as: $ i \rightarrow \mathrm{map}[i] $ .
itype N

Detailed Description

template<typename T>
class PermScaleMatrix< T >

A class for square matrices with exactly one entry in each row and in each column.

PermScaleMatrix defines the class of square matrices where each row and each column have exactly one element. The action of a PermScaleMatrix on a vector is thus to permute the elements, and scale each one by some constant factor. These matrices are closed under multiplication, and therefore form a semigroup.

PermScaleMatrix objects can be constructed from:

PermScaleMatrix objects have all the inherited functionality of a Permutation or ScalingPermutation. They also support a restricted subset of basic linear algebra (although since they inherit from Matrix, they can always be converted to a DenseMatrix). Things you can do with a PermScaleMatrix include:

Note that you cannot add or subtract two PermScaleMatrix objects -- the result iss not a PermScaleMatrix. To do so, convert first to DenseMatrix.


Member Function Documentation

template<typename T>
virtual T& PermScaleMatrix< T >::operator() itype  r,
itype  c
[inline, virtual]
 

Returns a dummy copy of the requested element. (Mandatory override of pure virtual from Matrix).

If the requested element is not one of the nonzero ones, then we have to return a reference to a dummy. However, it's not clear what we should do if the requested element is nonzero. Currently we return a dummy copy of the element, so that it's not possible to change an element directly. This behavior is open to debate -- as it stands, we cannot change an element directly, although it could be done rather awkwardly through multiplication by another matrix.

Implements Matrix< T >.


The documentation for this class was generated from the following file:
Generated on Wed Jun 14 22:25:29 2006 for linalg by  doxygen 1.4.4