|
Ublas : |
Subject: Re: [ublas] size1 and size2
From: Karl Meerbergen (karl.meerbergen_at_[hidden])
Date: 2009-09-14 13:29:45
Dear all,
I think that num_rows() and num_columns() are currently used quite often
in libraries. Note that the bindings also use this terminology now after
strong suggestions from the referees.
For vectors, it is usually size() (because of STL I guess). Matlab uses
length(), whereas size() assumes a matrix argument.
For tensors etc, size<i> are probably the best option. This is also
compatible with matlab.
In short, there is no consensus. Using free functions instead of member
functions all of them can be implemented, of course.
Best,
Karl
Marco Guazzone wrote:
> On Mon, Sep 14, 2009 at 4:23 AM, er <erwann.rogard_at_[hidden]> wrote:
>
>> Nasos Iliopoulos wrote:
>>
>>> I have a problem with rows and cols like other people have with left and
>>> right. I have to think which is which :).
>>> Beyond that I prefer size1 and size2 for the same reasons Curtis does,
>>> but i don't see much of a problem providing overloads to them under the
>>> umbrella of a utils.h header or something.
>>> size<1> and size<2> would be my personal favourite (as Gunter proposed),
>>> but I think it goes too much for the average user.
>>>
>>> Best
>>> Nasos
>>>
>>>
>> size_major would be closer to the STL convention, and avoids a new
>> convention (row) on top of another (major). However size1, size<1>, or
>> perhaps size<0> all seem fine.
>>
>>
>
> Hello!
>
> I think it would be necessary to distinguish between the matrix
> theoretical concept from implementation detail.
> I'm not a mathematician so correct me if I'm wrong.
> For what I know a matrix is defined in terms of rows and columns; for instance:
> * From http://en.wikipedia.org/wiki/Matrix_%28mathematics%29
> "A matrix with m rows and n columns is called an m-by-n matrix or m
> × n matrix, while m and n are called its dimensions"
>
> * From http://mathworld.wolfram.com/Matrix.html
> "An mXn matrix consists of m rows and n columns, and the set of mXn
> matrices with real coefficients is sometimes denoted R^(mXn)"
>
> What is argued in the previous emails is about matrix orientation that
> IMO is an implementation detail.
> So, if I declare a ublas::matrix(m,n) what I expect is that this
> matrix has m rows and n columns regardless its orientation
>
> Note, this is what I expect. Maybe it is not the phylosophy under the uBlas lib.
> Let me know in this case and I'll stop to stress ;))
>
> Anyway, maybe we can keep the two concept separate. So for a matrix A(m,n):
> A.num_rows() ==> m
> A.num_cols() ==> n
> A.size1() ==> m if row_major OR n if column_major
> A.size2() ==> n if row_major OR m if column_major
> At least this is how the choice made by MTL4 (actually it uses dim1
> and dim2 in place of size1 and size2, respectively).
>
> What do you think?
>
>
> Cheers,
>
> -- Marco
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: karl.meerbergen_at_[hidden]
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm