Applying matrix divide in APL and J

  • Authors:
  • Norman Thomson

  • Affiliations:
  • Mail Point 17H, IBM UK Ltd., P.O. Box 30, Greenock, Scotland PA16 0AH

  • Venue:
  • APL '94 Proceedings of the international conference on APL : the language and its applications: the language and its applications
  • Year:
  • 1994

Quantified Score

Hi-index 0.00

Visualization

Abstract

This paper shows two generalisations of the APL2 domino function. Domino has two roles, first the solution of non-degenerate systems of linear equations, and secondly the estimation of linear least squares fits. There is an inherent duality between these, since the first consists of finding a series of x-values to fit a set of fixed c's (coefficients), whereas the second consists of finding a series of c's to fit a set of fixed x- and y-values. This duality is exploited in extending both roles of domino using Newton-Raphson iteration to find roots of non-linear systems on the one hand, and to perform non-linear curve fitting on the other. The nature of the problem is such that it is natural to write APL2 solutions using operators rather than functions, and in each case a corresponding J solution is given. Further simple idioms involving domino give the consequent fitted values and Analysis of Variance calculations. The paper concludes with a compact tool-kit showing in parallel columns both the APL2 and J codes needed to achieve these extensions. The brevity of the J code speaks for itself.