Index Mathematics Conjectures nbv lettuce Widgets

mat_poly_iden

stdlib/polynomial/mat_poly_iden.nbv

mat_poly_iden(static N, static size)

get an identity matrix of polynomial ring elements

a matrix is encoded as height, width, followed by each row concatenated e.g. concat! height, width, row, row, row, row

Precompiles
concat!, if_eq!, loop_flat_map!
Used by
bdlop/bdlop_lattice

Source

# get an identity matrix of polynomial ring elements
#
# a matrix is encoded as height, width, followed
# by each row concatenated
# e.g.
# concat! height, width, row, row, row, row
(static N, static size)

let mat = loop_flat_map! size, i {
  loop_flat_map! size, j {
    let mut v[N]
    if_eq! i, j {
      v[0] = 1
    }
    v
  }
}

concat! size, size, mat