invalid_count (Descriptive Statistics)


Import

#include <archr/stats/invalid_count.h>
#include <archr/stats/invalid_count.hpp>
import archr.stats
atomsLoads('archr')

Synopsis

 size_t archr_stats_invalid_count_f32(const float *first, size_t nbelem);
(1)
 size_t archr_stats_invalid_count_f64(const double *first, size_t nbelem);
(2)
 size_t invalid_count(const float *first, size_t nbelem);
(1)
 size_t invalid_count(const double *first, size_t nbelem);
(2)
 size_t invalid_count(const float *first, const float *last);
(3)
 size_t invalid_count(const double *first, const double *last);
(4)
template <typename Range> size_t invalid_count(const Range& data);
(5)
subroutine archr_stats_invalid_count_f32(integer(4) :: r, real(4), dimension(*), parameter :: first, integer(4) :: nbelem)
(1)
subroutine archr_stats_invalid_count_f64(integer(4) :: r, real(8), dimension(*), parameter :: first, integer(4) :: nbelem)
(2)
def invalid_count(first):
    return r
(1)
def invalid_count(data):
    return r
(2)
function r = archr_stats_invalid_count(first)
(1)
function r = archr_stats_invalid_count(data)
(2)

Description

This function computes the number of the elements stored in:

Parameters

first

the beginning of the range of elements to process.

last

the end of the range of elements to process.

nbelem

the number of elements to process.

Return value

The number of elements in the given range or container which are equivalent to NaN.

Example

#include <archr/stats/invalid_count.h>
#include <stdio.h>

int main()
{
  float fnan = 0.f/0.f;
  float v[] = {1,fnan,3,4,fnan,6};

  printf("invalid_count(1,NaN,3,4,NaN,6) = %d\n", archr_stats_invalid_count_f32(&v[0],6) );

  return 0;
}

Possible Output

invalid_count(1,NaN,3,4,NaN,6) = 2
invalid_count(1,NaN,3,4)       = 1
#include <archr/stats/invalid_count.hpp>
#include <iostream>
#include <vector>

int main()
{
  float fnan = 0.f/0.f;
  std::vector<float> v{1,fnan,3,4,fnan,6};

  std::cout << "invalid_count(1,NaN,3,4,NaN,6) = " << archr::stats::invalid_count(v) << "\n";
  std::cout << "invalid_count(1,NaN,3,4,NaN)   = " << archr::stats::invalid_count(v.data(), 5) << "\n";
  std::cout << "invalid_count(1,NaN,3,4)       = " << archr::stats::invalid_count(v.data(), v.data() + 4) << "\n";

  return 0;
}

Possible Output

invalid_count(1,NaN,3,4,NaN,6) = 2
invalid_count(1,NaN,3,4,NaN)   = 2
invalid_count(1,NaN,3,4)       = 1

Possible Output