Opened 14 years ago
Closed 14 years ago
#396 closed request (fixed)
Interfacing MatrixWeighted with Matrix and MatrixLookupWeighted
Reported by: | Peter | Owned by: | Peter |
---|---|---|---|
Priority: | major | Milestone: | yat 0.5 |
Component: | utility | Version: | trunk |
Keywords: | Cc: |
Description (last modified by )
This include:
- Construct MatrixLookupWeighted from MatrixWeighted
- Construct MatrixWeighted from two Matrix
- Construct MatrixWeighted from one Matrix (and use nan function to calcaulate weights)
Having these, I think we should deprecate a number of constructors in MatrixLookupWeighted that take one or two Matrix. Also I think it is preferable to change the internal representation in MatrixLookupWeighted. Currently it is two Matrix, and I think it makes more sense to have one MatrixWeighted. There is a competition between allowing fast construction
MatrixLookupWeighted(const MatrixWeighted&)
and MatrixLookupWeighted(const Matrix&, const Matrix&)
, because when the argument is not the same as the internal representation one has to copy. I think creating from a MatrixWeighted is more important and another reason to change the internal representation to MatrixWeighted is that the iterators will be faster since we can work with references and avoid the current proxies (that have to create bot data and weight also when we are only interested in one of data
or weight
).
needed for ticket:444
Change History (14)
comment:1 Changed 14 years ago by
Owner: | changed from Jari Häkkinen to Peter |
---|---|
Status: | new → assigned |
comment:2 Changed 14 years ago by
Changing MatrixLookupWeighted to hold a MatrixWeighted rather than two Matrix would have an important change, namely that constructor of type
MatrixLookupWeighted(const Matrix&, const Matrix&)
will copy the values (and not as before copy the two references. This implies that if any of the Matrix is changed later on (outside the MatrixLookupWeighted?) it will not modify the value in MatrixLookupWeighted?. Currently that is not the case, since MatrixLookupWeighted? holds by reference.
This opens the question: should be finish this change? If yes, how to deal with these constructors?
I see three alternatives.
- Keep underlying data as two Matrix as in yat 0.4
- Change to MatrixWeighted as described above and deprecate these constructors.
- Change to MatrixWeighted as described above and remove these constructors. The motivation for this argument would be that it is better to remove a functionality than keeping it and changing the behavior.
comment:3 Changed 14 years ago by
No feedback from anyone, so I guess all alternatives are fine. I prefer 3) and will go with that.
comment:4 Changed 14 years ago by
(In [1482]) refs #396 stupid implementation of constructors - copying should be avoided when internal representation in MatrixLookupWeighted? has changed
comment:5 Changed 14 years ago by
(In [1483]) refs #396 - removing a constructor in MatrixLookupWeighted? - needed to re-organize tests in ncc_test to track down an error
comment:7 Changed 14 years ago by
Description: | modified (diff) |
---|
comment:14 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Constructors 2) and 3) were added in [1384].