New patches: [unrevert anonymous**20070513235818] < > { hunk ./matrix.ss 77 "square matrix" (lambda (m) (= (matrix-rows m) (matrix-cols m))))) - (define-struct matrix - (ptr rows cols) #f) - - (provide matrix? matrix-multiplication-compatible/c matrix-valid-row-index/c + (provide matrix-multiplication-compatible/c matrix-valid-row-index/c matrix-valid-col-index/c matrix-square/c matrix-same-dimensions/c matrix-col-vector-compatible/c matrix-row-vector-compatible/c matrix-ec :matrix hunk ./matrix.ss 81 - _matrix - struct:matrix) + (struct matrix (ptr rows cols)) + _matrix) + + (define-struct matrix + (ptr rows cols) #f) + + (define _matrix* + (make-ctype _pointer matrix-ptr + (lambda (x) + (error '_matrix + "cannot convert C output to _matrix")))) + + (define-fun-syntax _matrix + (syntax-id-rules (i o io) + ((_matrix i) + _matrix*) + ((_matrix o rows cols) + (type: _pointer + pre: (let* ((n (* rows cols)) + (p (malloc n _double 'atomic))) + (memset p 0 n _double) + p) + post: (p => (make-matrix p rows cols)))) + ((_matrix io) + (type: _pointer + bind: m + pre: (m => (matrix-ptr m)) + post: m)) + (_matrix _matrix*))) + + (define ptr->matrix make-matrix) + (provide* (unsafe ptr->matrix)) (provide/contract (rename my-make-matrix make-matrix hunk ./matrix.ss 123 elts (and/c (listof number?) (list/length/c (* i j))) matrix?)) - (matrix-rows (->/c matrix? natural-number/c)) - (matrix-cols (->/c matrix? natural-number/c)) (matrix-ref (->r ((m matrix?) (i (and/c natural-number/c (matrix-valid-row-index/c m))) hunk ./matrix.ss 197 (ptr-set! p _double* k elt)) m)) - (define _matrix* - (make-ctype _pointer matrix-ptr - (lambda (x) - (error '_matrix - "cannot convert C output to _matrix")))) - - (define-fun-syntax _matrix - (syntax-id-rules (i o io) - ((_matrix i) - _matrix*) - ((_matrix o rows cols) - (type: _pointer - pre: (let* ((n (* rows cols)) - (p (malloc n _double 'atomic))) - (memset p 0 n _double) - p) - post: (p => (make-matrix p rows cols)))) - ((_matrix io) - (type: _pointer - bind: m - pre: (m => (matrix-ptr m)) - post: m)) - (_matrix _matrix*))) - (define (matrix-ptr-index m i j) (+ i (* j (matrix-rows m)))) hunk ./matrix.ss 422 (set! wrapping? (>= i+1 rows))) #t ((if wrapping? 0 i+1) - (if wrapping? j+1 j)))))) - - (define ptr->matrix make-matrix) - (provide* (unsafe ptr->matrix)) - (define-unsafer matrix-unsafe!)) + (if wrapping? j+1 j))))))) } Context: [TAG 1.3 Will M. Farr **20070510215400] Patch bundle hash: cf713e492ea4231e4f40b38edc586b79dbd260b3