Skip to content

Commit

Permalink
Fix for sparse matrix failing
Browse files Browse the repository at this point in the history
  • Loading branch information
GregJohnsonJr committed Nov 7, 2024
1 parent bd9082b commit 862ed7c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/cluster.R
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ read_count <- function(count_table_path) {
#' @param j_index A list of j indexes, must be numeric
#' @param distances A list of the distance at the i and j index
#' @examples
#' # This will return the path to our example file
#'
#' i_values <- as.integer(1:100)
#' j_values <- as.integer(sample(1:100, 100, TRUE))
#' x_values <- as.numeric(runif(100, 0, 1))
Expand Down
1 change: 1 addition & 0 deletions man/create_sparse_matrix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/MatrixAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ SparseDistanceMatrix MatrixAdapter::CreateSparseMatrix() {
names.insert(samples.begin(), samples.end());
const int nameSize = static_cast<int>(names.size());
sparseMatrix.resize(nameSize);
if(static_cast<int>(xPosition.size()) > nameSize) { // There are values that should exist
// Not size, but the largest index inside of xPostions
const int maxXValue = *std::max_element(xPosition.begin(), xPosition.end());
const int maxYValue = *std::max_element(yPosition.begin(), yPosition.end());
if(std::max(maxXValue, maxYValue) > nameSize) { // There are values that should exist
std::set<std::string> unknownNames;
for(int i = nameSize; i < static_cast<int>(xPosition.size()); i++) {
if(i >= nameSize + 2)
Expand Down

0 comments on commit 862ed7c

Please sign in to comment.