Opened 16 years ago

Closed 15 years ago

#267 closed enhancement (fixed)

iterator for 2D Lookups

Reported by: Peter Owned by: Peter
Priority: minor Milestone: yat 0.4
Component: classifier Version: trunk
Keywords: Cc:

Description (last modified by Peter)

related to ticket:256 ticket:263 ticket:306

Instead of using constructor in DataLookup1D one can call these functions in DataLookup2D. I suggest two functions: one for row view and one for columns view.

Change History (13)

comment:1 Changed 15 years ago by Peter

I think we should have iterators for this functionality


in addition to iterators


As Lookups by design is const, iterators are const_iterators.

comment:2 Changed 15 years ago by Markus Ringnér

I agree.

This is similar to what I in October mistakenly thought you wanted for matrix in ticket:263.

comment:3 Changed 15 years ago by Peter

Ok, we should collect all those tickets in one place.

There is a problem we need to solve. DataLookup2D can be both weighted and unweighted, so we need to specialize the iterator for this case. I assume Iterator for these 2D containers will be very similar to the 1D versions, perhaps they could even be incorporated within that class using some clever pattern.

comment:4 Changed 15 years ago by Peter

Description: modified (diff)

adding relationship to ticket:263

comment:5 Changed 15 years ago by Peter

We should remember that if we delete DataLookup2D as suggested by Markus in comment:ticket:287:3 the problem above is no longer a problem. In short it means that we are going towards all weighted/unweighted polymorphism static.

comment:6 Changed 15 years ago by Peter

Summary: functions in DataLookup2D creating Lookup1diterator for 2D containers

comment:7 Changed 15 years ago by Peter

MatrixLookup::iterator and KernelLookup::iterator could be implemented in Iterator and MatrixLookupWeighted? in IteratorWeighted?.

To do that we need a tag we can specialize on for how to implement operator*, in other words, specialize how to go from container and index to value. Currently it is implemented as container_(index_), which I think we should keep as default.

comment:8 Changed 15 years ago by Markus Ringnér

I am not sure I follow exactly how you are thinking. But in the case of row/column iterators, does not a fixed additional index for the other matrix-direction not being iterated over also have to be stored somewhere (in the iterator)? mlw.row_iterator(i).begin(), where is the fixed value i stored? So operator* can return container_(i,index_) ?

comment:9 Changed 15 years ago by Peter

aah that's true. But that should be solvable. I'm just against implementing 13 new iterator classes. I think it smells like adapter of type bind. Let's have a functor in Iterator that takes care of operator*. If we wanna be fancy we could even templatize the fixed index as Functor<5> for example.

The iterator used for iterating over all elements in I guess is so different that we have to implement it in a new class.

comment:10 Changed 15 years ago by Peter

Description: modified (diff)
Summary: iterator for 2D containersiterator for 2D Lookups

Lifted out parts for utility::matrix that belongs in elsewhere. see ticket:306.

comment:11 Changed 15 years ago by Peter

Iterators for MatrixLookup? and KernelLookup? were implemented in [1063] and [1066], respectively.

comment:12 Changed 15 years ago by Peter

Status: newassigned

There will be no iterator for DataLookup2D. I cant see a solution how mix dynamic and static polymorphism in this way. I consider DataLookup2D to be deprecated.

comment:13 Changed 15 years ago by Peter

Resolution: fixed
Status: assignedclosed

iterator for MatrixLookupWeighted? in [1091] and [1090]

Note: See TracTickets for help on using tickets.