Raul, Yes, I think you are correct about # providing a workalike. Thanks, very much.
I am hoping that the Apple C function "vDSP_vcmprs" can give me those results, but I am having trouble getting my head around the instructions for vDSP_vcmprs, which takes a vector input, not an array, for example. Thank you, On Wed, Jan 2, 2013 at 10:21 AM, Raul Miller <[email protected]> wrote: > That sounds very much like a description of # with a boolean left argument. > > If the left argument of sample becomes the sub-pixel index of interest > > sample=: 4 : 'wind x&{@,;._3"2 y' > > we can define a workalike using # > > samp=:4 :0 > 'row col'=. (_2 {. #: 4+x)=/0 1 > 'height width'=. $y > (height$row)# (width$col)#"1 y > ) > > In other words: > > dat=: ?.8 8$2 > 0 (samp -: sample) dat > 1 > 1 (samp -: sample) dat > 1 > 2 (samp -: sample) dat > 1 > 3 (samp -: sample) dat > 1 > > Note that we could also incorporate the arbitrary choice of the pixel > being picked into samp, but that would make testing a problem. (We > could do it by making the random choice mechanism be a user defined > verb and then for testing purposes we could supply a specialized > definition of that verb, but I am not sure that that is warranted for > the current definition of sample.) > > FYI, > > -- > Raul > > On Tue, Jan 1, 2013 at 12:47 PM, Brian Schott <[email protected]> wrote: >> I have been reading -- no scanning -- apple developer's docs (because >> ultimately my code is developed in apple's Xcode) on math|digital >> signal processing and I am seeing talk of existing procedures that do >> dot products, FFT, convolutions, and scaling in the same docs. >> >> In particular there is mention at the link below of a function >> vDSP_vcmprs which has the following desctiption. >> >> "Performs the following operation: >> >> >> "Compresses vector A based on the nonzero values of gating vector B. >> For nonzero elements of B, corresponding elements of A are >> sequentially copied to output vector C." >> >> http://developer.apple.com/library/ios/#documentation/Accelerate/Reference/vDSPRef/Reference/reference.html >> >> This looks very promising to me if I can figure out the inputs which >> include 2 input vectors and 1 output vector and 3 corresponding >> "strides". I assume input vector A would be my raveled 52x52 image of >> 0s and 1s; input B would be some permutation of 1, 3#0 or of 1,15# 0. >> Would the stride of A be 52 and the stride of B be 4 or 16? Does C >> have a stride? >> >> Can anyone help here? >> >> -- (B=) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
