annotate sequences/@extractdata/extractdata.m @ 2:7357e1dc2ad6
Simplified scheduler library with new schedule representation.
author |
samer |
date |
Sat, 22 Dec 2012 16:17:51 +0000 |
parents |
672052bd81f8 |
children |
|
rev |
line source |
samer@0
|
1 function o=extractdata(source,dim,range)
|
samer@0
|
2 % extractdata - Sequence of extracts from source sequence
|
samer@0
|
3 %
|
samer@0
|
4 % extractdata :: seq [[Size]], D:natural, [[2]->[Size(D)]] -> seq [[Size2]].
|
samer@0
|
5 %
|
samer@0
|
6 % extractdata is basically the same as fndata extract but more efficient.
|
samer@0
|
7
|
samer@0
|
8 sz=size(source);
|
samer@0
|
9 sz(dim)=range(2)-range(1)+1;
|
samer@0
|
10 o.dim=dim;
|
samer@0
|
11 o.range=range;
|
samer@0
|
12 o=class(o,'extractdata',ddata(source,sz,'datafn',@dfn,'stringfn',@sfn,'nextfn',@next_c));
|
samer@0
|
13
|
samer@0
|
14
|
samer@0
|
15 function x=dfn(o), x=extract(source(o),o.dim,o.range);
|
samer@0
|
16 function s=sfn(o)
|
samer@0
|
17 s=sprintf('[%d/%d:%d]', o.dim, o.range(1), o.range(2));
|