Created
April 27, 2015 02:25
-
-
Save kouddy/307619abdc2d8b82e237 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (dot-product v w) | |
(accumulate + 0 (map * v w))) | |
(define (matrix-*-vector m v) | |
(map (lambda (row) (dot-product row v)) | |
m)) | |
(define (transpose mat) | |
(accumulate-n cons null mat)) | |
(define (matrix-*-matrix m n) | |
(let ((cols (transpose n))) | |
(map (lambda (row) | |
(map (lambda (col) | |
(dot-product row col)) | |
cols)) | |
m))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment