anchor.diff:      // Conversion functions
   
       /// Character array to integer array
  -    let chars_to_ints (chars:char[]) =
  +    let charsToInts (chars:char[]) =
           Array.map (fun c -> int c) chars
   
       /// Character array to string
  
positive.code:                 -d + 2 * l - 2 - b
  
          [<ReflectedDefinition>]
          let initial_i d max_row = 
              if d > max_row then max_row else d
  
          [<ReflectedDefinition>]
          let initial_j d max_row =
              if d < max_row then 0 else d - max_row
  
          [<ReflectedDefinition>]
          let get_i d m max_row = 
              (initial_i d max_row) - m
  
          [<ReflectedDefinition>]
          let get_j d m max_row = 
              (initial_j d max_row) + m
  
          [<ReflectedDefinition>]
          let kernel (matrix:(prim_cell)[,]) (fst_seq:int[]) (snd_seq:int[]) (m_maxs:int[]) =
  
              let start = blockIdx.x * blockDim.x + threadIdx.x
              let stride = gridDim.x * blockDim.x
  
negative.code:             let rows = matrix.GetLength(0)
              let cols = matrix.GetLength(1)
  
              let dMax = rows + cols
  
              __syncthreads()
              for d in 0..dMax do
                  let mMax = mMaxs.[d]
                  let mutable m = start
                  while m <= mMax do
                      let i = getI d m (rows - 1)
                      let j = getJ d m (rows - 1)
  
                      // Avoid the first row and first column of the matrix because they are reserved for the sequences in the form of 0s.
                      if i <> 0 && j <> 0 then
                          matrix.[i,j] <- bestTrace matrix.[i-1,j-1] matrix.[i,j-1] matrix.[i-1,j] fstSeq.[i-1] sndSeq.[j-1] 
  
                      m <- m + stride
                  __syncthreads()
              __syncthreads()
  
  
          let transformKernel = <@ kernel @> |> Compiler.makeKernel
  
          let gpuCellMatrix (fst_seq:int[]) (snd_seq:int[]) =
              let rows, cols = fst_seq.Length + 1, snd_seq.Length + 1
  
              let d_max = rows + cols - 1
              let d_maxs = [|for d in 0..d_max -> d|]
              let m_maxs = d_maxs |> Array.map (fun d -> maxDiagCell d rows cols)
  
              let gpu = Gpu.Default
              let fstSeqGpu = gpu.Allocate(fst_seq)
              let sndSeqGpu = gpu.Allocate(snd_seq)
              let mMaxsGpu = gpu.Allocate(m_maxs)
              let matrixGpu = gpu.Allocate<Cell>(rows, cols)
  
              let lp = LaunchParam(1, 512)
              gpu.Launch transformKernel lp matrixGpu fstSeqGpu sndSeqGpu mMaxsGpu
  
              let matrix = Gpu.CopyToHost(matrixGpu)
  
              Gpu.Free(fstSeqGpu)
              Gpu.Free(sndSeqGpu)
              Gpu.Free(mMaxsGpu)
              Gpu.Free(matrixGpu)
  
              matrix
  
      module ParallelSmithWaterman =
          let run (fstSeq:string) (sndSeq:string) =
              let fstSeqPrim = fstSeq |> stringToCharInts
              let sndSeqPrim = sndSeq |> stringToCharInts
              let cell_matrix = ParallelMatrix.gpuCellMatrix fstSeqPrim sndSeqPrim
              let i, j = indexOfMaxInMatrix cell_matrix
  
              let alignment = traceBackPrimitive fstSeqPrim sndSeqPrim i j List.Empty List.Empty cell_matrix
  
  