Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dóra Kocsis
dynare
Commits
3bbfc056
Commit
3bbfc056
authored
Aug 30, 2010
by
Houtan Bastani
Browse files
SWZ: Change file ending type to unix
parent
a5ed8187
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
matlab/swz/c-code/utilities/DWCcode/histogram/dw_histogram.c
View file @
3bbfc056
This diff is collapsed.
Click to expand it.
matlab/swz/c-code/utilities/DWCcode/histogram/dw_histogram.h
View file @
3bbfc056
#ifndef __HISTOGRAMS__
#define __HISTOGRAMS__
#include
"matrix.h"
#define HISTOGRAM_FIXED 1
#define HISTOGRAM_VARIABLE 2
/* Matrix histograms */
typedef
struct
{
TMatrix
Min
;
TMatrix
Max
;
int
**
low
;
int
**
high
;
int
***
freq
;
int
rows
;
int
cols
;
int
intervals
;
int
sample_size
;
int
type
;
}
TMatrixHistogram
;
/* Vector histograms */
typedef
struct
{
TVector
Min
;
TVector
Max
;
int
*
low
;
int
*
high
;
int
**
freq
;
int
dim
;
int
intervals
;
int
sample_size
;
int
type
;
}
TVectorHistogram
;
/* Scalar histograms */
typedef
struct
{
PRECISION
Min
;
PRECISION
Max
;
int
low
;
int
high
;
int
*
freq
;
int
intervals
;
int
sample_size
;
int
type
;
}
TScalarHistogram
;
TMatrixHistogram
*
CreateMatrixHistogram
(
int
rows
,
int
cols
,
int
intervals
,
int
type
);
void
SetMaxMinMatrixHistogram
(
TMatrix
Min
,
TMatrix
Max
,
TMatrixHistogram
*
h
);
void
FreeMatrixHistogram
(
TMatrixHistogram
*
h
);
void
AddMatrixObservation
(
TMatrix
X
,
TMatrixHistogram
*
h
);
void
MatrixPercentile
(
TMatrix
X
,
PRECISION
percentile
,
TMatrixHistogram
*
h
);
void
MatrixCumulative
(
TMatrix
P
,
TMatrix
Level
,
TMatrixHistogram
*
h
);
TMatrix
PlotMatrixHistogramAuto
(
int
i
,
int
j
,
int
bins
,
TMatrixHistogram
*
h
);
TMatrix
PlotMatrixHistogram
(
int
i
,
int
j
,
PRECISION
min
,
PRECISION
max
,
int
bins
,
TMatrixHistogram
*
h
);
TVectorHistogram
*
CreateVectorHistogram
(
int
dim
,
int
intervals
,
int
type
);
void
SetMaxMinVectorHistogram
(
TVector
Min
,
TVector
Max
,
TVectorHistogram
*
h
);
void
FreeVectorHistogram
(
TVectorHistogram
*
h
);
void
AddVectorObservation
(
TVector
X
,
TVectorHistogram
*
h
);
void
VectorPercentile
(
TVector
X
,
PRECISION
percentile
,
TVectorHistogram
*
h
);
void
VectorCumulative
(
TVector
p
,
TVector
level
,
TVectorHistogram
*
h
);
TMatrix
PlotVectorHistogramAuto
(
int
i
,
int
bins
,
TVectorHistogram
*
h
);
TMatrix
PlotVectorHistogram
(
int
i
,
PRECISION
min
,
PRECISION
max
,
int
bins
,
TVectorHistogram
*
h
);
TScalarHistogram
*
CreateScalarHistogram
(
int
intervals
,
int
type
);
void
SetMaxMinScalarHistogram
(
PRECISION
Min
,
PRECISION
Max
,
TScalarHistogram
*
h
);
void
FreeScalarHistogram
(
TScalarHistogram
*
h
);
void
AddScalarObservation
(
PRECISION
x
,
TScalarHistogram
*
h
);
PRECISION
ScalarPercentile
(
PRECISION
percentile
,
TScalarHistogram
*
h
);
PRECISION
ScalarCumulative
(
PRECISION
level
,
TScalarHistogram
*
h
);
TMatrix
PlotScalarHistogramAuto
(
int
bins
,
TScalarHistogram
*
h
);
TMatrix
PlotScalarHistogram
(
PRECISION
min
,
PRECISION
max
,
int
bins
,
TScalarHistogram
*
h
);
#endif
#ifndef __HISTOGRAMS__
#define __HISTOGRAMS__
#include
"matrix.h"
#define HISTOGRAM_FIXED 1
#define HISTOGRAM_VARIABLE 2
/* Matrix histograms */
typedef
struct
{
TMatrix
Min
;
TMatrix
Max
;
int
**
low
;
int
**
high
;
int
***
freq
;
int
rows
;
int
cols
;
int
intervals
;
int
sample_size
;
int
type
;
}
TMatrixHistogram
;
/* Vector histograms */
typedef
struct
{
TVector
Min
;
TVector
Max
;
int
*
low
;
int
*
high
;
int
**
freq
;
int
dim
;
int
intervals
;
int
sample_size
;
int
type
;
}
TVectorHistogram
;
/* Scalar histograms */
typedef
struct
{
PRECISION
Min
;
PRECISION
Max
;
int
low
;
int
high
;
int
*
freq
;
int
intervals
;
int
sample_size
;
int
type
;
}
TScalarHistogram
;
TMatrixHistogram
*
CreateMatrixHistogram
(
int
rows
,
int
cols
,
int
intervals
,
int
type
);
void
SetMaxMinMatrixHistogram
(
TMatrix
Min
,
TMatrix
Max
,
TMatrixHistogram
*
h
);
void
FreeMatrixHistogram
(
TMatrixHistogram
*
h
);
void
AddMatrixObservation
(
TMatrix
X
,
TMatrixHistogram
*
h
);
void
MatrixPercentile
(
TMatrix
X
,
PRECISION
percentile
,
TMatrixHistogram
*
h
);
void
MatrixCumulative
(
TMatrix
P
,
TMatrix
Level
,
TMatrixHistogram
*
h
);
TMatrix
PlotMatrixHistogramAuto
(
int
i
,
int
j
,
int
bins
,
TMatrixHistogram
*
h
);
TMatrix
PlotMatrixHistogram
(
int
i
,
int
j
,
PRECISION
min
,
PRECISION
max
,
int
bins
,
TMatrixHistogram
*
h
);
TVectorHistogram
*
CreateVectorHistogram
(
int
dim
,
int
intervals
,
int
type
);
void
SetMaxMinVectorHistogram
(
TVector
Min
,
TVector
Max
,
TVectorHistogram
*
h
);
void
FreeVectorHistogram
(
TVectorHistogram
*
h
);
void
AddVectorObservation
(
TVector
X
,
TVectorHistogram
*
h
);
void
VectorPercentile
(
TVector
X
,
PRECISION
percentile
,
TVectorHistogram
*
h
);
void
VectorCumulative
(
TVector
p
,
TVector
level
,
TVectorHistogram
*
h
);
TMatrix
PlotVectorHistogramAuto
(
int
i
,
int
bins
,
TVectorHistogram
*
h
);
TMatrix
PlotVectorHistogram
(
int
i
,
PRECISION
min
,
PRECISION
max
,
int
bins
,
TVectorHistogram
*
h
);
TScalarHistogram
*
CreateScalarHistogram
(
int
intervals
,
int
type
);
void
SetMaxMinScalarHistogram
(
PRECISION
Min
,
PRECISION
Max
,
TScalarHistogram
*
h
);
void
FreeScalarHistogram
(
TScalarHistogram
*
h
);
void
AddScalarObservation
(
PRECISION
x
,
TScalarHistogram
*
h
);
PRECISION
ScalarPercentile
(
PRECISION
percentile
,
TScalarHistogram
*
h
);
PRECISION
ScalarCumulative
(
PRECISION
level
,
TScalarHistogram
*
h
);
TMatrix
PlotScalarHistogramAuto
(
int
bins
,
TScalarHistogram
*
h
);
TMatrix
PlotScalarHistogram
(
PRECISION
min
,
PRECISION
max
,
int
bins
,
TScalarHistogram
*
h
);
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment