function typed( arr, dtype ) {
	var ctor;
	var len;
	var out;
	var set;
	var fcn;
	var o;
	var i;

	ctor = bufferCtors( dtype );
	len = arr.length;
	out = new ctor( len );

	// If the output data buffer is a complex number array, we need to use accessors...
	o = arraylike2object( out );
	if ( o.accessorProtocol ) {
		set = o.accessors[ 1 ];
		fcn = castReturn( wrapper, 1, complexCtors( dtype ) );
		for ( i = 0; i < len; i++ ) {
			set( out, i, fcn( i ) ); // we're assuming that we're doing something sensible here (e.g., not trying to cast arbitrary objects to complex numbers, etc)
		}
	} else {
		for ( i = 0; i < len; i++ ) {
			out[ i ] = arr.iget( i ); // we're assuming that we're doing something sensible here (e.g., not trying to cast an ndarray containing generic objects to a double-precision floating-point array or a complex-valued ndarray to a real-valued ndarray, etc)
		}
	}
	return out;

	/**
	* Returns the ndarray element specified by a provided linear index.
	*
	* @private
	* @param {NonNegativeInteger} i - linear index
	* @returns {*} value
	*/
	function wrapper( i ) {
		return arr.iget( i );
	}
}
Copies a "typed" ndarray view.

@private
@param {ndarray} arr - input ndarray
@param {string} dtype - data type
@returns {Array} output data buffer