Skip to content

support for in-place operations for redden adn deredden (redden! & deredden!)?Β #82

@m4ttes4

Description

@m4ttes4

I was wondering if there are plans to include in-place versions of the main functions, specifically redden! and deredden!.

Currently, the implementation of redden creates a new array for every call:

redden(law::ExtinctionLaw, wave::Real, flux; Av = 1) = flux * 10^(-0.4 * Av * law(wave))

In scenarios where we are processing large spectra or multiple lines of sight, avoiding the allocation of a new flux array by modifying the existing one in-place would significantly improve performance and memory efficiency.

A possible implementation for the in-place version could look like this:
function redden!(law::ExtinctionLaw, wave, flux; Av = 1) flux .*= 10 .^ (-0.4 .* Av .* law.(wave)) return flux end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions