anchor.diff:  (defmethod .+ (A B)
     (error ".+ Not implelented for types ~a and ~a" (type-of A) (type-of B)))
   
  +(defgeneric .* (A B))
  +
   (defmethod .* ((A number) (B number))
  +  (declare (optimize speed)
  +	   (type double-float A B))
     (* A B))
   
   (defmethod .* ((A simple-array) (B simple-array))
  -  (with-result (result (list (array-dimension A 0) (array-dimension B 1)))
  -    (do-matrix (result (i j))
  -      (setf (aref result i j) (dot (mref a i t) (mref b t j))))))
  +  (declare (optimize speed)
  +	   (type (simple-array double-float (* *)) A B))
  +  (do-matrix-with-result (result (i j) result (list (array-dimension A 0) (array-dimension B 1)))
  +    (setf (aref result i j) (dot (mref a i t) (mref b t j)))))
   
   (defmethod .* ((A array) (B array))
  -  (with-result (result (list (array-dimension A 0) (array-dimension B 1)))
  -    (do-matrix (result (i j))
  -      (setf (aref result i j) (dot (mref a i t) (mref b t j))))))
  +  (declare (optimize speed)
  +	   (type (vector double-float) A)
  +	   (type (array double-float (* *)) B))
  +  (do-matrix-with-result (result (i j) result (list (array-dimension A 0) (array-dimension B 1)))
  +    (setf (aref result i j) (dot (mref a i t) (mref b t j)))))
   
   (defmethod .* ((A vector) (B vector))
  -  (with-result (result (list (length A) (length B)))
  -    (do-matrix (result (i j))
  -      (setf (aref result i j) (* (aref A i) (aref B j))))))
  +  (declare (optimize speed)
  +	   (type (vector double-float *) A B))
  +  (do-matrix-with-result (result (i j) result (list (length A) (length B)))
  +    (setf (aref result i j) (* (aref A i) (aref B j)))))
   
   (defmethod .* ((A simple-array) (B vector))
  +    (declare (optimize speed)
  +	   (type (simple-array double-float (* *)) A)
  +	   (type (vector double-float) B))
       (with-result (result (array-dimensions B))
         (loop for i from 0 below (length B)
   	 do (setf (aref result i) (.* B (mref A i t))))))
   
   (defmethod .* ((A vector) (B simple-array))
  +  (declare (optimize speed)
  +	   (type (vector double-float) A)
  +	   (type (simple-array double-float (* *)) B))
     (with-result (result (list (length A)))
       (loop for i from 0 below (1- (length A))
          do (setf (aref result i) (.* A (mref B i t))))))
  
positive.code: 	 sum (aref M i i))))
  
  (defun transpose (matrix)
    (let ((result (make-array (nreverse (array-dimensions matrix)))))
      (do-matrix (result (i j))
        (setf (aref result i j) (aref matrix j i)))
      result))
  
  (defgeneric .+ (A B)
    (:documentation "Matrix addition function, will also add single numbers elementwise to the matrix."))
  
negative.code: (defgeneric ./ (A B))
  
  (defmethod ./ ((A simple-array) (B number))
    (do-matrix-with-result (result subs result (array-dimensions A))
      (setf (apply #'aref result subs) (/ (apply #'aref A subs) B))))
  
  (defmethod ./ ((A vector) (B number))
    (do-matrix-with-result (A (i) result (list (length A)))
      (setf (aref result i) (/ (aref A i) B))))
  
  (defmethod ./ ((A number) (B number))
    (/ A B))
  