function normalize( mat ) { // TODO: eventually remove this function once project has implemented comparable functionality as a standalone package
	var mbuf;
	var sm1;
	var sm2;
	var om;
	var M;
	var N;
	var i;

	mbuf = mat.data;
	M = mat.shape[ 0 ];
	N = mat.shape[ 1 ];
	sm1 = mat.strides[ 0 ];
	sm2 = mat.strides[ 1 ];
	om = mat.offset;

	for ( i = 0; i < M; i++ ) {
		// Normalize a matrix row:
		norm( N, mbuf, sm2, om );

		// Update the index offset to point to the next row:
		om += sm1;
	}
	return mat;
}
Normalizes matrix elements by row magnitudes.

@private
@param {ndarray} mat - matrix to normalize
@returns {ndarray} input matrix