# acotpi (Core Functions) 1.x.x.x

### Import

#include <archr/core/acotpi.h>
#include <archr/core/acotpi.hpp>
import archr.core
atomsLoads('archr')

### Synopsis

  float archr_core_acotpi_1f32(const float i1);  (1)  double archr_core_acotpi_1f64(const double i1);  (2)  void archr_core_acotpi_f32(float *o0, const float *i1, size_t sz);  (3)  void archr_core_acotpi_f64(double *o0, const double *i1, size_t sz);  (4)
  float acotpi(const float i1);  (1)  double acotpi(const double i1);  (2)  void acotpi(const float *i1, size_t sz, float *o0);  (3)  void acotpi(const double *i1, size_t sz, double *o0);  (4) template void acotpi(const Range& i1, Range& o0);  (5)
 subroutine archr_core_acotpi_1f32(real(4) :: r, real(4), parameter :: i1)  (1) subroutine archr_core_acotpi_1f64(real(8) :: r, real(8), parameter :: i1)  (2) subroutine archr_core_acotpi_f32(real(4), dimension(*), parameter :: i1, integer(4) :: sz, real(4), dimension(*) :: o0)  (3) subroutine archr_core_acotpi_f64(real(8), dimension(*), parameter :: i1, integer(4) :: sz, real(8), dimension(*) :: o0)  (4)
 def acotpi(i1): return o0  (1)
 function o0 = archr_core_acotpi(i1)  (1)

### Description

Computes the Inverse Hyperbolic in multiple of PIs:

• to the range defined by:

• [i1_first, i1_last)
• [i1, i1 + sz)

and stores the result in another range, beginning at o0.

• of its i1ument and returns it.

### Parameters

 i1_first, i1_last The range of input elements o0 The beginning of the destination range, may be equal to i1 i1 The scalar/contiguous data input element

### Example


#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <archr/core/acotpi.h>

double rand_in(double min, double max) {
return min + ((double)(max - min) * ((double)rand() / RAND_MAX));
}

int main() {
time_t t;
size_t i;
size_t sz = 10;
float* i1 = (float*)malloc(sz * sizeof(float));
float* o1 = (float*)malloc(sz * sizeof(float));

srand((unsigned int)time(&t));
for (i = 0; i < sz; ++i) {
i1[i] = (float)rand_in((float)-10, (float)10);
}
archr_core_acotpi_f32(o1, i1, sz);
for (i = 0; i < sz; ++i) {
printf("%4lu: acotpi(%f) = %f\n", i, (double)i1[i], (double)o1[i]);
}
}


### Possible Output

   0: acotpi(9.422858) = 0.033655
1: acotpi(1.837882) = 0.158616
2: acotpi(-3.262253) = -0.094679
3: acotpi(-7.822172) = -0.040474
4: acotpi(-5.006380) = -0.062755
5: acotpi(-8.051063) = -0.039335
6: acotpi(4.945784) = 0.063504
7: acotpi(9.347142) = 0.033925
8: acotpi(5.106514) = 0.061555
9: acotpi(6.345078) = 0.049757


#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cstddef>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <archr/core/acotpi.hpp>

double rand_in(double min, double max) {
return min + (double(max - min) * (double(std::rand()) / RAND_MAX));
}

int main() {
std::size_t i;
std::size_t sz = 10;
std::vector<float> i1(sz);
std::vector<float> o1(sz);

std::srand(std::time(0));
std::generate(i1.begin(), i1.end(), []() { return rand_in(float(-10), float(10)); });
archr::core::acotpi(i1.data(), sz, o1.data());
for (i = 0; i < sz; ++i) {
std::cout << std::setw(4) << i << ": " << "acotpi" << "(" << i1[i] << ")" << " = " << o1[i] << std::endl;
}
}


### Possible Output

   0: acotpi(-3.46646) = -0.0893986
1: acotpi(0.0076237) = 0.497573
2: acotpi(2.72348) = 0.112011
3: acotpi(8.51445) = 0.0372142
4: acotpi(-6.4343) = -0.0490782
5: acotpi(-3.71831) = -0.0836273
6: acotpi(-7.9096) = -0.0400311
7: acotpi(-4.88013) = -0.0643351
8: acotpi(-8.88769) = -0.0356647
9: acotpi(-2.04958) = -0.144489


program main
integer(4), parameter  :: sz = 10
real(4), dimension(sz) :: o0
real(4), dimension(sz) :: i0
real(8)                :: r0, r1
real(8)                :: min0, max0
real(8)                :: min1, max1
real(8)                :: min2, max2
! Init:
min0 = -10
max0 = 10
do i=1,sz
r0 = random_in(min0, max0)
i0(i) = r0
end do
! Example:
call archr_core_acotpi_f32(o0, i0, size(i0))
! Output:
do i=1,sz
print *, i, ": ", o0(i)
end do
contains
! Generate a random number within a range
function random_in(mn, mx) result(r)
real(8) :: r
real(8), intent(in) :: mn, mx
r = mn + (rand() * (mx - mn))
end function random_in
end program


### Possible Output

           1 :   -3.17260027E-02
2 :   -4.29321527E-02
3 :    6.14894927E-02
4 :  -0.280051827
5 :   0.315341830
6 :   -5.60441613E-02
7 :   -3.49953473E-02
8 :    8.67659450E-02
9 :    8.65671933E-02
10 :    3.64530385E-02