from org.virbo.dataset import RepeatIndexDataSet

print '== Repeat Rank 1, adding index to tail (leaves) =='
ds= indgen(5)
ds= RepeatIndexDataSet( ds, 1, 3 )
ds= dataset(0) + ds
for ds1 in ds:
    for ds11 in ds1:
         print ds11,
    print ''
print '=='

print '== Repeat Rank 1, inserting index 0. =='
ds= indgen(5)
ds= RepeatIndexDataSet( ds, 0, 3 )
ds= dataset(0) + ds
for ds1 in ds:
    for ds11 in ds1:
         print ds11,
    print ''
print '=='

print '== Repeat Rank 2 =='
ds= indgen(3,4)
ds= RepeatIndexDataSet( ds, 0, 2 )
ds= dataset(0) + ds
for ds1 in ds:
    for ds11 in ds1:
         for ds111 in ds11:
             print ds111,
         print ''
    print '='
print '=='

ds= indgen(3,4)
ds= RepeatIndexDataSet( ds, 1, 2 )
ds= dataset(0) + ds
for ds1 in ds:
    for ds11 in ds1:
         for ds111 in ds11:
             print ds111,
         print ''
    print '='
print '=='

ds= indgen(3,4)
ds= RepeatIndexDataSet( ds, 2, 2 )
ds= dataset(0) + ds
for ds1 in ds:
    for ds11 in ds1:
         for ds111 in ds11:
             print ds111,
         print ''
    print '='
print '=='

print '== Repeat of Repeat =='
ds= indgen(3)
ds= RepeatIndexDataSet( ds, 1, 4 )
ds= RepeatIndexDataSet( ds, 2, 5 )
ds= dataset(0) + ds
for ds1 in ds:
    for ds11 in ds1:
         for ds111 in ds11:
             print ds111,
         print ''
    print '='
print '=='