Create a matrix from an Array[Float] composed of rows after rows

Require: width > 0 and height > 0

Require: array.length >= width*height

var matrix = new Matrix.from_array(2, 2, [1.0, 2.0,
                                          3.0, 4.0])
assert matrix.to_s == """
1.0 2.0
3.0 4.0"""

Property definitions

matrix $ Matrix :: from_array
	# Create a matrix from an `Array[Float]` composed of rows after rows
	#
	# Require: `width > 0 and height > 0`
	# Require: `array.length >= width*height`
	#
	# ~~~
	# var matrix = new Matrix.from_array(2, 2, [1.0, 2.0,
	#                                           3.0, 4.0])
	# assert matrix.to_s == """
	# 1.0 2.0
	# 3.0 4.0"""
	# ~~~
	init from_array(width, height: Int, array: SequenceRead[Float])
	do
		assert width > 0
		assert height > 0
		assert array.length >= width*height

		init(width, height)

		for i in height.times do
			for j in width.times do
				self[j, i] = array[i + j*width]
			end
		end
	end
lib/matrix/matrix.nit:83,2--108,4