PRINT USING Anomaly in Decimal BASIC Compiler and ParactBASIC (2020-02-17 05:00 by toml_12953 #84310)
I'm using the latest Decimal BASIC Compiler and Paract BASIC as well as Lazarus Pascal 2.06. Below is code to compute a Kronecker Product of two matrices. In Decimal BASIC interpreter 7.8.5.4, the result prints out fine. The last column has a problem in ParactBASIC.
The 4 in the upper right is out of line with the rest of the column. This forum won't allow me to show the proper output but if you run the program you can see the problem for yourself.
! BASIC code to find the Kronecker Product of two
! matrices and stores it as matrix C
! rowa and cola are no of rows and columns
! of matrix A
! rowb and colb are no of rows and columns
! of matrix B
LET cola = 2
LET rowa = 3
LET colb = 3
LET rowb = 2
! Sub to compute the Kronecker Product
! of two matrices
SUB Kronecker( A(,) , B(,) )
DIM C(100,100)
MAT redim C(rowa*rowb,cola*colb)
! i loops till rowa
FOR i=1 TO rowa
! k loops till rowb
FOR k=1 TO rowb
! j loops till cola
FOR j=1 TO cola
! l loops till colb
FOR l=1 TO colb
! Each element of matrix A is
! multiplied by whole Matrix B
! resp and stored as Matrix C
LET C(i + l,j + k) = A(i,j) * B(k,l)
PRINT USING "### ": C(i + l,j + k);
NEXT l
NEXT j
PRINT
NEXT k
NEXT i
END SUB