rgsl/
synchrotron.rs

1//
2// A rust binding for the GSL library by Guillaume Gomez (guillaume1.gomez@gmail.com)
3//
4
5use crate::{types, Value};
6use std::mem::MaybeUninit;
7
8/// This routine computes the first synchrotron function x \int_x^\infty dt K_{5/3}(t) for x >= 0.
9#[doc(alias = "gsl_sf_synchrotron_1")]
10pub fn synchrotron_1(x: f64) -> f64 {
11    unsafe { sys::gsl_sf_synchrotron_1(x) }
12}
13
14/// This routine computes the first synchrotron function x \int_x^\infty dt K_{5/3}(t) for x >= 0.
15#[doc(alias = "gsl_sf_synchrotron_1_e")]
16pub fn synchrotron_1_e(x: f64) -> Result<types::Result, Value> {
17    let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
18    let ret = unsafe { sys::gsl_sf_synchrotron_1_e(x, result.as_mut_ptr()) };
19
20    result_handler!(ret, unsafe { result.assume_init() }.into())
21}
22
23/// This routine computes the second synchrotron function x K_{2/3}(x) for x >= 0.
24#[doc(alias = "gsl_sf_synchrotron_2")]
25pub fn synchrotron_2(x: f64) -> f64 {
26    unsafe { sys::gsl_sf_synchrotron_2(x) }
27}
28
29/// This routine computes the second synchrotron function x K_{2/3}(x) for x >= 0.
30#[doc(alias = "gsl_sf_synchrotron_2_e")]
31pub fn synchrotron_2_e(x: f64) -> Result<types::Result, Value> {
32    let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
33    let ret = unsafe { sys::gsl_sf_synchrotron_2_e(x, result.as_mut_ptr()) };
34
35    result_handler!(ret, unsafe { result.assume_init() }.into())
36}