Skip to main content

Distribution from Multi-Dimensional Samples

Name

UxHwDoubleDistFromMultidimensionalSamples, UxHwFloatDistFromMultidimensionalSamples Create an array of distributions using an array of multidimensional samples.

Synopsis

#include <stddef.h>
#include <uxhw.h>

void UxHwDoubleDistFromMultidimensionalSamples(double * destinationArray, void * samples, size_t sampleCount, size_t sampleCardinality);
void UxHwFloatDistFromMultidimensionalSamples(float * destinationArray, void * samples, size_t sampleCount, size_t sampleCardinality);

Description

The UxHwDoubleDistFromMultidimensionalSamples() function, on architectures that associate distributions with floating-point values, creates a multivariate distribution by writing to the first sampleCardinality elements of the destinationArray array and by associating a distribution with each of those elements. The distributions are calculated using multidimensional samples from the samples array which is a 2-Dimensional floating-point array, with sampleCount multidimensional samples, each of which has sampleCardinality dimensions. The first dimension of samples array indexes the samples and the second dimension indexes each of the physical dimensions of samples. The size of destinationArray is sampleCardinality.

Parameters

  • destinationArray The pointer to the array where the floating-point values and their associated distributions are going to be stored. The user is responsible for allocating memory for destinationArray.
  • samples The pointer to the 2-Dimensional array of samples.
  • sampleCount The number of multidimensional samples that are going to be used from the samples array in order to calculate the resulting distribution.
  • sampleCardinality The number of dimensions for each multidimensional sample.

Return Values

The UxHwDoubleDistFromMultidimensionalSamples() function does not return a value.

  Examples

#include <uxhw.h>
#include <stdio.h>

enum
{
kSampleCardinality = 3,
kSampleCount = 4,
};

int
main(void)
{
int i;
double samples[kSampleCount][kSampleCardinality] = {
{1.0, 2.0, 3.0},
{4.0, 5.0, 6.0},
{7.0, 8.0, 9.0},
{10.0, 11.0, 12.0}
};

double value[kSampleCardinality];

UxHwDoubleDistFromMultidimensionalSamples(
value,
(void *) samples,
kSampleCount,
kSampleCardinality);

for (i = 0; i < kSampleCardinality; i++)
{
printf("value[i] = %lf\n", value[i]);
}

return 0;
}