Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetanserre committed Jul 22, 2024
2 parents b1f3808 + de99d1d commit b1e5ca9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions pygkls/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 3.28)
project(pygkls)
set(CMAKE_CXX_STANDARD 20)
set (CMAKE_CXX_FLAGS "-fPIC -O3")
set(CMAKE_CXX_FLAGS "-fPIC -O3")

file (GLOB_RECURSE SRC_FILES src/*.cc)
file(GLOB_RECURSE SRC_FILES src/*.cc)

include_directories(include)

Expand Down
2 changes: 1 addition & 1 deletion pygkls/include/gkls.hh
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ extern T_GKLS_GlobalMinima GKLS_glob;

/*------------------------User function prototypes -------------------------*/

int GKLS_domain_alloc(void); /* allocate boundary vectors */
int GKLS_domain_alloc(double domain_lo, double domain_hi); /* allocate boundary vectors */

void GKLS_domain_free(void); /* deallocate boundary vectors */

Expand Down
8 changes: 4 additions & 4 deletions pygkls/src/gkls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ double GKLS_norm(double *x1, double *x2)
/* The subroutine has no INPUT parameters */
/* RETURN VALUE: an error code */
/*****************************************************************************/
int GKLS_domain_alloc()
int GKLS_domain_alloc(double domain_lo, double domain_hi)
{
unsigned int i;

Expand All @@ -123,8 +123,8 @@ int GKLS_domain_alloc()
/* Set the admissible region as [-1,1]^GKLS_dim */
for (i = 0; i < GKLS_dim; i++)
{
GKLS_domain_left[i] = -1.0;
GKLS_domain_right[i] = 1.0;
GKLS_domain_left[i] = domain_lo;
GKLS_domain_right[i] = domain_hi;
}
return GKLS_OK; /* no errors */
} /* GKLS_domain_alloc() */
Expand Down Expand Up @@ -159,7 +159,7 @@ int GKLS_set_default()
if ((GKLS_domain_left == NULL) || (GKLS_domain_right == NULL))
{
/* define the boundaries */
if ((error = GKLS_domain_alloc()) != GKLS_OK)
if ((error = GKLS_domain_alloc(-1, 1)) != GKLS_OK)
return error;
}
/* Find min_side = min |b(i)-a(i)|, D=[a,b], and */
Expand Down
7 changes: 3 additions & 4 deletions pygkls/src/wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,16 @@ namespace GKLS {

void set_dim(unsigned int dim) {
GKLS_dim = dim;
set_domain(GKLS_domain_left[0], GKLS_domain_right[0]);
}

void set_num_minima(unsigned int num_minima) {
GKLS_num_minima = num_minima;
}

void set_domain(double domain_lo, double domain_hi) {
for (int i = 0; i < GKLS_dim; i++) {
GKLS_domain_left[i] = domain_lo;
GKLS_domain_right[i] = domain_hi;
}
GKLS_domain_free();
GKLS_domain_alloc(domain_lo, domain_hi);
}

void set_global_dist(double global_dist) {
Expand Down

0 comments on commit b1e5ca9

Please sign in to comment.