Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
Use pointer to const for all the matrices in the analysis update
Browse files Browse the repository at this point in the history
  • Loading branch information
joakim-hove authored and markusdregi committed Feb 4, 2019
1 parent 3108972 commit e91b9db
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 86 deletions.
22 changes: 11 additions & 11 deletions lib/analysis/analysis_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,12 @@ void analysis_module_free__( void * arg) {

void analysis_module_initX(analysis_module_type * module ,
matrix_type * X ,
matrix_type * A ,
matrix_type * S ,
matrix_type * R ,
matrix_type * dObs ,
matrix_type * E ,
matrix_type * D,
const matrix_type * A ,
const matrix_type * S ,
const matrix_type * R ,
const matrix_type * dObs ,
const matrix_type * E ,
const matrix_type * D,
rng_type * rng) {


Expand All @@ -267,11 +267,11 @@ void analysis_module_initX(analysis_module_type * module ,

void analysis_module_updateA(analysis_module_type * module ,
matrix_type * A ,
matrix_type * S ,
matrix_type * R ,
matrix_type * dObs ,
matrix_type * E ,
matrix_type * D ,
const matrix_type * S ,
const matrix_type * R ,
const matrix_type * dObs ,
const matrix_type * E ,
const matrix_type * D ,
const module_info_type* module_info,
rng_type * rng) {

Expand Down
10 changes: 5 additions & 5 deletions lib/analysis/bootstrap_enkf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ static void free_iens_resample( int ** iens_resample, int ens_size ) {

void bootstrap_enkf_updateA(void * module_data ,
matrix_type * A ,
matrix_type * S ,
matrix_type * R ,
matrix_type * dObs ,
matrix_type * E ,
matrix_type * D ,
const matrix_type * S ,
const matrix_type * R ,
const matrix_type * dObs ,
const matrix_type * E ,
const matrix_type * D ,
const module_info_type* module_info,
rng_type * rng) {

Expand Down
12 changes: 6 additions & 6 deletions lib/analysis/cv_enkf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,12 +526,12 @@ static void getW_prin_comp(cv_enkf_data_type * cv_data , matrix_type *W , const

void cv_enkf_initX(void * module_data ,
matrix_type * X ,
matrix_type * A ,
matrix_type * S ,
matrix_type * R ,
matrix_type * dObs ,
matrix_type * E ,
matrix_type * D,
const matrix_type * A ,
const matrix_type * S ,
const matrix_type * R ,
const matrix_type * dObs ,
const matrix_type * E ,
const matrix_type * D,
rng_type * rng) {


Expand Down
13 changes: 7 additions & 6 deletions lib/analysis/fwd_step_enkf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ static void fwd_step_enkf_write_iter_info( fwd_step_enkf_data_type * data , step
/*Main function: */
void fwd_step_enkf_updateA(void * module_data ,
matrix_type * A ,
matrix_type * S ,
matrix_type * R ,
matrix_type * dObs ,
matrix_type * E ,
matrix_type * D ,
const matrix_type * S0 ,
const matrix_type * R ,
const matrix_type * dObs ,
const matrix_type * E ,
const matrix_type * D ,
const module_info_type* module_info,
rng_type * rng) {

Expand All @@ -255,6 +255,7 @@ void fwd_step_enkf_updateA(void * module_data ,
fwd_step_log_open(fwd_step_data->fwd_step_log);
module_data_block_vector_type * data_block_vector = module_info_get_data_block_vector(module_info);
printf("Running Forward Stepwise regression:\n");
matrix_type * S = matrix_alloc_copy(S0);
{

int ens_size = matrix_get_columns( S );
Expand Down Expand Up @@ -372,7 +373,7 @@ void fwd_step_enkf_updateA(void * module_data ,


}

matrix_free(S);
fwd_step_log_close( fwd_step_data->fwd_step_log );
}

Expand Down
16 changes: 8 additions & 8 deletions lib/analysis/null_enkf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@


void null_enkf_initX(void * module_data ,
matrix_type * X ,
matrix_type * A ,
matrix_type * S ,
matrix_type * R ,
matrix_type * dObs ,
matrix_type * E ,
matrix_type * D,
rng_type * rng) {
matrix_type * X ,
const matrix_type * A ,
const matrix_type * S ,
const matrix_type * R ,
const matrix_type * dObs ,
const matrix_type * E ,
const matrix_type * D,
rng_type * rng) {

matrix_diag_set_scalar( X , 1.0 );

Expand Down
14 changes: 8 additions & 6 deletions lib/analysis/sqrt_enkf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,17 @@ bool sqrt_enkf_set_int( void * arg , const char * var_name , int value) {

void sqrt_enkf_initX(void * module_data ,
matrix_type * X ,
matrix_type * A ,
matrix_type * S ,
matrix_type * R ,
matrix_type * dObs ,
matrix_type * E ,
matrix_type *D,
const matrix_type * A ,
const matrix_type * S0 ,
const matrix_type * R ,
const matrix_type * dObs ,
const matrix_type * E ,
const matrix_type *D,
rng_type * rng) {

sqrt_enkf_data_type * data = sqrt_enkf_data_safe_cast( module_data );
{
matrix_type * S = matrix_alloc_copy(S0);
int ncomp = std_enkf_get_subspace_dimension( data->std_data );
double truncation = std_enkf_get_truncation( data->std_data );
int nrobs = matrix_get_rows( S );
Expand All @@ -129,6 +130,7 @@ void sqrt_enkf_initX(void * module_data ,
free( eig );

enkf_linalg_checkX( X , false );
matrix_free(S);
}
}

Expand Down
22 changes: 12 additions & 10 deletions lib/analysis/std_enkf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,17 @@ void std_enkf_data_free( void * data ) {


static void std_enkf_initX__( matrix_type * X ,
matrix_type * S ,
matrix_type * R ,
matrix_type * E ,
matrix_type * D ,
const matrix_type * S0 ,
const matrix_type * R ,
const matrix_type * E ,
const matrix_type * D ,
double truncation,
int ncomp,
bool bootstrap ,
bool use_EE ,
bool use_GE) {

matrix_type * S = matrix_alloc_copy(S0);
int nrobs = matrix_get_rows( S );
int ens_size = matrix_get_columns( S );
int nrmin = util_int_min( ens_size , nrobs);
Expand Down Expand Up @@ -190,6 +191,7 @@ static void std_enkf_initX__( matrix_type * X ,
enkf_linalg_init_stdX( X , S , D , W , eig , bootstrap);

matrix_free( W );
matrix_free( S );
free( eig );
enkf_linalg_checkX( X , bootstrap );
}
Expand All @@ -200,12 +202,12 @@ static void std_enkf_initX__( matrix_type * X ,

void std_enkf_initX(void * module_data ,
matrix_type * X ,
matrix_type * A ,
matrix_type * S ,
matrix_type * R ,
matrix_type * dObs ,
matrix_type * E ,
matrix_type * D,
const matrix_type * A ,
const matrix_type * S ,
const matrix_type * R ,
const matrix_type * dObs ,
const matrix_type * E ,
const matrix_type * D,
rng_type * rng) {


Expand Down
22 changes: 11 additions & 11 deletions lib/include/ert/analysis/analysis_module.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,22 @@ typedef enum {

void analysis_module_initX(analysis_module_type * module ,
matrix_type * X ,
matrix_type * A ,
matrix_type * S ,
matrix_type * R ,
matrix_type * dObs ,
matrix_type * E ,
matrix_type * D,
const matrix_type * A ,
const matrix_type * S ,
const matrix_type * R ,
const matrix_type * dObs ,
const matrix_type * E ,
const matrix_type * D,
rng_type * rng);


void analysis_module_updateA(analysis_module_type * module ,
matrix_type * A ,
matrix_type * S ,
matrix_type * R ,
matrix_type * dObs ,
matrix_type * E ,
matrix_type * D ,
const matrix_type * S ,
const matrix_type * R ,
const matrix_type * dObs ,
const matrix_type * E ,
const matrix_type * D ,
const module_info_type* module_info,
rng_type * rng);

Expand Down
22 changes: 11 additions & 11 deletions lib/include/ert/analysis/analysis_table.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ extern "C" {

typedef void (analysis_updateA_ftype) (void * module_data ,
matrix_type * A ,
matrix_type * S ,
matrix_type * R ,
matrix_type * dObs ,
matrix_type * E ,
matrix_type * D ,
const matrix_type * S ,
const matrix_type * R ,
const matrix_type * dObs ,
const matrix_type * E ,
const matrix_type * D ,
const module_info_type* module_info,
rng_type * rng);


typedef void (analysis_initX_ftype) (void * module_data ,
matrix_type * X ,
matrix_type * A ,
matrix_type * S ,
matrix_type * R ,
matrix_type * dObs ,
matrix_type * E ,
matrix_type * D,
const matrix_type * A ,
const matrix_type * S ,
const matrix_type * R ,
const matrix_type * dObs ,
const matrix_type * E ,
const matrix_type * D,
rng_type * rng);


Expand Down
12 changes: 6 additions & 6 deletions lib/include/ert/analysis/cv_enkf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ void cv_enkf_init_update( void * arg ,

void cv_enkf_initX(void * module_data ,
matrix_type * X ,
matrix_type * A ,
matrix_type * S ,
matrix_type * R ,
matrix_type * dObs ,
matrix_type * E ,
matrix_type * D,
const matrix_type * A ,
const matrix_type * S ,
const matrix_type * R ,
const matrix_type * dObs ,
const matrix_type * E ,
const matrix_type * D,
rng_type * rng);

bool cv_enkf_set_double( void * arg , const char * var_name , double value);
Expand Down
12 changes: 6 additions & 6 deletions lib/include/ert/analysis/std_enkf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ extern "C" {
bool std_enkf_set_double( void * arg , const char * var_name , double value);
void std_enkf_initX(void * module_data ,
matrix_type * X ,
matrix_type * A ,
matrix_type * S ,
matrix_type * R ,
matrix_type * dObs ,
matrix_type * E ,
matrix_type * D,
const matrix_type * A ,
const matrix_type * S ,
const matrix_type * R ,
const matrix_type * dObs ,
const matrix_type * E ,
const matrix_type * D,
rng_type * rng);

#ifdef __cplusplus
Expand Down

0 comments on commit e91b9db

Please sign in to comment.