[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Matrix initialisation
From: |
Jaroslav Hajek |
Subject: |
Re: Matrix initialisation |
Date: |
Tue, 28 Dec 2010 22:06:47 +0100 |
On Mon, Dec 27, 2010 at 4:53 PM, Søren Hauberg <address@hidden> wrote:
> Hi
>
> I just got a bug report for the image package, where the fix boiled down
> to changing (in C++)
>
> Matrix J (bins_length, thetas_length);
>
> to
>
> Matrix J (bins_length, thetas_length, 0.0);
>
> i.e. initialise the matrix to contain zeros. I always thought that if
> you did not provide an initial value when constructing a matrix, it
> would default to zero. Has this ever been the case or is it just
> something I made up?
>
The latter, probably. As far as I remember, you always get an
uninitialized array using the first form.