@@ -272,12 +272,12 @@ \section{Vectors and matrices}
272272represented in equation \ref {eq:matrixcomp } is symmetric, we have
273273$ {\bf D}={\bf C}^{\mathop {\rm T}}$ .
274274
275- \subsection {Vector and matrix --- Smalltalk implementation }
275+ \subsection {Vector and matrix implementation }
276276\label {sec:slinearalgebra } \marginpar {Figure
277277\ref {fig:linearalgebraclasses } with the box {\bf Vector} and {\bf
278278Matrix} grayed.} Listings \ref {ls:vector } and \ref {ls:matrix } show
279- respectively the implementation of vectors and matrices as
280- Smalltalk classes. A special implementation for symmetric matrices
279+ respectively the implementation of vectors and matrices.
280+ A special implementation for symmetric matrices
281281is shown in listing \ref {ls:symmatrix }.
282282
283283The public interface is designed as to map itself as close as
@@ -321,7 +321,7 @@ \subsection{Vector and matrix --- Smalltalk implementation}
321321The next assignment redefines the vector $ {\bf v}$ as the product
322322of the matrix $ {\bf A}$ with the vector $ {\bf u}$ . It is now a
3233232-dimensional vector. Here again the correspondence between the
324- Smalltalk and the mathematical expression is direct.
324+ Pharo and the mathematical expression is direct.
325325
326326The last two lines compute the vector $ {\bf w}$ as the transpose
327327product with the matrix $ {\bf a}$ . The result of both line is the
@@ -342,8 +342,8 @@ \subsection{Vector and matrix --- Smalltalk implementation}
342342as an exercise to the reader.
343343
344344\rubrique {Implementation} A vector is akin to an instance of the
345- Smalltalk class {\tt Array}, for which mathematical operations
346- have been defined. Thus, a vector in Smalltalk can be implemented
345+ Pharo class {\tt Array}, for which mathematical operations
346+ have been defined. Thus, a vector in Pharo can be implemented
347347directly as a subclass of the class {\tt Array}. A matrix is an
348348object whose instance variable is an array of vectors.
349349
@@ -403,7 +403,7 @@ \subsection{Vector and matrix --- Smalltalk implementation}
403403large short-lived objects put a heavy toll of the garbage
404404collector.
405405
406- \begin {listing } Vector class in Smalltalk \label {ls:vector }
406+ \begin {listing } Vector class in Pharo \label {ls:vector }
407407\input {Smalltalk/LinearAlgebra/DhbVector }
408408\end {listing }
409409
@@ -443,10 +443,6 @@ \subsection{Vector and matrix --- Smalltalk implementation}
443443a matrix with itself. This construct is used in several algorithms
444444presented in this book.
445445
446- The reader should compare the Smalltalk code with the Java code.
447- The Java implementation makes the index management explicit. Since
448- there are no iterator methods in Java, there is no other choice.
449-
450446\begin {quotation }
451447\noindent {\bf Note:} The presented matrix implementation is
452448straightforward. Depending on the problem to solve, however, it is
@@ -462,7 +458,7 @@ \subsection{Vector and matrix --- Smalltalk implementation}
462458\ref {sec:doubledisp } and \ref {sec:multipledisp }. The reader who is
463459not familiar with multiple dispatching should trace down a few
464460examples between simple matrices using the debugger.
465- \begin {listing } Matrix classes in Smalltalk \label {ls:matrix }
461+ \begin {listing } Matrix classes \label {ls:matrix }
466462\input {Smalltalk/LinearAlgebra/DhbMatrix }
467463\end {listing }
468464Listing \ref {ls:symmatrix } shows the implementation of the class
@@ -475,7 +471,7 @@ \subsection{Vector and matrix --- Smalltalk implementation}
475471yields a symmetric matrix whereas the same operations between a
476472symmetric matrix and a normal matrix yield a normal matrix.
477473Product requires quadruple dispatching.
478- \begin {listing } Symmetric matrix classes in Smalltalk \label {ls:symmatrix }
474+ \begin {listing } Symmetric matrix classes \label {ls:symmatrix }
479475\input {Smalltalk/LinearAlgebra/DhbSymmetricMatrix }
480476\end {listing }
481477
@@ -690,7 +686,7 @@ \subsection{Linear equations --- General implementation}
690686The class implementing Gaussian elimination has the following
691687instance variables:
692688\begin {description }
693- \item [\tt rows] an array or a vector whose elements contain the rows of the
689+ \item [\texttt { rows } ] an array or a vector whose elements contain the rows of the
694690 matrix $ {\bf S}$ .
695691 \item [\tt solutions] an array whose elements contain the solutions of the
696692 system corresponding to each constant vector.
@@ -708,18 +704,14 @@ \subsection{Linear equations --- General implementation}
708704computed, backward substitution is performed and the result is
709705stored in the solution array.
710706
711- \subsection {Linear equations --- Smalltalk implementation }
712- Listing \ref {ls:lineqs } shows the class {\tt
713- DhbLinearEquationSystem} implementing Gaussian elimination in
714- Smalltalk.
707+ \subsection {Linear equation implementation }
708+ Listing \ref {ls:lineqs } shows the class {\tt DhbLinearEquationSystem} implementing Gaussian elimination.
715709
716- To solve the system of equations \ref {eq:lineqex } using Gaussian
717- elimination, one needs to write to evaluate the following
718- expression:
710+ To solve the system of equations \ref {eq:lineqex } using Gaussian elimination, one needs to write the following expression:
719711\begin {codeExample }
720712\begin {verbatim }
721713
722- ( DhbLinearEquationSystem equations: #( (3 2 4)
714+ (DhbLinearEquationSystem equations: #( (3 2 4)
723715 (2 -5 -1)
724716 (1 -2 2))
725717 constant: #(16 6 10)
@@ -750,8 +742,8 @@ \subsection{Linear equations --- Smalltalk implementation}
750742vectors are supplied in an array columns by columns. Similarly,
751743the two solutions must be fetched one after the other.
752744
753- The class {\tt DhbLinearEquationSystem} The class method {\tt
754- equations:constants:} allows to create a new instance for a given
745+ The class {\tt DhbLinearEquationSystem}. The class method {\tt
746+ equations:constants:} allows one to create a new instance for a given
755747matrix and a series of constant vectors.
756748
757749The method {\tt solutionAt:} returns the solution for a given
@@ -779,7 +771,7 @@ \subsection{Linear equations --- Smalltalk implementation}
779771attempting Gaussian elimination a second time. Then, the value
780772{\tt nil} is returned to represent the non-existent solution.
781773
782- \begin {listing } Smalltalk implementation of a system of linear equations
774+ \begin {listing } Implementation of a system of linear equations
783775\label {ls:lineqs }
784776\input {Smalltalk/LinearAlgebra/DhbLinearEquationSystem }
785777\end {listing }
@@ -978,9 +970,9 @@ \subsection{LUP decomposition --- General implementation}
978970attempted. Then, the methods implementing the forward and backward
979971substitution algorithms are called in succession.
980972
981- \subsection {LUP decomposition --- Smalltalk implementation }
973+ \subsection {LUP decomposition }
982974Listing \ref {ls:lup } shows the methods of the class {\tt
983- DhbLUPDecomposition} implementing LUP decomposition in Smalltalk .
975+ DhbLUPDecomposition} implementing LUP decomposition.
984976
985977To solve the system of equations \ref {eq:lineqex } using LUP
986978decomposition, one needs to write to evaluate the following
@@ -1015,17 +1007,12 @@ \subsection{LUP decomposition --- Smalltalk implementation}
10151007backward substitutions. When the second solution is fetched, only
10161008forward and backward substitutions are performed.
10171009
1018- The default creation class method {\tt new} has been overloaded to
1019- prevent creating an object without initialized instance variables.
10201010The proper creation class method, {\tt equations:}, takes an array
10211011of arrays, the components of the matrix $ {\bf A}$ . When a new
10221012instance is initialized the supplied coefficients are copied into
10231013the instance variable {\tt rows} and the parity of the permutation
10241014is set to one. Copying the coefficients is necessary since the
1025- storage is reused during the decomposition steps. In addition,
1026- some Smalltalk protect constants such as the one used in the code
1027- examples above. In this later case, copying is necessary to
1028- prevent a read-only exception.
1015+ storage is reused during the decomposition steps.
10291016
10301017A second creation method {\tt direct:} allows the creation of an
10311018instance using the supplied system's coefficients directly. The
@@ -1042,7 +1029,7 @@ \subsection{LUP decomposition --- Smalltalk implementation}
10421029integer 0 to flag the singular case. Then, any subsequent calls to
10431030the method {\tt solve:} returns {\tt nil}.
10441031
1045- \begin {listing } Smalltalk implementation of the LUP decomposition
1032+ \begin {listing } Implementation of the LUP decomposition
10461033\label {ls:lup }
10471034\input {Smalltalk/LinearAlgebra/DhbLUPDecomposition }
10481035\end {listing }
@@ -1103,12 +1090,12 @@ \subsection{Computing the determinant of matrix --- General implementation}
11031090product by the parity of the permutation to obtain the final
11041091result.
11051092
1106- \subsection {Computing the determinant of matrix --- Smalltalk implementation }
1093+ \subsection {Computing the determinant of matrix implementation }
11071094Listing \ref {ls:determinant } shows the methods of classes {\tt
11081095DhbMatrix} and {\tt DhbLUPDecomposition} needed to compute a
11091096matrix determinant.
11101097
1111- \begin {listing } Smalltalk methods to compute a matrix determinant \label {ls:determinant }
1098+ \begin {listing } Methods to compute a matrix determinant \label {ls:determinant }
11121099\input {Smalltalk/LinearAlgebra/DhbMatrix(DhbMatrixDeterminant) }
11131100\input {Smalltalk/LinearAlgebra/DhbLUPDecomposition(DhbMatrixDeterminant) }
11141101\end {listing }
@@ -1276,9 +1263,9 @@ \section{Matrix inversion}
12761263however. this technique is plagued with rounding errors and should
12771264be used with caution (\cf section \ref {sec:matrixrounding }).
12781265
1279- \subsection {Matrix inversion --- Smalltalk implementation }
1266+ \subsection {Matrix inversion implementation }
12801267Listing \ref {ls:inversion } shows the complete implementation in
1281- Smalltalk . It contains additional methods for the classes {\tt
1268+ Pharo . It contains additional methods for the classes {\tt
12821269DhbMatrix} and {\tt DhbSymmetricMatrix}.
12831270
12841271For symmetric matrices the method {\tt inverse} first tests
@@ -1301,7 +1288,7 @@ \subsection{Matrix inversion --- Smalltalk implementation}
13011288matrix produces an arithmetic error which must be handled by the
13021289calling method.
13031290
1304- \begin {listing } Smalltalk implementation of matrix inversion \label {ls:inversion }
1291+ \begin {listing } Implementation of matrix inversion \label {ls:inversion }
13051292\input {Smalltalk/LinearAlgebra/DhbSymmetricMatrix(DhbMatrixInversion) }
13061293\input {Smalltalk/LinearAlgebra/DhbMatrix(DhbMatrixInversion) }
13071294\end {listing }
@@ -1496,8 +1483,7 @@ \subsection{Finding the largest eigenvalue --- General
14961483computing a new matrix as described in equation
14971484\ref {eq:eigennext }.
14981485
1499- \subsection {Finding the largest eigenvalue --- Smalltalk
1500- implementation } Listing \ref {ls:eigenlarge } shows the Smalltalk
1486+ \subsection {Finding the largest eigenvalue implementation } Listing \ref {ls:eigenlarge } shows the Pharo
15011487implementation of the class {\tt DhbLargestEigenValueFinder},
15021488subclass of the class {\tt DhbIterativeProcess}.
15031489
@@ -1528,7 +1514,7 @@ \subsection{Finding the largest eigenvalue --- Smalltalk
15281514first one. The next largest eigenvalue and its eigenvector are
15291515retrieved from this new instance exactly as before.
15301516
1531- \begin {listing } Smalltalk implementation of the search for the largest eigenvalue
1517+ \begin {listing } Implementation of the search for the largest eigenvalue
15321518\label {ls:eigenlarge }
15331519\input {Smalltalk/LinearAlgebra/DhbLargestEigenValueFinder }
15341520\end {listing }
@@ -1794,8 +1780,8 @@ \subsection{Jacobi's algorithm --- General implementation}
17941780containing the eigenvectors. Extracting these results is language
17951781dependent.
17961782
1797- \subsection {Jacobi's algorithm --- Smalltalk implementation }
1798- Listing \ref {ls:jacobi } shows the Smalltalk implementation of
1783+ \subsection {Jacobi's algorithm implementation }
1784+ Listing \ref {ls:jacobi } shows the implementation of
17991785Jacobi's algorithm.
18001786
18011787The following code example shows how to use the class to find the
@@ -1840,7 +1826,7 @@ \subsection{Jacobi's algorithm --- Smalltalk implementation}
18401826beginning of this section shows how to obtain the eigenvectors
18411827from the matrix.
18421828
1843- \begin {listing } Smalltalk implementation of Jacobi's algorithm \label {ls:jacobi }
1829+ \begin {listing } Implementation of Jacobi's algorithm \label {ls:jacobi }
18441830\input {Smalltalk/LinearAlgebra/DhbJacobiTransformation }
18451831\end {listing }
18461832
0 commit comments