public function readFromArray(array $data) {
        $callback = 
        function ($v) {
            if ((!isset($v[0])) || (!isset($v[1]))) {
                throw new \InvalidArgumentException('Mismatch in the number of x and y in the dataset.');
            } else {
                $this->xVector[] = $v[0];
                $this->yVector[] = $v[1];
            }
        };    
        array_walk($data, $callback);
    }