Question: Default value for sparse rtables

For a table

T := table(sparse = {}, [1 = {a}, 2 = {b}])

T[3] returns {}. 

Is there an equivalent for an rtable?

restart

T := table(sparse = {}, [1 = {a}, 2 = {b}])

table( [( 1 ) = {a}, ( 2 ) = {b} ] )

T[1]; T[2]

{a}

{b}

Get the default value here

T[3]

{}

But (as documented), the sparseness of the table is not inherited - all elements are filled

Vector[row](6, T, storage = sparse); op(%)

Vector[row](%id = 36893490697130506636)

6, {1 = {a}, 2 = {b}, 3 = {}, 4 = {}, 5 = {}, 6 = {}}, datatype = anything, storage = sparse, order = Fortran_order, shape = []

fill = {} should fill in all unspecified values. but this is incompatible with storage = sparse (as documented).

Vector[row](6, {1 = T[1], 2 = T[2]}, storage = sparse, fill = {}); op(%)

Vector[row](%id = 36893490697130478916)

6, {1 = {a}, 2 = {b}}, datatype = anything, storage = sparse, order = Fortran_order, shape = []

And the default fill is still zero for datatype=set; I expected {} here.

Vector[row](6, {1 = T[1], 2 = T[2]}, storage = sparse, datatype = set); op(%)

Vector[row](%id = 36893490697130474412)

6, {1 = {a}, 2 = {b}}, datatype = set, storage = sparse, order = Fortran_order, attributes = [_fill = 0], shape = []

NULL

Download Sparse.mw

Please Wait...