[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Access the neighbors of an element
From: |
Francesco Potorti` |
Subject: |
Re: Access the neighbors of an element |
Date: |
Fri, 11 Feb 2005 15:50:29 +0100 |
>Over the time, the matrix changes only at one position. By hand it is
>much easier to calculate the passage of the energie of one matrix to the
>other, than calculate the whole energie again. The transit is in O(1),
>the energie is in O(n^2).
>
>My idea was to do the same in octave, but it doesn't work. It's faster to
>compare 800 elements than find and access 4 elements.
In fact, it works, as soon as you remember that O(1) and O(n^2) need at
least a multiplicative constant in order to produce times. If you
increase n enough, you will find the n where the O(1) time solution is
faster.
>> If that's your case, then you can do it the way I said, using terms of the
>> form
>> (X(m,n) == X(m-1,n)).
>
>But n and m are chosen randomly and I don't know if m+1, m-1, n-1, n+1
>exist.
Create a matrix with guard (first and last) columns and rows, which are
not used for computations, but only to be sure that m+1, m-1, n+1, n-1
all exist. Fille them with values that do not change the results of
your computations. For example, you can use "*" instead of "==" when
computing the energy and set the guard values to 0, so they do not
interfere.
--
Francesco Potortì (ricercatore) Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR Fax: +39 050 313 8091
via G. Moruzzi 1, I-56124 Pisa Email: address@hidden
Web: http://fly.isti.cnr.it/ Key: fly.isti.cnr.it/public.key
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- Access the neighbors of an element, Joerg Sommer, 2005/02/09
- Re: Access the neighbors of an element, Mike Miller, 2005/02/09
- Re: Access the neighbors of an element, Francesco Potorti`, 2005/02/10
- Message not available
- Re: Access the neighbors of an element, Jörg Sommer, 2005/02/10
- Re: Access the neighbors of an element,
Francesco Potorti` <=
- Re: Access the neighbors of an element, Joerg Sommer, 2005/02/11
- Re: Access the neighbors of an element, John W. Eaton, 2005/02/11
- Data types (was: Re: Access the neighbors of an element), Joerg Sommer, 2005/02/12
- Data types (was: Re: Access the neighbors of an element), John W. Eaton, 2005/02/12
- Re: Data types (was: Re: Access the neighbors of an element), Paul Kienzle, 2005/02/12
- Re: Data types (was: Re: Access the neighbors of an element), Paul Kienzle, 2005/02/12
- Re: Access the neighbors of an element, Joerg Sommer, 2005/02/12