public static InvertibleCodec<long[][], LongGene> ofMatrix(
		final LongRange domain,
		final int rows,
		final int cols
	) {
		requireNonNull(domain);
		Requires.positive(rows);
		Requires.positive(cols);

		return InvertibleCodec.of(
			Genotype.of(
				LongChromosome.of(domain, cols).instances()
					.limit(rows)
					.collect(ISeq.toISeq())
			),
			gt -> gt.stream()
				.map(ch -> ch.as(LongChromosome.class).toArray())
				.toArray(long[][]::new),
			matrix -> Genotype.of(
				Stream.of(matrix)
					.map(row ->
						LongChromosome.of(
							LongStream.of(row)
								.mapToObj(v -> LongGene.of(v, domain))
								.collect(ISeq.toISeq())
						))
					.collect(ISeq.toISeq())
			)
		);
	}
Return a 2-dimensional matrix {@link InvertibleCodec} for the given range.
All matrix values are restricted by the same domain. The dimension of the
returned matrix is {@code long[rows][cols]}.

@since 4.4

@param domain the domain of the matrix values
@param rows the number of rows of the matrix
@param cols the number of columns of the matrix
@return a new matrix {@code Codec}
@throws NullPointerException if the given {@code domain} is {@code null}
@throws IllegalArgumentException if the {@code rows} or {@code cols} are
        smaller than one.
jenetics/src/main/java/io/jenetics/engine/Codecs.java