use crate::error::TaError;
use crate::indicator::indicator;
indicator! {
fn acos(values: &[f64]) -> Vec<f64> with acos_with_output;
}
pub fn acos_with_output(values: &[f64], out: &mut [f64]) -> Result<(), TaError> {
if out.len() != values.len() {
return Err(TaError::BadParam(
"acos_with_output: out length must equal values length".into(),
));
}
for (o, &v) in out.iter_mut().zip(values.iter()) {
*o = v.acos();
}
Ok(())
}
indicator! {
fn asin(values: &[f64]) -> Vec<f64> with asin_with_output;
}
pub fn asin_with_output(values: &[f64], out: &mut [f64]) -> Result<(), TaError> {
if out.len() != values.len() {
return Err(TaError::BadParam(
"asin_with_output: out length must equal values length".into(),
));
}
for (o, &v) in out.iter_mut().zip(values.iter()) {
*o = v.asin();
}
Ok(())
}
indicator! {
fn atan(values: &[f64]) -> Vec<f64> with atan_with_output;
}
pub fn atan_with_output(values: &[f64], out: &mut [f64]) -> Result<(), TaError> {
if out.len() != values.len() {
return Err(TaError::BadParam(
"atan_with_output: out length must equal values length".into(),
));
}
for (o, &v) in out.iter_mut().zip(values.iter()) {
*o = v.atan();
}
Ok(())
}
indicator! {
fn ceil(values: &[f64]) -> Vec<f64> with ceil_with_output;
}
pub fn ceil_with_output(values: &[f64], out: &mut [f64]) -> Result<(), TaError> {
if out.len() != values.len() {
return Err(TaError::BadParam(
"ceil_with_output: out length must equal values length".into(),
));
}
for (o, &v) in out.iter_mut().zip(values.iter()) {
*o = v.ceil();
}
Ok(())
}
indicator! {
fn cos(values: &[f64]) -> Vec<f64> with cos_with_output;
}
pub fn cos_with_output(values: &[f64], out: &mut [f64]) -> Result<(), TaError> {
if out.len() != values.len() {
return Err(TaError::BadParam(
"cos_with_output: out length must equal values length".into(),
));
}
for (o, &v) in out.iter_mut().zip(values.iter()) {
*o = v.cos();
}
Ok(())
}
indicator! {
fn cosh(values: &[f64]) -> Vec<f64> with cosh_with_output;
}
pub fn cosh_with_output(values: &[f64], out: &mut [f64]) -> Result<(), TaError> {
if out.len() != values.len() {
return Err(TaError::BadParam(
"cosh_with_output: out length must equal values length".into(),
));
}
for (o, &v) in out.iter_mut().zip(values.iter()) {
*o = v.cosh();
}
Ok(())
}
indicator! {
fn exp(values: &[f64]) -> Vec<f64> with exp_with_output;
}
pub fn exp_with_output(values: &[f64], out: &mut [f64]) -> Result<(), TaError> {
if out.len() != values.len() {
return Err(TaError::BadParam(
"exp_with_output: out length must equal values length".into(),
));
}
for (o, &v) in out.iter_mut().zip(values.iter()) {
*o = v.exp();
}
Ok(())
}
indicator! {
fn floor(values: &[f64]) -> Vec<f64> with floor_with_output;
}
pub fn floor_with_output(values: &[f64], out: &mut [f64]) -> Result<(), TaError> {
if out.len() != values.len() {
return Err(TaError::BadParam(
"floor_with_output: out length must equal values length".into(),
));
}
for (o, &v) in out.iter_mut().zip(values.iter()) {
*o = v.floor();
}
Ok(())
}
indicator! {
fn ln(values: &[f64]) -> Vec<f64> with ln_with_output;
}
pub fn ln_with_output(values: &[f64], out: &mut [f64]) -> Result<(), TaError> {
if out.len() != values.len() {
return Err(TaError::BadParam(
"ln_with_output: out length must equal values length".into(),
));
}
for (o, &v) in out.iter_mut().zip(values.iter()) {
*o = v.ln();
}
Ok(())
}
indicator! {
fn log10(values: &[f64]) -> Vec<f64> with log10_with_output;
}
pub fn log10_with_output(values: &[f64], out: &mut [f64]) -> Result<(), TaError> {
if out.len() != values.len() {
return Err(TaError::BadParam(
"log10_with_output: out length must equal values length".into(),
));
}
for (o, &v) in out.iter_mut().zip(values.iter()) {
*o = v.log10();
}
Ok(())
}
indicator! {
fn sin(values: &[f64]) -> Vec<f64> with sin_with_output;
}
pub fn sin_with_output(values: &[f64], out: &mut [f64]) -> Result<(), TaError> {
if out.len() != values.len() {
return Err(TaError::BadParam(
"sin_with_output: out length must equal values length".into(),
));
}
for (o, &v) in out.iter_mut().zip(values.iter()) {
*o = v.sin();
}
Ok(())
}
indicator! {
fn sinh(values: &[f64]) -> Vec<f64> with sinh_with_output;
}
pub fn sinh_with_output(values: &[f64], out: &mut [f64]) -> Result<(), TaError> {
if out.len() != values.len() {
return Err(TaError::BadParam(
"sinh_with_output: out length must equal values length".into(),
));
}
for (o, &v) in out.iter_mut().zip(values.iter()) {
*o = v.sinh();
}
Ok(())
}
indicator! {
fn sqrt(values: &[f64]) -> Vec<f64> with sqrt_with_output;
}
pub fn sqrt_with_output(values: &[f64], out: &mut [f64]) -> Result<(), TaError> {
if out.len() != values.len() {
return Err(TaError::BadParam(
"sqrt_with_output: out length must equal values length".into(),
));
}
for (o, &v) in out.iter_mut().zip(values.iter()) {
*o = v.sqrt();
}
Ok(())
}
indicator! {
fn tan(values: &[f64]) -> Vec<f64> with tan_with_output;
}
pub fn tan_with_output(values: &[f64], out: &mut [f64]) -> Result<(), TaError> {
if out.len() != values.len() {
return Err(TaError::BadParam(
"tan_with_output: out length must equal values length".into(),
));
}
for (o, &v) in out.iter_mut().zip(values.iter()) {
*o = v.tan();
}
Ok(())
}
indicator! {
fn tanh(values: &[f64]) -> Vec<f64> with tanh_with_output;
}
pub fn tanh_with_output(values: &[f64], out: &mut [f64]) -> Result<(), TaError> {
if out.len() != values.len() {
return Err(TaError::BadParam(
"tanh_with_output: out length must equal values length".into(),
));
}
for (o, &v) in out.iter_mut().zip(values.iter()) {
*o = v.tanh();
}
Ok(())
}