Sets or clears the series mode of an SPL function.


SERIES("funname", mode)



A string. The name of the SPL function.



Optional. An integer, the series mode.


clear series mode


enable series mode, force return value to be a series (default)


Nothing. Changes the series mode of an SPL function.


Consider the following SPL routine:




a = {{1, 2, 3},

     {2, 4, 6}, 

     {3, 6, 9}} 


m1 = smax(a);


m1 == 9


Since the input a is an array, smax returns the maximum of the entire array as a scalar.


If the SPL routine is set to explicitly return a series:


series("smax", 1);

m2 = smax(a);


m2 == {9}


The return value is a series because smax now automatically converts the scalar result to a series result. This is equivalent to:





Using column iteration:


iterate("smax", 1);

m3 = smax(a);


m3 == {{3, 6, 9}}


since smax now iterates over each column and returns the maximum of each column.


The series function forces an SPL routine to always return a series. This behavior optimizes evaluation since the return type is already known before the calculation takes place. The optimizations are similar to what occurs with internal functions that always return a series such as FFT or INTEG. However, this behavior persists only for the duration of the current session. Use the SERIES modifier in the function definition to make the behavior permanent. For example:


SERIES smax(s)



SERIES can also be specified in command mode. For example:


series smax


forces smax to always return a series.


Because the command form does not accept optional arguments, the command form can only enable series mode.

See Also: