Skip to content

Commit

Permalink
solve CRAN complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cortes committed Mar 8, 2023
1 parent ca238f8 commit c82ce5d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 3.12.4)
project (cmfrec VERSION 3.6.0)
project (cmfrec VERSION 3.5.1)
set(CMAKE_BUILD_TYPE Release)

### Note: this build script allows configuring 4 things manually:
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: cmfrec
Type: Package
Title: Collective Matrix Factorization for Recommender Systems
Version: 3.6.0
Version: 3.5.1
Authors@R: c(
person(given="David", family="Cortes", role=c("aut", "cre", "cph"),
email="[email protected]"),
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def test_supports_clang_reassociate(self):
setup(
name = "cmfrec",
packages = ["cmfrec"],
version = '3.5.0-1',
version = '3.5.1',
description = 'Collective matrix factorization',
author = 'David Cortes',
author_email = '[email protected]',
Expand Down
6 changes: 4 additions & 2 deletions src/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,15 +964,17 @@ int_t random_parallel(ArraysToFill arrays, int_t seed, bool normal, int nthreads
const size_t BUCKET_SIZE = (size_t)1 << 18; /* <- a bit over 250k */
rng_state_t initial_state[4];
seed_state(seed, initial_state);
if (arrays.sizeA + arrays.sizeB < BUCKET_SIZE)
if (arrays.sizeA + arrays.sizeB <= BUCKET_SIZE)
{
rnorm_singlethread(arrays, initial_state);
return 0;
}

const size_t buckA = arrays.sizeA / BUCKET_SIZE + (arrays.sizeA % BUCKET_SIZE) != 0;
const size_t buckB = arrays.sizeB / BUCKET_SIZE + (arrays.sizeB % BUCKET_SIZE) != 0;
const size_t tot_buckets = buckA + buckB;
const size_t tot_buckets = max2(1, buckA + buckB);
/* Note: the condition above is not needed, but GCC12 complains otherwise
and by extension CRAN complains too */

real_t **ptr_bucket = (real_t**)malloc(tot_buckets*sizeof(real_t*));
size_t *sz_bucket = (size_t*)malloc(tot_buckets*sizeof(size_t));
Expand Down

0 comments on commit c82ce5d

Please sign in to comment.