def apply_indexed_when

stelliferous@0.0.2.0 · tensor_operations.bend:156

import stelliferous@0.0.2.0/tensor_operations.bend as TensorOperations
import Base
import stelliferous@0.0.2.0/storage_buffer.bend as Storage
import stelliferous@0.0.2.0/tensor_view.bend as Views
import stelliferous@0.0.2.0/tensor_access.bend as Access
import stelliferous@0.0.2.0/proofs/tensor_access_certificate.bend as AccessCertificate

156def apply_indexed_when(~Element: Data,~operation: U32 -> Element -> Element,valid: Bool,count: Maybe<&2,U32>,+view: Views.View,
157  input: Storage.Buffer<Element>,output: Storage.Buffer<Element>) -> Outcome<(Storage.Buffer<Element> & Storage.Buffer<Element>)>:
158  match valid count:
159    case True{} Some{+count}:
160      Storage.Buffer{input,input_length,input_certificate} = input
161      Storage.Buffer{output,output_length,output_certificate} = output
162      Accepted{pair_buffers(~Element,input_length,output_length,
163        Access.apply_indexed_run(~Element,~operation,U32.to_nat(count),view,input,output),
164        AccessCertificate.apply_indexed(~Element,~operation,U32.to_nat(count),view,input,output,input_certificate,output_certificate))}
165    case valid count: Rejected{(input,output)}

Uses (12)

Used by (1)