: matrix-map ( matrix quot: ( ... elt -- ... elt' ) -- matrix' )
'[ _ map ] map ; inline
+: matrix-map-index ( matrix quot: ( ... elt i j -- ... elt' ) -- matrix' )
+ '[ [ swap @ ] curry map-index ] map-index ; inline
+
: column-map ( matrix quot: ( ... col -- ... col' ) -- matrix' )
[ transpose ] dip map transpose ; inline
] if ;
: normalize-matrix ( m -- m' )
- dup zero-matrix? [ ] [
- dup mabs mmax m/n
- ] if ;
+ dup zero-matrix? [ ] [
+ dup mabs mmax m/n
+ ] if ;
! well-defined for square matrices; but works on nonsquare too
: main-diagonal ( matrix -- seq )