@@ -48,7 +48,7 @@ template<typename DataType, typename IndexType> struct SpMatRow; | |||
template<typename DataType, typename IndexType> struct SpMatVal; | |||
/*! | |||
* 2D-array wrapper for v1 and v2 part of the exercise t use as RAII | |||
* 2D-array wrapper for v1 and v2 part of the exercise used as RAII | |||
* and copy-prevention. | |||
* | |||
* This is a very thin abstraction layer over a native array. | |||
@@ -180,7 +180,7 @@ Matrix<DataType, IndexType, Type> make_Matrix(IndexType s) { | |||
* A(3, 4) = 7; | |||
* \endcode | |||
* | |||
* We also provide getCol() and getRow() functions witch return a viwer/iterator to rows and | |||
* We also provide getCol() and getRow() functions witch return a viewer/iterator to rows and | |||
* columns of the matrix. In the case of a symmetric matrix instead of a row we return the | |||
* equivalent column. This way we gain speed due to CSC format nature. | |||
* | |||
@@ -290,15 +290,15 @@ struct SpMat { | |||
} | |||
/*! | |||
* A read item functionality using binary search to find the correct row | |||
* A read item functionality using linear search to find the correct row | |||
* | |||
* @param i The row number | |||
* @param j The column number | |||
* @return The value of the item or DataType{} if is not present. | |||
*/ | |||
DataType get2(IndexType i, IndexType j) { | |||
DataType get_lin(IndexType i, IndexType j) { | |||
IndexType idx; bool found; | |||
std::tie(idx, found) =find2_idx(rows, col_ptr[j], col_ptr[j+1], i); | |||
std::tie(idx, found) =find_lin_idx(rows, col_ptr[j], col_ptr[j+1], i); | |||
return (found) ? values[idx] : 0; | |||
} | |||
@@ -318,7 +318,7 @@ struct SpMat { | |||
*/ | |||
DataType set(DataType v, IndexType i, IndexType j) { | |||
IndexType idx; bool found; | |||
std::tie(idx, found) = find2_idx(rows, col_ptr[j], col_ptr[j+1], i); | |||
std::tie(idx, found) = find_lin_idx(rows, col_ptr[j], col_ptr[j+1], i); | |||
if (found) | |||
return values[idx] = v; // we don't change NNZ even if we write "0" | |||
else { | |||
@@ -402,10 +402,10 @@ private: | |||
else if (b >= e) return std::make_pair(end, false); | |||
else { | |||
if (v[m] < match) b = m +1; | |||
else e = m -1; | |||
else e = m -1; | |||
} | |||
} | |||
return std::make_pair(end, false);; | |||
return std::make_pair(end, false); | |||
} | |||
/*! | |||
* find helper for set using index for begin-end instead of iterators. | |||
@@ -418,7 +418,7 @@ private: | |||
* \param end The vector's index to end | |||
* \param match What to search | |||
*/ | |||
std::pair<IndexType, bool> find2_idx(const std::vector<IndexType>& v, IndexType begin, IndexType end, IndexType match) { | |||
std::pair<IndexType, bool> find_lin_idx(const std::vector<IndexType>& v, IndexType begin, IndexType end, IndexType match) { | |||
for ( ; begin < end ; ++begin) { | |||
if (match == v[begin]) return std::make_pair(begin, true); | |||
else if (match < v[begin]) return std::make_pair(begin, false); | |||
@@ -223,10 +223,10 @@ private: | |||
}; | |||
/*! | |||
* A Logger for entire programm. | |||
* A Logger for entire program. | |||
*/ | |||
struct Log { | |||
struct Endl {} endl; //!< a tag objec to to use it as a new line request. | |||
struct Endl {} endl; //!< a tag object to to use it as a new line request. | |||
//! We provide logging via << operator | |||
template<typename T> | |||
@@ -86,6 +86,7 @@ uint32_t* vertexWiseTriangleCounts (uint32_t *coo_row, uint32_t *coo_col, uint32 | |||
// convert input | |||
coo2csc_e (R, C, coo_row, coo_col, nz, n, 1); | |||
// we use the lower triangular optimization just because ;) | |||
for (uint32_t i=0 ; i<n ; ++i) { | |||
for (uint32_t j = C[i]; j<C[i+1] ; ++j) { | |||
uint32_t j_idx = R[j]; | |||
@@ -127,7 +127,7 @@ bool get_options(int argc, char* argv[]){ | |||
// Input checkers | |||
if (session.inputMatrix == InputMatrix::UNSPECIFIED) { | |||
std::cout << "Error message\n"; | |||
std::cout << "Invokation error. Try -h for details.\n"; | |||
status = false; | |||
} | |||
#if CODE_VERSION == V4 | |||
@@ -138,7 +138,7 @@ int nworkers() { | |||
* \note | |||
* We use two methods of calculation based on \c --make_symmetric or \c --triangular_only | |||
* - A full matrix calculation which update only c[i] | |||
* - A lower triangular matrix which update c[i], c[j], c[k]. This is wayyy faster. | |||
* - A lower triangular matrix which update c[i], c[j], c[k]. This is waaayyy faster. | |||
*/ | |||
std::vector<value_t> triang_v(matrix& A) { | |||
std::vector<std::atomic<value_t>> c(A.size()); | |||
@@ -196,7 +196,7 @@ int nworkers() { return 1; } | |||
* \note | |||
* We use two methods of calculation based on \c --make_symmetric or \c --triangular_only | |||
* - A full matrix calculation which update only c[i] | |||
* - A lower triangular matrix which update c[i], c[j], c[k]. This is wayyy faster. | |||
* - A lower triangular matrix which update c[i], c[j], c[k]. This is waaayyy faster. | |||
*/ | |||
std::vector<value_t> triang_v(matrix& A) { | |||
std::vector<value_t> c(A.size()); | |||
@@ -45,7 +45,7 @@ int nworkers() { | |||
* \note | |||
* We use two methods of calculation based on \c --make_symmetric or \c --triangular_only | |||
* - A full matrix calculation which update only c[i] | |||
* - A lower triangular matrix which update c[i], c[j], c[k]. This is wayyy faster. | |||
* - A lower triangular matrix which update c[i], c[j], c[k]. This is waaayyy faster. | |||
* \warning | |||
* The later(--triangular_only) produce correct results ONLY if we are after the total count. | |||
*/ | |||
@@ -128,7 +128,7 @@ int nworkers() { | |||
* \note | |||
* We use two methods of calculation based on \c --make_symmetric or \c --triangular_only | |||
* - A full matrix calculation which update only c[i] | |||
* - A lower triangular matrix which update c[i], c[j], c[k]. This is wayyy faster. | |||
* - A lower triangular matrix which update c[i], c[j], c[k]. This is waaayyy faster. | |||
* \warning | |||
* The later(--triangular_only) produce correct results ONLY if we are after the total count. | |||
*/ | |||
@@ -199,7 +199,7 @@ int nworkers() { | |||
* \note | |||
* We use two methods of calculation based on \c --make_symmetric or \c --triangular_only | |||
* - A full matrix calculation which update only c[i] | |||
* - A lower triangular matrix which update c[i], c[j], c[k]. This is wayyy faster. | |||
* - A lower triangular matrix which update c[i], c[j], c[k]. This is waaayyy faster. | |||
* \warning | |||
* The later(--triangular_only) produce correct results ONLY if we are after the total count. | |||
*/ | |||
@@ -297,7 +297,7 @@ int nworkers() { return 1; } | |||
* \note | |||
* We use two methods of calculation based on \c --make_symmetric or \c --triangular_only | |||
* - A full matrix calculation which update only c[i] | |||
* - A lower triangular matrix which update c[i], c[j], c[k]. This is wayyy faster. | |||
* - A lower triangular matrix which update c[i], c[j], c[k]. This is waaayyy faster. | |||
* \warning | |||
* The later(--triangular_only) produce correct results ONLY if we are after the total count. | |||
*/ | |||