Opened 13 years ago

Last modified 12 years ago

#358 new request

add iterators in Kernel class

Reported by: Peter Owned by: Peter
Priority: minor Milestone: yat 0.x+
Component: classifier Version: trunk
Keywords: Cc:

Description

No reason not to have iterators here. I think Kernel class in principle is const so only const_iterators are relevant. I think we can implement this similarly to how it is done in e.g. KernelLookup?.

Change History (2)

comment:1 Changed 13 years ago by Peter

Priority: majorminor

KernelLookup? uses a StrideIterator?<Container2DIterator> and it would be easy to implmenent is in an identical way for Kernel. However, Container2DIterator requires functions rows() and columns(), which is lacking in Kernel. Therefore we end up with three choices:

  1. Add rows() and columns() to Kernel and implement iterator as in KernelLookup?
  1. Implement a new iterator similar to Container2DIterator but using size rather than rows and columns.
  1. Skip the iterators in Kernel.

I don't like 1. because it adds to the interaface of Kernel, which is not natural. A Kernel is symmetric and no need to have rows and columns. It used to have these functions but they were removed. Alternative 2. is stupid because it is just duplicating a bunch of code. Then we are left with three. At first sight it is not good, but one could argue that iterators are not really needed in Kernel. A simple workaround for a user is to use a KernelLookup? instead and this class has iterators. I think this would work in most places, but perhaps there are sitution when a lookup of the entire Kernel is not working because the KernelLookup lacks some functionality.

comment:2 Changed 12 years ago by Jari Häkkinen

Milestone: yat 0.5yat 0.x+
Note: See TracTickets for help on using tickets.