incr-set prlevel 1
if #0=3 START
incr-set prlevel -1
;;; Usage:
;;;     <pts_linear I M J
;;;
;;; Find a linear subsystem of the polynomials I vanishing at the
;;; points which are the rows of M.
incr-set prlevel 1
jump END
;;; Parameters:
;;; I = ideal of polynomials all of the same degree.
;;; M = m by n matrix with constant entries, such that the i th row
;;;	represents a point in P^{n-1}, where n = number of variables of the
;;;	base ring.
;;;
;;; Output values:
;;; J = ideal consisting of the sub-vector space of I vanishing at every
;;;	point in M.
;;;
; last modified 5/23/89 MES
START:
     
;; the following is really
;;
;; result := (c by 0) matrix, where c = ncolumns(I)
;; for i := nrows(M) downto 1 do
;;    point := i th row of M
;;    evpoint := set i th variable to i th element of point, of I.
;;    add this as a column to "result".
;; end for
;;
;; ker := kernel of (result)
;; finally, J := I.ker
     
ncols #1 @c
mat @result
    @c
    0
     
nrows #2 @i
doloop:
    if @i dopoint endpoints
dopoint:
    int @i @i-1
     
    submat #2 @point
	@i+1
	;; entire row
     
    ev @point #1 @evpoint
     
    transpose @evpoint @evpoint
    concat @result @evpoint
     
    jump doloop
     
endpoints:
     
transpose @result @result
res @result @ker 2
mult #1 @ker.2 #3
     
kill @c @result @i @point @evpoint @ker
END:
incr-set prlevel -1
     
$;;;;;;;; EXAMPLE SECTION ;;;;;;;;;;;;;;;;;;;;;;;;;
<ring 3 a-c r
power r 3 r3
mat m
    3
    6
  (1) ? 1
	0
	0
  (2) ? 0
	1
	0
  (3) ? 0
	0
	1
  (4) ? 1
	1
	1
  (5) ? 2
	3
	7
  (6) ? -2
	5
	1
     
transpose m m
type m
<pts_linear r3 m n
type n
listvars
     
;; TEST 2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; let's blow up small number's of points on P2.
     
<ring 3 abc r
power r 2 r2
power r 3 r3
     
mat m
   3
   2
  (1) ? 1
	0
	0
  (2) ? 0
	1
	0
transpose m m
     
<pts_linear r2 m n2
type n2
<pts_linear r3 m n3
type n3
