Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ At the heart of DeepCausality is the **Causal Monad** pattern, implemented throu
| `PropagatingEffect<T>` | Stateless effect propagation | Value + Error + Log |
| `PropagatingProcess<T>` | Stateful effect propagation | Value + State + Context + Error + Log |

These monads enable **composable causal computations** where effects flow through a pipeline of transformations wth the following key properties:
- **Error propagation**: Errors short-circuit the chain automatically
- **Logging**: Each step can append to an audit trail
- **Counterfactuals**: `bind` supports hypothetical "what-if" reasoning
These monads enable **composable causal computations** where effects flow through a pipeline of transformations with the following key properties:
- **Error propagation**: Errors short-circuit the chain automatically.
- **Logging**: Each step can append to an audit trail.
- **Counterfactuals**: `bind` supports hypothetical "what-if" reasoning.

### The Three Pillars

Expand Down
24 changes: 24 additions & 0 deletions deep_causality_num/src/algebra/field_real.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,21 @@ pub trait RealField:
/// ```
fn tanh(self) -> Self;

/// Computes the arctangent of a number. Return value is in radians in the
/// range [-pi/2, pi/2];
///
/// ```
/// use deep_causality_num::RealField;
///
/// let f = 1.0;
///
/// // atan(tan(1))
/// let abs_difference = (f.tan().atan() - 1.0).abs();
///
/// assert!(abs_difference < 1e-10);
/// ```
fn atan(self) -> Self;

/// Computes the four-quadrant arctangent of `self` (y) and `other` (x).
/// # Example
/// ```
Expand Down Expand Up @@ -399,6 +414,11 @@ impl RealField for f32 {
fn epsilon() -> Self {
f32::EPSILON
}

#[inline]
fn atan(self) -> Self {
Comment thread
marvin-hansen marked this conversation as resolved.
f32::atan(self)
}
}

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -578,4 +598,8 @@ impl RealField for f64 {
fn epsilon() -> Self {
f64::EPSILON
}

fn atan(self) -> Self {
f64::atan(self)
}
}
13 changes: 9 additions & 4 deletions deep_causality_num/src/float_double/traits_algebra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ impl RealField for DoubleFloat {
}

#[inline]
fn abs(self) -> Self {
<Self as Float>::abs(self)
fn sqrt(self) -> Self {
<Self as Float>::sqrt(self)
}

#[inline]
fn sqrt(self) -> Self {
<Self as Float>::sqrt(self)
fn abs(self) -> Self {
<Self as Float>::abs(self)
}

#[inline]
Expand Down Expand Up @@ -192,6 +192,11 @@ impl RealField for DoubleFloat {
<Self as Float>::tanh(self)
}

#[inline]
fn atan(self) -> Self {
<Self as Float>::atan(self)
}

#[inline]
fn atan2(self, other: Self) -> Self {
<Self as Float>::atan2(self, other)
Expand Down
Loading