Nested Intervals

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

Nested Intervals

Peter Stewart-2

            Thanks Bert. You did not misunderstand my question. I’m very new to squeak and

 find it a lot of fun. I’m having trouble with syntax and I haven’t found examples that help me.

In this method, ‘numerators’, ‘determinant’ is a Matrix. I want this method, ‘numerators’, to make three matrices from ‘determinant’,

replacing successive columns (k) with the elements in an OrderedCollection (‘constants’) Then add these

matrices to an OrderedCollection (‘numerators’) and return that OrderedCollection.

 

When I inspect the ‘numerators’ returned, it contains a single Matrix, each column of which is filled with the replacement

column. I tried the Matrix class instance method called “column at: put:”. It put the new column in the wrong place,

spread across two columns, and left all the other elements ‘nil’

I’d appreciate any help on this. Thanks

 

The instance variables are all assigned values in the ‘initialize’ method.

 

Object subclass: #Structure

            instanceVariableNames: 'determinant constants data denominator numerators size' 

            classVariableNames: ''

            poolDictionaries: ''

            category: 'Sim-Model'

 

numerators

 

            | tempMatrix  |

           

            "determinant is a Matrix. constants is an OrderedCollection."

           

            numerators := OrderedCollection new.

            tempMatrix := determinant.

 

            (1 to: size) do: [ :k |

                        (1 to: size) do: [ :row |

                                    (1 to: size) do: [ :column | (tempMatrix at: row at: k put: (constants at: row))

                                                                          (numerators add: tempMatrix)

                                                ]

                                    ]

                        ].

            ^ numerators.

 


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners