      * Returns the similarity results or -1.0 on caught error
      */
     func compute(A: [Double], B: [Double]) -> Double {
+        // look for empty input
+        if A.count == 0 || B.count == 0 {
+            return -1
+        }
+        
         // look for vector size mismatch
         if A.count != B.count {
             if let mode = self.getCurrentMismatchMode() {

    private var currentSimMode = [EMSimilarityMode.Cosine]
    
    /** Set the currentSimMode via push **/
    func pushCurrentSimMode(mode: EMSimilarityMode) {
        self.currentSimMode.append(mode)
    }
    
    /** Pop the currentSimMode via pop if it won't make the stack empty **/
    func popCurrentSimMode() {
        if self.currentSimMode.count > 1 {
            self.currentSimMode.popLast()
        }

    private var currentMismatchMode = [EMVectorSizeMismatchMode.Bail]
    
    /** Set the currentMismatcMode via push **/
    func pushMismatchMode(mode: EMVectorSizeMismatchMode) {
        self.currentMismatchMode.append(mode)
    }
    
    /** Pop the currentMismatchMode via pop if it won't make the stack empty **/
    func popMismatchMode() {
        if self.currentMismatchMode.count > 1 {
            self.currentMismatchMode.popLast()
        }
