# shrinkage::ErasedPathPenalty

Shrinkage for Rust · 0.3.0

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

```rust
pub struct ErasedPathPenalty<P>(P)
```

Adapt a typed penalty shape to independently selected runtime path factories. Numerical dispatch remains at whole proximal-operation boundaries. 

<a id="impl-a4d03c25cac73d048f0fac46d467f6a28909c0805f36bc02485bcecf9d8064a3"></a>

## Inherent implementation

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

```rust
impl<P> ErasedPathPenalty<P>
```

<a id="method-new-a4d03c25cac73d048f0fac46d467f6a28909c0805f36bc02485bcecf9d8064a3"></a>

### `new`

```rust
pub fn new(penalty: P) -> Self
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

Retain the penalty's automatic path capabilities before boxing it. 

<a id="impl-f9ab9c4f8c11d4ba6675810dca99f22967326073ccec6d2271b98bc8bb252812"></a>

## [Implementation of PathPenalty](<5696a47a26612eb54b73987df7c9af737a60d396dd77d3c0b67969a3a5f37105>)

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

```rust
impl<P: PathPenalty> PathPenalty for ErasedPathPenalty<P> where <P as PathPenalty>::AtStrength: 'static
```

<a id="associated-type-AtStrength-f9ab9c4f8c11d4ba6675810dca99f22967326073ccec6d2271b98bc8bb252812"></a>

### `AtStrength`

```rust
type AtStrength = Box<dyn ProximalPenalty<Error = FitError>>;
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

<a id="method-at_strength-f9ab9c4f8c11d4ba6675810dca99f22967326073ccec6d2271b98bc8bb252812"></a>

### `at_strength`

```rust
fn at_strength(
    &self,
    lambda: f64
) -> Result<<Self as PathPenalty>::AtStrength, FitError>
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

<a id="method-maximum_penalty-f9ab9c4f8c11d4ba6675810dca99f22967326073ccec6d2271b98bc8bb252812"></a>

### `maximum_penalty`

```rust
fn maximum_penalty(&self, gradient: &[f64]) -> Result<PenaltyMaximum, FitError>
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

<a id="method-path_anchor-f9ab9c4f8c11d4ba6675810dca99f22967326073ccec6d2271b98bc8bb252812"></a>

### `path_anchor`

```rust
fn path_anchor(&self, gradient: &[f64]) -> Result<f64, FitError>
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

<a id="impl-fff0350d952c6991b7dcd7dd8ffce6d9433870057cd2c5e19f1915231acb20cc"></a>

## [Implementation of Penalty](<a4f4243001e8d9121fca7a92bcb924b17aa5375aba23987fae95b2a05faf5245>)

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

```rust
impl<P: ProximalPenalty> Penalty for ErasedPathPenalty<P>
```

<a id="associated-type-Error-fff0350d952c6991b7dcd7dd8ffce6d9433870057cd2c5e19f1915231acb20cc"></a>

### `Error`

```rust
type Error = FitError;
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

<a id="method-validate_input-fff0350d952c6991b7dcd7dd8ffce6d9433870057cd2c5e19f1915231acb20cc"></a>

### `validate_input`

```rust
fn validate_input(&self, input: &[f64]) -> Result<(), FitError>
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

<a id="method-value-fff0350d952c6991b7dcd7dd8ffce6d9433870057cd2c5e19f1915231acb20cc"></a>

### `value`

```rust
fn value(&self, input: &[f64]) -> Result<f64, FitError>
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

<a id="impl-8229edc5d6baea4d2c5d03c6231654dd3f77fc0abd6ac5c0876d76ba4e976aec"></a>

## [Implementation of ProximalPenalty](<45434a0394c5d718086e7e777f7db8271e2fb2b568e2519720168e5ea2877ed0>)

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

```rust
impl<P: ProximalPenalty> ProximalPenalty for ErasedPathPenalty<P>
```

<a id="method-gap_safe-8229edc5d6baea4d2c5d03c6231654dd3f77fc0abd6ac5c0876d76ba4e976aec"></a>

### `gap_safe`

```rust
fn gap_safe(&self) -> Option<&dyn shrinkage::GapSafePenalty>
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

<a id="method-prox-8229edc5d6baea4d2c5d03c6231654dd3f77fc0abd6ac5c0876d76ba4e976aec"></a>

### `prox`

```rust
fn prox(
    &self,
    input: &[f64],
    step: f64,
    output: &mut [f64]
) -> Result<(), FitError>
```

[Source](<https://github.com/jolars/shrinkage/blob/eeafe449edce19d3c552a03060f681ae3891af74/src/path/penalty.rs>)

<a id="impl-9dd0192a31f2c3fdfe6134d097c605d61edbc4296221657d69f934fc62081ac0"></a>

## Implementation of Freeze

```rust
impl<P> Freeze for ErasedPathPenalty<P> where P: Freeze
```

<a id="impl-89f67da20bed692c4222b329a9029f5f05a4b7f627967ea1a0442a372e1f2962"></a>

## Implementation of RefUnwindSafe

```rust
impl<P> RefUnwindSafe for ErasedPathPenalty<P> where P: RefUnwindSafe
```

<a id="impl-92059fc036866f950162fd0d7ad12118fbadbef14e338775fa8b111757ca4b32"></a>

## Implementation of Send

```rust
impl<P> Send for ErasedPathPenalty<P> where P: Send
```

<a id="impl-e63da7631c04ff03fabdfe3416f2278881d9182e7f6d1ab2247f49461a7b7efa"></a>

## Implementation of Sync

```rust
impl<P> Sync for ErasedPathPenalty<P> where P: Sync
```

<a id="impl-0b4d43f6e05fd1e0e3f47b56d811c874f3e07fd4d3ca554ad2885cc3158a4580"></a>

## Implementation of Unpin

```rust
impl<P> Unpin for ErasedPathPenalty<P> where P: Unpin
```

<a id="impl-a4381a24103e90557a031d6df8c51ce72204e58429348bb9dcfdfb78ea1885e9"></a>

## Implementation of UnsafeUnpin

```rust
impl<P> UnsafeUnpin for ErasedPathPenalty<P> where P: UnsafeUnpin
```

<a id="impl-7f2a8c9de7e189c9008373506aea03142aa770941717b6d6205d06bdde87227e"></a>

## Implementation of UnwindSafe

```rust
impl<P> UnwindSafe for ErasedPathPenalty<P> where P: UnwindSafe
```

<a id="impl-1e5682dc18e03c648aa9b125290c107c1e8d96ce8a179a8532e4057da4daf0cd"></a>

## Implementation of Any

```rust
impl<T> Any for T where T: 'static + ?Sized
```

<a id="impl-6c0b25c2c92cdb117802d9c0a4c70afc9a8bfb0da875bc6e66191e2349fcdf3f"></a>

## Implementation of Borrow

```rust
impl<T> Borrow<T> for T where T: ?Sized
```

<a id="impl-796e80d926348273a22b04d8e84f510693b11c06ec57c3c3e2e8c1524094a85c"></a>

## Implementation of BorrowMut

```rust
impl<T> BorrowMut<T> for T where T: ?Sized
```

<a id="impl-8360e4092e7ec4a05a26dd304cd739398f0cacc50c8d08dd5be0223d1a08d02e"></a>

## Implementation of ByRef

```rust
impl<T> ByRef<T> for T
```

<a id="impl-dbb1293b7b5dd80c4d9a98cfdd6843dc7470224c0b1387731cd418da07046d7b"></a>

## Implementation of CastableFrom

```rust
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT where ST: ?Sized, DT: ?Sized
```

<a id="impl-97b65e7dfc44b5ecaa495a3a19fe737914a1e9f8532200cf8f46191314e7d777"></a>

## Implementation of CastableFrom

```rust
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT where ST: ?Sized, DT: ?Sized
```

<a id="impl-c22bdd3b1b677b66eb32d1c182cc1410c7f0c46491dd74e6a659647c238d19ec"></a>

## Implementation of From

```rust
impl<T> From<T> for T
```

<a id="impl-5adf6ca1830f30fbbac655ab8ff394d254954df7ededc7cc833c72fdc87d6f00"></a>

## Implementation of Imply

```rust
impl<T, U> Imply<T> for U where T: ?Sized, U: ?Sized
```

<a id="impl-85eec431edd188129f88290bbcb748e4d2fdc97f7efef3c162b8c252286ffec0"></a>

## Implementation of Into

```rust
impl<T, U> Into<U> for T where U: From<T>
```

<a id="impl-c40268dd59dd3329202d3c0544c62372e98ff3baa8ec442ec00752e024ec1d06"></a>

## Implementation of IntoEither

```rust
impl<T> IntoEither for T
```

<a id="impl-5655b1ef858b34a584cb80104f040c8a4063ced0d281311a0833ed12aefde86e"></a>

## Implementation of Pointable

```rust
impl<T> Pointable for T
```

<a id="impl-8cc2aa01198fc9fa44f08b889f62988d70d2a7f4f0f11f4666d4c08bdaddb22a"></a>

## Implementation of Read

```rust
impl<T> Read<Exclusive, BecauseExclusive> for T where T: ?Sized
```

<a id="impl-5ea09131039c62dd92b119d480a35c7e2b33d2b81dccf0b849f6b1f19f4bda24"></a>

## Implementation of Same

```rust
impl<T> Same for T
```

<a id="impl-7ee6ff38d6674f5edfe4734359062c2a67a572cff5899a89704764822b931c7f"></a>

## Implementation of SupersetOf

```rust
impl<SS, SP> SupersetOf<SS> for SP where SS: SubsetOf<SP>
```

<a id="impl-83960135d00d98080c95a08867729696e36811280c2dd9cf34c1b4fe21c81e18"></a>

## Implementation of TryFrom

```rust
impl<T, U> TryFrom<U> for T where U: Into<T>
```

<a id="impl-1cc495bcaa5112ffb304e7f0de674feca391fd97f47bec86033a9225b72ac05c"></a>

## Implementation of TryInto

```rust
impl<T, U> TryInto<U> for T where U: TryFrom<T>
```
