futhark
Safe HaskellNone
LanguageGHC2021

Futhark.AD.Shared

Description

Various definitions used for both forward and reverse mode.

Synopsis

Documentation

vecPerm :: ArrayShape s => Shape -> TypeBase s o -> [Int] Source #

A permutation for transposing the vector shape past the next dimension.

That is, converts [vec...][d][elem...] to [d][vec...][elem...].

mapNest :: (MonadBuilder m, Rep m ~ SOACS, Traversable f) => Shape -> f SubExp -> (f SubExp -> m (Exp SOACS)) -> m (Exp SOACS) Source #

mkMap Source #

Arguments

:: (MonadBuilder m, Rep m ~ SOACS, Traversable f) 
=> Name 
-> Shape 
-> f VName 
-> (f VName -> m [VName])

Action for building the body, passed names corresponding to elements of the arrays.

-> m [VName] 

Construct a map over the given arrays, which must have the provided outer shape. The purpose of the Shape argument is to handle the case where no arrays are provided.

accAddLambda :: (MonadBuilder m, Rep m ~ SOACS) => Int -> [Type] -> m (Lambda SOACS) Source #

An addition operator for an accumulator whose index space has the given rank and whose elements have the given types. The operators for the individual element types are fused horizontally, as an accumulator operator must handle all of them at once.