anchor.diff:    (assert (> input-dimension 0))
     (%make-sparse-perceptron :input-dimension input-dimension
                              :weight (make-dvec input-dimension 0d0)
  -                           :bias 0d0))
  +                           :bias 0d0
  +                           :tmp-float (make-dvec 1 0d0)))
   
   (define-learner sparse-perceptron (learner input training-label)
  -  (sf! input (sparse-perceptron-weight learner) (sparse-perceptron-bias learner) *result*)
  -  (when (<= (* training-label (refr)) 0d0)
  -    (let ((bias (sparse-perceptron-bias learner)))
  -      (declare (type double-float bias))
  -      (if (> training-label 0d0)
  -        (progn
  -          (ds-v+ (sparse-perceptron-weight learner) input (sparse-perceptron-weight learner))
  -          (setf (sparse-perceptron-bias learner) (+ bias 1d0)))
  -        (progn
  -          (ds-v- (sparse-perceptron-weight learner) input (sparse-perceptron-weight learner))
  -          (setf (sparse-perceptron-bias learner) (- bias 1d0)))))))
  +  (let ((tmp-float (sparse-perceptron-tmp-float learner)))
  +    (declare (type (simple-array double-float 1) tmp-float))
  +    (sf! input (sparse-perceptron-weight learner) (sparse-perceptron-bias learner) tmp-float)
  +    (when (<= (* training-label (aref tmp-float 0)) 0d0)
  +      (let ((bias (sparse-perceptron-bias learner)))
  +        (declare (type double-float bias))
  +        (if (> training-label 0d0)
  +          (progn
  +            (ds-v+ (sparse-perceptron-weight learner) input (sparse-perceptron-weight learner))
  +            (setf (sparse-perceptron-bias learner) (+ bias 1d0)))
  +          (progn
  +            (ds-v- (sparse-perceptron-weight learner) input (sparse-perceptron-weight learner))
  +            (setf (sparse-perceptron-bias learner) (- bias 1d0))))))))
   
   ;;; Sparse AROW
   
   (defstruct (sparse-arow (:constructor  %make-sparse-arow)
                           (:print-object %print-sparse-arow))
     input-dimension weight bias
  -  gamma sigma sigma0 tmp-vec1 tmp-vec2)
  +  gamma sigma sigma0 tmp-vec1 tmp-vec2 tmp-float)
   
   (defun %print-sparse-arow (obj stream)
     (format stream "#S(SPARSE-AROW~%~T:INPUT-DIMENSION ~A~%~T:WEIGHT ~A ...~%~T:BIAS ~A~%~T:GAMMA ~A~%~T:SIGMA ~A ...~%~T:SIGMA0 ~A)"
  
positive.code:   eta C
    ;; Internal parameters
    phi psi zeta sigma sigma0
    tmp-vec1 tmp-vec2)
  
  (defun %print-sparse-scw (obj stream)
    (format stream "#S(SPARSE-SCW~%~T:INPUT-DIMENSION ~A~%~T:WEIGHT ~A ...~%~T:BIAS ~A~%~T:ETA ~A~%~T:C ~A~%~T:PHI ~A~%~T:PSI ~A~%~T:ZETA ~A~%~T:SIGMA ~A ...~%~T:SIGMA0 ~A)"
  
negative.code: 
  (defstruct (perceptron (:constructor %make-perceptron)
                         (:print-object %print-perceptron))
    input-dimension weight bias tmp-float)
  
  (defun %print-perceptron (obj stream)
    (format stream "#S(PERCEPTRON~%~T:INPUT-DIMENSION ~A~%~T:WEIGHT ~A ...~%~T:BIAS ~A)"
  