Forums: Forum of Decimal BASIC (Thread #41831)

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

! Driver code.

DIM A(10,10), B(10,10)

MAT READ A(rowa,cola)
DATA 1,2,3,4,1,0

MAT READ B(rowb,colb)
DATA 0,5,2,6,7,3

CALL Kronecker( A , B )

! This code is contributed by Tom Lake.

END

Reply to #84310×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

Re: PRINT USING Anomaly in Decimal BASIC Compiler and ParactBASIC (2020-02-18 20:57 by SHIRAISHI Kazuo #84311)

Thanks for the report.

The failure happens on sendig text into SynEdit control.
Solution shall be seeked from now on.

Reply to #84310

Reply to #84311×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login