better implementation of zero-matrix
parent
44850e6533
commit
989cb7d5df
|
@ -1,12 +1,12 @@
|
|||
! Copyright (C) 2005, 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: arrays kernel math math.order math.vectors
|
||||
USING: arrays fry kernel math math.order math.vectors
|
||||
sequences sequences.private accessors columns ;
|
||||
IN: math.matrices
|
||||
|
||||
! Matrices
|
||||
: zero-matrix ( m n -- matrix )
|
||||
[ nip 0 <array> ] curry map ;
|
||||
'[ _ 0 <array> ] replicate ;
|
||||
|
||||
: identity-matrix ( n -- matrix )
|
||||
#! Make a nxn identity matrix.
|
||||
|
@ -60,4 +60,4 @@ PRIVATE>
|
|||
gram-schmidt [ normalize ] map ;
|
||||
|
||||
: cross-zip ( seq1 seq2 -- seq1xseq2 )
|
||||
[ [ 2array ] with map ] curry map ;
|
||||
[ [ 2array ] with map ] curry map ;
|
||||
|
|
Loading…
Reference in New Issue