mike-bourgeous / mb-math

Mathematical functions shared by mb-sound, mb-geometry, and other personal projects
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Allow pad, zpad, and opad to accept a block for padded processing. #11

Closed mike-bourgeous closed 4 months ago

mike-bourgeous commented 4 months ago

This enables processing of padded data without having to manage removal of the padding.

MB::M.zpad(Numo::SFloat[1,2,3], 5, alignment: 0.5) do |d| puts MB::U.highlight(d); d.reverse end
Numo::SFloat#shape=[5]
[0, 1, 2, 3, 0]
=> Numo::SFloat(view)#shape=[3]
[3, 2, 1]