Skip to main content

Get Independent Joint Multidimensonal Copy

Name

UxHwDoubleGetIndependentJointMultidimensionalCopy, UxHwFloatGetIndependentJointMultidimensionalCopy — Create copies of the distributions in the input array, and store them in an output array, such that the distributions in the output array are stripped of all correlations to all variables in the system, including to the distributions in the input array. The function ensures that the distributions in the output array preserve the correlations amongst each other in the same manner that the distributions in the input array are correlated amongst each other.

Synopsis

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

double UxHwDoubleGetIndependentJointMultidimensionalCopy(double * srcDistArray, double * destDistArray, size_t numberOfDistributions);
float UxHwFloatGetIndependentJointMultidimensionalCopy(float * srcDistArray, float * destDistArray, size_t numberOfDistributions);

Description

On Signaloid cores that track correlations (e.g., Signaloid core plus types), the UxHwDoubleGetIndependentJointMultidimensionalCopy() function creates copies of the distributions provided in the input array srcDistArray of size numberOfDistributions, and stores them in the output array destDistArray of size numberOfDistributions, such that the distributions in the output array are stripped of all correlations to all variables in the system, including the distributions in the input array. The function ensures that the distributions in the output array preserve the correlations amongst each other in the same manner that the distributions in the input array are correlated amongst each other.

Parameters

  • srcDistArray — The input array with the distributions whose independent copies will be created.
  • destDistArray — The output array holding the distributions that are the independent copies of distributions in the input array.
  • numberOfDistributions — The number of diastributions in both the input array srcDistArray and the output array destDistArray.

Return Values

The UxHwDoubleGetIndependentJointMultidimensionalCopy() function does not return a value.

✏️   Examples

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

int
main(void)
{
size_t numberOfDistributions = 2;
double a = UxHwDoubleGaussDist(0, 1);
double b = -a;
double srcDistArray[numberOfDistributions];
double destDistArray[numberOfDistributions];

srcDistArray[0] = UxHwDoubleGaussDist(0, 1);
srcDistArray[1] = -srcDistArray[0];

UxHwDoubleGetIndependentJointMultidimensionalCopy(srcDistArray, destDistArray, numberOfDistributions);

printf("`srcDistArray[0]` and `destDistArray[0]` are independent (their difference is the difference between independent Gaussians): %lf.\n", srcDistArray[0] - destDistArray[0]);
printf("`srcDistArray[1]` and `destDistArray[1]` are independent (their difference is the difference between independent Gaussians): %lf.\n", srcDistArray[1] - destDistArray[1]);
printf("`destDistArray[0]` and `destDistArray[1]` are not independent (they preserve the correlation structure between `srcDistArray[0]` and `srcDistArray[1]`, and hence, their sum is a particle value at zero): %lf.\n", destDistArray[0] + destDistArray[1]);

return 0;
}