         n-cols (count (first data))
         start-vector (or start-vector (repeatv n-cols 1))
         ; XXX - this add extra cols to the start vector if we have new comments... should test
-        start-vector (into [] (concat start-vector (repeatv (- n-cols (count start-vector)) 1)))]
+        start-vector (matrix
+                       (concat start-vector
+                               (repeatv (- n-cols (dimension-count start-vector 0)) 1)))]
     (loop [iters iters start-vector start-vector last-eigval 0]
       (let [product-vector (xtxr data start-vector)
-            eigval (norm product-vector)
-            normed (ic.core/div product-vector eigval)]
+            eigval (length product-vector)
+            normed (normalise product-vector)]
         (if (or (= iters 0) (= eigval last-eigval))
           normed
           (recur (dec iters) normed eigval))))))

  power-iteration"
  (let [cntrd-data (centered-data data)
        start-vectors (or start-vectors [])
        data-dim (apply min (ic.core/dim cntrd-data))]
    (loop [data' cntrd-data n-comps' (min n-comps data-dim) pcs [] start-vectors start-vectors]
      (let [pc (power-iteration data' iters (first start-vectors)) ; may eventually want to return eigenvals...
            pcs (conj pcs pc)]

(defn pca-project [data pcs]
  "Apply the principal component projection specified by pcs to the data"
  ; Here we map each row of data to it's projection
  (mmul data (transpose pcs)))


