AbstractLinAlgPack_GenPermMatrixSliceOp.hpp File Reference

#include "AbstractLinAlgPack_Types.hpp"
#include "AbstractLinAlgPack_GenPermMatrixSlice.hpp"

Include dependency graph for AbstractLinAlgPack_GenPermMatrixSliceOp.hpp:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  AbstractLinAlgPack

Operations for GenPermMatrixSlice.

ToDo: Finish documentation!

void V_StMtV (SpVector *sv_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const DVectorSlice &vs_rhs2)
 sv_lhs = alpha * op(P_rhs1) * vs_rhs2.
void V_MtV (SpVector *sv_lhs, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const DVectorSlice &vs_rhs2)
 sv_lhs = op(P_rhs1) * vs_rhs2
void V_StMtV (SpVector *sv_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const SpVectorSlice &sv_rhs2)
 sv_lhs = alpha * op(P_rhs1) * sv_rhs2.
void V_MtV (SpVector *sv_lhs, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const SpVectorSlice &sv_rhs2)
 sv_lhs = op(P_rhs1) * sv_rhs2
void Vp_StMtV (SpVector *sv_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const DVectorSlice &vs_rhs2)
 sv_lhs += alpha * op(P_rhs1) * vs_rhs2.
void Vp_MtV (SpVector *sv_lhs, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const DVectorSlice &vs_rhs2)
 sv_lhs += op(P_rhs1) * vs_rhs2.
void Vp_StMtV (DVectorSlice *vs_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const DVectorSlice &vs_rhs2, value_type beta=1.0)
 vs_lhs = alpha * op(P_rhs1) * vs_rhs2 + beta * vs_lhs
void Vp_StMtV (DVectorSlice *vs_lhs, value_type alpha, const GenPermMatrixSlice &P_rhs1, BLAS_Cpp::Transp P_rhs1_trans, const SpVectorSlice &sv_rhs2, value_type beta=1.0)
 vs_lhs = alpha * op(P_rhs1) * sv_rhs2 + beta * vs_lhs
void intersection (const GenPermMatrixSlice &P1, BLAS_Cpp::Transp P1_trans, const GenPermMatrixSlice &P2, BLAS_Cpp::Transp P2_trans, size_type *Q_nz, const size_type Q_max_nz=0, size_type Q_row_i[]=NULL, size_type Q_col_j[]=NULL, GenPermMatrixSlice *Q=NULL)
 Find the intersection between two GenPermMatrixSlice objects.


Function Documentation

void AbstractLinAlgPack::V_StMtV SpVector sv_lhs,
value_type  alpha,
const GenPermMatrixSlice &  P_rhs1,
BLAS_Cpp::Transp  P_rhs1_trans,
const DVectorSlice vs_rhs2
 

sv_lhs = alpha * op(P_rhs1) * vs_rhs2.

This function will resize the sparse vector lhs and only the resultant nonzero elements will be added.

If op(P_rhs1) is sorted by row (i.e. op(P_rhs1) = P_rhs1 sorted by row or op(P_rhs1) = P_rhs1' sorted by column) then sv_lhs->assume_sorted(true) is called and sv_lhs->is_sorted()==true on output.

This function will execute in O(P_rhs1.nz()) time.

Definition at line 38 of file AbstractLinAlgPack_GenPermMatrixSliceOp.cpp.

void V_MtV SpVector sv_lhs,
const GenPermMatrixSlice &  P_rhs1,
BLAS_Cpp::Transp  P_rhs1_trans,
const DVectorSlice vs_rhs2
[inline]
 

sv_lhs = op(P_rhs1) * vs_rhs2

Definition at line 61 of file AbstractLinAlgPack_GenPermMatrixSliceOp.hpp.

void AbstractLinAlgPack::V_StMtV SpVector sv_lhs,
value_type  alpha,
const GenPermMatrixSlice &  P_rhs1,
BLAS_Cpp::Transp  P_rhs1_trans,
const SpVectorSlice sv_rhs2
 

sv_lhs = alpha * op(P_rhs1) * sv_rhs2.

This function will resize the sparse vector lhs and add only the nonzero elements in the rhs.

If op(P_rhs1) is sorted by row (i.e. op(P_rhs1) = P_rhs1 sorted by row or op(P_rhs1) = P_rhs1' sorted by column) then sv_lhs->assume_sorted(true) is called.

Let's assume that op(P_rhs1) is not sorted by column and sv_rhs2 is sorted. In this case a linear search will have to be performed to match up elements. P_rhs1 will be iterated through sequentially and the corresponding nonzero element in sv_rhs2 searched for (binary search). Therefore, the runtime in this case will be:


    O( P_rhs1.nz() * log(sv_rhs2.nz()) )
 
If P_rhs1 and sv_rhs2 are unsorted, then the runtime will be:
 
    O( P_rhs1.nz() * sv_rhs2.nz() )
 
If op(P_rhs1) is sorted by column and sv_rhs2 is also sorted then the runtime will be:

    O( max( P_rhs1.nz(), sv_rhs2.nz() ) )
 
Of course if op(P_rhs1) is not sorted by row then the output vector will not be assumed sorted.

Definition at line 88 of file AbstractLinAlgPack_GenPermMatrixSliceOp.cpp.

void V_MtV SpVector sv_lhs,
const GenPermMatrixSlice &  P_rhs1,
BLAS_Cpp::Transp  P_rhs1_trans,
const SpVectorSlice sv_rhs2
[inline]
 

sv_lhs = op(P_rhs1) * sv_rhs2

Definition at line 108 of file AbstractLinAlgPack_GenPermMatrixSliceOp.hpp.

void AbstractLinAlgPack::Vp_StMtV SpVector sv_lhs,
value_type  alpha,
const GenPermMatrixSlice &  P_rhs1,
BLAS_Cpp::Transp  P_rhs1_trans,
const DVectorSlice vs_rhs2
 

sv_lhs += alpha * op(P_rhs1) * vs_rhs2.

This function will not resize the sparse vector lhs and will add new elements for the nonzero elements in the rhs. Therefore it is up to the client to ensure that there is sufficient storage for these elements. This function will not check to see if elements with duplicate indexes are added. It is up to the client to determine that. If sv_lhs is sorted on input and op(P_rhs1) is sorted by row, then sv_lhs->is_sorted() == true on output.

This function will execute in O(P_rhs1.nz()) time.

Definition at line 138 of file AbstractLinAlgPack_GenPermMatrixSliceOp.cpp.

void Vp_MtV SpVector sv_lhs,
const GenPermMatrixSlice &  P_rhs1,
BLAS_Cpp::Transp  P_rhs1_trans,
const DVectorSlice vs_rhs2
[inline]
 

sv_lhs += op(P_rhs1) * vs_rhs2.

Definition at line 137 of file AbstractLinAlgPack_GenPermMatrixSliceOp.hpp.

void AbstractLinAlgPack::Vp_StMtV DVectorSlice vs_lhs,
value_type  alpha,
const GenPermMatrixSlice &  P_rhs1,
BLAS_Cpp::Transp  P_rhs1_trans,
const DVectorSlice vs_rhs2,
value_type  beta = 1.0
 

vs_lhs = alpha * op(P_rhs1) * vs_rhs2 + beta * vs_lhs

Definition at line 189 of file AbstractLinAlgPack_GenPermMatrixSliceOp.cpp.

void AbstractLinAlgPack::Vp_StMtV DVectorSlice vs_lhs,
value_type  alpha,
const GenPermMatrixSlice &  P_rhs1,
BLAS_Cpp::Transp  P_rhs1_trans,
const SpVectorSlice sv_rhs2,
value_type  beta = 1.0
 

vs_lhs = alpha * op(P_rhs1) * sv_rhs2 + beta * vs_lhs

Definition at line 227 of file AbstractLinAlgPack_GenPermMatrixSliceOp.cpp.

void AbstractLinAlgPack::intersection const GenPermMatrixSlice &  P1,
BLAS_Cpp::Transp  P1_trans,
const GenPermMatrixSlice &  P2,
BLAS_Cpp::Transp  P2_trans,
size_type Q_nz,
const size_type  Q_max_nz = 0,
size_type  Q_row_i[] = NULL,
size_type  Q_col_j[] = NULL,
GenPermMatrixSlice *  Q = NULL
 

Find the intersection between two GenPermMatrixSlice objects.

This subroutine has two modes. In the first mode (Q_max_nz == 0) it just computes the number of nonzero entries in the matrix:

Q = op(P1)*op(P1)

In the second mode (Q_max_nz > 0 && Q_row_i != NULL && Q_col_j != NULL) it also computes the row and column arrays for the resultant matrix Q. In addition if Q != NULL then a GenPermMatrixSlice object will be setup with as:

Q->initialize( op(P1).rows(), op(P2).cols(), Q_nz, 0, 0, Q_ordered_by, Q_row_i, Q_col_j, false )

Above Q_ordered_by will be determined of the fly.

This operation might require O(min(op(P1).cols(),op(P2).rows()) temporary storage but will always be executed in:

O(P1.nz()) + O(P2.nz()) + O(min(op(P1).cols(),op(P2).rows())

Parameters:
P1 [in] Right hand side permutation matrix.
P1_trans [in] If no_trans then op(P1) = P1 otherwise op(P1) = P1'.
P1 [in] Left hand side permutation matrix.
P1_trans [in] If no_trans then op(P2) = P2 otherwise op(P2) = P2'.
Q_nz [out] On return will contain the number of nonzeros in the resultant matrix Q
Q_max_nz [in] If Q_max_nz > 0 then the resultant row Q_row_i and column Q_col_j indices will be set. If it turns out that Q_nz will be larger than Q_max_nz then the exception std::length_error will be thrown and Q_row_i and Q_col_j may be left in an inconsistent state. If Q_max_nz == 0 then the rest of the return arguments are ignored and the resultant matrix will not be returned.
Q_row_i [out] Array (length Q_max_nz): If Q_max_nz > 0 then out return Q_row_i[k], k=0,,,Q_nz-1 will contain the row indices for the resultant matrix Q. If Q_max_nz == 0 then Q_row_i can be NULL.
Q_row_i [out] Array (length Q_max_nz): If Q_max_nz > 0 then out return Q_col_j[k], k=0,,,Q_nz-1 will contain the column indices for the resultant matrix Q. If Q_max_nz == 0 then Qd_col_j can be NULL.
Q [out] If Q_max_nz > 0 && Q != NULL then Q will be initialized as described above. It is allowed for Q == NULL.

Definition at line 327 of file AbstractLinAlgPack_GenPermMatrixSliceOp.cpp.


Generated on Thu Sep 18 12:35:23 2008 for MOOCHO (Single Doxygen Collection) by doxygen 1.3.9.1