Designing a matrix library for D

ed via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 24 03:31:51 PDT 2014


On Tuesday, 24 June 2014 at 07:01:14 UTC, Mason McGill wrote:
> On Tuesday, 24 June 2014 at 04:36:04 UTC, ed wrote:
>> On Monday, 23 June 2014 at 21:08:03 UTC, Mason McGill wrote:
>> [snip]
>>>
>>> Concepts:
>>> InputGrid: anything with a size (size_t[n]) and n-dimensional 
>>> opIndex.
>>> OutputGrid: anything with a size (size_t[n]) and 
>>> n-dimensional opIndexAssign.
>> [snip]
>>>
>>> Cheers,
>>> Mason
>>
>> I don't think 'Grid' is not a good name for the type. The term 
>> Grid is generally used to refer to any sort of grid; regular, 
>> semiregular, irregular, unstructured, curvilinear etc. etc. 
>> grids.
>
> When you're talking about sampling on a grid, warping can 
> either be thought of as warping the grid, or warping the 
> function to be sampled. My library happens to work in terms of 
> the second approach, so it is (pedantically) consistent. I see 
> your point, though.
>
>> They are all very different in their use and internal 
>> representations. Often a grid will have support for metadata 
>> at each point (GIS etc.) whereas a matrix will not.
>>
>> I think the word Matrix is a better fit, because that is what 
>> they these types are.
>
> Not quite. "Matrix" connotes 2-dimensional tensors (in the 
> linear algebra sense). The library I'm developing at work is 
> for manipulating multidimensional arrays, which don't have the 
> same semantics people expect from matrices (representing linear 
> operators). However, the name "Array" already refers to at 
> least 3 data structures in D, so it was out. I picked "Grid" 
> because the library is for processing data sampled regularly on 
> n-dimensional grids (mostly vision). With my library, you could 
> represent complex data in a GIS via a grid of structures, or 
> multiple grids ("layers").
>

Well you could but there are well established data structures 
that are optimal for each grid type so it would be better to just 
use one of those.

> If you're not convinced, I intend to release my work under a 
> liberal license, so feel free to download it and find/replace 
> "Grid" -> "Matrix" :)

Fair enough and I am only nitpicking. Your library sounds 
promising so I'll definitely give it a whirl when released.

>
> Also, check out this other option if you haven't already:
> http://denis-sh.bitbucket.org/unstandard/unstd.multidimarray.html

Yep, this is nice and I use it already, along with Sci-D.


Cheers,
ed


More information about the Digitalmars-d mailing list