Multidimension array

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Multidimension array

lhhuong
Hi everybody, i am a newbie in smalltalk, I want to create dijkstra algorithm in smalltalk so I need to declare an 2D array. But I don't know how to declare 2D array.
What should I do? Thanks Advanced
Reply | Threaded
Open this post in threaded view
|

Re: Multidimension array

reinier van oosten-3
Hi lhhuong,

The simple answer is you have to make an array of arrays.

But why do you need a matrix for the dijkstra algorithm. As far as I know the Dijkstra algorithm it computes the shortest path in a network of nodes and edges. In Smalltalk you can implement this by a network of nodes and edges. A node has a list of edges with path length. An edge connects two nodes. You can just implement the algorithm over the nodes and edges.

Reinier van Oosten

> On 29 Dec 2014, at 13:50, lhhuong <[hidden email]> wrote:
>
> Hi everybody, i am a newbie in smalltalk, I want to create dijkstra algorithm
> in smalltalk so I need to declare an 2D array. But I don't know how to
> declare 2D array.
> What should I do? Thanks Advanced
>
>
>
> --
> View this message in context: http://forum.world.st/Multidimension-array-tp4797285.html
> Sent from the VisualWorks mailing list archive at Nabble.com.
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Multidimension array

lhhuong
Thank Reinier van Oosten  so much. I see, I not only declare 2D array for dijkstra but also reuse for more others. I have found a way to declare matrix as easy as Java.
Now, I found it. :)
http://stackoverflow.com/questions/17130196/how-to-make-a-matrix-class-in-smalltalk-visual-works
Reply | Threaded
Open this post in threaded view
|

Re: Multidimension array

Mark Pirogovsky-3
In reply to this post by lhhuong
Two things come to mind:

1.  You can try the simplest implementation of matrix giving you rows
and  columns:
class   TwoDList -- a two-dimensional list, representing rows and
columns in a table.

it gives you access to columns rows, individual cells, etc.

Create:    TwoDList columns: 20  rows: 20

2. Look up the book and it's supplemental code
"Object-Oriented Implementation
of Numerical Methods"
by Didier H. Besset

There you can find implementation for Matrix and such.

Download it from :

http://sourceforge.net/projects/dhbnumerics

Hope this helps.

--Mark Pirogovsky

lhhuong wrote:

> Hi everybody, i am a newbie in smalltalk, I want to create dijkstra algorithm
> in smalltalk so I need to declare an 2D array. But I don't know how to
> declare 2D array.
> What should I do? Thanks Advanced
>
>
>
> --
> View this message in context: http://forum.world.st/Multidimension-array-tp4797285.html
> Sent from the VisualWorks mailing list archive at Nabble.com.
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
> ____________________________________________________________
> Protect what matters
> Floods can happen anywhere. Learn your risk and find an agent today.
> http://thirdpartyoffers.netzero.net/TGL3265/54a2b26e1455a326d229amp01duc
>
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Multidimension array

skrish
In reply to this post by lhhuong

You remind me of my Masters project in UIUC..!!.. did that dijkstra algorithm for a Pathfinder project way back in time..!!

On Mon, Dec 29, 2014 at 10:28 PM, lhhuong <[hidden email]> wrote:
Thank Reinier van Oosten  so much. I see, I not only declare 2D array for
dijkstra but also reuse for more others. I have found a way to declare
matrix as easy as Java.
Now, I found it. :)
http://stackoverflow.com/questions/17130196/how-to-make-a-matrix-class-in-smalltalk-visual-works



--
View this message in context: http://forum.world.st/Multidimension-array-tp4797285p4797307.html
Sent from the VisualWorks mailing list archive at Nabble.com.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Multidimension array

lhhuong
In reply to this post by Mark Pirogovsky-3
It's very helpful, but I think I will use the first way, thank Mark Pirogovsky so much.