Re: [q-lang-users] Vector module
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2007-10-03 00:55:08
|
ed...@ri... wrote: > Except for sparce matrices, shouldn't matricies be built using the tuples as John > describes? Yes, but it would be nice to have some additional convenience functions for creating those (reftuple2, mkreftuple2, etc.), which would take a tuple of tuples of values, or an initial value and two dimensions, and turn that into a tuple of tuple of references. Just like reftuple and mkreftuple now, but for two dimensions, ok? It's all about convenience functions. Of course one can argue whether these would be needed for reference lists and streams, too, but for consistency it might be nice to provide them anyway. Do we need higher-dimensional tensors as well? Oh well, John, you opened a can of worms there. ;-) > Or, are you talking about another type array2? Nope, that was only an analogy, as array::Array already offers the kind of convenience functions alluded to above (array2, mkarray2). Also note that we're not really talking about new types here, it's just convenience functions added on top of the existing types. A tuple of references is still a tuple after all. BTW, talking about sparse matrices, the Array data type already makes for a very nice sparse vector and matrix data structure, since it's space-efficient and member lookup and update both works in logarithmic time. And it also lets you add and remove members efficiently at the beginning and the end, which should be useful for mathematical applications. But note that John's proposal is about something else, namely *mutable* vectors and matrices. For that you still need references. But, as I already noted, this functionality can be added to Array, Dict and HDict just as easily as to tuples, lists and streams. Well, at least that's what I hope. ;-) Cheers, Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |