Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add const to some char* strings #6

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,4 @@ Please see Data.md for information about dataset.



![Handout](docs/STARS-H-final.png)
![Handout](docs/STARSH-Final.png)
Binary file modified docs/STARS-H-final.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/STARSH-Final.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion include/control/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct
//! Parameters of STARS-H
struct starsh_params starsh_params =
{
STARSH_BACKEND_NOTSELECTED, STARSH_LRENGINE_NOTSELECTED, -1
STARSH_BACKEND_NOTSELECTED, STARSH_LRENGINE_NOTSELECTED, -1, {0, 0, 0, 1}
};

const static struct starsh_params starsh_params_default =
Expand Down
2 changes: 1 addition & 1 deletion include/starsh-rbf.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void starsh_generate_3d_cube(int nrows, int ncols,
STARSH_int *irow, STARSH_int *icol, void *row_data, void *col_data,
void *result, int lda);
void starsh_generate_3d_virus_rhs(STARSH_int mesh_points, double *A);
int starsh_generate_3d_rbf_mesh_coordinates_virus(STARSH_mddata **data, char *file_name, STARSH_int mesh_points, int ndim,
int starsh_generate_3d_rbf_mesh_coordinates_virus(STARSH_mddata **data, const char *file_name, STARSH_int mesh_points, int ndim,
int kernel, int numobj, int isreg, double reg, double rad, double denst, int mordering);
int starsh_generate_3d_rbf_mesh_coordinates_cube(STARSH_mddata **data, STARSH_int mesh_points, int ndim, int kernel,
int isreg, double reg, double rad, int mordering);
Expand Down
4 changes: 3 additions & 1 deletion include/starsh.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ struct starsh_params
//!< What low-rank engine to use (e.g. RSVD).
int oversample;
//!< Oversampling parameter for RSVD and RRQR.
int iseed[4];
};

//! Built-in parameters of STARS-H, accessible through environment.
Expand All @@ -51,6 +52,7 @@ int starsh_init();
int starsh_set_backend(const char *string);
int starsh_set_lrengine(const char *string);
int starsh_set_oversample(const char *string);
int starsh_set_seed(const int *iseed);

//! @}
// End of group
Expand Down Expand Up @@ -238,7 +240,7 @@ struct starsh_problem

int starsh_problem_new(STARSH_problem **problem, int ndim, STARSH_int *shape,
char symm, char dtype, void *row_data, void *col_data,
STARSH_kernel *kernel, char *name);
STARSH_kernel *kernel, const char *name);
void starsh_problem_free(STARSH_problem *problem);
void starsh_problem_info(STARSH_problem *problem);
int starsh_problem_get_block(STARSH_problem *problem, int nrows, int ncols,
Expand Down
2 changes: 1 addition & 1 deletion src/applications/mesh_deformation/mesh_rbf.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ static void starsh_morton_zsort3(int n, double *points)
* @param[in] denst: density scaling factor
* @param[in] mordering: 0: no ordering, 1: Morton ordering.
* */
int starsh_generate_3d_rbf_mesh_coordinates_virus(STARSH_mddata **data, char *file_name, STARSH_int mesh_points, int ndim, int kernel,
int starsh_generate_3d_rbf_mesh_coordinates_virus(STARSH_mddata **data, const char *file_name, STARSH_int mesh_points, int ndim, int kernel,
int numobj, int isreg, double reg, double rad, double denst, int mordering){


Expand Down
3 changes: 1 addition & 2 deletions src/applications/randtlr.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,13 @@ int starsh_randtlr_generate(STARSH_randtlr **data, STARSH_int count,
return STARSH_WRONG_PARAMETER;
}
STARSH_int nblocks = count/block_size;
int iseed[4] = {0, 0, 0, 1};
double *U, *S, *tau, *work;
int lwork = block_size;
STARSH_MALLOC(U, count*block_size);
STARSH_MALLOC(S, block_size);
STARSH_MALLOC(tau, block_size);
STARSH_MALLOC(work, lwork);
LAPACKE_dlarnv_work(3, iseed, count*block_size, U);
LAPACKE_dlarnv_work(3, starsh_params.iseed, count*block_size, U);
for(STARSH_int i = 0; i < nblocks; i++)
{
LAPACKE_dgeqrf_work(LAPACK_COL_MAJOR, block_size, block_size,
Expand Down
3 changes: 1 addition & 2 deletions src/backends/sequential/dense/drsdd.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ void starsh_dense_dlrrsdd(int nrows, int ncols, double *D, int ldD, double *U,
svd_V = svd_S+mn2;
svdqr_work = svd_V+ncols*mn2;
int svdqr_lwork = lwork-(size_t)mn2*(2*ncols+nrows+mn2+1);
int iseed[4] = {0, 0, 0, 1};
// Generate random matrix X
LAPACKE_dlarnv_work(3, iseed, ncols*mn2, X);
LAPACKE_dlarnv_work(3, starsh_params.iseed, ncols*mn2, X);
// Multiply by random matrix
cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, nrows, mn2,
ncols, 1.0, D, ldD, X, ncols, 0.0, Q, nrows);
Expand Down
3 changes: 1 addition & 2 deletions src/backends/sequential/dense/zrsdd.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,10 @@ double* starsh_dense_zlrrsdd(int nrows, int ncols, double _Complex *D, int ldD,
svd_V = svd_S+mn2;
svdqr_work = svd_V+ncols*mn2;
int svdqr_lwork = lwork-(size_t)mn2*(2*ncols+nrows+mn2+1);
int iseed[4] = {0, 0, 0, 1};
double _Complex zero = (double _Complex) 0.0;
double _Complex one = (double _Complex) 1.0;
// Generate random matrix X
LAPACKE_zlarnv_work(3, iseed, nrows*mn2, X);
LAPACKE_zlarnv_work(3, starsh_params.iseed, nrows*mn2, X);
// Multiply by random matrix
cblas_zgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, nrows, mn2,
ncols, &one, D, ldD, X, ncols, &zero, Q, nrows);
Expand Down
15 changes: 15 additions & 0 deletions src/control/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,18 @@ int starsh_set_oversample(const char *string)
starsh_params.oversample = value;
return STARSH_SUCCESS;
}

int starsh_set_seed(const int *seed)
//! Set random seed
/*! @param[in] seed: seed that contains 4 int parameters
* Default: {0, 0, 0, 1}.
* @return Error code @ref STARSH_ERRNO.
* @sa starsh_init().
* */
{
for (int i = 0; i < 4; i++)
{
starsh_params.iseed[i] = seed[i];
}
return STARSH_SUCCESS;
}
2 changes: 1 addition & 1 deletion src/control/problem.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

int starsh_problem_new(STARSH_problem **problem, int ndim, STARSH_int *shape,
char symm, char dtype, void *row_data, void *col_data,
STARSH_kernel *kernel, char *name)
STARSH_kernel *kernel, const char *name)
//! Init @ref STARSH_problem object.
/*! Unlike all other *_new() functions, this function creates copy of `shape`
* to store internally. This is done to avoid clearing memory of static
Expand Down