Update of /cvsroot/q-lang/qcalc
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28084
Modified Files:
calclib.q
Log Message:
bug fixes, extra index argument for matrix, rowvect, colvect
Index: calclib.q
===================================================================
RCS file: /cvsroot/q-lang/qcalc/calclib.q,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** calclib.q 1 Nov 2007 14:51:05 -0000 1.3
--- calclib.q 4 Nov 2007 23:45:42 -0000 1.4
***************
*** 21,25 ****
The index function returns both indices as a pair (I,J) where I and J are
the zero-based row and column indices, respectively. Thus A1 will be
! returned as (0,0), A2 as (1,0), B1 as (0,1), etc. */
public index, row, column;
--- 21,26 ----
The index function returns both indices as a pair (I,J) where I and J are
the zero-based row and column indices, respectively. Thus A1 will be
! returned as (0,0), A2 as (1,0), B1 as (0,1), etc. The row and column
! functions return only the row and column number, respectively. */
public index, row, column;
***************
*** 46,54 ****
convenience functions to create matrices with just one row or column for a
given list of values, respectively. In any case the matrix or vector is
! inserted into the table right below the cell which contains the matrix
! call, i.e., starting at (row+1,column), so you should make sure that you do
! not override any important data there. */
! public matrix Xs, rowvect Xs, colvect Xs;
/* Implementation. */
--- 47,53 ----
convenience functions to create matrices with just one row or column for a
given list of values, respectively. In any case the matrix or vector is
! inserted into the table starting at the given index KEY. */
! public matrix KEY Xs, rowvect KEY Xs, colvect KEY Xs;
/* Implementation. */
***************
*** 61,73 ****
= printf "\f+++ Message: %s\n" (str S);
! setval KEY X = printf "\f+++ Update: %s %s\n" (str KEY,str X);
! matrix Xs:List = dowith setval Ks (cat Xs)
! where (I0,J0) = index,
! Ks = [(I0+I+1,J0+J) : I in [0..N-1], J in [0..M-1]]
if all islist Xs and then all ((=M).(#)) Xs
! where Ys:List = hd Xs, N = #Xs, M = #Ys;
! rowvect Xs:List = matrix [Xs];
! colvect Xs:List = matrix $ map (push []) Xs;
--- 60,77 ----
= printf "\f+++ Message: %s\n" (str S);
! setval (I:Int,J:Int) X
! = printf "\f+++ Update: %s %s\n" (str (I,J),str X)
! if (I>=0) and then (J>=0);
! matrix (I0:Int,J0:Int) Xs:List
! = dowith setval Ks (cat Xs)
! where Ks = [(I0+I,J0+J) : I in [0..N-1], J in [0..M-1]]
if all islist Xs and then all ((=M).(#)) Xs
! where Ys:List = hd Xs, N = #Xs, M = #Ys
! if (I0>=0) and then (J0>=0);
! rowvect (I0:Int,J0:Int) Xs:List
! = matrix (I0,J0) [Xs];
! colvect (I0:Int,J0:Int) Xs:List
! = matrix (I0,J0) $ map (push []) Xs;
|