Ejemplo n.º 1
0
 Real GeneralStatistics::mean() const {
     Size N = samples();
     QL_REQUIRE(N != 0, "empty sample set");
     // eat our own dog food
     return expectationValue(identity<Real>(),
                             everywhere()).first;
 }
Ejemplo n.º 2
0
InputParameters validParams<ElementIndicator>()
{
  InputParameters params = validParams<Indicator>();
  params.addRequiredParam<VariableName>("variable", "The name of the variable that this Indicator operates on");

  std::vector<SubdomainName> everywhere(1, "ANY_BLOCK_ID");
params.addParam<std::vector<SubdomainName> >("block", everywhere, "block ID or name where the object works");

  params += validParams<TransientInterface>();
  return params;
}
Ejemplo n.º 3
0
 Real GeneralStatistics::variance() const {
     Size N = samples();
     QL_REQUIRE(N > 1,
                "sample number <=1, unsufficient");
     // Subtract the mean and square. Repeat on the whole range.
     // Hopefully, the whole thing will be inlined in a single loop.
     Real s2 = expectationValue(compose(square<Real>(),
                                        subtract<Real>(mean())),
                                everywhere()).first;
     return s2*N/(N-1.0);
 }
Ejemplo n.º 4
0
    Real GeneralStatistics::skewness() const {
        Size N = samples();
        QL_REQUIRE(N > 2,
                   "sample number <=2, unsufficient");

        Real x = expectationValue(compose(cube<Real>(),
                                          subtract<Real>(mean())),
                                  everywhere()).first;
        Real sigma = standardDeviation();

        return (x/(sigma*sigma*sigma))*(N/(N-1.0))*(N/(N-2.0));
    }
Ejemplo n.º 5
0
InputParameters validParams<AddNodalNormalsAction>()
{
  InputParameters params = validParams<Action>();

  // Initialize the 'boundary' input option to default to any boundary
  std::vector<BoundaryName> everywhere(1, "ANY_BOUNDARY_ID");
  params.addParam<std::vector<BoundaryName> >("boundary", everywhere, "The boundary ID or name where the normals will be computed");
  params.addParam<BoundaryName>("corner_boundary", "boundary ID or name with nodes at 'corners'");
  MooseEnum orders("FIRST, SECOND", "FIRST");
  params.addParam<MooseEnum>("order", orders,  "Specifies the order of variables that hold the nodal normals. Needs to match the order of the mesh");

  return params;
}
Ejemplo n.º 6
0
    Real GeneralStatistics::kurtosis() const {
        Size N = samples();
        QL_REQUIRE(N > 3,
                   "sample number <=3, unsufficient");

        Real x = expectationValue(compose(fourth_power<Real>(),
                                          subtract<Real>(mean())),
                                  everywhere()).first;
        Real sigma2 = variance();

        Real c1 = (N/(N-1.0)) * (N/(N-2.0)) * ((N+1.0)/(N-3.0));
        Real c2 = 3.0 * ((N-1.0)/(N-2.0)) * ((N-1.0)/(N-3.0));

        return c1*(x/(sigma2*sigma2))-c2;
    }