Creates proxies for ndarrays. These give a logical view of a function as an ndarray.
Proxy ndarrays work just like ndarrays, and can be used in all the same ways. However, unlike dense arrays they do not keep any storage and instead use a function to determine the contents of the array. Here is a simple example:
var proxy =//Create a 10x10 proxy ndarrayvar x =x //Prints out: Called: 1 2x //Prints out: Called: 7 8
It is possible to slice the view of a proxy ndarray, just like a regular ndarray:
x //Prints out: Called: 3 4x //Prints out: Called: 7 3
You can use lazy ndarrays with cwise or any other library that works with ndarrays.
It is also possible to add a setter to the proxy ndarray to implement custom assignment operations. For example:
var y =y //Prints: SET: 2 3 = 10
If a setter isn't specified, then writing to the array throws an error.
You can install the library using npm:
npm install ndarray-proxy
And like all ndarray modules it should work in a browser that supports typed arrays using browserify.
require('ndarray-proxy')(shape, get_func[, set_func])
Creates a wrapper for an ndarray
shapeis the shape of the wrapped ndarray
get_func(i0,i1,...)implements access to the ndarray
set_func(i0,i1,...,v)implements writing to the ndarray
Returns A proxy view of the functions.
(c) 2013 Mikola Lysenko. MIT License