Question

I am trying to get an array linearly spaced given the step size.

For Example

arange(10,15,0.5) = 10.5, 11, 11.5, 12, 12.5, 13, 13.5, 14, 14.5,15

arange(10, 15, 1) = 11, 12, 13, 14

There is linspace function that accepts only number of elements to be generated. Is there a way to provide step size instead of the number of elements?

For now, I calculate number of elements manually and use linspace to get the result.

Is there any straight to use api to get desired output? Thanks

Was it helpful?

Solution

Try:

ILArray<double> A = ILMath.vec<double>(10.0,0.5,15.0); 

More array creation functions can be found in the Array section of the documentation. A number of quick reference charts is also available:

ILNumerics' getting started: http://ilnumerics.net/media/oldres/img/ILNumerics_ArraysUsage.pdf

ILNumerics for Matlab users: http://ilnumerics.net/media/oldres/img/ILNumerics4MatlabUsers.pdf

Last but not least the class reference for all ILMath functions: http://ilnumerics.net/apidoc/?topic=html/Methods_T_ILNumerics_ILMath.htm

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top