         for d in [0...@ndim]
             f += @stride[d]*p[d]
 
+        return f
+
 
     ###
     Fill the array with a given constant value


    TODO: testing with more than 1 dimension
    ###
    flatPosition: (p) ->

        if p.length != @ndim
            throw new error.NumjisException('incorrect position dimension, got: ' + p.length + ' expecting: ' + @ndim)

        for n in [0...@length]
            @data[n] = value


###
Creates a ND-array filled with zeros

@param [int list] shape array shape
@param [dtype, optional] array type

@return NDArray object
###
zeros = (shape, dtype=float32) ->

    arr = new NDArray(shape, dtype=dtype)
    return arr
    

###
