42 #ifndef COO_MATRIX_TMPL_CONVERT_TO_SPARSE_COMPRESSED_COLUMN_DEF_H
43 #define COO_MATRIX_TMPL_CONVERT_TO_SPARSE_COMPRESSED_COLUMN_DEF_H
47 namespace AbstractLinAlgPack {
49 template<
class T_COOM>
60 typename T_COOM::difference_type loc_co = m.col_offset();
61 for(
typename T_COOM::const_iterator itr = m.begin(); itr != m.end(); ++itr )
62 num_in_col[ col_perm[ col_offset + loc_co + itr->col_j() -1 ] -1 ]++;
66 typename T_COOM::difference_type loc_ro = m.row_offset();
67 for(
typename T_COOM::const_iterator itr = m.begin(); itr != m.end(); ++itr ) {
69 num_in_col[ col_perm[ col_offset + loc_ro + i - 1 ] - 1 ]++;
75 template<
class T_COOM>
89 typename T_COOM::difference_type
90 loc_ro = m.row_offset(),
91 loc_co = m.col_offset();
94 for(
typename T_COOM::const_iterator itr = m.begin(); itr != m.end(); ++itr ) {
96 i = loc_ro + itr->row_i(),
97 j = loc_co + itr->col_j();
99 ele = next_nz_in_col[ col_perm[ col_offset + j - 1 ] - 1 ]++;
100 D_val[ ele - 1 ] = alpha * itr->value();
102 D_row_i[ ele - 1 ] = row_perm[ row_offset + i - 1 ];
107 for(
typename T_COOM::const_iterator itr = m.begin(); itr != m.end(); ++itr ) {
109 i = loc_co + itr->col_j(),
110 j = loc_ro + itr->row_i();
112 ele = next_nz_in_col[ col_perm[ col_offset + j - 1 ] - 1 ]++;
113 D_val[ ele - 1 ] = alpha * itr->value();
115 D_row_i[ ele - 1 ] = row_perm[ row_offset + i - 1 ];
120 template<
class T_COOM>
134 for(
typename T_COOM::const_iterator itr = m.begin(); itr != m.end(); ++itr ) {
135 register const value_type val = ::fabs( itr->value() );
136 if( val > alpha ) alpha = val;
139 alpha = scaled_max_ele / alpha;
141 , col_offset, row_perm, col_perm, next_nz_in_col, D_val, D_row_i );
147 #endif // COO_MATRIX_TMPL_CONVERT_TO_SPARSE_COMPRESSED_COLUMN_DEF_H
COOMatrixPartitionedViewUtilityPack::TransposedPartition< T_Indice, T_Value > trans(COOMatrixPartitionedViewUtilityPack::Partition< T_Indice, T_Value > &part)
Create a transposed view of a partition object.
FortranTypes::f_int f_int
RTOp_value_type value_type
size_type COOM_num_in_column(const T_COOM &m, BLAS_Cpp::Transp trans, size_type col_offset, const IVector::value_type *col_perm, size_type *num_in_col)
void COOM_insert_nonzeros(const T_COOM &m, BLAS_Cpp::Transp trans, value_type alpha, size_type row_offset, size_type col_offset, const IVector::value_type *row_perm, const IVector::value_type *col_perm, size_type *next_nz_in_col, FortranTypes::f_dbl_prec *D_val, FortranTypes::f_int *D_row_i)
RTOp_index_type size_type
AbstractLinAlgPack::value_type value_type
value_type COOM_insert_scaled_nonzeros(const T_COOM &m, BLAS_Cpp::Transp trans, value_type scaled_max_ele, size_type row_offset, size_type col_offset, const IVector::value_type *row_perm, const IVector::value_type *col_perm, size_type *next_nz_in_col, FortranTypes::f_dbl_prec *D_val, FortranTypes::f_int *D_row_i)
FortranTypes::f_dbl_prec f_dbl_prec