better implementation of zero-matrix
parent
44850e6533
commit
989cb7d5df
|
@ -1,12 +1,12 @@
|
||||||
! Copyright (C) 2005, 2009 Slava Pestov.
|
! Copyright (C) 2005, 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! 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 ;
|
sequences sequences.private accessors columns ;
|
||||||
IN: math.matrices
|
IN: math.matrices
|
||||||
|
|
||||||
! Matrices
|
! Matrices
|
||||||
: zero-matrix ( m n -- matrix )
|
: zero-matrix ( m n -- matrix )
|
||||||
[ nip 0 <array> ] curry map ;
|
'[ _ 0 <array> ] replicate ;
|
||||||
|
|
||||||
: identity-matrix ( n -- matrix )
|
: identity-matrix ( n -- matrix )
|
||||||
#! Make a nxn identity matrix.
|
#! Make a nxn identity matrix.
|
||||||
|
|
Loading…
Reference in New Issue