vSMC  v3.0.0
Scalable Monte Carlo
utility.h
Go to the documentation of this file.
1 //============================================================================
2 // vSMC/include/vsmc/utility/utility.h
3 //----------------------------------------------------------------------------
4 // vSMC: Scalable Monte Carlo
5 //----------------------------------------------------------------------------
6 // Copyright (c) 2013-2016, Yan Zhou
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are met:
11 //
12 // Redistributions of source code must retain the above copyright notice,
13 // this list of conditions and the following disclaimer.
14 //
15 // Redistributions in binary form must reproduce the above copyright notice,
16 // this list of conditions and the following disclaimer in the documentation
17 // and/or other materials provided with the distribution.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
20 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 // POSSIBILITY OF SUCH DAMAGE.
30 //============================================================================
31 
32 #ifndef VSMC_UTILITY_UTILITY_H
33 #define VSMC_UTILITY_UTILITY_H
34 
35 #include <vsmc/internal/common.h>
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
43 
45 void *vsmc_malloc(size_t n, size_t alignment);
46 
48 void vsmc_free(void *ptr);
49 
51 
54 
57 
59 void vsmc_covariance_delete(vsmc_covariance *covariance_ptr);
60 
63 
66  vSMCMatrixLayout layout, size_t n, size_t p, const double *x,
67  const double *w, double *mean, double *cov, vSMCMatrixLayout cov_layout,
68  int cov_upper, int cov_packed);
69 
71 
74 
77  const char *filename, const char *dataname, int append);
78 
80 void vsmc_hdf5store_particle(vsmc_particle particle, const char *filename,
81  const char *dataname, int append);
82 
84 void vsmc_hdf5store_monitor(vsmc_monitor monitor, const char *filename,
85  const char *dataname, int append);
86 
88 void vsmc_hdf5store_sampler(vsmc_sampler sampler, const char *filename,
89  const char *dataname, int append);
90 
92 
95 
98 
100 void vsmc_stop_watch_delete(vsmc_stop_watch *stop_watch_ptr);
101 
104 
107 
109 int vsmc_stop_watch_start(vsmc_stop_watch stop_watch);
110 
112 int vsmc_stop_watch_stop(vsmc_stop_watch stop_watch);
113 
115 void vsmc_stop_watch_reset(vsmc_stop_watch stop_watch);
116 
118 double vsmc_stop_watch_cycles(vsmc_stop_watch stop_watch);
119 
122 
125 
128 
130 double vsmc_stop_watch_seconds(vsmc_stop_watch stop_watch);
131 
133 double vsmc_stop_watch_minutes(vsmc_stop_watch stop_watch);
134 
136 double vsmc_stop_watch_hours(vsmc_stop_watch stop_watch);
137 
139 
140 #ifdef __cplusplus
141 } // extern "C"
142 #endif
143 
144 #endif // VSMC_UTILITY_UTILITY_H
int vsmc_stop_watch_start(vsmc_stop_watch stop_watch)
vsmc::StopWatch::start
double vsmc_stop_watch_hours(vsmc_stop_watch stop_watch)
vsmc::StopWatch::hours
void vsmc_free(void *ptr)
vsmc::AlignedMemory::aligned_free
vsmc::Particle
Definition: defines.h:194
int vsmc_stop_watch_running(vsmc_stop_watch stop_watch)
vsmc::StopWatch::running
void vsmc_stop_watch_assign(vsmc_stop_watch stop_watch, vsmc_stop_watch other)
vsmc::StopWatch::operator=
void vsmc_stop_watch_delete(vsmc_stop_watch *stop_watch_ptr)
vsmc::StopWatch::~StopWatch
void * vsmc_malloc(size_t n, size_t alignment)
vsmc::AlignedMemory::aligned_malloc
void vsmc_hdf5store_sampler(vsmc_sampler sampler, const char *filename, const char *dataname, int append)
vsmc::hdf5store
void vsmc_covariance_assign(vsmc_covariance covariance, vsmc_covariance other)
vsmc::Covariance::operator=
double vsmc_stop_watch_nanoseconds(vsmc_stop_watch stop_watch)
vsmc::StopWatch::nanoseconds
void vsmc_hdf5store_particle(vsmc_particle particle, const char *filename, const char *dataname, int append)
vsmc::hdf5store
vsmc::Monitor
Definition: defines.h:204
double vsmc_stop_watch_seconds(vsmc_stop_watch stop_watch)
vsmc::StopWatch::seconds
void vsmc_hdf5store_state_matrix(vsmc_state_matrix state_matrix, const char *filename, const char *dataname, int append)
vsmc::hdf5store
double vsmc_stop_watch_minutes(vsmc_stop_watch stop_watch)
vsmc::StopWatch::minutes
void vsmc_hdf5store_monitor(vsmc_monitor monitor, const char *filename, const char *dataname, int append)
vsmc::hdf5store
double vsmc_stop_watch_milliseconds(vsmc_stop_watch stop_watch)
vsmc::StopWatch::milliseconds
void vsmc_stop_watch_reset(vsmc_stop_watch stop_watch)
vsmc::StopWatch::reset
vsmc::Covariance<double>
Definition: defines.h:209
vSMCMatrixLayout
vsmc::MatrixLayout
Definition: defines.h:45
void vsmc_covariance_compute(vsmc_covariance covariance, vSMCMatrixLayout layout, size_t n, size_t p, const double *x, const double *w, double *mean, double *cov, vSMCMatrixLayout cov_layout, int cov_upper, int cov_packed)
vsmc::Covariance::operator()
vsmc_covariance vsmc_covariance_new(void)
vsmc::Covariance::Covariance
double vsmc_stop_watch_microseconds(vsmc_stop_watch stop_watch)
vsmc::StopWatch::microseconds
vsmc_stop_watch vsmc_stop_watch_new(void)
vsmc::StopWatch::StopWatch
vsmc::Sampler
Definition: defines.h:199
`vsmc::StateMatrix<vsmc::RowMajor, vsmc::Dynamic, double>
Definition: defines.h:178
int vsmc_stop_watch_stop(vsmc_stop_watch stop_watch)
vsmc::StopWatch::stop
double vsmc_stop_watch_cycles(vsmc_stop_watch stop_watch)
vsmc::StopWatch::cycles
vsmc::StopWatch
Definition: defines.h:214
void vsmc_covariance_delete(vsmc_covariance *covariance_ptr)
vsmc::Covariance::~Covariance