From 06e9639ea3e214870c8bf5412d7aa6a3cffdb641 Mon Sep 17 00:00:00 2001 From: Vesna Tanko Date: Tue, 27 Aug 2019 13:19:05 +0200 Subject: [PATCH 1/7] Distances: Offload work to a separate thread --- Orange/widgets/unsupervised/owdistances.py | 72 +++++++++++++------ .../unsupervised/tests/test_owdistances.py | 46 +++++++++++- 2 files changed, 96 insertions(+), 22 deletions(-) diff --git a/Orange/widgets/unsupervised/owdistances.py b/Orange/widgets/unsupervised/owdistances.py index 153cd78b56f..b97069b9917 100644 --- a/Orange/widgets/unsupervised/owdistances.py +++ b/Orange/widgets/unsupervised/owdistances.py @@ -6,6 +6,7 @@ import Orange.misc from Orange import distance from Orange.widgets import gui, settings +from Orange.widgets.utils.concurrent import TaskState, ConcurrentWidgetMixin from Orange.widgets.utils.sql import check_sql_input from Orange.widgets.utils.widgetpreview import WidgetPreview from Orange.widgets.widget import OWWidget, Msg, Input, Output @@ -26,7 +27,22 @@ ] -class OWDistances(OWWidget): +class DistanceRunner: + @staticmethod + def run(data: Orange.data.Table, metric: distance, normalized_dist: bool, + axis: int, state: TaskState) -> Orange.misc.DistMatrix: + if data is None: + return None + + state.set_status("Calculating...") + if metric.supports_normalization and normalized_dist: + return metric(data, axis=1 - axis, impute=True, + normalize=True) + else: + return metric(data, axis=1 - axis, impute=True) + + +class OWDistances(OWWidget, ConcurrentWidgetMixin): name = "Distances" description = "Compute a matrix of pairwise distances." icon = "icons/Distance.svg" @@ -65,13 +81,15 @@ class Warning(OWWidget.Warning): imputing_data = Msg("Missing values were imputed") def __init__(self): - super().__init__() + OWWidget.__init__(self) + ConcurrentWidgetMixin.__init__(self) self.data = None - gui.radioButtons(self.controlArea, self, "axis", ["Rows", "Columns"], - box="Distances between", callback=self._invalidate - ) + gui.radioButtons( + self.controlArea, self, "axis", ["Rows", "Columns"], + box="Distances between", callback=self._invalidate + ) box = gui.widgetBox(self.controlArea, "Distance Metric") self.metrics_combo = gui.comboBox( box, self, "metric_idx", @@ -93,6 +111,7 @@ def __init__(self): @Inputs.data @check_sql_input def set_data(self, data): + self.cancel() self.data = data self.refresh_metrics() self.unconditional_commit() @@ -106,8 +125,7 @@ def refresh_metrics(self): def commit(self): # pylint: disable=invalid-sequence-index metric = METRICS[self.metric_idx][1] - dist = self.compute_distances(metric, self.data) - self.Outputs.distances.send(dist) + self.compute_distances(metric, self.data) def compute_distances(self, metric, data): def _check_sparse(): @@ -152,22 +170,34 @@ def _fix_missing(): return True self.clear_messages() - if data is None: - return None - for check in (_check_sparse, - _fix_discrete, _fix_missing, _fix_nonbinary): - if not check(): - return None - try: - if metric.supports_normalization and self.normalized_dist: - return metric(data, axis=1 - self.axis, impute=True, - normalize=True) - else: - return metric(data, axis=1 - self.axis, impute=True) - except ValueError as e: + if data is not None: + for check in (_check_sparse, _fix_discrete, + _fix_missing, _fix_nonbinary): + if not check(): + data = None + break + + self.start(DistanceRunner.run, data, metric, + self.normalized_dist, self.axis) + + def on_partial_result(self, _): + pass + + def on_done(self, result: Orange.misc.DistMatrix): + assert isinstance(result, Orange.misc.DistMatrix) or result is None + self.Outputs.distances.send(result) + + def on_exception(self, e): + if isinstance(e, ValueError): self.Error.distances_value_error(e) - except MemoryError: + elif isinstance(e, MemoryError): self.Error.distances_memory_error() + else: + raise e + + def onDeleteWidget(self): + self.shutdown() + super().onDeleteWidget() def _invalidate(self): self.commit() diff --git a/Orange/widgets/unsupervised/tests/test_owdistances.py b/Orange/widgets/unsupervised/tests/test_owdistances.py index 2362a6bbadc..a4d8280f260 100644 --- a/Orange/widgets/unsupervised/tests/test_owdistances.py +++ b/Orange/widgets/unsupervised/tests/test_owdistances.py @@ -1,15 +1,46 @@ # Test methods with long descriptive names can omit docstrings # pylint: disable=missing-docstring +import unittest from unittest.mock import Mock import numpy as np from Orange.data import Table, Domain from Orange import distance -from Orange.widgets.unsupervised.owdistances import OWDistances, METRICS +from Orange.widgets.unsupervised.owdistances import OWDistances, METRICS, \ + DistanceRunner from Orange.widgets.tests.base import WidgetTest +class TestDistanceRunner(unittest.TestCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.iris = Table("iris")[::5] + + def test_run(self): + for _, metric in METRICS: + # between rows, normalized + dist1 = DistanceRunner.run(self.iris, metric, True, 0, Mock()) + dist2 = metric(self.iris, axis=1, impute=True, normalize=True) + np.testing.assert_array_equal(dist1, dist2) + + # between rows, not normalized + dist1 = DistanceRunner.run(self.iris, metric, False, 0, Mock()) + dist2 = metric(self.iris, axis=1, impute=True, normalize=False) + np.testing.assert_array_equal(dist1, dist2) + + # between columns, normalized + dist1 = DistanceRunner.run(self.iris, metric, True, 1, Mock()) + dist2 = metric(self.iris, axis=0, impute=True, normalize=True) + np.testing.assert_array_equal(dist1, dist2) + + # between columns, not normalized + dist1 = DistanceRunner.run(self.iris, metric, False, 1, Mock()) + dist2 = metric(self.iris, axis=0, impute=True, normalize=False) + np.testing.assert_array_equal(dist1, dist2) + + class TestOWDistances(WidgetTest): @classmethod def setUpClass(cls): @@ -27,6 +58,7 @@ def test_distance_combo(self): for i, (_, metric) in enumerate(METRICS): self.widget.metrics_combo.activated.emit(i) self.widget.metrics_combo.setCurrentIndex(i) + self.wait_until_stop_blocking() self.send_signal(self.widget.Inputs.data, self.iris) if metric.supports_normalization: expected = metric(self.iris, normalize=self.widget.normalized_dist) @@ -42,8 +74,10 @@ def test_error_message(self): data is removed from input""" self.widget.metric_idx = 2 self.send_signal(self.widget.Inputs.data, self.iris) + self.wait_until_stop_blocking() self.assertFalse(self.widget.Error.no_continuous_features.is_shown()) self.send_signal(self.widget.Inputs.data, self.titanic) + self.wait_until_stop_blocking() self.assertTrue(self.widget.Error.no_continuous_features.is_shown()) self.send_signal(self.widget.Inputs.data, None) self.assertFalse(self.widget.Error.no_continuous_features.is_shown()) @@ -53,32 +87,39 @@ def test_jaccard_messages(self): if name == "Jaccard": break self.send_signal(self.widget.Inputs.data, self.iris) + self.wait_until_stop_blocking() self.assertTrue(self.widget.Error.no_binary_features.is_shown()) self.assertFalse(self.widget.Warning.ignoring_nonbinary.is_shown()) self.send_signal(self.widget.Inputs.data, None) + self.wait_until_stop_blocking() self.assertFalse(self.widget.Error.no_binary_features.is_shown()) self.assertFalse(self.widget.Warning.ignoring_nonbinary.is_shown()) self.send_signal(self.widget.Inputs.data, self.titanic) + self.wait_until_stop_blocking() self.assertFalse(self.widget.Error.no_binary_features.is_shown()) self.assertTrue(self.widget.Warning.ignoring_nonbinary.is_shown()) self.send_signal(self.widget.Inputs.data, None) + self.wait_until_stop_blocking() self.assertFalse(self.widget.Error.no_binary_features.is_shown()) self.assertFalse(self.widget.Warning.ignoring_nonbinary.is_shown()) self.send_signal(self.widget.Inputs.data, self.titanic) + self.wait_until_stop_blocking() self.assertFalse(self.widget.Error.no_binary_features.is_shown()) self.assertTrue(self.widget.Warning.ignoring_nonbinary.is_shown()) dom = self.titanic.domain dom = Domain(dom.attributes[1:], dom.class_var) self.send_signal(self.widget.Inputs.data, self.titanic.transform(dom)) + self.wait_until_stop_blocking() self.assertFalse(self.widget.Error.no_binary_features.is_shown()) self.assertFalse(self.widget.Warning.ignoring_nonbinary.is_shown()) self.send_signal(self.widget.Inputs.data, Table("heart_disease")) + self.wait_until_stop_blocking() self.assertFalse(self.widget.Error.no_binary_features.is_shown()) self.assertFalse(self.widget.Warning.ignoring_discrete.is_shown()) @@ -93,10 +134,12 @@ def test_too_big_array(self): mock = Mock(side_effect=ValueError) self.widget.compute_distances(mock, self.iris) + self.wait_until_stop_blocking() self.assertTrue(self.widget.Error.distances_value_error.is_shown()) mock = Mock(side_effect=MemoryError) self.widget.compute_distances(mock, self.iris) + self.wait_until_stop_blocking() self.assertEqual(len(self.widget.Error.active), 1) self.assertTrue(self.widget.Error.distances_memory_error.is_shown()) @@ -110,5 +153,6 @@ def test_negative_values_bhattacharyya(self): if metric == distance.Bhattacharyya: break self.send_signal(self.widget.Inputs.data, self.iris) + self.wait_until_stop_blocking() self.assertTrue(self.widget.Error.distances_value_error.is_shown()) self.iris.X[0, 0] *= -1 From 64285043a7dad50b9fc21a3c755ae42c3cfa411e Mon Sep 17 00:00:00 2001 From: Vesna Tanko Date: Mon, 23 Sep 2019 13:29:16 +0200 Subject: [PATCH 2/7] Distances: Interruptible task --- Orange/distance/base.py | 19 ++++-- Orange/distance/distance.py | 36 ++++++----- Orange/widgets/unsupervised/owdistances.py | 39 +++++++----- .../unsupervised/tests/test_owdistances.py | 59 ++++++++++++++----- 4 files changed, 104 insertions(+), 49 deletions(-) diff --git a/Orange/distance/base.py b/Orange/distance/base.py index 517955a1138..7205e1cbce9 100644 --- a/Orange/distance/base.py +++ b/Orange/distance/base.py @@ -116,6 +116,8 @@ class Distance: impute (bool): if `True` (default is `False`), nans in the computed distances are replaced with zeros, and infs with very large numbers. + callback (callable or None): + callback function Attributes: axis (int): @@ -162,10 +164,12 @@ class Distance: axis = 1 impute = False - def __new__(cls, e1=None, e2=None, axis=1, impute=False, **kwargs): + def __new__(cls, e1=None, e2=None, axis=1, impute=False, + callback=None, **kwargs): self = super().__new__(cls) self.axis = axis self.impute = impute + self.callback = callback # Ugly, but needed to allow allow setting subclass-specific parameters # (such as normalize) when `e1` is not `None` and the `__new__` in the # subclass is skipped @@ -225,11 +229,14 @@ class DistanceModel: impute (bool): if `True` (default is `False`), nans in the computed distances are replaced with zeros, and infs with very large numbers + callback (callable or None): + callback function """ - def __init__(self, axis, impute=False): + def __init__(self, axis, impute=False, callback=None): self._axis = axis self.impute = impute + self.callback = callback @property def axis(self): @@ -291,9 +298,10 @@ class FittedDistanceModel(DistanceModel): continuous (np.ndarray): bool array indicating continuous attributes normalize (bool): if `True` (default is `False`) continuous columns are normalized + callback (callable or None): callback function """ - def __init__(self, attributes, axis=1, impute=False): - super().__init__(axis, impute) + def __init__(self, attributes, axis=1, impute=False, callback=None): + super().__init__(axis, impute, callback) self.attributes = attributes self.discrete = None self.continuous = None @@ -464,7 +472,8 @@ def fit_rows(self, attributes, x, n_vals): continuous, discrete, offsets[:curr_cont], scales[:curr_cont], dist_missing2_cont[:curr_cont], - dist_missing_disc, dist_missing2_disc) + dist_missing_disc, dist_missing2_disc, + self.callback) @staticmethod def get_discrete_stats(column, n_bins): diff --git a/Orange/distance/distance.py b/Orange/distance/distance.py index e8156e5ce38..0f21ea16e6d 100644 --- a/Orange/distance/distance.py +++ b/Orange/distance/distance.py @@ -26,8 +26,8 @@ class EuclideanRowsModel(FittedDistanceModel): def __init__(self, attributes, impute, normalize, continuous, discrete, means, stdvars, dist_missing2_cont, - dist_missing_disc, dist_missing2_disc): - super().__init__(attributes, 1, impute) + dist_missing_disc, dist_missing2_disc, callback): + super().__init__(attributes, 1, impute, callback) self.normalize = normalize self.continuous = continuous self.discrete = discrete @@ -93,8 +93,9 @@ class EuclideanColumnsModel(FittedDistanceModel): Means are used as offsets for normalization, and two deviations are used for scaling. """ - def __init__(self, attributes, impute, normalize, means, stdvars): - super().__init__(attributes, 0, impute) + def __init__(self, attributes, impute, normalize, means, stdvars, + callback=None): + super().__init__(attributes, 0, impute, callback) self.normalize = normalize self.means = means self.vars = stdvars @@ -135,9 +136,11 @@ class Euclidean(FittedDistance): fallback = SklDistance('euclidean') rows_model_type = EuclideanRowsModel - def __new__(cls, e1=None, e2=None, axis=1, impute=False, normalize=False): + def __new__(cls, e1=None, e2=None, axis=1, impute=False, normalize=False, + callback=None): # pylint: disable=arguments-differ - return super().__new__(cls, e1, e2, axis, impute, normalize=normalize) + return super().__new__(cls, e1, e2, axis, impute, callback, + normalize=normalize) def get_continuous_stats(self, column): """ @@ -180,7 +183,8 @@ def nowarn(msg, cat, *args, **kwargs): if self.normalize and not stdvars.all(): raise ValueError("some columns are constant") return EuclideanColumnsModel( - attributes, self.impute, self.normalize, means, stdvars) + attributes, self.impute, self.normalize, means, stdvars, + self.callback) class ManhattanRowsModel(FittedDistanceModel): @@ -193,8 +197,8 @@ class ManhattanRowsModel(FittedDistanceModel): def __init__(self, attributes, impute, normalize, continuous, discrete, medians, mads, dist_missing2_cont, - dist_missing_disc, dist_missing2_disc): - super().__init__(attributes, 1, impute) + dist_missing_disc, dist_missing2_disc, callback=None): + super().__init__(attributes, 1, impute, callback) self.normalize = normalize self.continuous = continuous self.discrete = discrete @@ -250,8 +254,9 @@ class ManhattanColumnsModel(FittedDistanceModel): used for scaling. """ - def __init__(self, attributes, impute, normalize, medians, mads): - super().__init__(attributes, 0, impute) + def __init__(self, attributes, impute, normalize, medians, mads, + callback=None): + super().__init__(attributes, 0, impute, callback) self.normalize = normalize self.medians = medians self.mads = mads @@ -271,9 +276,11 @@ class Manhattan(FittedDistance): fallback = SklDistance('manhattan') rows_model_type = ManhattanRowsModel - def __new__(cls, e1=None, e2=None, axis=1, impute=False, normalize=False): + def __new__(cls, e1=None, e2=None, axis=1, impute=False, normalize=False, + callback=None): # pylint: disable=arguments-differ - return super().__new__(cls, e1, e2, axis, impute, normalize=normalize) + return super().__new__(cls, e1, e2, axis, impute, callback, + normalize=normalize) def get_continuous_stats(self, column): """ @@ -310,7 +317,8 @@ def fit_cols(self, attributes, x, n_vals): "some columns have zero absolute distance from median, " "or no values") return ManhattanColumnsModel( - attributes, self.impute, self.normalize, medians, mads) + attributes, self.impute, self.normalize, medians, mads, + self.callback) class Cosine(FittedDistance): diff --git a/Orange/widgets/unsupervised/owdistances.py b/Orange/widgets/unsupervised/owdistances.py index b97069b9917..15f17040bdd 100644 --- a/Orange/widgets/unsupervised/owdistances.py +++ b/Orange/widgets/unsupervised/owdistances.py @@ -5,7 +5,8 @@ import Orange.data import Orange.misc from Orange import distance -from Orange.widgets import gui, settings +from Orange.widgets import gui +from Orange.widgets.settings import Setting from Orange.widgets.utils.concurrent import TaskState, ConcurrentWidgetMixin from Orange.widgets.utils.sql import check_sql_input from Orange.widgets.utils.widgetpreview import WidgetPreview @@ -27,6 +28,10 @@ ] +class InterruptException(Exception): + pass + + class DistanceRunner: @staticmethod def run(data: Orange.data.Table, metric: distance, normalized_dist: bool, @@ -34,12 +39,16 @@ def run(data: Orange.data.Table, metric: distance, normalized_dist: bool, if data is None: return None + def callback(i: float) -> bool: + state.set_progress_value(i) + if state.is_interruption_requested(): + raise InterruptException + state.set_status("Calculating...") + kwargs = {"axis": 1 - axis, "impute": True, "callback": callback} if metric.supports_normalization and normalized_dist: - return metric(data, axis=1 - axis, impute=True, - normalize=True) - else: - return metric(data, axis=1 - axis, impute=True) + kwargs["normalize"] = True + return metric(data, **kwargs) class OWDistances(OWWidget, ConcurrentWidgetMixin): @@ -56,14 +65,14 @@ class Outputs: settings_version = 2 - axis = settings.Setting(0) # type: int - metric_idx = settings.Setting(0) # type: int + axis = Setting(0) # type: int + metric_idx = Setting(0) # type: int #: Use normalized distances if the metric supports it. #: The default is `True`, expect when restoring from old pre v2 settings #: (see `migrate_settings`). - normalized_dist = settings.Setting(True) # type: bool - autocommit = settings.Setting(True) # type: bool + normalized_dist = Setting(True) # type: bool + autocommit = Setting(True) # type: bool want_main_area = False buttons_area_orientation = Qt.Vertical @@ -187,13 +196,15 @@ def on_done(self, result: Orange.misc.DistMatrix): assert isinstance(result, Orange.misc.DistMatrix) or result is None self.Outputs.distances.send(result) - def on_exception(self, e): - if isinstance(e, ValueError): - self.Error.distances_value_error(e) - elif isinstance(e, MemoryError): + def on_exception(self, ex): + if isinstance(ex, ValueError): + self.Error.distances_value_error(ex) + elif isinstance(ex, MemoryError): self.Error.distances_memory_error() + elif isinstance(ex, InterruptException): + pass else: - raise e + raise ex def onDeleteWidget(self): self.shutdown() diff --git a/Orange/widgets/unsupervised/tests/test_owdistances.py b/Orange/widgets/unsupervised/tests/test_owdistances.py index a4d8280f260..be7f89c399b 100644 --- a/Orange/widgets/unsupervised/tests/test_owdistances.py +++ b/Orange/widgets/unsupervised/tests/test_owdistances.py @@ -5,8 +5,9 @@ import numpy as np -from Orange.data import Table, Domain from Orange import distance +from Orange.data import Table, Domain +from Orange.misc import DistMatrix from Orange.widgets.unsupervised.owdistances import OWDistances, METRICS, \ DistanceRunner from Orange.widgets.tests.base import WidgetTest @@ -17,28 +18,51 @@ class TestDistanceRunner(unittest.TestCase): def setUpClass(cls): super().setUpClass() cls.iris = Table("iris")[::5] + cls.iris.X[0, 2] = np.nan + cls.iris.X[1, 3] = np.nan + cls.iris.X[2, 1] = np.nan + cls.zoo = Table("zoo")[::5] + cls.zoo.X[0, 2] = np.nan + cls.zoo.X[1, 3] = np.nan + cls.zoo.X[2, 1] = np.nan def test_run(self): - for _, metric in METRICS: + state = Mock() + state.is_interruption_requested = Mock(return_value=False) + for name, metric in METRICS: + data = self.iris + if not metric.supports_missing: + data = distance.impute(data) + elif name == "Jaccard": + data = self.zoo + # between rows, normalized - dist1 = DistanceRunner.run(self.iris, metric, True, 0, Mock()) - dist2 = metric(self.iris, axis=1, impute=True, normalize=True) - np.testing.assert_array_equal(dist1, dist2) + dist1 = DistanceRunner.run(data, metric, True, 0, state) + dist2 = metric(data, axis=1, impute=True, normalize=True) + self.assertDistMatrixEqual(dist1, dist2) # between rows, not normalized - dist1 = DistanceRunner.run(self.iris, metric, False, 0, Mock()) - dist2 = metric(self.iris, axis=1, impute=True, normalize=False) - np.testing.assert_array_equal(dist1, dist2) + dist1 = DistanceRunner.run(data, metric, False, 0, state) + dist2 = metric(data, axis=1, impute=True, normalize=False) + self.assertDistMatrixEqual(dist1, dist2) # between columns, normalized - dist1 = DistanceRunner.run(self.iris, metric, True, 1, Mock()) - dist2 = metric(self.iris, axis=0, impute=True, normalize=True) - np.testing.assert_array_equal(dist1, dist2) + dist1 = DistanceRunner.run(data, metric, True, 1, state) + dist2 = metric(data, axis=0, impute=True, normalize=True) + self.assertDistMatrixEqual(dist1, dist2) # between columns, not normalized - dist1 = DistanceRunner.run(self.iris, metric, False, 1, Mock()) - dist2 = metric(self.iris, axis=0, impute=True, normalize=False) - np.testing.assert_array_equal(dist1, dist2) + dist1 = DistanceRunner.run(data, metric, False, 1, state) + dist2 = metric(data, axis=0, impute=True, normalize=False) + self.assertDistMatrixEqual(dist1, dist2) + + def assertDistMatrixEqual(self, dist1, dist2): + self.assertIsInstance(dist1, DistMatrix) + self.assertIsInstance(dist2, DistMatrix) + self.assertEqual(dist1.axis, dist2.axis) + self.assertEqual(dist1.row_items, dist2.row_items) + self.assertEqual(dist1.col_items, dist2.col_items) + np.testing.assert_array_almost_equal(dist1, dist2) class TestOWDistances(WidgetTest): @@ -59,14 +83,13 @@ def test_distance_combo(self): self.widget.metrics_combo.activated.emit(i) self.widget.metrics_combo.setCurrentIndex(i) self.wait_until_stop_blocking() - self.send_signal(self.widget.Inputs.data, self.iris) if metric.supports_normalization: expected = metric(self.iris, normalize=self.widget.normalized_dist) else: expected = metric(self.iris) if metric is not distance.Jaccard: - np.testing.assert_array_equal( + np.testing.assert_array_almost_equal( expected, self.get_output(self.widget.Outputs.distances)) def test_error_message(self): @@ -156,3 +179,7 @@ def test_negative_values_bhattacharyya(self): self.wait_until_stop_blocking() self.assertTrue(self.widget.Error.distances_value_error.is_shown()) self.iris.X[0, 0] *= -1 + + +if __name__ == "__main__": + unittest.main() From 9e65c6976b2aa597304690ad3c38c95f826e2ea6 Mon Sep 17 00:00:00 2001 From: Vesna Tanko Date: Thu, 28 Nov 2019 13:17:40 +0100 Subject: [PATCH 3/7] Distances: Interruptable Euclidean distance --- Orange/distance/_distance.c | 12143 +++++++++++++---------- Orange/distance/_distance.pyx | 230 +- Orange/distance/distance.py | 87 +- Orange/distance/tests/test_distance.py | 46 + 4 files changed, 7220 insertions(+), 5286 deletions(-) diff --git a/Orange/distance/_distance.c b/Orange/distance/_distance.c index 1c1f84b50d6..31f5499c2f7 100644 --- a/Orange/distance/_distance.c +++ b/Orange/distance/_distance.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.28.3 */ +/* Generated by Cython 0.29.13 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -7,8 +7,9 @@ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_28_3" -#define CYTHON_FUTURE_DIVISION 1 +#define CYTHON_ABI "0_29_13" +#define CYTHON_HEX_VERSION 0x001D0DF0 +#define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) @@ -78,6 +79,10 @@ #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 #elif defined(PYSTON_VERSION) #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 @@ -115,6 +120,10 @@ #define CYTHON_PEP489_MULTI_PHASE_INIT 0 #undef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 @@ -168,11 +177,17 @@ #define CYTHON_FAST_PYCALL 1 #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000) + #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) #endif #ifndef CYTHON_USE_TP_FINALIZE #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) #endif + #ifndef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1) + #endif + #ifndef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3) + #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) @@ -182,6 +197,9 @@ #undef SHIFT #undef BASE #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif #endif #ifndef __has_attribute #define __has_attribute(x) 0 @@ -292,8 +310,13 @@ #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ + PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif #define __Pyx_DefaultClassType PyType_Type #endif #ifndef Py_TPFLAGS_CHECKTYPES @@ -308,6 +331,9 @@ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif +#ifndef METH_STACKLESS + #define METH_STACKLESS 0 +#endif #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 @@ -321,7 +347,7 @@ #endif #if CYTHON_FAST_PYCCALL #define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))))) + ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))))) #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif @@ -330,6 +356,11 @@ #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1 + #define PyMem_RawMalloc(n) PyMem_Malloc(n) + #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n) + #define PyMem_RawFree(p) PyMem_Free(p) +#endif #if CYTHON_COMPILING_IN_PYSTON #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) @@ -352,7 +383,7 @@ typedef int Py_tss_t; static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { *key = PyThread_create_key(); - return 0; // PyThread_create_key reports success always + return 0; } static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); @@ -375,7 +406,7 @@ static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { return PyThread_get_key_value(*key); } -#endif // TSS (Thread Specific Storage) API +#endif #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) #else @@ -437,8 +468,8 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) #else @@ -583,7 +614,8 @@ typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* enc const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize @@ -599,6 +631,9 @@ typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* enc (sizeof(type) == sizeof(Py_ssize_t) &&\ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} #if defined (__cplusplus) && __cplusplus >= 201103L #include #define __Pyx_sst_abs(value) std::abs(value) @@ -657,6 +692,7 @@ static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); #define __Pyx_PySequence_Tuple(obj)\ (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) @@ -737,7 +773,7 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(default_encoding); @@ -910,7 +946,7 @@ typedef struct { #endif -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":730 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":776 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -919,7 +955,7 @@ typedef struct { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":731 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":777 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -928,7 +964,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":732 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":778 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -937,7 +973,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":733 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":779 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -946,7 +982,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":737 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":783 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -955,7 +991,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":738 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":784 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -964,7 +1000,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":739 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":785 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -973,7 +1009,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":740 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":786 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -982,7 +1018,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":744 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":790 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -991,7 +1027,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":745 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":791 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -1000,7 +1036,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":754 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":800 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< @@ -1009,7 +1045,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":755 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":801 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -1018,7 +1054,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":756 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":802 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -1027,7 +1063,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":758 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":804 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -1036,7 +1072,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":759 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":805 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -1045,7 +1081,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":760 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":806 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -1054,7 +1090,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":762 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":808 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -1063,7 +1099,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":763 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":809 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -1072,7 +1108,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":765 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":811 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -1081,7 +1117,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":766 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":812 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -1090,7 +1126,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":767 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":813 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -1129,7 +1165,7 @@ struct __pyx_MemviewEnum_obj; struct __pyx_memoryview_obj; struct __pyx_memoryviewslice_obj; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":769 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":815 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -1138,7 +1174,7 @@ struct __pyx_memoryviewslice_obj; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":770 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":816 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -1147,7 +1183,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":771 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":817 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -1156,7 +1192,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":773 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":819 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -1165,7 +1201,7 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -/* "View.MemoryView":104 +/* "View.MemoryView":105 * * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< @@ -1190,7 +1226,7 @@ struct __pyx_array_obj { }; -/* "View.MemoryView":278 +/* "View.MemoryView":279 * * @cname('__pyx_MemviewEnum') * cdef class Enum(object): # <<<<<<<<<<<<<< @@ -1203,7 +1239,7 @@ struct __pyx_MemviewEnum_obj { }; -/* "View.MemoryView":329 +/* "View.MemoryView":330 * * @cname('__pyx_memoryview') * cdef class memoryview(object): # <<<<<<<<<<<<<< @@ -1226,7 +1262,7 @@ struct __pyx_memoryview_obj { }; -/* "View.MemoryView":960 +/* "View.MemoryView":965 * * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< @@ -1243,7 +1279,7 @@ struct __pyx_memoryviewslice_obj { -/* "View.MemoryView":104 +/* "View.MemoryView":105 * * @cname("__pyx_array") * cdef class array: # <<<<<<<<<<<<<< @@ -1257,7 +1293,7 @@ struct __pyx_vtabstruct_array { static struct __pyx_vtabstruct_array *__pyx_vtabptr_array; -/* "View.MemoryView":329 +/* "View.MemoryView":330 * * @cname('__pyx_memoryview') * cdef class memoryview(object): # <<<<<<<<<<<<<< @@ -1277,7 +1313,7 @@ struct __pyx_vtabstruct_memoryview { static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview; -/* "View.MemoryView":960 +/* "View.MemoryView":965 * * @cname('__pyx_memoryviewslice') * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<< @@ -1364,6 +1400,107 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyCFunctionFastCall.proto */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); +#else +#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) +#endif + +/* PyFunctionFastCall.proto */ +#if CYTHON_FAST_PYCALL +#define __Pyx_PyFunction_FastCall(func, args, nargs)\ + __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); +#else +#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) +#endif +#define __Pyx_BUILD_ASSERT_EXPR(cond)\ + (sizeof(char [1 - 2*!(cond)]) - 1) +#ifndef Py_MEMBER_SIZE +#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) +#endif + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" + #define __Pxy_PyFrame_Initialize_Offsets()\ + ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ + (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) + #define __Pyx_PyFrame_GetLocalsplus(frame)\ + (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif + +/* PyObjectCall2Args.proto */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ + const char* function_name); + /* None.proto */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); @@ -1393,18 +1530,6 @@ static CYTHON_INLINE int __pyx_sub_acquisition_count_locked( static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int); static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int); -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - /* ArgTypeTest.proto */ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ @@ -1434,50 +1559,51 @@ static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +/* PyDictVersioning.proto */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __pyx_dict_cached_value;\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); #else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); #endif /* GetModuleGlobalName.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#if CYTHON_USE_DICT_VERSIONS +#define __Pyx_GetModuleGlobalName(var, name) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ + (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ + __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} +#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ + PY_UINT64_T __pyx_dict_version;\ + PyObject *__pyx_dict_cached_value;\ + (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ +} +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); #else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) +#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif /* ExtTypeTest.proto */ @@ -1486,34 +1612,65 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /* BufferFallbackError.proto */ static void __Pyx_RaiseBufferFallbackError(void); -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +/* FetchCommonType.proto */ +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); + +/* CythonFunction.proto */ +#define __Pyx_CyFunction_USED 1 +#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 +#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 +#define __Pyx_CYFUNCTION_CCLASS 0x04 +#define __Pyx_CyFunction_GetClosure(f)\ + (((__pyx_CyFunctionObject *) (f))->func_closure) +#define __Pyx_CyFunction_GetClassObj(f)\ + (((__pyx_CyFunctionObject *) (f))->func_classobj) +#define __Pyx_CyFunction_Defaults(type, f)\ + ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) +#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ + ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) +typedef struct { + PyCFunctionObject func; +#if PY_VERSION_HEX < 0x030500A0 + PyObject *func_weakreflist; #endif + PyObject *func_dict; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; + PyObject *func_classobj; + void *defaults; + int defaults_pyobjects; + int flags; + PyObject *defaults_tuple; + PyObject *defaults_kwdict; + PyObject *(*defaults_getter)(PyObject *); + PyObject *func_annotations; +} __pyx_CyFunctionObject; +static PyTypeObject *__pyx_CyFunctionType = 0; +#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) +#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ + __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) +static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *self, + PyObject *module, PyObject *globals, + PyObject* code); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(void); -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* DictGetItem.proto */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY @@ -1535,6 +1692,11 @@ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); /* RaiseNoneIterError.proto */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); +/* GetTopmostException.proto */ +#if CYTHON_USE_EXC_INFO_STACK +static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); +#endif + /* SaveResetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) @@ -1683,9 +1845,9 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { /* PyIntBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace); +static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); #else -#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\ +#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\ (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) #endif @@ -1719,11 +1881,6 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif -/* WriteUnraisableException.proto */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); - /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); @@ -1750,6 +1907,17 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable); /* SetupReduce.proto */ static int __Pyx_setup_reduce(PyObject* type_obj); +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto +#define __PYX_HAVE_RT_ImportType_proto +enum __Pyx_ImportType_CheckSize { + __Pyx_ImportType_CheckSize_Error = 0, + __Pyx_ImportType_CheckSize_Warn = 1, + __Pyx_ImportType_CheckSize_Ignore = 2 +}; +static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size); +#endif + /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -1833,6 +2001,9 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_dou /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + /* MemviewDtypeToObject.proto */ static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp); static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj); @@ -1951,33 +2122,15 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, /* CIntFromPy.proto */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); -/* PyIdentifierFromString.proto */ -#if !defined(__Pyx_PyIdentifier_FromString) -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) -#else - #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) -#endif -#endif - -/* ModuleImport.proto */ -static PyObject *__Pyx_ImportModule(const char *name); - -/* TypeImport.proto */ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); - /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); @@ -2033,7 +2186,7 @@ static PyObject *contiguous = 0; static PyObject *indirect_contiguous = 0; static int __pyx_memoryview_thread_locks_used; static PyThread_type_lock __pyx_memoryview_thread_locks[8]; -static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memviewslice, int __pyx_skip_dispatch); /*proto*/ +static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memviewslice, PyObject *, int __pyx_skip_dispatch); /*proto*/ static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ static void *__pyx_align_pointer(void *, size_t); /*proto*/ static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ @@ -2156,6 +2309,7 @@ static const char __pyx_k_n_rows1[] = "n_rows1"; static const char __pyx_k_n_rows2[] = "n_rows2"; static const char __pyx_k_nonnans[] = "nonnans"; static const char __pyx_k_Ellipsis[] = "Ellipsis"; +static const char __pyx_k_callback[] = "callback"; static const char __pyx_k_getstate[] = "__getstate__"; static const char __pyx_k_in1_unk2[] = "in1_unk2"; static const char __pyx_k_itemsize[] = "itemsize"; @@ -2164,6 +2318,7 @@ static const char __pyx_k_pyx_type[] = "__pyx_type"; static const char __pyx_k_setstate[] = "__setstate__"; static const char __pyx_k_unk1_in2[] = "unk1_in2"; static const char __pyx_k_TypeError[] = "TypeError"; +static const char __pyx_k_col_start[] = "col_start"; static const char __pyx_k_distances[] = "distances"; static const char __pyx_k_enumerate[] = "enumerate"; static const char __pyx_k_nonzeros1[] = "nonzeros1"; @@ -2173,6 +2328,7 @@ static const char __pyx_k_not1_unk2[] = "not1_unk2"; static const char __pyx_k_p_nonzero[] = "p_nonzero"; static const char __pyx_k_pyx_state[] = "__pyx_state"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; +static const char __pyx_k_row_start[] = "row_start"; static const char __pyx_k_unk1_not2[] = "unk1_not2"; static const char __pyx_k_unk1_unk2[] = "unk1_unk2"; static const char __pyx_k_IndexError[] = "IndexError"; @@ -2217,6 +2373,7 @@ static const char __pyx_k_euclidean_rows_discrete[] = "euclidean_rows_discrete"; static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'"; static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d."; static const char __pyx_k_Orange_distance__distance[] = "Orange.distance._distance"; +static const char __pyx_k_jaccard_rows_locals_lambda[] = "jaccard_rows.."; static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array"; static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous"; static const char __pyx_k_Orange_distance__distance_pyx[] = "Orange/distance/_distance.pyx"; @@ -2280,11 +2437,13 @@ static PyObject *__pyx_n_s_any_nan_row; static PyObject *__pyx_n_s_base; static PyObject *__pyx_n_s_c; static PyObject *__pyx_n_u_c; +static PyObject *__pyx_n_s_callback; static PyObject *__pyx_n_s_class; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_col; static PyObject *__pyx_n_s_col1; static PyObject *__pyx_n_s_col2; +static PyObject *__pyx_n_s_col_start; static PyObject *__pyx_kp_s_contiguous_and_direct; static PyObject *__pyx_kp_s_contiguous_and_indirect; static PyObject *__pyx_n_s_d; @@ -2324,6 +2483,7 @@ static PyObject *__pyx_n_s_ival1; static PyObject *__pyx_n_s_ival2; static PyObject *__pyx_n_s_jaccard_cols; static PyObject *__pyx_n_s_jaccard_rows; +static PyObject *__pyx_n_s_jaccard_rows_locals_lambda; static PyObject *__pyx_n_s_mads; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_manhattan_cols; @@ -2354,8 +2514,8 @@ static PyObject *__pyx_n_s_normalize; static PyObject *__pyx_n_s_not1_unk2; static PyObject *__pyx_n_s_np; static PyObject *__pyx_n_s_numpy; -static PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to; -static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor; +static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to; +static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor; static PyObject *__pyx_n_s_obj; static PyObject *__pyx_n_s_p_nonzero; static PyObject *__pyx_n_s_pack; @@ -2376,6 +2536,7 @@ static PyObject *__pyx_n_s_reduce_ex; static PyObject *__pyx_n_s_row; static PyObject *__pyx_n_s_row1; static PyObject *__pyx_n_s_row2; +static PyObject *__pyx_n_s_row_start; static PyObject *__pyx_n_s_setstate; static PyObject *__pyx_n_s_setstate_cython; static PyObject *__pyx_n_s_shape; @@ -2407,18 +2568,19 @@ static PyObject *__pyx_n_s_x; static PyObject *__pyx_n_s_x1; static PyObject *__pyx_n_s_x2; static PyObject *__pyx_n_s_zeros; -static PyObject *__pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distances); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, __Pyx_memviewslice __pyx_v_dist_missing, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_means, PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, CYTHON_UNUSED PyArrayObject *__pyx_v_means, CYTHON_UNUSED PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, __Pyx_memviewslice __pyx_v_means, __Pyx_memviewslice __pyx_v_vars); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_means, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_vars); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distances, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, __Pyx_memviewslice __pyx_v_dist_missing, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_means, PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, CYTHON_UNUSED PyArrayObject *__pyx_v_means, CYTHON_UNUSED PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, __Pyx_memviewslice __pyx_v_means, __Pyx_memviewslice __pyx_v_vars, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_means, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_vars, PyObject *__pyx_v_callback); /* proto */ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables); /* proto */ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, PyArrayObject *__pyx_v_dist_missing2_cont, char __pyx_v_two_tables); /* proto */ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables); /* proto */ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, char __pyx_v_normalize); /* proto */ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x); /* proto */ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x); /* proto */ +static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros1, PyArrayObject *__pyx_v_nonzeros2, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_nans1, PyArrayObject *__pyx_v_nans2, PyArrayObject *__pyx_v_ps, char __pyx_v_two_tables); /* proto */ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_nans, PyArrayObject *__pyx_v_ps); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ @@ -2482,9 +2644,7 @@ static PyObject *__pyx_tuple__6; static PyObject *__pyx_tuple__7; static PyObject *__pyx_tuple__8; static PyObject *__pyx_tuple__9; -static PyObject *__pyx_slice__25; -static PyObject *__pyx_slice__26; -static PyObject *__pyx_slice__27; +static PyObject *__pyx_slice__22; static PyObject *__pyx_tuple__10; static PyObject *__pyx_tuple__11; static PyObject *__pyx_tuple__12; @@ -2497,155 +2657,349 @@ static PyObject *__pyx_tuple__18; static PyObject *__pyx_tuple__19; static PyObject *__pyx_tuple__20; static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__22; static PyObject *__pyx_tuple__23; static PyObject *__pyx_tuple__24; +static PyObject *__pyx_tuple__25; +static PyObject *__pyx_tuple__26; static PyObject *__pyx_tuple__28; -static PyObject *__pyx_tuple__29; static PyObject *__pyx_tuple__30; -static PyObject *__pyx_tuple__31; -static PyObject *__pyx_tuple__33; -static PyObject *__pyx_tuple__35; -static PyObject *__pyx_tuple__37; -static PyObject *__pyx_tuple__39; -static PyObject *__pyx_tuple__41; -static PyObject *__pyx_tuple__43; -static PyObject *__pyx_tuple__45; -static PyObject *__pyx_tuple__47; -static PyObject *__pyx_tuple__49; -static PyObject *__pyx_tuple__51; +static PyObject *__pyx_tuple__32; +static PyObject *__pyx_tuple__34; +static PyObject *__pyx_tuple__36; +static PyObject *__pyx_tuple__38; +static PyObject *__pyx_tuple__40; +static PyObject *__pyx_tuple__42; +static PyObject *__pyx_tuple__44; +static PyObject *__pyx_tuple__46; +static PyObject *__pyx_tuple__48; +static PyObject *__pyx_tuple__50; +static PyObject *__pyx_tuple__52; static PyObject *__pyx_tuple__53; +static PyObject *__pyx_tuple__54; static PyObject *__pyx_tuple__55; +static PyObject *__pyx_tuple__56; static PyObject *__pyx_tuple__57; -static PyObject *__pyx_tuple__58; -static PyObject *__pyx_tuple__59; -static PyObject *__pyx_tuple__60; -static PyObject *__pyx_tuple__61; -static PyObject *__pyx_tuple__62; -static PyObject *__pyx_codeobj__32; -static PyObject *__pyx_codeobj__34; -static PyObject *__pyx_codeobj__36; -static PyObject *__pyx_codeobj__38; -static PyObject *__pyx_codeobj__40; -static PyObject *__pyx_codeobj__42; -static PyObject *__pyx_codeobj__44; -static PyObject *__pyx_codeobj__46; -static PyObject *__pyx_codeobj__48; -static PyObject *__pyx_codeobj__50; -static PyObject *__pyx_codeobj__52; -static PyObject *__pyx_codeobj__54; -static PyObject *__pyx_codeobj__56; -static PyObject *__pyx_codeobj__63; +static PyObject *__pyx_codeobj__27; +static PyObject *__pyx_codeobj__29; +static PyObject *__pyx_codeobj__31; +static PyObject *__pyx_codeobj__33; +static PyObject *__pyx_codeobj__35; +static PyObject *__pyx_codeobj__37; +static PyObject *__pyx_codeobj__39; +static PyObject *__pyx_codeobj__41; +static PyObject *__pyx_codeobj__43; +static PyObject *__pyx_codeobj__45; +static PyObject *__pyx_codeobj__47; +static PyObject *__pyx_codeobj__49; +static PyObject *__pyx_codeobj__51; +static PyObject *__pyx_codeobj__58; /* Late includes */ /* "Orange/distance/_distance.pyx":18 * * - * cpdef void lower_to_symmetric(double [:, :] distances): # <<<<<<<<<<<<<< - * cdef int row1, row2 - * for row1 in range(distances.shape[0]): + * cpdef void lower_to_symmetric(double [:, :] distances, callback): # <<<<<<<<<<<<<< + * cdef int row1, row2, step, n_rows1 + * n_rows1 = distances.shape[0] */ -static PyObject *__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric(PyObject *__pyx_self, PyObject *__pyx_arg_distances); /*proto*/ -static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memviewslice __pyx_v_distances, CYTHON_UNUSED int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memviewslice __pyx_v_distances, PyObject *__pyx_v_callback, CYTHON_UNUSED int __pyx_skip_dispatch) { int __pyx_v_row1; int __pyx_v_row2; + int __pyx_v_step; + int __pyx_v_n_rows1; + long __pyx_v_row_start; __Pyx_RefNannyDeclarations - Py_ssize_t __pyx_t_1; - Py_ssize_t __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; + long __pyx_t_1; + long __pyx_t_2; + long __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + Py_ssize_t __pyx_t_15; + Py_ssize_t __pyx_t_16; + Py_ssize_t __pyx_t_17; + Py_ssize_t __pyx_t_18; __Pyx_RefNannySetupContext("lower_to_symmetric", 0); /* "Orange/distance/_distance.pyx":20 - * cpdef void lower_to_symmetric(double [:, :] distances): - * cdef int row1, row2 - * for row1 in range(distances.shape[0]): # <<<<<<<<<<<<<< - * for row2 in range(row1): - * distances[row2, row1] = distances[row1, row2] - */ - __pyx_t_1 = (__pyx_v_distances.shape[0]); - __pyx_t_2 = __pyx_t_1; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_row1 = __pyx_t_3; - - /* "Orange/distance/_distance.pyx":21 - * cdef int row1, row2 - * for row1 in range(distances.shape[0]): - * for row2 in range(row1): # <<<<<<<<<<<<<< - * distances[row2, row1] = distances[row1, row2] - * - */ - __pyx_t_4 = __pyx_v_row1; - __pyx_t_5 = __pyx_t_4; - for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { - __pyx_v_row2 = __pyx_t_6; - - /* "Orange/distance/_distance.pyx":22 - * for row1 in range(distances.shape[0]): - * for row2 in range(row1): - * distances[row2, row1] = distances[row1, row2] # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_7 = __pyx_v_row1; - __pyx_t_8 = __pyx_v_row2; - __pyx_t_9 = __pyx_v_row2; - __pyx_t_10 = __pyx_v_row1; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_9 * __pyx_v_distances.strides[0]) ) + __pyx_t_10 * __pyx_v_distances.strides[1]) )) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_7 * __pyx_v_distances.strides[0]) ) + __pyx_t_8 * __pyx_v_distances.strides[1]) ))); - } + * cpdef void lower_to_symmetric(double [:, :] distances, callback): + * cdef int row1, row2, step, n_rows1 + * n_rows1 = distances.shape[0] # <<<<<<<<<<<<<< + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + */ + __pyx_v_n_rows1 = (__pyx_v_distances.shape[0]); + + /* "Orange/distance/_distance.pyx":21 + * cdef int row1, row2, step, n_rows1 + * n_rows1 = distances.shape[0] + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + */ + __pyx_t_1 = 0x64; + __pyx_t_2 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_1 > __pyx_t_2) != 0)) { + __pyx_t_3 = __pyx_t_1; + } else { + __pyx_t_3 = __pyx_t_2; } + __pyx_v_step = __pyx_t_3; - /* "Orange/distance/_distance.pyx":18 - * - * - * cpdef void lower_to_symmetric(double [:, :] distances): # <<<<<<<<<<<<<< - * cdef int row1, row2 - * for row1 in range(distances.shape[0]): + /* "Orange/distance/_distance.pyx":22 + * n_rows1 = distances.shape[0] + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); -} - -/* Python wrapper */ -static PyObject *__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric(PyObject *__pyx_self, PyObject *__pyx_arg_distances); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_lower_to_symmetric[] = "lower_to_symmetric(__Pyx_memviewslice distances) -> void"; -static PyObject *__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric(PyObject *__pyx_self, PyObject *__pyx_arg_distances) { - __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyObject *__pyx_r = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_6 = __pyx_t_5; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 22, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_6))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 22, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } else { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 22, __pyx_L1_error) + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + #endif + } + } else { + __pyx_t_5 = __pyx_t_8(__pyx_t_6); + if (unlikely(!__pyx_t_5)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 22, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __pyx_t_3 = __Pyx_PyInt_As_long(__pyx_t_5); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_row_start = __pyx_t_3; + + /* "Orange/distance/_distance.pyx":23 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * for row2 in range(row1): + */ + __pyx_t_4 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_9 = __pyx_v_callback; __pyx_t_10 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + } + } + __pyx_t_5 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "Orange/distance/_distance.pyx":24 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * for row2 in range(row1): + * distances[row2, row1] = distances[row1, row2] + */ + __pyx_t_11 = __pyx_v_n_rows1; + __pyx_t_3 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_11 < __pyx_t_3) != 0)) { + __pyx_t_1 = __pyx_t_11; + } else { + __pyx_t_1 = __pyx_t_3; + } + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = __pyx_t_3; + for (__pyx_t_11 = __pyx_v_row_start; __pyx_t_11 < __pyx_t_1; __pyx_t_11+=1) { + __pyx_v_row1 = __pyx_t_11; + + /* "Orange/distance/_distance.pyx":25 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * for row2 in range(row1): # <<<<<<<<<<<<<< + * distances[row2, row1] = distances[row1, row2] + * + */ + __pyx_t_12 = __pyx_v_row1; + __pyx_t_13 = __pyx_t_12; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_row2 = __pyx_t_14; + + /* "Orange/distance/_distance.pyx":26 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * for row2 in range(row1): + * distances[row2, row1] = distances[row1, row2] # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_15 = __pyx_v_row1; + __pyx_t_16 = __pyx_v_row2; + __pyx_t_17 = __pyx_v_row2; + __pyx_t_18 = __pyx_v_row1; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_17 * __pyx_v_distances.strides[0]) ) + __pyx_t_18 * __pyx_v_distances.strides[1]) )) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_15 * __pyx_v_distances.strides[0]) ) + __pyx_t_16 * __pyx_v_distances.strides[1]) ))); + } + } + + /* "Orange/distance/_distance.pyx":22 + * n_rows1 = distances.shape[0] + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + */ + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "Orange/distance/_distance.pyx":18 + * + * + * cpdef void lower_to_symmetric(double [:, :] distances, callback): # <<<<<<<<<<<<<< + * cdef int row1, row2, step, n_rows1 + * n_rows1 = distances.shape[0] + */ + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_WriteUnraisable("Orange.distance._distance.lower_to_symmetric", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6Orange_8distance_9_distance_lower_to_symmetric[] = "lower_to_symmetric(double[:, :] distances, callback) -> void"; +static PyObject *__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lower_to_symmetric (wrapper)", 0); - assert(__pyx_arg_distances); { - __pyx_v_distances = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_arg_distances, PyBUF_WRITABLE); if (unlikely(!__pyx_v_distances.memview)) __PYX_ERR(0, 18, __pyx_L3_error) + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_callback,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_distances)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("lower_to_symmetric", 1, 2, 2, 1); __PYX_ERR(0, 18, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lower_to_symmetric") < 0)) __PYX_ERR(0, 18, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_distances = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_distances.memview)) __PYX_ERR(0, 18, __pyx_L3_error) + __pyx_v_callback = values[1]; } goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lower_to_symmetric", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 18, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.lower_to_symmetric", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(__pyx_self, __pyx_v_distances); + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(__pyx_self, __pyx_v_distances, __pyx_v_callback); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distances) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distances, PyObject *__pyx_v_callback) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("lower_to_symmetric", 0); __Pyx_XDECREF(__pyx_r); if (unlikely(!__pyx_v_distances.memview)) { __Pyx_RaiseUnboundLocalError("distances"); __PYX_ERR(0, 18, __pyx_L1_error) } - __pyx_t_1 = __Pyx_void_to_None(__pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__pyx_v_distances, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_t_1 = __Pyx_void_to_None(__pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__pyx_v_distances, __pyx_v_callback, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2663,7 +3017,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(CYTHON return __pyx_r; } -/* "Orange/distance/_distance.pyx":25 +/* "Orange/distance/_distance.pyx":29 * * * def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -2673,8 +3027,8 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(CYTHON /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_2euclidean_rows_discrete[] = "euclidean_rows_discrete(ndarray distances, ndarray x1, ndarray x2, __Pyx_memviewslice dist_missing, ndarray dist_missing2, char two_tables)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_3euclidean_rows_discrete = {"euclidean_rows_discrete", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_2euclidean_rows_discrete}; +static char __pyx_doc_6Orange_8distance_9_distance_2euclidean_rows_discrete[] = "euclidean_rows_discrete(ndarray distances, ndarray x1, ndarray x2, double[:, :] dist_missing, ndarray dist_missing2, char two_tables, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_3euclidean_rows_discrete = {"euclidean_rows_discrete", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_2euclidean_rows_discrete}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_distances = 0; PyArrayObject *__pyx_v_x1 = 0; @@ -2682,16 +3036,19 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete( __Pyx_memviewslice __pyx_v_dist_missing = { 0, 0, { 0 }, { 0 }, { 0 } }; PyArrayObject *__pyx_v_dist_missing2 = 0; char __pyx_v_two_tables; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("euclidean_rows_discrete (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_dist_missing,&__pyx_n_s_dist_missing2,&__pyx_n_s_two_tables,0}; - PyObject* values[6] = {0,0,0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_dist_missing,&__pyx_n_s_dist_missing2,&__pyx_n_s_two_tables,&__pyx_n_s_callback,0}; + PyObject* values[7] = {0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); @@ -2716,37 +3073,43 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete( case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 6, 6, 1); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 1); __PYX_ERR(0, 29, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 6, 6, 2); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 2); __PYX_ERR(0, 29, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 6, 6, 3); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 3); __PYX_ERR(0, 29, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 6, 6, 4); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 4); __PYX_ERR(0, 29, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 6, 6, 5); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 5); __PYX_ERR(0, 29, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 6: + if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 6); __PYX_ERR(0, 29, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "euclidean_rows_discrete") < 0)) __PYX_ERR(0, 25, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "euclidean_rows_discrete") < 0)) __PYX_ERR(0, 29, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -2755,27 +3118,29 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete( values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x1 = ((PyArrayObject *)values[1]); __pyx_v_x2 = ((PyArrayObject *)values[2]); - __pyx_v_dist_missing = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dist_missing.memview)) __PYX_ERR(0, 28, __pyx_L3_error) + __pyx_v_dist_missing = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dist_missing.memview)) __PYX_ERR(0, 32, __pyx_L3_error) __pyx_v_dist_missing2 = ((PyArrayObject *)values[4]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[5]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 30, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[5]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 34, __pyx_L3_error) + __pyx_v_callback = values[6]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 29, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.euclidean_rows_discrete", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 25, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 26, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 27, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 29, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_dist_missing, __pyx_v_dist_missing2, __pyx_v_two_tables); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 29, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 30, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 31, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 33, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_dist_missing, __pyx_v_dist_missing2, __pyx_v_two_tables, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -2786,18 +3151,20 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete( return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, __Pyx_memviewslice __pyx_v_dist_missing, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, __Pyx_memviewslice __pyx_v_dist_missing, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables, PyObject *__pyx_v_callback) { int __pyx_v_n_rows1; int __pyx_v_n_rows2; int __pyx_v_n_cols; int __pyx_v_row1; int __pyx_v_row2; int __pyx_v_col; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; int __pyx_v_ival1; int __pyx_v_ival2; + long __pyx_v_row_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_dist_missing2; __Pyx_Buffer __pyx_pybuffer_dist_missing2; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; @@ -2810,29 +3177,37 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - __pyx_t_5numpy_float64_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - __pyx_t_5numpy_float64_t __pyx_t_17; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + Py_ssize_t __pyx_t_9; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_t_14; + int __pyx_t_15; + int __pyx_t_16; + int __pyx_t_17; int __pyx_t_18; - Py_ssize_t __pyx_t_19; + int __pyx_t_19; Py_ssize_t __pyx_t_20; Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + __pyx_t_5numpy_float64_t __pyx_t_22; Py_ssize_t __pyx_t_23; Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; + __pyx_t_5numpy_float64_t __pyx_t_25; + int __pyx_t_26; + Py_ssize_t __pyx_t_27; + Py_ssize_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; __Pyx_RefNannySetupContext("euclidean_rows_discrete", 0); __pyx_pybuffer_distances.pybuffer.buf = NULL; __pyx_pybuffer_distances.refcount = 0; @@ -2852,295 +3227,425 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_pybuffernd_dist_missing2.rcbuffer = &__pyx_pybuffer_dist_missing2; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 25, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 25, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 25, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 25, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error) } __pyx_pybuffernd_dist_missing2.diminfo[0].strides = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dist_missing2.diminfo[0].shape = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":36 + /* "Orange/distance/_distance.pyx":41 * int ival1, ival2 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< * n_rows2 = x2.shape[0] - * with nogil: + * step = max(n_rows1 // 100, 100) */ __pyx_t_1 = (__pyx_v_x1->dimensions[0]); __pyx_t_2 = (__pyx_v_x1->dimensions[1]); __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":37 + /* "Orange/distance/_distance.pyx":42 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< - * with nogil: - * for row1 in range(n_rows1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":38 + /* "Orange/distance/_distance.pyx":43 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":39 + /* "Orange/distance/_distance.pyx":44 * n_rows2 = x2.shape[0] - * with nogil: - * for row1 in range(n_rows1): # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * d = 0 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - __pyx_t_3 = __pyx_v_n_rows1; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_row1 = __pyx_t_5; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 44, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 44, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 44, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_10(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 44, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_row_start = __pyx_t_5; - /* "Orange/distance/_distance.pyx":40 - * with nogil: - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":45 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: */ - if ((__pyx_v_two_tables != 0)) { - __pyx_t_6 = __pyx_v_n_rows2; - } else { - __pyx_t_6 = __pyx_v_row1; - } - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_row2 = __pyx_t_8; + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":41 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * d = 0 # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] + /* "Orange/distance/_distance.pyx":46 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): */ - __pyx_v_d = 0.0; + __pyx_t_13 = __pyx_v_n_rows1; + __pyx_t_5 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_13 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_13; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_13 = __pyx_v_row_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { + __pyx_v_row1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":42 - * for row2 in range(n_rows2 if two_tables else row1): - * d = 0 - * for col in range(n_cols): # <<<<<<<<<<<<<< - * val1, val2 = x1[row1, col], x2[row2, col] - * ival1, ival2 = int(val1), int(val2) + /* "Orange/distance/_distance.pyx":47 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 */ - __pyx_t_9 = __pyx_v_n_cols; - __pyx_t_10 = __pyx_t_9; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { - __pyx_v_col = __pyx_t_11; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":43 - * d = 0 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< - * ival1, ival2 = int(val1), int(val2) - * if npy_isnan(val1): + /* "Orange/distance/_distance.pyx":48 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ - __pyx_t_12 = __pyx_v_row1; - __pyx_t_13 = __pyx_v_col; - __pyx_t_14 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_x1.diminfo[1].strides)); - __pyx_t_15 = __pyx_v_row2; - __pyx_t_16 = __pyx_v_col; - __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x2.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_14; - __pyx_v_val2 = __pyx_t_17; + if ((__pyx_v_two_tables != 0)) { + __pyx_t_14 = __pyx_v_n_rows2; + } else { + __pyx_t_14 = __pyx_v_row1; + } + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_row2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":44 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * ival1, ival2 = int(val1), int(val2) # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":49 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] */ - __pyx_v_ival1 = ((int)__pyx_v_val1); - __pyx_v_ival2 = ((int)__pyx_v_val2); + __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":45 - * val1, val2 = x1[row1, col], x2[row2, col] - * ival1, ival2 = int(val1), int(val2) - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2[col] + /* "Orange/distance/_distance.pyx":50 + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 + * for col in range(n_cols): # <<<<<<<<<<<<<< + * val1, val2 = x1[row1, col], x2[row2, col] + * ival1, ival2 = int(val1), int(val2) */ - __pyx_t_18 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_18) { + __pyx_t_17 = __pyx_v_n_cols; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_col = __pyx_t_19; - /* "Orange/distance/_distance.pyx":46 - * ival1, ival2 = int(val1), int(val2) - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2[col] - * else: + /* "Orange/distance/_distance.pyx":51 + * d = 0 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< + * ival1, ival2 = int(val1), int(val2) + * if npy_isnan(val1): */ - __pyx_t_18 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_18) { + __pyx_t_20 = __pyx_v_row1; + __pyx_t_21 = __pyx_v_col; + __pyx_t_22 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x1.diminfo[1].strides)); + __pyx_t_23 = __pyx_v_row2; + __pyx_t_24 = __pyx_v_col; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x2.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_22; + __pyx_v_val2 = __pyx_t_25; - /* "Orange/distance/_distance.pyx":47 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += dist_missing2[col] # <<<<<<<<<<<<<< - * else: - * d += dist_missing[col, ival2] + /* "Orange/distance/_distance.pyx":52 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * ival1, ival2 = int(val1), int(val2) # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - __pyx_t_19 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_dist_missing2.diminfo[0].strides))); + __pyx_v_ival1 = ((int)__pyx_v_val1); + __pyx_v_ival2 = ((int)__pyx_v_val2); - /* "Orange/distance/_distance.pyx":46 - * ival1, ival2 = int(val1), int(val2) - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2[col] - * else: + /* "Orange/distance/_distance.pyx":53 + * val1, val2 = x1[row1, col], x2[row2, col] + * ival1, ival2 = int(val1), int(val2) + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2[col] */ - goto __pyx_L13; - } + __pyx_t_26 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_26) { - /* "Orange/distance/_distance.pyx":49 - * d += dist_missing2[col] - * else: - * d += dist_missing[col, ival2] # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * d += dist_missing[col, ival1] + /* "Orange/distance/_distance.pyx":54 + * ival1, ival2 = int(val1), int(val2) + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2[col] + * else: */ - /*else*/ { - __pyx_t_20 = __pyx_v_col; - __pyx_t_21 = __pyx_v_ival2; - __pyx_v_d = (__pyx_v_d + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dist_missing.data + __pyx_t_20 * __pyx_v_dist_missing.strides[0]) ) + __pyx_t_21 * __pyx_v_dist_missing.strides[1]) )))); - } - __pyx_L13:; + __pyx_t_26 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_26) { - /* "Orange/distance/_distance.pyx":45 - * val1, val2 = x1[row1, col], x2[row2, col] - * ival1, ival2 = int(val1), int(val2) - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2[col] + /* "Orange/distance/_distance.pyx":55 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += dist_missing2[col] # <<<<<<<<<<<<<< + * else: + * d += dist_missing[col, ival2] */ - goto __pyx_L12; - } + __pyx_t_27 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_dist_missing2.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":50 - * else: - * d += dist_missing[col, ival2] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing[col, ival1] - * elif ival1 != ival2: + /* "Orange/distance/_distance.pyx":54 + * ival1, ival2 = int(val1), int(val2) + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2[col] + * else: */ - __pyx_t_18 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_18) { + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":51 - * d += dist_missing[col, ival2] - * elif npy_isnan(val2): - * d += dist_missing[col, ival1] # <<<<<<<<<<<<<< - * elif ival1 != ival2: - * d += 1 + /* "Orange/distance/_distance.pyx":57 + * d += dist_missing2[col] + * else: + * d += dist_missing[col, ival2] # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * d += dist_missing[col, ival1] */ - __pyx_t_22 = __pyx_v_col; - __pyx_t_23 = __pyx_v_ival1; - __pyx_v_d = (__pyx_v_d + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dist_missing.data + __pyx_t_22 * __pyx_v_dist_missing.strides[0]) ) + __pyx_t_23 * __pyx_v_dist_missing.strides[1]) )))); + /*else*/ { + __pyx_t_28 = __pyx_v_col; + __pyx_t_29 = __pyx_v_ival2; + __pyx_v_d = (__pyx_v_d + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dist_missing.data + __pyx_t_28 * __pyx_v_dist_missing.strides[0]) ) + __pyx_t_29 * __pyx_v_dist_missing.strides[1]) )))); + } + __pyx_L17:; - /* "Orange/distance/_distance.pyx":50 - * else: - * d += dist_missing[col, ival2] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing[col, ival1] - * elif ival1 != ival2: + /* "Orange/distance/_distance.pyx":53 + * val1, val2 = x1[row1, col], x2[row2, col] + * ival1, ival2 = int(val1), int(val2) + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2[col] */ - goto __pyx_L12; - } + goto __pyx_L16; + } - /* "Orange/distance/_distance.pyx":52 - * elif npy_isnan(val2): - * d += dist_missing[col, ival1] - * elif ival1 != ival2: # <<<<<<<<<<<<<< - * d += 1 - * distances[row1, row2] += d + /* "Orange/distance/_distance.pyx":58 + * else: + * d += dist_missing[col, ival2] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing[col, ival1] + * elif ival1 != ival2: */ - __pyx_t_18 = ((__pyx_v_ival1 != __pyx_v_ival2) != 0); - if (__pyx_t_18) { + __pyx_t_26 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_26) { - /* "Orange/distance/_distance.pyx":53 - * d += dist_missing[col, ival1] - * elif ival1 != ival2: - * d += 1 # <<<<<<<<<<<<<< - * distances[row1, row2] += d + /* "Orange/distance/_distance.pyx":59 + * d += dist_missing[col, ival2] + * elif npy_isnan(val2): + * d += dist_missing[col, ival1] # <<<<<<<<<<<<<< + * elif ival1 != ival2: + * d += 1 + */ + __pyx_t_30 = __pyx_v_col; + __pyx_t_31 = __pyx_v_ival1; + __pyx_v_d = (__pyx_v_d + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dist_missing.data + __pyx_t_30 * __pyx_v_dist_missing.strides[0]) ) + __pyx_t_31 * __pyx_v_dist_missing.strides[1]) )))); + + /* "Orange/distance/_distance.pyx":58 + * else: + * d += dist_missing[col, ival2] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing[col, ival1] + * elif ival1 != ival2: + */ + goto __pyx_L16; + } + + /* "Orange/distance/_distance.pyx":60 + * elif npy_isnan(val2): + * d += dist_missing[col, ival1] + * elif ival1 != ival2: # <<<<<<<<<<<<<< + * d += 1 + * distances[row1, row2] += d + */ + __pyx_t_26 = ((__pyx_v_ival1 != __pyx_v_ival2) != 0); + if (__pyx_t_26) { + + /* "Orange/distance/_distance.pyx":61 + * d += dist_missing[col, ival1] + * elif ival1 != ival2: + * d += 1 # <<<<<<<<<<<<<< + * distances[row1, row2] += d * */ - __pyx_v_d = (__pyx_v_d + 1.0); + __pyx_v_d = (__pyx_v_d + 1.0); - /* "Orange/distance/_distance.pyx":52 - * elif npy_isnan(val2): - * d += dist_missing[col, ival1] - * elif ival1 != ival2: # <<<<<<<<<<<<<< - * d += 1 - * distances[row1, row2] += d + /* "Orange/distance/_distance.pyx":60 + * elif npy_isnan(val2): + * d += dist_missing[col, ival1] + * elif ival1 != ival2: # <<<<<<<<<<<<<< + * d += 1 + * distances[row1, row2] += d */ + } + __pyx_L16:; } - __pyx_L12:; - } - /* "Orange/distance/_distance.pyx":54 - * elif ival1 != ival2: - * d += 1 - * distances[row1, row2] += d # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":62 + * elif ival1 != ival2: + * d += 1 + * distances[row1, row2] += d # <<<<<<<<<<<<<< * * */ - __pyx_t_24 = __pyx_v_row1; - __pyx_t_25 = __pyx_v_row2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_distances.diminfo[1].strides) += __pyx_v_d; + __pyx_t_32 = __pyx_v_row1; + __pyx_t_33 = __pyx_v_row2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_distances.diminfo[1].strides) += __pyx_v_d; + } + } + + /* "Orange/distance/_distance.pyx":47 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; } - } } + } - /* "Orange/distance/_distance.pyx":38 - * n_rows1, n_cols = x1.shape[0], x1.shape[1] + /* "Orange/distance/_distance.pyx":44 * n_rows2 = x2.shape[0] - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":25 + /* "Orange/distance/_distance.pyx":29 * * * def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -3152,6 +3657,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -3176,7 +3686,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( return __pyx_r; } -/* "Orange/distance/_distance.pyx":57 +/* "Orange/distance/_distance.pyx":65 * * * def fix_euclidean_rows( # <<<<<<<<<<<<<< @@ -3186,8 +3696,8 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_4fix_euclidean_rows[] = "fix_euclidean_rows(ndarray distances, ndarray x1, ndarray x2, ndarray means, ndarray vars, ndarray dist_missing2, char two_tables)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_5fix_euclidean_rows = {"fix_euclidean_rows", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_4fix_euclidean_rows}; +static char __pyx_doc_6Orange_8distance_9_distance_4fix_euclidean_rows[] = "fix_euclidean_rows(ndarray distances, ndarray x1, ndarray x2, ndarray means, ndarray vars, ndarray dist_missing2, char two_tables, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_5fix_euclidean_rows = {"fix_euclidean_rows", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_4fix_euclidean_rows}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_distances = 0; PyArrayObject *__pyx_v_x1 = 0; @@ -3196,16 +3706,19 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObj PyArrayObject *__pyx_v_vars = 0; PyArrayObject *__pyx_v_dist_missing2 = 0; char __pyx_v_two_tables; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fix_euclidean_rows (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_means,&__pyx_n_s_vars,&__pyx_n_s_dist_missing2,&__pyx_n_s_two_tables,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_means,&__pyx_n_s_vars,&__pyx_n_s_dist_missing2,&__pyx_n_s_two_tables,&__pyx_n_s_callback,0}; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -3232,43 +3745,49 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObj case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 7, 7, 1); __PYX_ERR(0, 57, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 1); __PYX_ERR(0, 65, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 7, 7, 2); __PYX_ERR(0, 57, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 2); __PYX_ERR(0, 65, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_means)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 7, 7, 3); __PYX_ERR(0, 57, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 3); __PYX_ERR(0, 65, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vars)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 7, 7, 4); __PYX_ERR(0, 57, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 4); __PYX_ERR(0, 65, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 7, 7, 5); __PYX_ERR(0, 57, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 5); __PYX_ERR(0, 65, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 7, 7, 6); __PYX_ERR(0, 57, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 6); __PYX_ERR(0, 65, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 7); __PYX_ERR(0, 65, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_rows") < 0)) __PYX_ERR(0, 57, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_rows") < 0)) __PYX_ERR(0, 65, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -3278,6 +3797,7 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObj values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + values[7] = PyTuple_GET_ITEM(__pyx_args, 7); } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x1 = ((PyArrayObject *)values[1]); @@ -3285,23 +3805,24 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObj __pyx_v_means = ((PyArrayObject *)values[3]); __pyx_v_vars = ((PyArrayObject *)values[4]); __pyx_v_dist_missing2 = ((PyArrayObject *)values[5]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 64, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L3_error) + __pyx_v_callback = values[7]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 57, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 65, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_euclidean_rows", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 58, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 59, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 60, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_means), __pyx_ptype_5numpy_ndarray, 1, "means", 0))) __PYX_ERR(0, 61, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vars), __pyx_ptype_5numpy_ndarray, 1, "vars", 0))) __PYX_ERR(0, 62, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 63, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_means, __pyx_v_vars, __pyx_v_dist_missing2, __pyx_v_two_tables); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 66, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 67, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 68, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_means), __pyx_ptype_5numpy_ndarray, 1, "means", 0))) __PYX_ERR(0, 69, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vars), __pyx_ptype_5numpy_ndarray, 1, "vars", 0))) __PYX_ERR(0, 70, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_means, __pyx_v_vars, __pyx_v_dist_missing2, __pyx_v_two_tables, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -3312,16 +3833,18 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObj return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_means, PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_means, PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables, PyObject *__pyx_v_callback) { int __pyx_v_n_rows1; int __pyx_v_n_rows2; int __pyx_v_n_cols; int __pyx_v_row1; int __pyx_v_row2; int __pyx_v_col; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; + long __pyx_v_row_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_dist_missing2; __Pyx_Buffer __pyx_pybuffer_dist_missing2; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; @@ -3338,33 +3861,41 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - __pyx_t_5numpy_float64_t __pyx_t_17; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - __pyx_t_5numpy_float64_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; Py_ssize_t __pyx_t_23; Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; + __pyx_t_5numpy_float64_t __pyx_t_25; Py_ssize_t __pyx_t_26; Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; + __pyx_t_5numpy_float64_t __pyx_t_28; Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; + Py_ssize_t __pyx_t_34; + Py_ssize_t __pyx_t_35; + Py_ssize_t __pyx_t_36; + Py_ssize_t __pyx_t_37; __Pyx_RefNannySetupContext("fix_euclidean_rows", 0); __pyx_pybuffer_distances.pybuffer.buf = NULL; __pyx_pybuffer_distances.refcount = 0; @@ -3392,329 +3923,459 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_pybuffernd_dist_missing2.rcbuffer = &__pyx_pybuffer_dist_missing2; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 57, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 65, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 57, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 65, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 57, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 65, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_means.rcbuffer->pybuffer, (PyObject*)__pyx_v_means, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 57, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_means.rcbuffer->pybuffer, (PyObject*)__pyx_v_means, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 65, __pyx_L1_error) } __pyx_pybuffernd_means.diminfo[0].strides = __pyx_pybuffernd_means.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_means.diminfo[0].shape = __pyx_pybuffernd_means.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vars.rcbuffer->pybuffer, (PyObject*)__pyx_v_vars, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 57, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vars.rcbuffer->pybuffer, (PyObject*)__pyx_v_vars, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 65, __pyx_L1_error) } __pyx_pybuffernd_vars.diminfo[0].strides = __pyx_pybuffernd_vars.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vars.diminfo[0].shape = __pyx_pybuffernd_vars.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 57, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 65, __pyx_L1_error) } __pyx_pybuffernd_dist_missing2.diminfo[0].strides = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dist_missing2.diminfo[0].shape = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":69 + /* "Orange/distance/_distance.pyx":78 * double val1, val2, d * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< * n_rows2 = x2.shape[0] - * with nogil: + * step = max(n_rows1 // 100, 100) */ __pyx_t_1 = (__pyx_v_x1->dimensions[0]); __pyx_t_2 = (__pyx_v_x1->dimensions[1]); __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":70 + /* "Orange/distance/_distance.pyx":79 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< - * with nogil: - * for row1 in range(n_rows1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":71 + /* "Orange/distance/_distance.pyx":80 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":72 + /* "Orange/distance/_distance.pyx":81 * n_rows2 = x2.shape[0] - * with nogil: - * for row1 in range(n_rows1): # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): - */ - __pyx_t_3 = __pyx_v_n_rows1; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_row1 = __pyx_t_5; - - /* "Orange/distance/_distance.pyx":73 - * with nogil: - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * if npy_isnan(distances[row1, row2]): - * d = 0 - */ - if ((__pyx_v_two_tables != 0)) { - __pyx_t_6 = __pyx_v_n_rows2; - } else { - __pyx_t_6 = __pyx_v_row1; - } - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_row2 = __pyx_t_8; - - /* "Orange/distance/_distance.pyx":74 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - __pyx_t_9 = __pyx_v_row1; - __pyx_t_10 = __pyx_v_row2; - __pyx_t_11 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); - if (__pyx_t_11) { - - /* "Orange/distance/_distance.pyx":75 - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): - * d = 0 # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 81, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 81, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 81, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_10(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 81, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_row_start = __pyx_t_5; + + /* "Orange/distance/_distance.pyx":82 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: */ - __pyx_v_d = 0.0; + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":76 - * if npy_isnan(distances[row1, row2]): - * d = 0 - * for col in range(n_cols): # <<<<<<<<<<<<<< - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): + /* "Orange/distance/_distance.pyx":83 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): */ - __pyx_t_12 = __pyx_v_n_cols; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_col = __pyx_t_14; + __pyx_t_13 = __pyx_v_n_rows1; + __pyx_t_5 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_13 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_13; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_13 = __pyx_v_row_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { + __pyx_v_row1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":77 - * d = 0 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":84 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): */ - __pyx_t_15 = __pyx_v_row1; - __pyx_t_16 = __pyx_v_col; - __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x1.diminfo[1].strides)); - __pyx_t_18 = __pyx_v_row2; - __pyx_t_19 = __pyx_v_col; - __pyx_t_20 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x2.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_17; - __pyx_v_val2 = __pyx_t_20; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":78 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2[col] + /* "Orange/distance/_distance.pyx":85 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * if npy_isnan(distances[row1, row2]): + * d = 0 */ - __pyx_t_11 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_11) { + if ((__pyx_v_two_tables != 0)) { + __pyx_t_14 = __pyx_v_n_rows2; + } else { + __pyx_t_14 = __pyx_v_row1; + } + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_row2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":79 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2[col] - * else: + /* "Orange/distance/_distance.pyx":86 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_17 = __pyx_v_row1; + __pyx_t_18 = __pyx_v_row2; + __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":80 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += dist_missing2[col] # <<<<<<<<<<<<<< - * else: - * d += (val2 - means[col]) ** 2 + vars[col] + /* "Orange/distance/_distance.pyx":87 + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): + * d = 0 # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] */ - __pyx_t_21 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_dist_missing2.diminfo[0].strides))); + __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":79 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2[col] - * else: + /* "Orange/distance/_distance.pyx":88 + * if npy_isnan(distances[row1, row2]): + * d = 0 + * for col in range(n_cols): # <<<<<<<<<<<<<< + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): */ - goto __pyx_L14; - } + __pyx_t_20 = __pyx_v_n_cols; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_col = __pyx_t_22; - /* "Orange/distance/_distance.pyx":82 - * d += dist_missing2[col] - * else: - * d += (val2 - means[col]) ** 2 + vars[col] # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * d += (val1 - means[col]) ** 2 + vars[col] + /* "Orange/distance/_distance.pyx":89 + * d = 0 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - /*else*/ { - __pyx_t_22 = __pyx_v_col; - __pyx_t_23 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val2 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_means.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_means.diminfo[0].strides))), 2.0) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_vars.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_vars.diminfo[0].strides)))); - } - __pyx_L14:; + __pyx_t_23 = __pyx_v_row1; + __pyx_t_24 = __pyx_v_col; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x1.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row2; + __pyx_t_27 = __pyx_v_col; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x2.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; + + /* "Orange/distance/_distance.pyx":90 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2[col] + */ + __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":78 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2[col] + /* "Orange/distance/_distance.pyx":91 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2[col] + * else: */ - goto __pyx_L13; - } + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { + + /* "Orange/distance/_distance.pyx":92 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += dist_missing2[col] # <<<<<<<<<<<<<< + * else: + * d += (val2 - means[col]) ** 2 + vars[col] + */ + __pyx_t_29 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_dist_missing2.diminfo[0].strides))); + + /* "Orange/distance/_distance.pyx":91 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2[col] + * else: + */ + goto __pyx_L18; + } - /* "Orange/distance/_distance.pyx":83 + /* "Orange/distance/_distance.pyx":94 + * d += dist_missing2[col] + * else: + * d += (val2 - means[col]) ** 2 + vars[col] # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * d += (val1 - means[col]) ** 2 + vars[col] + */ + /*else*/ { + __pyx_t_30 = __pyx_v_col; + __pyx_t_31 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val2 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_means.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_means.diminfo[0].strides))), 2.0) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_vars.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_vars.diminfo[0].strides)))); + } + __pyx_L18:; + + /* "Orange/distance/_distance.pyx":90 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2[col] + */ + goto __pyx_L17; + } + + /* "Orange/distance/_distance.pyx":95 + * else: + * d += (val2 - means[col]) ** 2 + vars[col] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += (val1 - means[col]) ** 2 + vars[col] * else: - * d += (val2 - means[col]) ** 2 + vars[col] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += (val1 - means[col]) ** 2 + vars[col] - * else: */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":84 - * d += (val2 - means[col]) ** 2 + vars[col] - * elif npy_isnan(val2): - * d += (val1 - means[col]) ** 2 + vars[col] # <<<<<<<<<<<<<< - * else: - * d += (val1 - val2) ** 2 + /* "Orange/distance/_distance.pyx":96 + * d += (val2 - means[col]) ** 2 + vars[col] + * elif npy_isnan(val2): + * d += (val1 - means[col]) ** 2 + vars[col] # <<<<<<<<<<<<<< + * else: + * d += (val1 - val2) ** 2 */ - __pyx_t_24 = __pyx_v_col; - __pyx_t_25 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val1 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_means.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_means.diminfo[0].strides))), 2.0) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_vars.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_vars.diminfo[0].strides)))); + __pyx_t_32 = __pyx_v_col; + __pyx_t_33 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val1 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_means.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_means.diminfo[0].strides))), 2.0) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_vars.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_vars.diminfo[0].strides)))); - /* "Orange/distance/_distance.pyx":83 + /* "Orange/distance/_distance.pyx":95 + * else: + * d += (val2 - means[col]) ** 2 + vars[col] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += (val1 - means[col]) ** 2 + vars[col] * else: - * d += (val2 - means[col]) ** 2 + vars[col] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += (val1 - means[col]) ** 2 + vars[col] - * else: */ - goto __pyx_L13; - } + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":86 - * d += (val1 - means[col]) ** 2 + vars[col] - * else: - * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< - * distances[row1, row2] = d - * if not two_tables: + /* "Orange/distance/_distance.pyx":98 + * d += (val1 - means[col]) ** 2 + vars[col] + * else: + * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< + * distances[row1, row2] = d + * if not two_tables: */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + /*else*/ { + __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + } + __pyx_L17:; } - __pyx_L13:; - } - /* "Orange/distance/_distance.pyx":87 - * else: - * d += (val1 - val2) ** 2 - * distances[row1, row2] = d # <<<<<<<<<<<<<< - * if not two_tables: - * distances[row2, row1] = d + /* "Orange/distance/_distance.pyx":99 + * else: + * d += (val1 - val2) ** 2 + * distances[row1, row2] = d # <<<<<<<<<<<<<< + * if not two_tables: + * distances[row2, row1] = d */ - __pyx_t_26 = __pyx_v_row1; - __pyx_t_27 = __pyx_v_row2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_34 = __pyx_v_row1; + __pyx_t_35 = __pyx_v_row2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":88 - * d += (val1 - val2) ** 2 - * distances[row1, row2] = d - * if not two_tables: # <<<<<<<<<<<<<< - * distances[row2, row1] = d + /* "Orange/distance/_distance.pyx":100 + * d += (val1 - val2) ** 2 + * distances[row1, row2] = d + * if not two_tables: # <<<<<<<<<<<<<< + * distances[row2, row1] = d * */ - __pyx_t_11 = ((!(__pyx_v_two_tables != 0)) != 0); - if (__pyx_t_11) { + __pyx_t_19 = ((!(__pyx_v_two_tables != 0)) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":89 - * distances[row1, row2] = d - * if not two_tables: - * distances[row2, row1] = d # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":101 + * distances[row1, row2] = d + * if not two_tables: + * distances[row2, row1] = d # <<<<<<<<<<<<<< * * */ - __pyx_t_28 = __pyx_v_row2; - __pyx_t_29 = __pyx_v_row1; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_36 = __pyx_v_row2; + __pyx_t_37 = __pyx_v_row1; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":88 - * d += (val1 - val2) ** 2 - * distances[row1, row2] = d - * if not two_tables: # <<<<<<<<<<<<<< - * distances[row2, row1] = d + /* "Orange/distance/_distance.pyx":100 + * d += (val1 - val2) ** 2 + * distances[row1, row2] = d + * if not two_tables: # <<<<<<<<<<<<<< + * distances[row2, row1] = d * */ - } + } - /* "Orange/distance/_distance.pyx":74 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":86 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ + } } } - } + + /* "Orange/distance/_distance.pyx":84 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; + } } + } - /* "Orange/distance/_distance.pyx":71 - * n_rows1, n_cols = x1.shape[0], x1.shape[1] + /* "Orange/distance/_distance.pyx":81 * n_rows2 = x2.shape[0] - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":57 + /* "Orange/distance/_distance.pyx":65 * * * def fix_euclidean_rows( # <<<<<<<<<<<<<< @@ -3726,6 +4387,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -3753,7 +4419,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO return __pyx_r; } -/* "Orange/distance/_distance.pyx":92 +/* "Orange/distance/_distance.pyx":104 * * * def fix_euclidean_rows_normalized( # <<<<<<<<<<<<<< @@ -3763,8 +4429,8 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized[] = "fix_euclidean_rows_normalized(ndarray distances, ndarray x1, ndarray x2, ndarray means, ndarray vars, ndarray dist_missing2, char two_tables)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized = {"fix_euclidean_rows_normalized", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized}; +static char __pyx_doc_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized[] = "fix_euclidean_rows_normalized(ndarray distances, ndarray x1, ndarray x2, ndarray means, ndarray vars, ndarray dist_missing2, char two_tables, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized = {"fix_euclidean_rows_normalized", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_distances = 0; PyArrayObject *__pyx_v_x1 = 0; @@ -3773,16 +4439,19 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_norma CYTHON_UNUSED PyArrayObject *__pyx_v_vars = 0; PyArrayObject *__pyx_v_dist_missing2 = 0; char __pyx_v_two_tables; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fix_euclidean_rows_normalized (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_means,&__pyx_n_s_vars,&__pyx_n_s_dist_missing2,&__pyx_n_s_two_tables,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_means,&__pyx_n_s_vars,&__pyx_n_s_dist_missing2,&__pyx_n_s_two_tables,&__pyx_n_s_callback,0}; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -3809,43 +4478,49 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_norma case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 7, 7, 1); __PYX_ERR(0, 92, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 1); __PYX_ERR(0, 104, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 7, 7, 2); __PYX_ERR(0, 92, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 2); __PYX_ERR(0, 104, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_means)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 7, 7, 3); __PYX_ERR(0, 92, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 3); __PYX_ERR(0, 104, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vars)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 7, 7, 4); __PYX_ERR(0, 92, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 4); __PYX_ERR(0, 104, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 7, 7, 5); __PYX_ERR(0, 92, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 5); __PYX_ERR(0, 104, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 7, 7, 6); __PYX_ERR(0, 92, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 6); __PYX_ERR(0, 104, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 7); __PYX_ERR(0, 104, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_rows_normalized") < 0)) __PYX_ERR(0, 92, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_rows_normalized") < 0)) __PYX_ERR(0, 104, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -3855,6 +4530,7 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_norma values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + values[7] = PyTuple_GET_ITEM(__pyx_args, 7); } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x1 = ((PyArrayObject *)values[1]); @@ -3862,23 +4538,24 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_norma __pyx_v_means = ((PyArrayObject *)values[3]); __pyx_v_vars = ((PyArrayObject *)values[4]); __pyx_v_dist_missing2 = ((PyArrayObject *)values[5]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 99, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L3_error) + __pyx_v_callback = values[7]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 92, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 104, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_euclidean_rows_normalized", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 93, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 94, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 95, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_means), __pyx_ptype_5numpy_ndarray, 1, "means", 0))) __PYX_ERR(0, 96, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vars), __pyx_ptype_5numpy_ndarray, 1, "vars", 0))) __PYX_ERR(0, 97, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 98, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_means, __pyx_v_vars, __pyx_v_dist_missing2, __pyx_v_two_tables); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 105, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 106, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 107, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_means), __pyx_ptype_5numpy_ndarray, 1, "means", 0))) __PYX_ERR(0, 108, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vars), __pyx_ptype_5numpy_ndarray, 1, "vars", 0))) __PYX_ERR(0, 109, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_means, __pyx_v_vars, __pyx_v_dist_missing2, __pyx_v_two_tables, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -3889,16 +4566,18 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_norma return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, CYTHON_UNUSED PyArrayObject *__pyx_v_means, CYTHON_UNUSED PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, CYTHON_UNUSED PyArrayObject *__pyx_v_means, CYTHON_UNUSED PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables, PyObject *__pyx_v_callback) { int __pyx_v_n_rows1; int __pyx_v_n_rows2; int __pyx_v_n_cols; int __pyx_v_row1; int __pyx_v_row2; int __pyx_v_col; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; + long __pyx_v_row_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_dist_missing2; __Pyx_Buffer __pyx_pybuffer_dist_missing2; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; @@ -3915,29 +4594,37 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - __pyx_t_5numpy_float64_t __pyx_t_17; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - __pyx_t_5numpy_float64_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; Py_ssize_t __pyx_t_23; Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; + __pyx_t_5numpy_float64_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + __pyx_t_5numpy_float64_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; __Pyx_RefNannySetupContext("fix_euclidean_rows_normalized", 0); __pyx_pybuffer_distances.pybuffer.buf = NULL; __pyx_pybuffer_distances.refcount = 0; @@ -3965,325 +4652,455 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_pybuffernd_dist_missing2.rcbuffer = &__pyx_pybuffer_dist_missing2; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 92, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 104, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 92, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 104, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 92, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 104, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_means.rcbuffer->pybuffer, (PyObject*)__pyx_v_means, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 92, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_means.rcbuffer->pybuffer, (PyObject*)__pyx_v_means, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 104, __pyx_L1_error) } __pyx_pybuffernd_means.diminfo[0].strides = __pyx_pybuffernd_means.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_means.diminfo[0].shape = __pyx_pybuffernd_means.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vars.rcbuffer->pybuffer, (PyObject*)__pyx_v_vars, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 92, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vars.rcbuffer->pybuffer, (PyObject*)__pyx_v_vars, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 104, __pyx_L1_error) } __pyx_pybuffernd_vars.diminfo[0].strides = __pyx_pybuffernd_vars.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vars.diminfo[0].shape = __pyx_pybuffernd_vars.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 92, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 104, __pyx_L1_error) } __pyx_pybuffernd_dist_missing2.diminfo[0].strides = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dist_missing2.diminfo[0].shape = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":104 + /* "Orange/distance/_distance.pyx":117 * double val1, val2, d * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< * n_rows2 = x2.shape[0] - * with nogil: + * step = max(n_rows1 // 100, 100) */ __pyx_t_1 = (__pyx_v_x1->dimensions[0]); __pyx_t_2 = (__pyx_v_x1->dimensions[1]); __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":105 + /* "Orange/distance/_distance.pyx":118 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< - * with nogil: - * for row1 in range(n_rows1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":106 + /* "Orange/distance/_distance.pyx":119 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":107 + /* "Orange/distance/_distance.pyx":120 * n_rows2 = x2.shape[0] - * with nogil: - * for row1 in range(n_rows1): # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - __pyx_t_3 = __pyx_v_n_rows1; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_row1 = __pyx_t_5; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 120, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 120, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 120, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_10(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 120, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_row_start = __pyx_t_5; - /* "Orange/distance/_distance.pyx":108 - * with nogil: - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * if npy_isnan(distances[row1, row2]): - * d = 0 + /* "Orange/distance/_distance.pyx":121 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: */ - if ((__pyx_v_two_tables != 0)) { - __pyx_t_6 = __pyx_v_n_rows2; - } else { - __pyx_t_6 = __pyx_v_row1; - } - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_row2 = __pyx_t_8; + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":109 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":122 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): */ - __pyx_t_9 = __pyx_v_row1; - __pyx_t_10 = __pyx_v_row2; - __pyx_t_11 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); - if (__pyx_t_11) { + __pyx_t_13 = __pyx_v_n_rows1; + __pyx_t_5 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_13 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_13; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_13 = __pyx_v_row_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { + __pyx_v_row1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":110 - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): - * d = 0 # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] + /* "Orange/distance/_distance.pyx":123 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): */ - __pyx_v_d = 0.0; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":111 - * if npy_isnan(distances[row1, row2]): - * d = 0 - * for col in range(n_cols): # <<<<<<<<<<<<<< - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): + /* "Orange/distance/_distance.pyx":124 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * if npy_isnan(distances[row1, row2]): + * d = 0 */ - __pyx_t_12 = __pyx_v_n_cols; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_col = __pyx_t_14; + if ((__pyx_v_two_tables != 0)) { + __pyx_t_14 = __pyx_v_n_rows2; + } else { + __pyx_t_14 = __pyx_v_row1; + } + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_row2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":112 - * d = 0 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":125 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ - __pyx_t_15 = __pyx_v_row1; - __pyx_t_16 = __pyx_v_col; - __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x1.diminfo[1].strides)); - __pyx_t_18 = __pyx_v_row2; - __pyx_t_19 = __pyx_v_col; - __pyx_t_20 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x2.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_17; - __pyx_v_val2 = __pyx_t_20; + __pyx_t_17 = __pyx_v_row1; + __pyx_t_18 = __pyx_v_row2; + __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":113 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2[col] + /* "Orange/distance/_distance.pyx":126 + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): + * d = 0 # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] */ - __pyx_t_11 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_11) { + __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":114 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2[col] - * else: + /* "Orange/distance/_distance.pyx":127 + * if npy_isnan(distances[row1, row2]): + * d = 0 + * for col in range(n_cols): # <<<<<<<<<<<<<< + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_20 = __pyx_v_n_cols; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_col = __pyx_t_22; - /* "Orange/distance/_distance.pyx":115 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += dist_missing2[col] # <<<<<<<<<<<<<< - * else: - * d += val2 ** 2 + 0.5 + /* "Orange/distance/_distance.pyx":128 + * d = 0 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - __pyx_t_21 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_dist_missing2.diminfo[0].strides))); + __pyx_t_23 = __pyx_v_row1; + __pyx_t_24 = __pyx_v_col; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x1.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row2; + __pyx_t_27 = __pyx_v_col; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x2.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; + + /* "Orange/distance/_distance.pyx":129 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2[col] + */ + __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":114 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2[col] - * else: + /* "Orange/distance/_distance.pyx":130 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2[col] + * else: */ - goto __pyx_L14; - } + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":117 - * d += dist_missing2[col] - * else: - * d += val2 ** 2 + 0.5 # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * d += val1 ** 2 + 0.5 + /* "Orange/distance/_distance.pyx":131 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += dist_missing2[col] # <<<<<<<<<<<<<< + * else: + * d += val2 ** 2 + 0.5 */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val2, 2.0) + 0.5)); - } - __pyx_L14:; + __pyx_t_29 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_dist_missing2.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":113 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2[col] + /* "Orange/distance/_distance.pyx":130 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2[col] + * else: */ - goto __pyx_L13; - } + goto __pyx_L18; + } + + /* "Orange/distance/_distance.pyx":133 + * d += dist_missing2[col] + * else: + * d += val2 ** 2 + 0.5 # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * d += val1 ** 2 + 0.5 + */ + /*else*/ { + __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val2, 2.0) + 0.5)); + } + __pyx_L18:; + + /* "Orange/distance/_distance.pyx":129 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2[col] + */ + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":118 + /* "Orange/distance/_distance.pyx":134 + * else: + * d += val2 ** 2 + 0.5 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += val1 ** 2 + 0.5 * else: - * d += val2 ** 2 + 0.5 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += val1 ** 2 + 0.5 - * else: */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":119 - * d += val2 ** 2 + 0.5 - * elif npy_isnan(val2): - * d += val1 ** 2 + 0.5 # <<<<<<<<<<<<<< - * else: - * d += (val1 - val2) ** 2 + /* "Orange/distance/_distance.pyx":135 + * d += val2 ** 2 + 0.5 + * elif npy_isnan(val2): + * d += val1 ** 2 + 0.5 # <<<<<<<<<<<<<< + * else: + * d += (val1 - val2) ** 2 */ - __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val1, 2.0) + 0.5)); + __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val1, 2.0) + 0.5)); - /* "Orange/distance/_distance.pyx":118 + /* "Orange/distance/_distance.pyx":134 + * else: + * d += val2 ** 2 + 0.5 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += val1 ** 2 + 0.5 * else: - * d += val2 ** 2 + 0.5 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += val1 ** 2 + 0.5 - * else: */ - goto __pyx_L13; - } + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":121 - * d += val1 ** 2 + 0.5 - * else: - * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< - * distances[row1, row2] = d - * if not two_tables: + /* "Orange/distance/_distance.pyx":137 + * d += val1 ** 2 + 0.5 + * else: + * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< + * distances[row1, row2] = d + * if not two_tables: */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + /*else*/ { + __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + } + __pyx_L17:; } - __pyx_L13:; - } - /* "Orange/distance/_distance.pyx":122 - * else: - * d += (val1 - val2) ** 2 - * distances[row1, row2] = d # <<<<<<<<<<<<<< - * if not two_tables: - * distances[row2, row1] = d + /* "Orange/distance/_distance.pyx":138 + * else: + * d += (val1 - val2) ** 2 + * distances[row1, row2] = d # <<<<<<<<<<<<<< + * if not two_tables: + * distances[row2, row1] = d */ - __pyx_t_22 = __pyx_v_row1; - __pyx_t_23 = __pyx_v_row2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_30 = __pyx_v_row1; + __pyx_t_31 = __pyx_v_row2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":123 - * d += (val1 - val2) ** 2 - * distances[row1, row2] = d - * if not two_tables: # <<<<<<<<<<<<<< - * distances[row2, row1] = d + /* "Orange/distance/_distance.pyx":139 + * d += (val1 - val2) ** 2 + * distances[row1, row2] = d + * if not two_tables: # <<<<<<<<<<<<<< + * distances[row2, row1] = d * */ - __pyx_t_11 = ((!(__pyx_v_two_tables != 0)) != 0); - if (__pyx_t_11) { + __pyx_t_19 = ((!(__pyx_v_two_tables != 0)) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":124 - * distances[row1, row2] = d - * if not two_tables: - * distances[row2, row1] = d # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":140 + * distances[row1, row2] = d + * if not two_tables: + * distances[row2, row1] = d # <<<<<<<<<<<<<< * * */ - __pyx_t_24 = __pyx_v_row2; - __pyx_t_25 = __pyx_v_row1; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_32 = __pyx_v_row2; + __pyx_t_33 = __pyx_v_row1; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":123 - * d += (val1 - val2) ** 2 - * distances[row1, row2] = d - * if not two_tables: # <<<<<<<<<<<<<< - * distances[row2, row1] = d + /* "Orange/distance/_distance.pyx":139 + * d += (val1 - val2) ** 2 + * distances[row1, row2] = d + * if not two_tables: # <<<<<<<<<<<<<< + * distances[row2, row1] = d * */ - } + } - /* "Orange/distance/_distance.pyx":109 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":125 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ + } } } - } + + /* "Orange/distance/_distance.pyx":123 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; + } } + } - /* "Orange/distance/_distance.pyx":106 - * n_rows1, n_cols = x1.shape[0], x1.shape[1] + /* "Orange/distance/_distance.pyx":120 * n_rows2 = x2.shape[0] - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":92 + /* "Orange/distance/_distance.pyx":104 * * * def fix_euclidean_rows_normalized( # <<<<<<<<<<<<<< @@ -4295,6 +5112,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -4322,7 +5144,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma return __pyx_r; } -/* "Orange/distance/_distance.pyx":127 +/* "Orange/distance/_distance.pyx":143 * * * def fix_euclidean_cols( # <<<<<<<<<<<<<< @@ -4332,23 +5154,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_9fix_euclidean_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_8fix_euclidean_cols[] = "fix_euclidean_cols(ndarray distances, ndarray x, __Pyx_memviewslice means, __Pyx_memviewslice vars)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_9fix_euclidean_cols = {"fix_euclidean_cols", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_9fix_euclidean_cols, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_8fix_euclidean_cols}; +static char __pyx_doc_6Orange_8distance_9_distance_8fix_euclidean_cols[] = "fix_euclidean_cols(ndarray distances, ndarray x, double[:] means, double[:] vars, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_9fix_euclidean_cols = {"fix_euclidean_cols", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_9fix_euclidean_cols, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_8fix_euclidean_cols}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_9fix_euclidean_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_distances = 0; PyArrayObject *__pyx_v_x = 0; __Pyx_memviewslice __pyx_v_means = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_vars = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fix_euclidean_cols (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x,&__pyx_n_s_means,&__pyx_n_s_vars,0}; - PyObject* values[4] = {0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x,&__pyx_n_s_means,&__pyx_n_s_vars,&__pyx_n_s_callback,0}; + PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -4369,48 +5194,56 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_9fix_euclidean_cols(PyObj case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 4, 4, 1); __PYX_ERR(0, 127, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 1); __PYX_ERR(0, 143, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_means)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 4, 4, 2); __PYX_ERR(0, 127, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 2); __PYX_ERR(0, 143, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vars)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 4, 4, 3); __PYX_ERR(0, 127, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 3); __PYX_ERR(0, 143, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 4); __PYX_ERR(0, 143, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_cols") < 0)) __PYX_ERR(0, 127, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_cols") < 0)) __PYX_ERR(0, 143, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x = ((PyArrayObject *)values[1]); - __pyx_v_means = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_means.memview)) __PYX_ERR(0, 130, __pyx_L3_error) - __pyx_v_vars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vars.memview)) __PYX_ERR(0, 131, __pyx_L3_error) + __pyx_v_means = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_means.memview)) __PYX_ERR(0, 146, __pyx_L3_error) + __pyx_v_vars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vars.memview)) __PYX_ERR(0, 147, __pyx_L3_error) + __pyx_v_callback = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 127, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 143, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_euclidean_cols", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 128, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 129, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(__pyx_self, __pyx_v_distances, __pyx_v_x, __pyx_v_means, __pyx_v_vars); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 144, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(__pyx_self, __pyx_v_distances, __pyx_v_x, __pyx_v_means, __pyx_v_vars, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -4421,15 +5254,17 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_9fix_euclidean_cols(PyObj return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, __Pyx_memviewslice __pyx_v_means, __Pyx_memviewslice __pyx_v_vars) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, __Pyx_memviewslice __pyx_v_means, __Pyx_memviewslice __pyx_v_vars, PyObject *__pyx_v_callback) { int __pyx_v_n_rows; int __pyx_v_n_cols; int __pyx_v_col1; int __pyx_v_col2; int __pyx_v_row; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; + long __pyx_v_col_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; __Pyx_Buffer __pyx_pybuffer_distances; __Pyx_LocalBuf_ND __pyx_pybuffernd_x; @@ -4438,36 +5273,44 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - __pyx_t_5numpy_float64_t __pyx_t_17; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - __pyx_t_5numpy_float64_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; Py_ssize_t __pyx_t_23; Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; + __pyx_t_5numpy_float64_t __pyx_t_25; Py_ssize_t __pyx_t_26; Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; + __pyx_t_5numpy_float64_t __pyx_t_28; Py_ssize_t __pyx_t_29; Py_ssize_t __pyx_t_30; Py_ssize_t __pyx_t_31; Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; + Py_ssize_t __pyx_t_34; + Py_ssize_t __pyx_t_35; + Py_ssize_t __pyx_t_36; + Py_ssize_t __pyx_t_37; + Py_ssize_t __pyx_t_38; + Py_ssize_t __pyx_t_39; + Py_ssize_t __pyx_t_40; __Pyx_RefNannySetupContext("fix_euclidean_cols", 0); __pyx_pybuffer_distances.pybuffer.buf = NULL; __pyx_pybuffer_distances.refcount = 0; @@ -4479,288 +5322,418 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 127, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 143, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 127, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 143, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":136 + /* "Orange/distance/_distance.pyx":153 * double val1, val2, d * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< - * with nogil: - * for col1 in range(n_cols): + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): */ __pyx_t_1 = (__pyx_v_x->dimensions[0]); __pyx_t_2 = (__pyx_v_x->dimensions[1]); __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":137 + /* "Orange/distance/_distance.pyx":154 * * n_rows, n_cols = x.shape[0], x.shape[1] - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * for col2 in range(col1): + * step = max(n_cols // 100, 100) # <<<<<<<<<<<<<< + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_cols / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":138 + /* "Orange/distance/_distance.pyx":155 * n_rows, n_cols = x.shape[0], x.shape[1] - * with nogil: - * for col1 in range(n_cols): # <<<<<<<<<<<<<< - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): */ - __pyx_t_3 = __pyx_v_n_cols; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_col1 = __pyx_t_5; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 155, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 155, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 155, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_10(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 155, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_col_start = __pyx_t_5; - /* "Orange/distance/_distance.pyx":139 - * with nogil: - * for col1 in range(n_cols): - * for col2 in range(col1): # <<<<<<<<<<<<<< - * if npy_isnan(distances[col1, col2]): - * d = 0 + /* "Orange/distance/_distance.pyx":156 + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) # <<<<<<<<<<<<<< + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: */ - __pyx_t_6 = __pyx_v_col1; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_col2 = __pyx_t_8; + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_col_start * 0x64) / __pyx_v_n_cols)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":140 - * for col1 in range(n_cols): - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< - * d = 0 - * for row in range(n_rows): + /* "Orange/distance/_distance.pyx":157 + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): # <<<<<<<<<<<<<< + * with nogil: + * for col2 in range(col1): */ - __pyx_t_9 = __pyx_v_col1; - __pyx_t_10 = __pyx_v_col2; - __pyx_t_11 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); - if (__pyx_t_11) { + __pyx_t_13 = __pyx_v_n_cols; + __pyx_t_5 = (__pyx_v_col_start + __pyx_v_step); + if (((__pyx_t_13 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_13; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_13 = __pyx_v_col_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { + __pyx_v_col1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":141 - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): - * d = 0 # <<<<<<<<<<<<<< - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] + /* "Orange/distance/_distance.pyx":158 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): */ - __pyx_v_d = 0.0; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":142 - * if npy_isnan(distances[col1, col2]): - * d = 0 - * for row in range(n_rows): # <<<<<<<<<<<<<< - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): + /* "Orange/distance/_distance.pyx":159 + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: + * for col2 in range(col1): # <<<<<<<<<<<<<< + * if npy_isnan(distances[col1, col2]): + * d = 0 */ - __pyx_t_12 = __pyx_v_n_rows; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_row = __pyx_t_14; + __pyx_t_14 = __pyx_v_col1; + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_col2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":143 - * d = 0 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":160 + * with nogil: + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< + * d = 0 + * for row in range(n_rows): */ - __pyx_t_15 = __pyx_v_row; - __pyx_t_16 = __pyx_v_col1; - __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_t_18 = __pyx_v_row; - __pyx_t_19 = __pyx_v_col2; - __pyx_t_20 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_17; - __pyx_v_val2 = __pyx_t_20; + __pyx_t_17 = __pyx_v_col1; + __pyx_t_18 = __pyx_v_col2; + __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":144 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += vars[col1] + vars[col2] \ + /* "Orange/distance/_distance.pyx":161 + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): + * d = 0 # <<<<<<<<<<<<<< + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] */ - __pyx_t_11 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_11) { + __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":145 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += vars[col1] + vars[col2] \ - * + (means[col1] - means[col2]) ** 2 + /* "Orange/distance/_distance.pyx":162 + * if npy_isnan(distances[col1, col2]): + * d = 0 + * for row in range(n_rows): # <<<<<<<<<<<<<< + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_20 = __pyx_v_n_rows; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_row = __pyx_t_22; - /* "Orange/distance/_distance.pyx":146 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += vars[col1] + vars[col2] \ # <<<<<<<<<<<<<< - * + (means[col1] - means[col2]) ** 2 - * else: + /* "Orange/distance/_distance.pyx":163 + * d = 0 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - __pyx_t_21 = __pyx_v_col1; - __pyx_t_22 = __pyx_v_col2; + __pyx_t_23 = __pyx_v_row; + __pyx_t_24 = __pyx_v_col1; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row; + __pyx_t_27 = __pyx_v_col2; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; - /* "Orange/distance/_distance.pyx":147 - * if npy_isnan(val2): - * d += vars[col1] + vars[col2] \ - * + (means[col1] - means[col2]) ** 2 # <<<<<<<<<<<<<< - * else: - * d += (val2 - means[col1]) ** 2 + vars[col1] + /* "Orange/distance/_distance.pyx":164 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += vars[col1] + vars[col2] \ */ - __pyx_t_23 = __pyx_v_col1; - __pyx_t_24 = __pyx_v_col2; + __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":146 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += vars[col1] + vars[col2] \ # <<<<<<<<<<<<<< - * + (means[col1] - means[col2]) ** 2 - * else: + /* "Orange/distance/_distance.pyx":165 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += vars[col1] + vars[col2] \ + * + (means[col1] - means[col2]) ** 2 */ - __pyx_v_d = (__pyx_v_d + (((*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_21 * __pyx_v_vars.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_22 * __pyx_v_vars.strides[0]) )))) + pow(((*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_23 * __pyx_v_means.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_24 * __pyx_v_means.strides[0]) )))), 2.0))); + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":145 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += vars[col1] + vars[col2] \ - * + (means[col1] - means[col2]) ** 2 + /* "Orange/distance/_distance.pyx":166 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += vars[col1] + vars[col2] \ # <<<<<<<<<<<<<< + * + (means[col1] - means[col2]) ** 2 + * else: */ - goto __pyx_L14; - } + __pyx_t_29 = __pyx_v_col1; + __pyx_t_30 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":149 - * + (means[col1] - means[col2]) ** 2 - * else: - * d += (val2 - means[col1]) ** 2 + vars[col1] # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * d += (val1 - means[col2]) ** 2 + vars[col2] + /* "Orange/distance/_distance.pyx":167 + * if npy_isnan(val2): + * d += vars[col1] + vars[col2] \ + * + (means[col1] - means[col2]) ** 2 # <<<<<<<<<<<<<< + * else: + * d += (val2 - means[col1]) ** 2 + vars[col1] */ - /*else*/ { - __pyx_t_25 = __pyx_v_col1; - __pyx_t_26 = __pyx_v_col1; - __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val2 - (*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_25 * __pyx_v_means.strides[0]) )))), 2.0) + (*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_26 * __pyx_v_vars.strides[0]) ))))); - } - __pyx_L14:; + __pyx_t_31 = __pyx_v_col1; + __pyx_t_32 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":144 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += vars[col1] + vars[col2] \ + /* "Orange/distance/_distance.pyx":166 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += vars[col1] + vars[col2] \ # <<<<<<<<<<<<<< + * + (means[col1] - means[col2]) ** 2 + * else: */ - goto __pyx_L13; - } + __pyx_v_d = (__pyx_v_d + (((*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_29 * __pyx_v_vars.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_30 * __pyx_v_vars.strides[0]) )))) + pow(((*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_31 * __pyx_v_means.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_32 * __pyx_v_means.strides[0]) )))), 2.0))); - /* "Orange/distance/_distance.pyx":150 - * else: - * d += (val2 - means[col1]) ** 2 + vars[col1] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += (val1 - means[col2]) ** 2 + vars[col2] - * else: + /* "Orange/distance/_distance.pyx":165 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += vars[col1] + vars[col2] \ + * + (means[col1] - means[col2]) ** 2 */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + goto __pyx_L18; + } - /* "Orange/distance/_distance.pyx":151 - * d += (val2 - means[col1]) ** 2 + vars[col1] - * elif npy_isnan(val2): - * d += (val1 - means[col2]) ** 2 + vars[col2] # <<<<<<<<<<<<<< - * else: - * d += (val1 - val2) ** 2 + /* "Orange/distance/_distance.pyx":169 + * + (means[col1] - means[col2]) ** 2 + * else: + * d += (val2 - means[col1]) ** 2 + vars[col1] # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * d += (val1 - means[col2]) ** 2 + vars[col2] */ - __pyx_t_27 = __pyx_v_col2; - __pyx_t_28 = __pyx_v_col2; - __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val1 - (*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_27 * __pyx_v_means.strides[0]) )))), 2.0) + (*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_28 * __pyx_v_vars.strides[0]) ))))); - - /* "Orange/distance/_distance.pyx":150 + /*else*/ { + __pyx_t_33 = __pyx_v_col1; + __pyx_t_34 = __pyx_v_col1; + __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val2 - (*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_33 * __pyx_v_means.strides[0]) )))), 2.0) + (*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_34 * __pyx_v_vars.strides[0]) ))))); + } + __pyx_L18:; + + /* "Orange/distance/_distance.pyx":164 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += vars[col1] + vars[col2] \ + */ + goto __pyx_L17; + } + + /* "Orange/distance/_distance.pyx":170 + * else: + * d += (val2 - means[col1]) ** 2 + vars[col1] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += (val1 - means[col2]) ** 2 + vars[col2] * else: - * d += (val2 - means[col1]) ** 2 + vars[col1] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += (val1 - means[col2]) ** 2 + vars[col2] - * else: */ - goto __pyx_L13; - } + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":153 - * d += (val1 - means[col2]) ** 2 + vars[col2] - * else: - * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< - * distances[col1, col2] = distances[col2, col1] = d + /* "Orange/distance/_distance.pyx":171 + * d += (val2 - means[col1]) ** 2 + vars[col1] + * elif npy_isnan(val2): + * d += (val1 - means[col2]) ** 2 + vars[col2] # <<<<<<<<<<<<<< + * else: + * d += (val1 - val2) ** 2 + */ + __pyx_t_35 = __pyx_v_col2; + __pyx_t_36 = __pyx_v_col2; + __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val1 - (*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_35 * __pyx_v_means.strides[0]) )))), 2.0) + (*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_36 * __pyx_v_vars.strides[0]) ))))); + + /* "Orange/distance/_distance.pyx":170 + * else: + * d += (val2 - means[col1]) ** 2 + vars[col1] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += (val1 - means[col2]) ** 2 + vars[col2] + * else: + */ + goto __pyx_L17; + } + + /* "Orange/distance/_distance.pyx":173 + * d += (val1 - means[col2]) ** 2 + vars[col2] + * else: + * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< + * distances[col1, col2] = distances[col2, col1] = d * */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + /*else*/ { + __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + } + __pyx_L17:; } - __pyx_L13:; - } - /* "Orange/distance/_distance.pyx":154 - * else: - * d += (val1 - val2) ** 2 - * distances[col1, col2] = distances[col2, col1] = d # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":174 + * else: + * d += (val1 - val2) ** 2 + * distances[col1, col2] = distances[col2, col1] = d # <<<<<<<<<<<<<< * * */ - __pyx_t_29 = __pyx_v_col1; - __pyx_t_30 = __pyx_v_col2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - __pyx_t_31 = __pyx_v_col2; - __pyx_t_32 = __pyx_v_col1; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_37 = __pyx_v_col1; + __pyx_t_38 = __pyx_v_col2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_39 = __pyx_v_col2; + __pyx_t_40 = __pyx_v_col1; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":140 - * for col1 in range(n_cols): - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< - * d = 0 - * for row in range(n_rows): + /* "Orange/distance/_distance.pyx":160 + * with nogil: + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< + * d = 0 + * for row in range(n_rows): */ + } } } - } + + /* "Orange/distance/_distance.pyx":158 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; + } } + } - /* "Orange/distance/_distance.pyx":137 - * + /* "Orange/distance/_distance.pyx":155 * n_rows, n_cols = x.shape[0], x.shape[1] - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * for col2 in range(col1): + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":127 + /* "Orange/distance/_distance.pyx":143 * * * def fix_euclidean_cols( # <<<<<<<<<<<<<< @@ -4772,6 +5745,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -4793,7 +5771,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO return __pyx_r; } -/* "Orange/distance/_distance.pyx":157 +/* "Orange/distance/_distance.pyx":177 * * * def fix_euclidean_cols_normalized( # <<<<<<<<<<<<<< @@ -4803,23 +5781,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized[] = "fix_euclidean_cols_normalized(ndarray distances, ndarray x, __Pyx_memviewslice means, __Pyx_memviewslice vars)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized = {"fix_euclidean_cols_normalized", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized}; +static char __pyx_doc_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized[] = "fix_euclidean_cols_normalized(ndarray distances, ndarray x, double[:] means, double[:] vars, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized = {"fix_euclidean_cols_normalized", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_distances = 0; PyArrayObject *__pyx_v_x = 0; CYTHON_UNUSED __Pyx_memviewslice __pyx_v_means = { 0, 0, { 0 }, { 0 }, { 0 } }; CYTHON_UNUSED __Pyx_memviewslice __pyx_v_vars = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fix_euclidean_cols_normalized (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x,&__pyx_n_s_means,&__pyx_n_s_vars,0}; - PyObject* values[4] = {0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x,&__pyx_n_s_means,&__pyx_n_s_vars,&__pyx_n_s_callback,0}; + PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -4840,48 +5821,56 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_11fix_euclidean_cols_norm case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 4, 4, 1); __PYX_ERR(0, 157, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 1); __PYX_ERR(0, 177, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_means)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 4, 4, 2); __PYX_ERR(0, 157, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 2); __PYX_ERR(0, 177, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vars)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 4, 4, 3); __PYX_ERR(0, 157, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 3); __PYX_ERR(0, 177, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 4); __PYX_ERR(0, 177, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_cols_normalized") < 0)) __PYX_ERR(0, 157, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_cols_normalized") < 0)) __PYX_ERR(0, 177, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x = ((PyArrayObject *)values[1]); - __pyx_v_means = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_means.memview)) __PYX_ERR(0, 160, __pyx_L3_error) - __pyx_v_vars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vars.memview)) __PYX_ERR(0, 161, __pyx_L3_error) + __pyx_v_means = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_means.memview)) __PYX_ERR(0, 180, __pyx_L3_error) + __pyx_v_vars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vars.memview)) __PYX_ERR(0, 181, __pyx_L3_error) + __pyx_v_callback = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 157, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 177, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_euclidean_cols_normalized", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 158, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 159, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized(__pyx_self, __pyx_v_distances, __pyx_v_x, __pyx_v_means, __pyx_v_vars); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 178, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 179, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized(__pyx_self, __pyx_v_distances, __pyx_v_x, __pyx_v_means, __pyx_v_vars, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -4892,15 +5881,17 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_11fix_euclidean_cols_norm return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_means, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_vars) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_means, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_vars, PyObject *__pyx_v_callback) { int __pyx_v_n_rows; int __pyx_v_n_cols; int __pyx_v_col1; int __pyx_v_col2; int __pyx_v_row; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; + long __pyx_v_col_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; __Pyx_Buffer __pyx_pybuffer_distances; __Pyx_LocalBuf_ND __pyx_pybuffernd_x; @@ -4909,28 +5900,36 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - __pyx_t_5numpy_float64_t __pyx_t_17; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - __pyx_t_5numpy_float64_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; Py_ssize_t __pyx_t_23; Py_ssize_t __pyx_t_24; + __pyx_t_5numpy_float64_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + __pyx_t_5numpy_float64_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; __Pyx_RefNannySetupContext("fix_euclidean_cols_normalized", 0); __pyx_pybuffer_distances.pybuffer.buf = NULL; __pyx_pybuffer_distances.refcount = 0; @@ -4942,264 +5941,394 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 157, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 177, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 157, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 177, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":166 + /* "Orange/distance/_distance.pyx":187 * double val1, val2, d * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< - * with nogil: - * for col1 in range(n_cols): + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): */ __pyx_t_1 = (__pyx_v_x->dimensions[0]); __pyx_t_2 = (__pyx_v_x->dimensions[1]); __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":167 + /* "Orange/distance/_distance.pyx":188 * * n_rows, n_cols = x.shape[0], x.shape[1] - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * for col2 in range(col1): + * step = max(n_cols // 100, 100) # <<<<<<<<<<<<<< + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_cols / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":168 + /* "Orange/distance/_distance.pyx":189 * n_rows, n_cols = x.shape[0], x.shape[1] - * with nogil: - * for col1 in range(n_cols): # <<<<<<<<<<<<<< - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): */ - __pyx_t_3 = __pyx_v_n_cols; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_col1 = __pyx_t_5; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 189, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 189, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 189, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_10(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 189, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_col_start = __pyx_t_5; - /* "Orange/distance/_distance.pyx":169 - * with nogil: - * for col1 in range(n_cols): - * for col2 in range(col1): # <<<<<<<<<<<<<< - * if npy_isnan(distances[col1, col2]): - * d = 0 + /* "Orange/distance/_distance.pyx":190 + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) # <<<<<<<<<<<<<< + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: */ - __pyx_t_6 = __pyx_v_col1; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_col2 = __pyx_t_8; + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_col_start * 0x64) / __pyx_v_n_cols)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 190, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 190, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":170 - * for col1 in range(n_cols): - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< - * d = 0 - * for row in range(n_rows): + /* "Orange/distance/_distance.pyx":191 + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): # <<<<<<<<<<<<<< + * with nogil: + * for col2 in range(col1): */ - __pyx_t_9 = __pyx_v_col1; - __pyx_t_10 = __pyx_v_col2; - __pyx_t_11 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); - if (__pyx_t_11) { + __pyx_t_13 = __pyx_v_n_cols; + __pyx_t_5 = (__pyx_v_col_start + __pyx_v_step); + if (((__pyx_t_13 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_13; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_13 = __pyx_v_col_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { + __pyx_v_col1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":171 - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): - * d = 0 # <<<<<<<<<<<<<< - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] + /* "Orange/distance/_distance.pyx":192 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): */ - __pyx_v_d = 0.0; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":172 - * if npy_isnan(distances[col1, col2]): - * d = 0 - * for row in range(n_rows): # <<<<<<<<<<<<<< - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): + /* "Orange/distance/_distance.pyx":193 + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: + * for col2 in range(col1): # <<<<<<<<<<<<<< + * if npy_isnan(distances[col1, col2]): + * d = 0 */ - __pyx_t_12 = __pyx_v_n_rows; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_row = __pyx_t_14; + __pyx_t_14 = __pyx_v_col1; + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_col2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":173 - * d = 0 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":194 + * with nogil: + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< + * d = 0 + * for row in range(n_rows): */ - __pyx_t_15 = __pyx_v_row; - __pyx_t_16 = __pyx_v_col1; - __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_t_18 = __pyx_v_row; - __pyx_t_19 = __pyx_v_col2; - __pyx_t_20 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_17; - __pyx_v_val2 = __pyx_t_20; + __pyx_t_17 = __pyx_v_col1; + __pyx_t_18 = __pyx_v_col2; + __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":174 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += 1 + /* "Orange/distance/_distance.pyx":195 + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): + * d = 0 # <<<<<<<<<<<<<< + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] */ - __pyx_t_11 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_11) { + __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":175 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += 1 - * else: + /* "Orange/distance/_distance.pyx":196 + * if npy_isnan(distances[col1, col2]): + * d = 0 + * for row in range(n_rows): # <<<<<<<<<<<<<< + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_20 = __pyx_v_n_rows; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_row = __pyx_t_22; - /* "Orange/distance/_distance.pyx":176 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += 1 # <<<<<<<<<<<<<< - * else: - * d += val2 ** 2 + 0.5 + /* "Orange/distance/_distance.pyx":197 + * d = 0 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - __pyx_v_d = (__pyx_v_d + 1.0); + __pyx_t_23 = __pyx_v_row; + __pyx_t_24 = __pyx_v_col1; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row; + __pyx_t_27 = __pyx_v_col2; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; - /* "Orange/distance/_distance.pyx":175 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += 1 - * else: + /* "Orange/distance/_distance.pyx":198 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += 1 */ - goto __pyx_L14; - } + __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":178 - * d += 1 - * else: - * d += val2 ** 2 + 0.5 # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * d += val1 ** 2 + 0.5 + /* "Orange/distance/_distance.pyx":199 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += 1 + * else: */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val2, 2.0) + 0.5)); - } - __pyx_L14:; + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":174 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += 1 + /* "Orange/distance/_distance.pyx":200 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += 1 # <<<<<<<<<<<<<< + * else: + * d += val2 ** 2 + 0.5 */ - goto __pyx_L13; - } + __pyx_v_d = (__pyx_v_d + 1.0); + + /* "Orange/distance/_distance.pyx":199 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += 1 + * else: + */ + goto __pyx_L18; + } + + /* "Orange/distance/_distance.pyx":202 + * d += 1 + * else: + * d += val2 ** 2 + 0.5 # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * d += val1 ** 2 + 0.5 + */ + /*else*/ { + __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val2, 2.0) + 0.5)); + } + __pyx_L18:; + + /* "Orange/distance/_distance.pyx":198 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += 1 + */ + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":179 + /* "Orange/distance/_distance.pyx":203 + * else: + * d += val2 ** 2 + 0.5 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += val1 ** 2 + 0.5 * else: - * d += val2 ** 2 + 0.5 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += val1 ** 2 + 0.5 - * else: */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":180 - * d += val2 ** 2 + 0.5 - * elif npy_isnan(val2): - * d += val1 ** 2 + 0.5 # <<<<<<<<<<<<<< - * else: - * d += (val1 - val2) ** 2 + /* "Orange/distance/_distance.pyx":204 + * d += val2 ** 2 + 0.5 + * elif npy_isnan(val2): + * d += val1 ** 2 + 0.5 # <<<<<<<<<<<<<< + * else: + * d += (val1 - val2) ** 2 */ - __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val1, 2.0) + 0.5)); + __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val1, 2.0) + 0.5)); - /* "Orange/distance/_distance.pyx":179 + /* "Orange/distance/_distance.pyx":203 + * else: + * d += val2 ** 2 + 0.5 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += val1 ** 2 + 0.5 * else: - * d += val2 ** 2 + 0.5 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += val1 ** 2 + 0.5 - * else: */ - goto __pyx_L13; - } + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":182 - * d += val1 ** 2 + 0.5 - * else: - * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< - * distances[col1, col2] = distances[col2, col1] = d + /* "Orange/distance/_distance.pyx":206 + * d += val1 ** 2 + 0.5 + * else: + * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< + * distances[col1, col2] = distances[col2, col1] = d * */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + /*else*/ { + __pyx_v_d = (__pyx_v_d + pow((__pyx_v_val1 - __pyx_v_val2), 2.0)); + } + __pyx_L17:; } - __pyx_L13:; - } - /* "Orange/distance/_distance.pyx":183 - * else: - * d += (val1 - val2) ** 2 - * distances[col1, col2] = distances[col2, col1] = d # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":207 + * else: + * d += (val1 - val2) ** 2 + * distances[col1, col2] = distances[col2, col1] = d # <<<<<<<<<<<<<< * * */ - __pyx_t_21 = __pyx_v_col1; - __pyx_t_22 = __pyx_v_col2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - __pyx_t_23 = __pyx_v_col2; - __pyx_t_24 = __pyx_v_col1; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_29 = __pyx_v_col1; + __pyx_t_30 = __pyx_v_col2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_31 = __pyx_v_col2; + __pyx_t_32 = __pyx_v_col1; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":170 - * for col1 in range(n_cols): - * for col2 in range(col1): - * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< - * d = 0 - * for row in range(n_rows): + /* "Orange/distance/_distance.pyx":194 + * with nogil: + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< + * d = 0 + * for row in range(n_rows): */ + } } } - } + + /* "Orange/distance/_distance.pyx":192 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * for col2 in range(col1): + * if npy_isnan(distances[col1, col2]): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; + } } + } - /* "Orange/distance/_distance.pyx":167 - * + /* "Orange/distance/_distance.pyx":189 * n_rows, n_cols = x.shape[0], x.shape[1] - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * for col2 in range(col1): + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":157 + /* "Orange/distance/_distance.pyx":177 * * * def fix_euclidean_cols_normalized( # <<<<<<<<<<<<<< @@ -5211,6 +6340,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -5232,7 +6366,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm return __pyx_r; } -/* "Orange/distance/_distance.pyx":186 +/* "Orange/distance/_distance.pyx":210 * * * def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, # <<<<<<<<<<<<<< @@ -5243,7 +6377,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6Orange_8distance_9_distance_12manhattan_rows_cont[] = "manhattan_rows_cont(ndarray x1, ndarray x2, char two_tables)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_13manhattan_rows_cont = {"manhattan_rows_cont", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_12manhattan_rows_cont}; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_13manhattan_rows_cont = {"manhattan_rows_cont", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_12manhattan_rows_cont}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_x1 = 0; PyArrayObject *__pyx_v_x2 = 0; @@ -5276,17 +6410,17 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont(PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 3, 3, 1); __PYX_ERR(0, 186, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 3, 3, 1); __PYX_ERR(0, 210, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 3, 3, 2); __PYX_ERR(0, 186, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 3, 3, 2); __PYX_ERR(0, 210, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "manhattan_rows_cont") < 0)) __PYX_ERR(0, 186, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "manhattan_rows_cont") < 0)) __PYX_ERR(0, 210, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -5297,18 +6431,18 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont(PyO } __pyx_v_x1 = ((PyArrayObject *)values[0]); __pyx_v_x2 = ((PyArrayObject *)values[1]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[2]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[2]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 186, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 210, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.manhattan_rows_cont", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 186, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 187, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 210, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 211, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(__pyx_self, __pyx_v_x1, __pyx_v_x2, __pyx_v_two_tables); /* function exit code */ @@ -5377,16 +6511,16 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT __pyx_pybuffernd_x2.rcbuffer = &__pyx_pybuffer_x2; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 186, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 210, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 186, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 210, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":194 + /* "Orange/distance/_distance.pyx":218 * np.ndarray[np.float64_t, ndim=2] distances * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< @@ -5398,7 +6532,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":195 + /* "Orange/distance/_distance.pyx":219 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< @@ -5407,23 +6541,23 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":196 + /* "Orange/distance/_distance.pyx":220 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) # <<<<<<<<<<<<<< * with nogil: * for row1 in range(n_rows1): */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_rows2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_rows2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); @@ -5431,20 +6565,20 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 196, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 220, __pyx_L1_error) __pyx_t_7 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -5461,13 +6595,13 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT __pyx_t_9 = __pyx_t_10 = __pyx_t_11 = 0; } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 196, __pyx_L1_error) + if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 220, __pyx_L1_error) } __pyx_t_7 = 0; __pyx_v_distances = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "Orange/distance/_distance.pyx":197 + /* "Orange/distance/_distance.pyx":221 * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) * with nogil: # <<<<<<<<<<<<<< @@ -5482,7 +6616,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT #endif /*try:*/ { - /* "Orange/distance/_distance.pyx":198 + /* "Orange/distance/_distance.pyx":222 * distances = np.zeros((n_rows1, n_rows2), dtype=float) * with nogil: * for row1 in range(n_rows1): # <<<<<<<<<<<<<< @@ -5494,7 +6628,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_row1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":199 + /* "Orange/distance/_distance.pyx":223 * with nogil: * for row1 in range(n_rows1): * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< @@ -5510,7 +6644,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { __pyx_v_row2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":200 + /* "Orange/distance/_distance.pyx":224 * for row1 in range(n_rows1): * for row2 in range(n_rows2 if two_tables else row1): * d = 0 # <<<<<<<<<<<<<< @@ -5519,7 +6653,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT */ __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":201 + /* "Orange/distance/_distance.pyx":225 * for row2 in range(n_rows2 if two_tables else row1): * d = 0 * for col in range(n_cols): # <<<<<<<<<<<<<< @@ -5531,7 +6665,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { __pyx_v_col = __pyx_t_19; - /* "Orange/distance/_distance.pyx":202 + /* "Orange/distance/_distance.pyx":226 * d = 0 * for col in range(n_cols): * d += fabs(x1[row1, col] - x2[row2, col]) # <<<<<<<<<<<<<< @@ -5545,7 +6679,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT __pyx_v_d = (__pyx_v_d + fabs(((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x1.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_x2.diminfo[1].strides))))); } - /* "Orange/distance/_distance.pyx":203 + /* "Orange/distance/_distance.pyx":227 * for col in range(n_cols): * d += fabs(x1[row1, col] - x2[row2, col]) * distances[row1, row2] = d # <<<<<<<<<<<<<< @@ -5559,7 +6693,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT } } - /* "Orange/distance/_distance.pyx":197 + /* "Orange/distance/_distance.pyx":221 * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) * with nogil: # <<<<<<<<<<<<<< @@ -5578,7 +6712,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT } } - /* "Orange/distance/_distance.pyx":204 + /* "Orange/distance/_distance.pyx":228 * d += fabs(x1[row1, col] - x2[row2, col]) * distances[row1, row2] = d * return distances # <<<<<<<<<<<<<< @@ -5590,7 +6724,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT __pyx_r = ((PyObject *)__pyx_v_distances); goto __pyx_L0; - /* "Orange/distance/_distance.pyx":186 + /* "Orange/distance/_distance.pyx":210 * * * def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, # <<<<<<<<<<<<<< @@ -5626,7 +6760,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT return __pyx_r; } -/* "Orange/distance/_distance.pyx":206 +/* "Orange/distance/_distance.pyx":230 * return distances * * def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -5637,7 +6771,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6Orange_8distance_9_distance_14fix_manhattan_rows[] = "fix_manhattan_rows(ndarray distances, ndarray x1, ndarray x2, ndarray medians, ndarray mads, ndarray dist_missing2_cont, char two_tables)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_15fix_manhattan_rows = {"fix_manhattan_rows", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_14fix_manhattan_rows}; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_15fix_manhattan_rows = {"fix_manhattan_rows", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_14fix_manhattan_rows}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_distances = 0; PyArrayObject *__pyx_v_x1 = 0; @@ -5682,41 +6816,41 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyOb case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 1); __PYX_ERR(0, 206, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 1); __PYX_ERR(0, 230, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 2); __PYX_ERR(0, 206, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 2); __PYX_ERR(0, 230, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_medians)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 3); __PYX_ERR(0, 206, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 3); __PYX_ERR(0, 230, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 4); __PYX_ERR(0, 206, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 4); __PYX_ERR(0, 230, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing2_cont)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 5); __PYX_ERR(0, 206, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 5); __PYX_ERR(0, 230, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 6); __PYX_ERR(0, 206, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 6); __PYX_ERR(0, 230, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_manhattan_rows") < 0)) __PYX_ERR(0, 206, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_manhattan_rows") < 0)) __PYX_ERR(0, 230, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; @@ -5735,22 +6869,22 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyOb __pyx_v_medians = ((PyArrayObject *)values[3]); __pyx_v_mads = ((PyArrayObject *)values[4]); __pyx_v_dist_missing2_cont = ((PyArrayObject *)values[5]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 206, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 230, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_manhattan_rows", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 206, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 207, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 208, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_medians), __pyx_ptype_5numpy_ndarray, 1, "medians", 0))) __PYX_ERR(0, 209, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mads), __pyx_ptype_5numpy_ndarray, 1, "mads", 0))) __PYX_ERR(0, 210, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2_cont), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2_cont", 0))) __PYX_ERR(0, 211, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 230, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 231, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 232, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_medians), __pyx_ptype_5numpy_ndarray, 1, "medians", 0))) __PYX_ERR(0, 233, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mads), __pyx_ptype_5numpy_ndarray, 1, "mads", 0))) __PYX_ERR(0, 234, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2_cont), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2_cont", 0))) __PYX_ERR(0, 235, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_medians, __pyx_v_mads, __pyx_v_dist_missing2_cont, __pyx_v_two_tables); /* function exit code */ @@ -5840,36 +6974,36 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_pybuffernd_dist_missing2_cont.rcbuffer = &__pyx_pybuffer_dist_missing2_cont; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 206, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 230, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 206, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 230, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 206, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 230, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_medians.rcbuffer->pybuffer, (PyObject*)__pyx_v_medians, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 206, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_medians.rcbuffer->pybuffer, (PyObject*)__pyx_v_medians, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 230, __pyx_L1_error) } __pyx_pybuffernd_medians.diminfo[0].strides = __pyx_pybuffernd_medians.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_medians.diminfo[0].shape = __pyx_pybuffernd_medians.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mads.rcbuffer->pybuffer, (PyObject*)__pyx_v_mads, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 206, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mads.rcbuffer->pybuffer, (PyObject*)__pyx_v_mads, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 230, __pyx_L1_error) } __pyx_pybuffernd_mads.diminfo[0].strides = __pyx_pybuffernd_mads.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mads.diminfo[0].shape = __pyx_pybuffernd_mads.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2_cont, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 206, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2_cont, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 230, __pyx_L1_error) } __pyx_pybuffernd_dist_missing2_cont.diminfo[0].strides = __pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dist_missing2_cont.diminfo[0].shape = __pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":217 + /* "Orange/distance/_distance.pyx":241 * double val1, val2, d * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< @@ -5881,7 +7015,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":218 + /* "Orange/distance/_distance.pyx":242 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] if two_tables else 0 # <<<<<<<<<<<<<< @@ -5895,7 +7029,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH } __pyx_v_n_rows2 = __pyx_t_2; - /* "Orange/distance/_distance.pyx":219 + /* "Orange/distance/_distance.pyx":243 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] if two_tables else 0 * with nogil: # <<<<<<<<<<<<<< @@ -5910,7 +7044,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH #endif /*try:*/ { - /* "Orange/distance/_distance.pyx":220 + /* "Orange/distance/_distance.pyx":244 * n_rows2 = x2.shape[0] if two_tables else 0 * with nogil: * for row1 in range(n_rows1): # <<<<<<<<<<<<<< @@ -5922,7 +7056,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_row1 = __pyx_t_5; - /* "Orange/distance/_distance.pyx":221 + /* "Orange/distance/_distance.pyx":245 * with nogil: * for row1 in range(n_rows1): * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< @@ -5938,7 +7072,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_row2 = __pyx_t_8; - /* "Orange/distance/_distance.pyx":222 + /* "Orange/distance/_distance.pyx":246 * for row1 in range(n_rows1): * for row2 in range(n_rows2 if two_tables else row1): * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< @@ -5950,7 +7084,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_t_11 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); if (__pyx_t_11) { - /* "Orange/distance/_distance.pyx":223 + /* "Orange/distance/_distance.pyx":247 * for row2 in range(n_rows2 if two_tables else row1): * if npy_isnan(distances[row1, row2]): * d = 0 # <<<<<<<<<<<<<< @@ -5959,7 +7093,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH */ __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":224 + /* "Orange/distance/_distance.pyx":248 * if npy_isnan(distances[row1, row2]): * d = 0 * for col in range(n_cols): # <<<<<<<<<<<<<< @@ -5971,7 +7105,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { __pyx_v_col = __pyx_t_14; - /* "Orange/distance/_distance.pyx":225 + /* "Orange/distance/_distance.pyx":249 * d = 0 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< @@ -5987,7 +7121,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_v_val1 = __pyx_t_17; __pyx_v_val2 = __pyx_t_20; - /* "Orange/distance/_distance.pyx":226 + /* "Orange/distance/_distance.pyx":250 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -5997,7 +7131,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_t_11 = (npy_isnan(__pyx_v_val1) != 0); if (__pyx_t_11) { - /* "Orange/distance/_distance.pyx":227 + /* "Orange/distance/_distance.pyx":251 * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -6007,7 +7141,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_11) { - /* "Orange/distance/_distance.pyx":228 + /* "Orange/distance/_distance.pyx":252 * if npy_isnan(val1): * if npy_isnan(val2): * d += dist_missing2_cont[col] # <<<<<<<<<<<<<< @@ -6017,7 +7151,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_t_21 = __pyx_v_col; __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_dist_missing2_cont.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":227 + /* "Orange/distance/_distance.pyx":251 * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -6027,7 +7161,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH goto __pyx_L14; } - /* "Orange/distance/_distance.pyx":230 + /* "Orange/distance/_distance.pyx":254 * d += dist_missing2_cont[col] * else: * d += fabs(val2 - medians[col]) + mads[col] # <<<<<<<<<<<<<< @@ -6041,7 +7175,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH } __pyx_L14:; - /* "Orange/distance/_distance.pyx":226 + /* "Orange/distance/_distance.pyx":250 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -6051,7 +7185,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH goto __pyx_L13; } - /* "Orange/distance/_distance.pyx":231 + /* "Orange/distance/_distance.pyx":255 * else: * d += fabs(val2 - medians[col]) + mads[col] * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -6061,7 +7195,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_11) { - /* "Orange/distance/_distance.pyx":232 + /* "Orange/distance/_distance.pyx":256 * d += fabs(val2 - medians[col]) + mads[col] * elif npy_isnan(val2): * d += fabs(val1 - medians[col]) + mads[col] # <<<<<<<<<<<<<< @@ -6072,7 +7206,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_t_25 = __pyx_v_col; __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val1 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_mads.diminfo[0].strides)))); - /* "Orange/distance/_distance.pyx":231 + /* "Orange/distance/_distance.pyx":255 * else: * d += fabs(val2 - medians[col]) + mads[col] * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -6082,7 +7216,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH goto __pyx_L13; } - /* "Orange/distance/_distance.pyx":234 + /* "Orange/distance/_distance.pyx":258 * d += fabs(val1 - medians[col]) + mads[col] * else: * d += fabs(val1 - val2) # <<<<<<<<<<<<<< @@ -6095,7 +7229,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_L13:; } - /* "Orange/distance/_distance.pyx":235 + /* "Orange/distance/_distance.pyx":259 * else: * d += fabs(val1 - val2) * distances[row1, row2] = d # <<<<<<<<<<<<<< @@ -6106,7 +7240,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_t_27 = __pyx_v_row2; *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":222 + /* "Orange/distance/_distance.pyx":246 * for row1 in range(n_rows1): * for row2 in range(n_rows2 if two_tables else row1): * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< @@ -6118,7 +7252,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH } } - /* "Orange/distance/_distance.pyx":219 + /* "Orange/distance/_distance.pyx":243 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] if two_tables else 0 * with nogil: # <<<<<<<<<<<<<< @@ -6137,7 +7271,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH } } - /* "Orange/distance/_distance.pyx":236 + /* "Orange/distance/_distance.pyx":260 * d += fabs(val1 - val2) * distances[row1, row2] = d * return distances # <<<<<<<<<<<<<< @@ -6149,7 +7283,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_r = ((PyObject *)__pyx_v_distances); goto __pyx_L0; - /* "Orange/distance/_distance.pyx":206 + /* "Orange/distance/_distance.pyx":230 * return distances * * def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -6186,7 +7320,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH return __pyx_r; } -/* "Orange/distance/_distance.pyx":239 +/* "Orange/distance/_distance.pyx":263 * * * def fix_manhattan_rows_normalized(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -6197,7 +7331,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized[] = "fix_manhattan_rows_normalized(ndarray distances, ndarray x1, ndarray x2, char two_tables)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized = {"fix_manhattan_rows_normalized", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized}; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized = {"fix_manhattan_rows_normalized", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_distances = 0; PyArrayObject *__pyx_v_x1 = 0; @@ -6233,23 +7367,23 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_norm case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, 1); __PYX_ERR(0, 239, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, 1); __PYX_ERR(0, 263, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, 2); __PYX_ERR(0, 239, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, 2); __PYX_ERR(0, 263, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, 3); __PYX_ERR(0, 239, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, 3); __PYX_ERR(0, 263, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_manhattan_rows_normalized") < 0)) __PYX_ERR(0, 239, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_manhattan_rows_normalized") < 0)) __PYX_ERR(0, 263, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -6262,19 +7396,19 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_norm __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x1 = ((PyArrayObject *)values[1]); __pyx_v_x2 = ((PyArrayObject *)values[2]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[3]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[3]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 266, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 239, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 263, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_manhattan_rows_normalized", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 239, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 240, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 241, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 263, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 264, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 265, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_two_tables); /* function exit code */ @@ -6341,21 +7475,21 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __pyx_pybuffernd_x2.rcbuffer = &__pyx_pybuffer_x2; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 239, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 263, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 239, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 263, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 239, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 263, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":247 + /* "Orange/distance/_distance.pyx":271 * double val1, val2, d * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< @@ -6367,7 +7501,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":248 + /* "Orange/distance/_distance.pyx":272 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] if two_tables else 0 # <<<<<<<<<<<<<< @@ -6381,7 +7515,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm } __pyx_v_n_rows2 = __pyx_t_2; - /* "Orange/distance/_distance.pyx":249 + /* "Orange/distance/_distance.pyx":273 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] if two_tables else 0 * with nogil: # <<<<<<<<<<<<<< @@ -6396,7 +7530,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm #endif /*try:*/ { - /* "Orange/distance/_distance.pyx":250 + /* "Orange/distance/_distance.pyx":274 * n_rows2 = x2.shape[0] if two_tables else 0 * with nogil: * for row1 in range(n_rows1): # <<<<<<<<<<<<<< @@ -6408,7 +7542,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_row1 = __pyx_t_5; - /* "Orange/distance/_distance.pyx":251 + /* "Orange/distance/_distance.pyx":275 * with nogil: * for row1 in range(n_rows1): * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< @@ -6424,7 +7558,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_row2 = __pyx_t_8; - /* "Orange/distance/_distance.pyx":252 + /* "Orange/distance/_distance.pyx":276 * for row1 in range(n_rows1): * for row2 in range(n_rows2 if two_tables else row1): * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< @@ -6436,7 +7570,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __pyx_t_11 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); if (__pyx_t_11) { - /* "Orange/distance/_distance.pyx":253 + /* "Orange/distance/_distance.pyx":277 * for row2 in range(n_rows2 if two_tables else row1): * if npy_isnan(distances[row1, row2]): * d = 0 # <<<<<<<<<<<<<< @@ -6445,7 +7579,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm */ __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":254 + /* "Orange/distance/_distance.pyx":278 * if npy_isnan(distances[row1, row2]): * d = 0 * for col in range(n_cols): # <<<<<<<<<<<<<< @@ -6457,7 +7591,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { __pyx_v_col = __pyx_t_14; - /* "Orange/distance/_distance.pyx":255 + /* "Orange/distance/_distance.pyx":279 * d = 0 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< @@ -6473,7 +7607,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __pyx_v_val1 = __pyx_t_17; __pyx_v_val2 = __pyx_t_20; - /* "Orange/distance/_distance.pyx":256 + /* "Orange/distance/_distance.pyx":280 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -6483,7 +7617,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __pyx_t_11 = (npy_isnan(__pyx_v_val1) != 0); if (__pyx_t_11) { - /* "Orange/distance/_distance.pyx":257 + /* "Orange/distance/_distance.pyx":281 * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -6493,7 +7627,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_11) { - /* "Orange/distance/_distance.pyx":258 + /* "Orange/distance/_distance.pyx":282 * if npy_isnan(val1): * if npy_isnan(val2): * d += 1 # <<<<<<<<<<<<<< @@ -6502,7 +7636,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm */ __pyx_v_d = (__pyx_v_d + 1.0); - /* "Orange/distance/_distance.pyx":257 + /* "Orange/distance/_distance.pyx":281 * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -6512,7 +7646,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm goto __pyx_L14; } - /* "Orange/distance/_distance.pyx":260 + /* "Orange/distance/_distance.pyx":284 * d += 1 * else: * d += fabs(val2) + 0.5 # <<<<<<<<<<<<<< @@ -6524,7 +7658,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm } __pyx_L14:; - /* "Orange/distance/_distance.pyx":256 + /* "Orange/distance/_distance.pyx":280 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -6534,7 +7668,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm goto __pyx_L13; } - /* "Orange/distance/_distance.pyx":261 + /* "Orange/distance/_distance.pyx":285 * else: * d += fabs(val2) + 0.5 * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -6544,7 +7678,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_11) { - /* "Orange/distance/_distance.pyx":262 + /* "Orange/distance/_distance.pyx":286 * d += fabs(val2) + 0.5 * elif npy_isnan(val2): * d += fabs(val1) + 0.5 # <<<<<<<<<<<<<< @@ -6553,7 +7687,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm */ __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val1) + 0.5)); - /* "Orange/distance/_distance.pyx":261 + /* "Orange/distance/_distance.pyx":285 * else: * d += fabs(val2) + 0.5 * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -6563,7 +7697,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm goto __pyx_L13; } - /* "Orange/distance/_distance.pyx":264 + /* "Orange/distance/_distance.pyx":288 * d += fabs(val1) + 0.5 * else: * d += fabs(val1 - val2) # <<<<<<<<<<<<<< @@ -6576,7 +7710,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __pyx_L13:; } - /* "Orange/distance/_distance.pyx":265 + /* "Orange/distance/_distance.pyx":289 * else: * d += fabs(val1 - val2) * distances[row1, row2] = d # <<<<<<<<<<<<<< @@ -6587,7 +7721,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __pyx_t_22 = __pyx_v_row2; *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":252 + /* "Orange/distance/_distance.pyx":276 * for row1 in range(n_rows1): * for row2 in range(n_rows2 if two_tables else row1): * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< @@ -6599,7 +7733,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm } } - /* "Orange/distance/_distance.pyx":249 + /* "Orange/distance/_distance.pyx":273 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] if two_tables else 0 * with nogil: # <<<<<<<<<<<<<< @@ -6618,7 +7752,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm } } - /* "Orange/distance/_distance.pyx":266 + /* "Orange/distance/_distance.pyx":290 * d += fabs(val1 - val2) * distances[row1, row2] = d * return distances # <<<<<<<<<<<<<< @@ -6630,7 +7764,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __pyx_r = ((PyObject *)__pyx_v_distances); goto __pyx_L0; - /* "Orange/distance/_distance.pyx":239 + /* "Orange/distance/_distance.pyx":263 * * * def fix_manhattan_rows_normalized(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -6661,7 +7795,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm return __pyx_r; } -/* "Orange/distance/_distance.pyx":269 +/* "Orange/distance/_distance.pyx":293 * * * def manhattan_cols(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< @@ -6672,7 +7806,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6Orange_8distance_9_distance_18manhattan_cols[] = "manhattan_cols(ndarray x, ndarray medians, ndarray mads, char normalize)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_19manhattan_cols = {"manhattan_cols", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_18manhattan_cols}; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_19manhattan_cols = {"manhattan_cols", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_18manhattan_cols}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_x = 0; PyArrayObject *__pyx_v_medians = 0; @@ -6708,23 +7842,23 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols(PyObject case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_medians)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, 1); __PYX_ERR(0, 269, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, 1); __PYX_ERR(0, 293, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, 2); __PYX_ERR(0, 269, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, 2); __PYX_ERR(0, 293, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_normalize)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, 3); __PYX_ERR(0, 269, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, 3); __PYX_ERR(0, 293, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "manhattan_cols") < 0)) __PYX_ERR(0, 269, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "manhattan_cols") < 0)) __PYX_ERR(0, 293, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -6737,19 +7871,19 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols(PyObject __pyx_v_x = ((PyArrayObject *)values[0]); __pyx_v_medians = ((PyArrayObject *)values[1]); __pyx_v_mads = ((PyArrayObject *)values[2]); - __pyx_v_normalize = __Pyx_PyInt_As_char(values[3]); if (unlikely((__pyx_v_normalize == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 272, __pyx_L3_error) + __pyx_v_normalize = __Pyx_PyInt_As_char(values[3]); if (unlikely((__pyx_v_normalize == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 269, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 293, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.manhattan_cols", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 269, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_medians), __pyx_ptype_5numpy_ndarray, 1, "medians", 0))) __PYX_ERR(0, 270, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mads), __pyx_ptype_5numpy_ndarray, 1, "mads", 0))) __PYX_ERR(0, 271, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 293, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_medians), __pyx_ptype_5numpy_ndarray, 1, "medians", 0))) __PYX_ERR(0, 294, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mads), __pyx_ptype_5numpy_ndarray, 1, "mads", 0))) __PYX_ERR(0, 295, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(__pyx_self, __pyx_v_x, __pyx_v_medians, __pyx_v_mads, __pyx_v_normalize); /* function exit code */ @@ -6829,21 +7963,21 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __pyx_pybuffernd_mads.rcbuffer = &__pyx_pybuffer_mads; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 269, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 293, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_medians.rcbuffer->pybuffer, (PyObject*)__pyx_v_medians, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 269, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_medians.rcbuffer->pybuffer, (PyObject*)__pyx_v_medians, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 293, __pyx_L1_error) } __pyx_pybuffernd_medians.diminfo[0].strides = __pyx_pybuffernd_medians.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_medians.diminfo[0].shape = __pyx_pybuffernd_medians.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mads.rcbuffer->pybuffer, (PyObject*)__pyx_v_mads, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 269, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mads.rcbuffer->pybuffer, (PyObject*)__pyx_v_mads, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 293, __pyx_L1_error) } __pyx_pybuffernd_mads.diminfo[0].strides = __pyx_pybuffernd_mads.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mads.diminfo[0].shape = __pyx_pybuffernd_mads.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":278 + /* "Orange/distance/_distance.pyx":302 * double [:, :] distances * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< @@ -6855,23 +7989,23 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":279 + /* "Orange/distance/_distance.pyx":303 * * n_rows, n_cols = x.shape[0], x.shape[1] * distances = np.zeros((n_cols, n_cols), dtype=float) # <<<<<<<<<<<<<< * with nogil: * for col1 in range(n_cols): */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); @@ -6879,26 +8013,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 279, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 303, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 303, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_distances = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "Orange/distance/_distance.pyx":280 + /* "Orange/distance/_distance.pyx":304 * n_rows, n_cols = x.shape[0], x.shape[1] * distances = np.zeros((n_cols, n_cols), dtype=float) * with nogil: # <<<<<<<<<<<<<< @@ -6913,7 +8047,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U #endif /*try:*/ { - /* "Orange/distance/_distance.pyx":281 + /* "Orange/distance/_distance.pyx":305 * distances = np.zeros((n_cols, n_cols), dtype=float) * with nogil: * for col1 in range(n_cols): # <<<<<<<<<<<<<< @@ -6925,7 +8059,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_col1 = __pyx_t_10; - /* "Orange/distance/_distance.pyx":282 + /* "Orange/distance/_distance.pyx":306 * with nogil: * for col1 in range(n_cols): * for col2 in range(col1): # <<<<<<<<<<<<<< @@ -6937,7 +8071,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_col2 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":283 + /* "Orange/distance/_distance.pyx":307 * for col1 in range(n_cols): * for col2 in range(col1): * d = 0 # <<<<<<<<<<<<<< @@ -6946,7 +8080,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U */ __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":284 + /* "Orange/distance/_distance.pyx":308 * for col2 in range(col1): * d = 0 * for row in range(n_rows): # <<<<<<<<<<<<<< @@ -6958,7 +8092,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { __pyx_v_row = __pyx_t_16; - /* "Orange/distance/_distance.pyx":285 + /* "Orange/distance/_distance.pyx":309 * d = 0 * for row in range(n_rows): * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< @@ -6974,7 +8108,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __pyx_v_val1 = __pyx_t_19; __pyx_v_val2 = __pyx_t_22; - /* "Orange/distance/_distance.pyx":286 + /* "Orange/distance/_distance.pyx":310 * for row in range(n_rows): * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -6984,7 +8118,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __pyx_t_23 = (npy_isnan(__pyx_v_val1) != 0); if (__pyx_t_23) { - /* "Orange/distance/_distance.pyx":287 + /* "Orange/distance/_distance.pyx":311 * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -6994,7 +8128,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __pyx_t_23 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_23) { - /* "Orange/distance/_distance.pyx":288 + /* "Orange/distance/_distance.pyx":312 * if npy_isnan(val1): * if npy_isnan(val2): * if normalize: # <<<<<<<<<<<<<< @@ -7004,7 +8138,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __pyx_t_23 = (__pyx_v_normalize != 0); if (__pyx_t_23) { - /* "Orange/distance/_distance.pyx":289 + /* "Orange/distance/_distance.pyx":313 * if npy_isnan(val2): * if normalize: * d += 1 # <<<<<<<<<<<<<< @@ -7013,7 +8147,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U */ __pyx_v_d = (__pyx_v_d + 1.0); - /* "Orange/distance/_distance.pyx":288 + /* "Orange/distance/_distance.pyx":312 * if npy_isnan(val1): * if npy_isnan(val2): * if normalize: # <<<<<<<<<<<<<< @@ -7023,7 +8157,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U goto __pyx_L14; } - /* "Orange/distance/_distance.pyx":291 + /* "Orange/distance/_distance.pyx":315 * d += 1 * else: * d += mads[col1] + mads[col2] \ # <<<<<<<<<<<<<< @@ -7034,7 +8168,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __pyx_t_24 = __pyx_v_col1; __pyx_t_25 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":292 + /* "Orange/distance/_distance.pyx":316 * else: * d += mads[col1] + mads[col2] \ * + fabs(medians[col1] - medians[col2]) # <<<<<<<<<<<<<< @@ -7044,7 +8178,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __pyx_t_26 = __pyx_v_col1; __pyx_t_27 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":291 + /* "Orange/distance/_distance.pyx":315 * d += 1 * else: * d += mads[col1] + mads[col2] \ # <<<<<<<<<<<<<< @@ -7055,7 +8189,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U } __pyx_L14:; - /* "Orange/distance/_distance.pyx":287 + /* "Orange/distance/_distance.pyx":311 * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -7065,7 +8199,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U goto __pyx_L13; } - /* "Orange/distance/_distance.pyx":294 + /* "Orange/distance/_distance.pyx":318 * + fabs(medians[col1] - medians[col2]) * else: * if normalize: # <<<<<<<<<<<<<< @@ -7076,7 +8210,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __pyx_t_23 = (__pyx_v_normalize != 0); if (__pyx_t_23) { - /* "Orange/distance/_distance.pyx":295 + /* "Orange/distance/_distance.pyx":319 * else: * if normalize: * d += fabs(val2) + 0.5 # <<<<<<<<<<<<<< @@ -7085,7 +8219,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U */ __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val2) + 0.5)); - /* "Orange/distance/_distance.pyx":294 + /* "Orange/distance/_distance.pyx":318 * + fabs(medians[col1] - medians[col2]) * else: * if normalize: # <<<<<<<<<<<<<< @@ -7095,7 +8229,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U goto __pyx_L15; } - /* "Orange/distance/_distance.pyx":297 + /* "Orange/distance/_distance.pyx":321 * d += fabs(val2) + 0.5 * else: * d += fabs(val2 - medians[col1]) + mads[col1] # <<<<<<<<<<<<<< @@ -7111,7 +8245,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U } __pyx_L13:; - /* "Orange/distance/_distance.pyx":286 + /* "Orange/distance/_distance.pyx":310 * for row in range(n_rows): * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -7121,7 +8255,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U goto __pyx_L12; } - /* "Orange/distance/_distance.pyx":299 + /* "Orange/distance/_distance.pyx":323 * d += fabs(val2 - medians[col1]) + mads[col1] * else: * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -7132,7 +8266,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __pyx_t_23 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_23) { - /* "Orange/distance/_distance.pyx":300 + /* "Orange/distance/_distance.pyx":324 * else: * if npy_isnan(val2): * if normalize: # <<<<<<<<<<<<<< @@ -7142,7 +8276,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __pyx_t_23 = (__pyx_v_normalize != 0); if (__pyx_t_23) { - /* "Orange/distance/_distance.pyx":301 + /* "Orange/distance/_distance.pyx":325 * if npy_isnan(val2): * if normalize: * d += fabs(val1) + 0.5 # <<<<<<<<<<<<<< @@ -7151,7 +8285,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U */ __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val1) + 0.5)); - /* "Orange/distance/_distance.pyx":300 + /* "Orange/distance/_distance.pyx":324 * else: * if npy_isnan(val2): * if normalize: # <<<<<<<<<<<<<< @@ -7161,7 +8295,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":303 + /* "Orange/distance/_distance.pyx":327 * d += fabs(val1) + 0.5 * else: * d += fabs(val1 - medians[col2]) + mads[col2] # <<<<<<<<<<<<<< @@ -7175,7 +8309,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U } __pyx_L17:; - /* "Orange/distance/_distance.pyx":299 + /* "Orange/distance/_distance.pyx":323 * d += fabs(val2 - medians[col1]) + mads[col1] * else: * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -7185,7 +8319,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U goto __pyx_L16; } - /* "Orange/distance/_distance.pyx":305 + /* "Orange/distance/_distance.pyx":329 * d += fabs(val1 - medians[col2]) + mads[col2] * else: * d += fabs(val1 - val2) # <<<<<<<<<<<<<< @@ -7200,7 +8334,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __pyx_L12:; } - /* "Orange/distance/_distance.pyx":306 + /* "Orange/distance/_distance.pyx":330 * else: * d += fabs(val1 - val2) * distances[col1, col2] = distances[col2, col1] = d # <<<<<<<<<<<<<< @@ -7217,7 +8351,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U } } - /* "Orange/distance/_distance.pyx":280 + /* "Orange/distance/_distance.pyx":304 * n_rows, n_cols = x.shape[0], x.shape[1] * distances = np.zeros((n_cols, n_cols), dtype=float) * with nogil: # <<<<<<<<<<<<<< @@ -7236,7 +8370,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U } } - /* "Orange/distance/_distance.pyx":307 + /* "Orange/distance/_distance.pyx":331 * d += fabs(val1 - val2) * distances[col1, col2] = distances[col2, col1] = d * return distances # <<<<<<<<<<<<<< @@ -7244,13 +8378,13 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 307, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "Orange/distance/_distance.pyx":269 + /* "Orange/distance/_distance.pyx":293 * * * def manhattan_cols(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< @@ -7287,7 +8421,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U return __pyx_r; } -/* "Orange/distance/_distance.pyx":310 +/* "Orange/distance/_distance.pyx":334 * * * def p_nonzero(np.ndarray[np.float64_t, ndim=1] x): # <<<<<<<<<<<<<< @@ -7303,7 +8437,7 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_21p_nonzero(PyObject *__p PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("p_nonzero (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 310, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 334, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_20p_nonzero(__pyx_self, ((PyArrayObject *)__pyx_v_x)); /* function exit code */ @@ -7337,11 +8471,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 310, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 334, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":315 + /* "Orange/distance/_distance.pyx":339 * double val * * nonzeros = nonnans = 0 # <<<<<<<<<<<<<< @@ -7351,19 +8485,19 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED __pyx_v_nonzeros = 0; __pyx_v_nonnans = 0; - /* "Orange/distance/_distance.pyx":316 + /* "Orange/distance/_distance.pyx":340 * * nonzeros = nonnans = 0 * for row in range(len(x)): # <<<<<<<<<<<<<< * val = x[row] * if not npy_isnan(val): */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_x)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 316, __pyx_L1_error) + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_x)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 340, __pyx_L1_error) __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_row = __pyx_t_3; - /* "Orange/distance/_distance.pyx":317 + /* "Orange/distance/_distance.pyx":341 * nonzeros = nonnans = 0 * for row in range(len(x)): * val = x[row] # <<<<<<<<<<<<<< @@ -7373,7 +8507,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED __pyx_t_4 = __pyx_v_row; __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_x.diminfo[0].strides)); - /* "Orange/distance/_distance.pyx":318 + /* "Orange/distance/_distance.pyx":342 * for row in range(len(x)): * val = x[row] * if not npy_isnan(val): # <<<<<<<<<<<<<< @@ -7383,7 +8517,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED __pyx_t_5 = ((!(npy_isnan(__pyx_v_val) != 0)) != 0); if (__pyx_t_5) { - /* "Orange/distance/_distance.pyx":319 + /* "Orange/distance/_distance.pyx":343 * val = x[row] * if not npy_isnan(val): * nonnans += 1 # <<<<<<<<<<<<<< @@ -7392,7 +8526,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED */ __pyx_v_nonnans = (__pyx_v_nonnans + 1); - /* "Orange/distance/_distance.pyx":320 + /* "Orange/distance/_distance.pyx":344 * if not npy_isnan(val): * nonnans += 1 * if val != 0: # <<<<<<<<<<<<<< @@ -7402,7 +8536,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED __pyx_t_5 = ((__pyx_v_val != 0.0) != 0); if (__pyx_t_5) { - /* "Orange/distance/_distance.pyx":321 + /* "Orange/distance/_distance.pyx":345 * nonnans += 1 * if val != 0: * nonzeros += 1 # <<<<<<<<<<<<<< @@ -7411,7 +8545,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED */ __pyx_v_nonzeros = (__pyx_v_nonzeros + 1); - /* "Orange/distance/_distance.pyx":320 + /* "Orange/distance/_distance.pyx":344 * if not npy_isnan(val): * nonnans += 1 * if val != 0: # <<<<<<<<<<<<<< @@ -7420,7 +8554,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED */ } - /* "Orange/distance/_distance.pyx":318 + /* "Orange/distance/_distance.pyx":342 * for row in range(len(x)): * val = x[row] * if not npy_isnan(val): # <<<<<<<<<<<<<< @@ -7430,7 +8564,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED } } - /* "Orange/distance/_distance.pyx":322 + /* "Orange/distance/_distance.pyx":346 * if val != 0: * nonzeros += 1 * return float(nonzeros) / nonnans # <<<<<<<<<<<<<< @@ -7438,13 +8572,13 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = PyFloat_FromDouble((((double)__pyx_v_nonzeros) / ((double)__pyx_v_nonnans))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 322, __pyx_L1_error) + __pyx_t_6 = PyFloat_FromDouble((((double)__pyx_v_nonzeros) / __pyx_v_nonnans)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; - /* "Orange/distance/_distance.pyx":310 + /* "Orange/distance/_distance.pyx":334 * * * def p_nonzero(np.ndarray[np.float64_t, ndim=1] x): # <<<<<<<<<<<<<< @@ -7472,7 +8606,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED return __pyx_r; } -/* "Orange/distance/_distance.pyx":324 +/* "Orange/distance/_distance.pyx":348 * return float(nonzeros) / nonnans * * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< @@ -7488,7 +8622,7 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_23any_nan_row(PyObject *_ PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("any_nan_row (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 324, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 348, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_22any_nan_row(__pyx_self, ((PyArrayObject *)__pyx_v_x)); /* function exit code */ @@ -7544,11 +8678,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 324, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 348, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":329 + /* "Orange/distance/_distance.pyx":353 * np.ndarray[np.int8_t, ndim=1] flags * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< @@ -7560,40 +8694,40 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":330 + /* "Orange/distance/_distance.pyx":354 * * n_rows, n_cols = x.shape[0], x.shape[1] * flags = np.zeros(x.shape[0], dtype=np.int8) # <<<<<<<<<<<<<< * with nogil: * for row in range(n_rows): */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 330, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 330, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 330, __pyx_L1_error) + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 354, __pyx_L1_error) __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -7610,13 +8744,13 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0; } __pyx_pybuffernd_flags.diminfo[0].strides = __pyx_pybuffernd_flags.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_flags.diminfo[0].shape = __pyx_pybuffernd_flags.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 330, __pyx_L1_error) + if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 354, __pyx_L1_error) } __pyx_t_8 = 0; __pyx_v_flags = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":331 + /* "Orange/distance/_distance.pyx":355 * n_rows, n_cols = x.shape[0], x.shape[1] * flags = np.zeros(x.shape[0], dtype=np.int8) * with nogil: # <<<<<<<<<<<<<< @@ -7631,7 +8765,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS #endif /*try:*/ { - /* "Orange/distance/_distance.pyx":332 + /* "Orange/distance/_distance.pyx":356 * flags = np.zeros(x.shape[0], dtype=np.int8) * with nogil: * for row in range(n_rows): # <<<<<<<<<<<<<< @@ -7643,7 +8777,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { __pyx_v_row = __pyx_t_14; - /* "Orange/distance/_distance.pyx":333 + /* "Orange/distance/_distance.pyx":357 * with nogil: * for row in range(n_rows): * for col in range(n_cols): # <<<<<<<<<<<<<< @@ -7655,7 +8789,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_col = __pyx_t_17; - /* "Orange/distance/_distance.pyx":334 + /* "Orange/distance/_distance.pyx":358 * for row in range(n_rows): * for col in range(n_cols): * if npy_isnan(x[row, col]): # <<<<<<<<<<<<<< @@ -7667,7 +8801,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_t_20 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[1].strides))) != 0); if (__pyx_t_20) { - /* "Orange/distance/_distance.pyx":335 + /* "Orange/distance/_distance.pyx":359 * for col in range(n_cols): * if npy_isnan(x[row, col]): * flags[row] = 1 # <<<<<<<<<<<<<< @@ -7677,7 +8811,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_t_21 = __pyx_v_row; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_flags.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_flags.diminfo[0].strides) = 1; - /* "Orange/distance/_distance.pyx":336 + /* "Orange/distance/_distance.pyx":360 * if npy_isnan(x[row, col]): * flags[row] = 1 * break # <<<<<<<<<<<<<< @@ -7686,7 +8820,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS */ goto __pyx_L9_break; - /* "Orange/distance/_distance.pyx":334 + /* "Orange/distance/_distance.pyx":358 * for row in range(n_rows): * for col in range(n_cols): * if npy_isnan(x[row, col]): # <<<<<<<<<<<<<< @@ -7699,7 +8833,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS } } - /* "Orange/distance/_distance.pyx":331 + /* "Orange/distance/_distance.pyx":355 * n_rows, n_cols = x.shape[0], x.shape[1] * flags = np.zeros(x.shape[0], dtype=np.int8) * with nogil: # <<<<<<<<<<<<<< @@ -7718,7 +8852,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS } } - /* "Orange/distance/_distance.pyx":337 + /* "Orange/distance/_distance.pyx":361 * flags[row] = 1 * break * return flags # <<<<<<<<<<<<<< @@ -7730,7 +8864,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_r = ((PyObject *)__pyx_v_flags); goto __pyx_L0; - /* "Orange/distance/_distance.pyx":324 + /* "Orange/distance/_distance.pyx":348 * return float(nonzeros) / nonnans * * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< @@ -7765,7 +8899,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS return __pyx_r; } -/* "Orange/distance/_distance.pyx":340 +/* "Orange/distance/_distance.pyx":364 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< @@ -7776,7 +8910,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6Orange_8distance_9_distance_24jaccard_rows[] = "jaccard_rows(ndarray nonzeros1, ndarray nonzeros2, ndarray x1, ndarray x2, ndarray nans1, ndarray nans2, ndarray ps, char two_tables)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_25jaccard_rows = {"jaccard_rows", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_24jaccard_rows}; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_25jaccard_rows = {"jaccard_rows", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_24jaccard_rows}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_nonzeros1 = 0; PyArrayObject *__pyx_v_nonzeros2 = 0; @@ -7824,47 +8958,47 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nonzeros2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 1); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 1); __PYX_ERR(0, 364, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 2); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 2); __PYX_ERR(0, 364, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 3); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 3); __PYX_ERR(0, 364, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nans1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 4); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 4); __PYX_ERR(0, 364, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nans2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 5); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 5); __PYX_ERR(0, 364, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ps)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 6); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 6); __PYX_ERR(0, 364, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 7); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 7); __PYX_ERR(0, 364, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_rows") < 0)) __PYX_ERR(0, 340, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_rows") < 0)) __PYX_ERR(0, 364, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; @@ -7885,23 +9019,23 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * __pyx_v_nans1 = ((PyArrayObject *)values[4]); __pyx_v_nans2 = ((PyArrayObject *)values[5]); __pyx_v_ps = ((PyArrayObject *)values[6]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[7]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 347, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[7]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 371, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 340, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 364, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.jaccard_rows", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros1), __pyx_ptype_5numpy_ndarray, 1, "nonzeros1", 0))) __PYX_ERR(0, 340, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros2), __pyx_ptype_5numpy_ndarray, 1, "nonzeros2", 0))) __PYX_ERR(0, 341, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 342, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 343, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans1), __pyx_ptype_5numpy_ndarray, 1, "nans1", 0))) __PYX_ERR(0, 344, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans2), __pyx_ptype_5numpy_ndarray, 1, "nans2", 0))) __PYX_ERR(0, 345, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 346, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros1), __pyx_ptype_5numpy_ndarray, 1, "nonzeros1", 0))) __PYX_ERR(0, 364, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros2), __pyx_ptype_5numpy_ndarray, 1, "nonzeros2", 0))) __PYX_ERR(0, 365, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 366, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 367, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans1), __pyx_ptype_5numpy_ndarray, 1, "nans1", 0))) __PYX_ERR(0, 368, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans2), __pyx_ptype_5numpy_ndarray, 1, "nans2", 0))) __PYX_ERR(0, 369, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 370, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(__pyx_self, __pyx_v_nonzeros1, __pyx_v_nonzeros2, __pyx_v_x1, __pyx_v_x2, __pyx_v_nans1, __pyx_v_nans2, __pyx_v_ps, __pyx_v_two_tables); /* function exit code */ @@ -7913,6 +9047,52 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * return __pyx_r; } +/* "Orange/distance/_distance.pyx":436 + * distances[row1, row2] = 1 - intersection / union + * if not two_tables: + * lower_to_symmetric(distances, lambda x: x) # <<<<<<<<<<<<<< + * return distances + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6Orange_8distance_9_distance_12jaccard_rows_lambda(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_12jaccard_rows_lambda = {"lambda", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_12jaccard_rows_lambda, METH_O, 0}; +static PyObject *__pyx_pw_6Orange_8distance_9_distance_12jaccard_rows_lambda(PyObject *__pyx_self, PyObject *__pyx_v_x) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda (wrapper)", 0); + __pyx_r = __pyx_lambda_funcdef_lambda(__pyx_self, ((PyObject *)__pyx_v_x)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lambda", 0); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_x); + __pyx_r = __pyx_v_x; + goto __pyx_L0; + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "Orange/distance/_distance.pyx":364 + * + * + * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< + * np.ndarray[np.int8_t, ndim=2] nonzeros2, + * np.ndarray[np.float64_t, ndim=2] x1, + */ + static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros1, PyArrayObject *__pyx_v_nonzeros2, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_nans1, PyArrayObject *__pyx_v_nans2, PyArrayObject *__pyx_v_ps, char __pyx_v_two_tables) { int __pyx_v_n_rows1; int __pyx_v_n_rows2; @@ -8023,41 +9203,41 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_pybuffernd_ps.rcbuffer = &__pyx_pybuffer_ps; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 340, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 364, __pyx_L1_error) } __pyx_pybuffernd_nonzeros1.diminfo[0].strides = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nonzeros1.diminfo[0].shape = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nonzeros1.diminfo[1].strides = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nonzeros1.diminfo[1].shape = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 340, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 364, __pyx_L1_error) } __pyx_pybuffernd_nonzeros2.diminfo[0].strides = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nonzeros2.diminfo[0].shape = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nonzeros2.diminfo[1].strides = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nonzeros2.diminfo[1].shape = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 340, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 364, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 340, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 364, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 340, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 364, __pyx_L1_error) } __pyx_pybuffernd_nans1.diminfo[0].strides = __pyx_pybuffernd_nans1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nans1.diminfo[0].shape = __pyx_pybuffernd_nans1.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 340, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 364, __pyx_L1_error) } __pyx_pybuffernd_nans2.diminfo[0].strides = __pyx_pybuffernd_nans2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nans2.diminfo[0].shape = __pyx_pybuffernd_nans2.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 340, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 364, __pyx_L1_error) } __pyx_pybuffernd_ps.diminfo[0].strides = __pyx_pybuffernd_ps.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ps.diminfo[0].shape = __pyx_pybuffernd_ps.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":354 + /* "Orange/distance/_distance.pyx":378 * double [:, :] distances * * n_rows1, n_cols = x1.shape[0], x2.shape[1] # <<<<<<<<<<<<<< @@ -8069,7 +9249,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":355 + /* "Orange/distance/_distance.pyx":379 * * n_rows1, n_cols = x1.shape[0], x2.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< @@ -8078,23 +9258,23 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":356 + /* "Orange/distance/_distance.pyx":380 * n_rows1, n_cols = x1.shape[0], x2.shape[1] * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) # <<<<<<<<<<<<<< * with nogil: * for row1 in range(n_rows1): */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_rows2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_rows2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); @@ -8102,26 +9282,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 356, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 380, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 356, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 380, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_distances = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "Orange/distance/_distance.pyx":357 + /* "Orange/distance/_distance.pyx":381 * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) * with nogil: # <<<<<<<<<<<<<< @@ -8136,7 +9316,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU #endif /*try:*/ { - /* "Orange/distance/_distance.pyx":358 + /* "Orange/distance/_distance.pyx":382 * distances = np.zeros((n_rows1, n_rows2), dtype=float) * with nogil: * for row1 in range(n_rows1): # <<<<<<<<<<<<<< @@ -8148,7 +9328,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_row1 = __pyx_t_10; - /* "Orange/distance/_distance.pyx":359 + /* "Orange/distance/_distance.pyx":383 * with nogil: * for row1 in range(n_rows1): * if nans1[row1]: # <<<<<<<<<<<<<< @@ -8159,7 +9339,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans1.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_nans1.diminfo[0].strides)) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":360 + /* "Orange/distance/_distance.pyx":384 * for row1 in range(n_rows1): * if nans1[row1]: * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< @@ -8175,7 +9355,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_row2 = __pyx_t_15; - /* "Orange/distance/_distance.pyx":361 + /* "Orange/distance/_distance.pyx":385 * if nans1[row1]: * for row2 in range(n_rows2 if two_tables else row1): * union = intersection = 0 # <<<<<<<<<<<<<< @@ -8185,7 +9365,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_v_union = 0.0; __pyx_v_intersection = 0.0; - /* "Orange/distance/_distance.pyx":362 + /* "Orange/distance/_distance.pyx":386 * for row2 in range(n_rows2 if two_tables else row1): * union = intersection = 0 * for col in range(n_cols): # <<<<<<<<<<<<<< @@ -8197,7 +9377,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_col = __pyx_t_18; - /* "Orange/distance/_distance.pyx":363 + /* "Orange/distance/_distance.pyx":387 * union = intersection = 0 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< @@ -8213,7 +9393,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_v_val1 = __pyx_t_21; __pyx_v_val2 = __pyx_t_24; - /* "Orange/distance/_distance.pyx":364 + /* "Orange/distance/_distance.pyx":388 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -8223,7 +9403,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val1) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":365 + /* "Orange/distance/_distance.pyx":389 * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -8233,7 +9413,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":366 + /* "Orange/distance/_distance.pyx":390 * if npy_isnan(val1): * if npy_isnan(val2): * intersection += ps[col] ** 2 # <<<<<<<<<<<<<< @@ -8243,7 +9423,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_25 = __pyx_v_col; __pyx_v_intersection = (__pyx_v_intersection + pow((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_ps.diminfo[0].strides)), 2.0)); - /* "Orange/distance/_distance.pyx":367 + /* "Orange/distance/_distance.pyx":391 * if npy_isnan(val2): * intersection += ps[col] ** 2 * union += 1 - (1 - ps[col]) ** 2 # <<<<<<<<<<<<<< @@ -8253,7 +9433,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_26 = __pyx_v_col; __pyx_v_union = (__pyx_v_union + (1.0 - pow((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_ps.diminfo[0].strides))), 2.0))); - /* "Orange/distance/_distance.pyx":365 + /* "Orange/distance/_distance.pyx":389 * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -8263,7 +9443,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L14; } - /* "Orange/distance/_distance.pyx":368 + /* "Orange/distance/_distance.pyx":392 * intersection += ps[col] ** 2 * union += 1 - (1 - ps[col]) ** 2 * elif val2 != 0: # <<<<<<<<<<<<<< @@ -8273,7 +9453,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":369 + /* "Orange/distance/_distance.pyx":393 * union += 1 - (1 - ps[col]) ** 2 * elif val2 != 0: * intersection += ps[col] # <<<<<<<<<<<<<< @@ -8283,7 +9463,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_27 = __pyx_v_col; __pyx_v_intersection = (__pyx_v_intersection + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_ps.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":370 + /* "Orange/distance/_distance.pyx":394 * elif val2 != 0: * intersection += ps[col] * union += 1 # <<<<<<<<<<<<<< @@ -8292,7 +9472,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_union = (__pyx_v_union + 1.0); - /* "Orange/distance/_distance.pyx":368 + /* "Orange/distance/_distance.pyx":392 * intersection += ps[col] ** 2 * union += 1 - (1 - ps[col]) ** 2 * elif val2 != 0: # <<<<<<<<<<<<<< @@ -8302,7 +9482,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L14; } - /* "Orange/distance/_distance.pyx":372 + /* "Orange/distance/_distance.pyx":396 * union += 1 * else: * union += ps[col] # <<<<<<<<<<<<<< @@ -8315,7 +9495,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU } __pyx_L14:; - /* "Orange/distance/_distance.pyx":364 + /* "Orange/distance/_distance.pyx":388 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -8325,7 +9505,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L13; } - /* "Orange/distance/_distance.pyx":373 + /* "Orange/distance/_distance.pyx":397 * else: * union += ps[col] * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -8335,7 +9515,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":374 + /* "Orange/distance/_distance.pyx":398 * union += ps[col] * elif npy_isnan(val2): * if val1 != 0: # <<<<<<<<<<<<<< @@ -8345,7 +9525,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((__pyx_v_val1 != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":375 + /* "Orange/distance/_distance.pyx":399 * elif npy_isnan(val2): * if val1 != 0: * intersection += val1 * ps[col] # <<<<<<<<<<<<<< @@ -8355,7 +9535,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_29 = __pyx_v_col; __pyx_v_intersection = (__pyx_v_intersection + (__pyx_v_val1 * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_ps.diminfo[0].strides)))); - /* "Orange/distance/_distance.pyx":376 + /* "Orange/distance/_distance.pyx":400 * if val1 != 0: * intersection += val1 * ps[col] * union += 1 # <<<<<<<<<<<<<< @@ -8364,7 +9544,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_union = (__pyx_v_union + 1.0); - /* "Orange/distance/_distance.pyx":374 + /* "Orange/distance/_distance.pyx":398 * union += ps[col] * elif npy_isnan(val2): * if val1 != 0: # <<<<<<<<<<<<<< @@ -8374,7 +9554,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L15; } - /* "Orange/distance/_distance.pyx":378 + /* "Orange/distance/_distance.pyx":402 * union += 1 * else: * union += ps[col] # <<<<<<<<<<<<<< @@ -8387,7 +9567,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU } __pyx_L15:; - /* "Orange/distance/_distance.pyx":373 + /* "Orange/distance/_distance.pyx":397 * else: * union += ps[col] * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -8397,7 +9577,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L13; } - /* "Orange/distance/_distance.pyx":380 + /* "Orange/distance/_distance.pyx":404 * union += ps[col] * else: * ival1 = nonzeros1[row1, col] # <<<<<<<<<<<<<< @@ -8409,7 +9589,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_32 = __pyx_v_col; __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":381 + /* "Orange/distance/_distance.pyx":405 * else: * ival1 = nonzeros1[row1, col] * ival2 = nonzeros2[row2, col] # <<<<<<<<<<<<<< @@ -8420,7 +9600,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_34 = __pyx_v_col; __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_nonzeros2.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_nonzeros2.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":382 + /* "Orange/distance/_distance.pyx":406 * ival1 = nonzeros1[row1, col] * ival2 = nonzeros2[row2, col] * union += ival1 | ival2 # <<<<<<<<<<<<<< @@ -8429,7 +9609,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_union = (__pyx_v_union + (__pyx_v_ival1 | __pyx_v_ival2)); - /* "Orange/distance/_distance.pyx":383 + /* "Orange/distance/_distance.pyx":407 * ival2 = nonzeros2[row2, col] * union += ival1 | ival2 * intersection += ival1 & ival2 # <<<<<<<<<<<<<< @@ -8441,7 +9621,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_L13:; } - /* "Orange/distance/_distance.pyx":384 + /* "Orange/distance/_distance.pyx":408 * union += ival1 | ival2 * intersection += ival1 & ival2 * if union != 0: # <<<<<<<<<<<<<< @@ -8451,7 +9631,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((__pyx_v_union != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":385 + /* "Orange/distance/_distance.pyx":409 * intersection += ival1 & ival2 * if union != 0: * distances[row1, row2] = 1 - intersection / union # <<<<<<<<<<<<<< @@ -8462,7 +9642,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_36 = __pyx_v_row2; *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_35 * __pyx_v_distances.strides[0]) ) + __pyx_t_36 * __pyx_v_distances.strides[1]) )) = (1.0 - (__pyx_v_intersection / __pyx_v_union)); - /* "Orange/distance/_distance.pyx":384 + /* "Orange/distance/_distance.pyx":408 * union += ival1 | ival2 * intersection += ival1 & ival2 * if union != 0: # <<<<<<<<<<<<<< @@ -8472,7 +9652,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU } } - /* "Orange/distance/_distance.pyx":359 + /* "Orange/distance/_distance.pyx":383 * with nogil: * for row1 in range(n_rows1): * if nans1[row1]: # <<<<<<<<<<<<<< @@ -8482,7 +9662,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L8; } - /* "Orange/distance/_distance.pyx":387 + /* "Orange/distance/_distance.pyx":411 * distances[row1, row2] = 1 - intersection / union * else: * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< @@ -8499,7 +9679,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_row2 = __pyx_t_15; - /* "Orange/distance/_distance.pyx":388 + /* "Orange/distance/_distance.pyx":412 * else: * for row2 in range(n_rows2 if two_tables else row1): * union = intersection = 0 # <<<<<<<<<<<<<< @@ -8509,7 +9689,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_v_union = 0.0; __pyx_v_intersection = 0.0; - /* "Orange/distance/_distance.pyx":390 + /* "Orange/distance/_distance.pyx":414 * union = intersection = 0 * # This case is slightly different since val1 can't be nan * if nans2[row2]: # <<<<<<<<<<<<<< @@ -8520,7 +9700,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans2.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_nans2.diminfo[0].strides)) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":391 + /* "Orange/distance/_distance.pyx":415 * # This case is slightly different since val1 can't be nan * if nans2[row2]: * for col in range(n_cols): # <<<<<<<<<<<<<< @@ -8532,7 +9712,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_col = __pyx_t_18; - /* "Orange/distance/_distance.pyx":392 + /* "Orange/distance/_distance.pyx":416 * if nans2[row2]: * for col in range(n_cols): * val2 = x2[row2, col] # <<<<<<<<<<<<<< @@ -8543,7 +9723,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_39 = __pyx_v_col; __pyx_v_val2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_x2.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":393 + /* "Orange/distance/_distance.pyx":417 * for col in range(n_cols): * val2 = x2[row2, col] * if nonzeros1[row1, col] != 0: # <<<<<<<<<<<<<< @@ -8555,7 +9735,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = (((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)) != 0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":394 + /* "Orange/distance/_distance.pyx":418 * val2 = x2[row2, col] * if nonzeros1[row1, col] != 0: * union += 1 # <<<<<<<<<<<<<< @@ -8564,7 +9744,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_union = (__pyx_v_union + 1.0); - /* "Orange/distance/_distance.pyx":395 + /* "Orange/distance/_distance.pyx":419 * if nonzeros1[row1, col] != 0: * union += 1 * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -8574,7 +9754,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":396 + /* "Orange/distance/_distance.pyx":420 * union += 1 * if npy_isnan(val2): * intersection += ps[col] # <<<<<<<<<<<<<< @@ -8584,7 +9764,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_42 = __pyx_v_col; __pyx_v_intersection = (__pyx_v_intersection + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_ps.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":395 + /* "Orange/distance/_distance.pyx":419 * if nonzeros1[row1, col] != 0: * union += 1 * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -8594,7 +9774,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L23; } - /* "Orange/distance/_distance.pyx":397 + /* "Orange/distance/_distance.pyx":421 * if npy_isnan(val2): * intersection += ps[col] * elif val2 != 0: # <<<<<<<<<<<<<< @@ -8604,7 +9784,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":398 + /* "Orange/distance/_distance.pyx":422 * intersection += ps[col] * elif val2 != 0: * intersection += 1 # <<<<<<<<<<<<<< @@ -8613,7 +9793,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_intersection = (__pyx_v_intersection + 1.0); - /* "Orange/distance/_distance.pyx":397 + /* "Orange/distance/_distance.pyx":421 * if npy_isnan(val2): * intersection += ps[col] * elif val2 != 0: # <<<<<<<<<<<<<< @@ -8623,7 +9803,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU } __pyx_L23:; - /* "Orange/distance/_distance.pyx":393 + /* "Orange/distance/_distance.pyx":417 * for col in range(n_cols): * val2 = x2[row2, col] * if nonzeros1[row1, col] != 0: # <<<<<<<<<<<<<< @@ -8633,7 +9813,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L22; } - /* "Orange/distance/_distance.pyx":399 + /* "Orange/distance/_distance.pyx":423 * elif val2 != 0: * intersection += 1 * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -8643,7 +9823,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":400 + /* "Orange/distance/_distance.pyx":424 * intersection += 1 * elif npy_isnan(val2): * union += ps[col] # <<<<<<<<<<<<<< @@ -8653,7 +9833,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_43 = __pyx_v_col; __pyx_v_union = (__pyx_v_union + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_ps.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":399 + /* "Orange/distance/_distance.pyx":423 * elif val2 != 0: * intersection += 1 * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -8663,7 +9843,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L22; } - /* "Orange/distance/_distance.pyx":401 + /* "Orange/distance/_distance.pyx":425 * elif npy_isnan(val2): * union += ps[col] * elif val2 != 0: # <<<<<<<<<<<<<< @@ -8673,7 +9853,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":402 + /* "Orange/distance/_distance.pyx":426 * union += ps[col] * elif val2 != 0: * union += 1 # <<<<<<<<<<<<<< @@ -8682,7 +9862,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_union = (__pyx_v_union + 1.0); - /* "Orange/distance/_distance.pyx":401 + /* "Orange/distance/_distance.pyx":425 * elif npy_isnan(val2): * union += ps[col] * elif val2 != 0: # <<<<<<<<<<<<<< @@ -8693,7 +9873,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_L22:; } - /* "Orange/distance/_distance.pyx":390 + /* "Orange/distance/_distance.pyx":414 * union = intersection = 0 * # This case is slightly different since val1 can't be nan * if nans2[row2]: # <<<<<<<<<<<<<< @@ -8703,7 +9883,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L19; } - /* "Orange/distance/_distance.pyx":404 + /* "Orange/distance/_distance.pyx":428 * union += 1 * else: * for col in range(n_cols): # <<<<<<<<<<<<<< @@ -8716,7 +9896,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_col = __pyx_t_18; - /* "Orange/distance/_distance.pyx":405 + /* "Orange/distance/_distance.pyx":429 * else: * for col in range(n_cols): * ival1 = nonzeros1[row1, col] # <<<<<<<<<<<<<< @@ -8727,7 +9907,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_45 = __pyx_v_col; __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":406 + /* "Orange/distance/_distance.pyx":430 * for col in range(n_cols): * ival1 = nonzeros1[row1, col] * ival2 = nonzeros2[row2, col] # <<<<<<<<<<<<<< @@ -8738,7 +9918,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_47 = __pyx_v_col; __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_nonzeros2.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_nonzeros2.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":407 + /* "Orange/distance/_distance.pyx":431 * ival1 = nonzeros1[row1, col] * ival2 = nonzeros2[row2, col] * union += ival1 | ival2 # <<<<<<<<<<<<<< @@ -8747,7 +9927,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_union = (__pyx_v_union + (__pyx_v_ival1 | __pyx_v_ival2)); - /* "Orange/distance/_distance.pyx":408 + /* "Orange/distance/_distance.pyx":432 * ival2 = nonzeros2[row2, col] * union += ival1 | ival2 * intersection += ival1 & ival2 # <<<<<<<<<<<<<< @@ -8759,7 +9939,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU } __pyx_L19:; - /* "Orange/distance/_distance.pyx":409 + /* "Orange/distance/_distance.pyx":433 * union += ival1 | ival2 * intersection += ival1 & ival2 * if union != 0: # <<<<<<<<<<<<<< @@ -8769,18 +9949,18 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((__pyx_v_union != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":410 + /* "Orange/distance/_distance.pyx":434 * intersection += ival1 & ival2 * if union != 0: * distances[row1, row2] = 1 - intersection / union # <<<<<<<<<<<<<< * if not two_tables: - * lower_to_symmetric(distances) + * lower_to_symmetric(distances, lambda x: x) */ __pyx_t_48 = __pyx_v_row1; __pyx_t_49 = __pyx_v_row2; *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_48 * __pyx_v_distances.strides[0]) ) + __pyx_t_49 * __pyx_v_distances.strides[1]) )) = (1.0 - (__pyx_v_intersection / __pyx_v_union)); - /* "Orange/distance/_distance.pyx":409 + /* "Orange/distance/_distance.pyx":433 * union += ival1 | ival2 * intersection += ival1 & ival2 * if union != 0: # <<<<<<<<<<<<<< @@ -8794,7 +9974,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU } } - /* "Orange/distance/_distance.pyx":357 + /* "Orange/distance/_distance.pyx":381 * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) * with nogil: # <<<<<<<<<<<<<< @@ -8813,49 +9993,52 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU } } - /* "Orange/distance/_distance.pyx":411 + /* "Orange/distance/_distance.pyx":435 * if union != 0: * distances[row1, row2] = 1 - intersection / union * if not two_tables: # <<<<<<<<<<<<<< - * lower_to_symmetric(distances) + * lower_to_symmetric(distances, lambda x: x) * return distances */ __pyx_t_12 = ((!(__pyx_v_two_tables != 0)) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":412 + /* "Orange/distance/_distance.pyx":436 * distances[row1, row2] = 1 - intersection / union * if not two_tables: - * lower_to_symmetric(distances) # <<<<<<<<<<<<<< + * lower_to_symmetric(distances, lambda x: x) # <<<<<<<<<<<<<< * return distances * */ - __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__pyx_v_distances, 0); + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_12jaccard_rows_lambda, 0, __pyx_n_s_jaccard_rows_locals_lambda, NULL, __pyx_n_s_Orange_distance__distance, __pyx_d, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__pyx_v_distances, __pyx_t_3, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "Orange/distance/_distance.pyx":411 + /* "Orange/distance/_distance.pyx":435 * if union != 0: * distances[row1, row2] = 1 - intersection / union * if not two_tables: # <<<<<<<<<<<<<< - * lower_to_symmetric(distances) + * lower_to_symmetric(distances, lambda x: x) * return distances */ } - /* "Orange/distance/_distance.pyx":413 + /* "Orange/distance/_distance.pyx":437 * if not two_tables: - * lower_to_symmetric(distances) + * lower_to_symmetric(distances, lambda x: x) * return distances # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "Orange/distance/_distance.pyx":340 + /* "Orange/distance/_distance.pyx":364 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< @@ -8900,7 +10083,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU return __pyx_r; } -/* "Orange/distance/_distance.pyx":416 +/* "Orange/distance/_distance.pyx":440 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< @@ -8911,7 +10094,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_6Orange_8distance_9_distance_26jaccard_cols[] = "jaccard_cols(ndarray nonzeros, ndarray x, ndarray nans, ndarray ps)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_27jaccard_cols = {"jaccard_cols", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_26jaccard_cols}; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_27jaccard_cols = {"jaccard_cols", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_26jaccard_cols}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_nonzeros = 0; PyArrayObject *__pyx_v_x = 0; @@ -8947,23 +10130,23 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols(PyObject * case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 1); __PYX_ERR(0, 416, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 1); __PYX_ERR(0, 440, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nans)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 2); __PYX_ERR(0, 416, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 2); __PYX_ERR(0, 440, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ps)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 3); __PYX_ERR(0, 416, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 3); __PYX_ERR(0, 440, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_cols") < 0)) __PYX_ERR(0, 416, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_cols") < 0)) __PYX_ERR(0, 440, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -8980,16 +10163,16 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols(PyObject * } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 416, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 440, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.jaccard_cols", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros), __pyx_ptype_5numpy_ndarray, 1, "nonzeros", 0))) __PYX_ERR(0, 416, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 417, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans), __pyx_ptype_5numpy_ndarray, 1, "nans", 0))) __PYX_ERR(0, 418, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 419, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros), __pyx_ptype_5numpy_ndarray, 1, "nonzeros", 0))) __PYX_ERR(0, 440, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 441, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans), __pyx_ptype_5numpy_ndarray, 1, "nans", 0))) __PYX_ERR(0, 442, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 443, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(__pyx_self, __pyx_v_nonzeros, __pyx_v_x, __pyx_v_nans, __pyx_v_ps); /* function exit code */ @@ -9118,26 +10301,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_pybuffernd_ps.rcbuffer = &__pyx_pybuffer_ps; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 416, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 440, __pyx_L1_error) } __pyx_pybuffernd_nonzeros.diminfo[0].strides = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nonzeros.diminfo[0].shape = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nonzeros.diminfo[1].strides = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nonzeros.diminfo[1].shape = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 416, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 440, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 416, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 440, __pyx_L1_error) } __pyx_pybuffernd_nans.diminfo[0].strides = __pyx_pybuffernd_nans.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nans.diminfo[0].shape = __pyx_pybuffernd_nans.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 416, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 440, __pyx_L1_error) } __pyx_pybuffernd_ps.diminfo[0].strides = __pyx_pybuffernd_ps.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ps.diminfo[0].shape = __pyx_pybuffernd_ps.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":427 + /* "Orange/distance/_distance.pyx":451 * double [:, :] distances * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< @@ -9149,23 +10332,23 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":428 + /* "Orange/distance/_distance.pyx":452 * * n_rows, n_cols = x.shape[0], x.shape[1] * distances = np.zeros((n_cols, n_cols), dtype=float) # <<<<<<<<<<<<<< * with nogil: * for col1 in range(n_cols): */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); @@ -9173,26 +10356,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 428, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 452, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 428, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 452, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_distances = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "Orange/distance/_distance.pyx":429 + /* "Orange/distance/_distance.pyx":453 * n_rows, n_cols = x.shape[0], x.shape[1] * distances = np.zeros((n_cols, n_cols), dtype=float) * with nogil: # <<<<<<<<<<<<<< @@ -9207,7 +10390,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU #endif /*try:*/ { - /* "Orange/distance/_distance.pyx":430 + /* "Orange/distance/_distance.pyx":454 * distances = np.zeros((n_cols, n_cols), dtype=float) * with nogil: * for col1 in range(n_cols): # <<<<<<<<<<<<<< @@ -9219,7 +10402,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_col1 = __pyx_t_10; - /* "Orange/distance/_distance.pyx":431 + /* "Orange/distance/_distance.pyx":455 * with nogil: * for col1 in range(n_cols): * if nans[col1]: # <<<<<<<<<<<<<< @@ -9230,7 +10413,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_nans.diminfo[0].strides)) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":432 + /* "Orange/distance/_distance.pyx":456 * for col1 in range(n_cols): * if nans[col1]: * for col2 in range(col1): # <<<<<<<<<<<<<< @@ -9242,7 +10425,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_col2 = __pyx_t_15; - /* "Orange/distance/_distance.pyx":433 + /* "Orange/distance/_distance.pyx":457 * if nans[col1]: * for col2 in range(col1): * in_both = in_any = 0 # <<<<<<<<<<<<<< @@ -9252,7 +10435,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_in_both = 0; __pyx_v_in_any = 0; - /* "Orange/distance/_distance.pyx":434 + /* "Orange/distance/_distance.pyx":458 * for col2 in range(col1): * in_both = in_any = 0 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 # <<<<<<<<<<<<<< @@ -9265,7 +10448,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_unk1_not2 = 0; __pyx_v_not1_unk2 = 0; - /* "Orange/distance/_distance.pyx":435 + /* "Orange/distance/_distance.pyx":459 * in_both = in_any = 0 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 * for row in range(n_rows): # <<<<<<<<<<<<<< @@ -9277,7 +10460,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_row = __pyx_t_18; - /* "Orange/distance/_distance.pyx":436 + /* "Orange/distance/_distance.pyx":460 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 * for row in range(n_rows): * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< @@ -9293,7 +10476,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_val1 = __pyx_t_21; __pyx_v_val2 = __pyx_t_24; - /* "Orange/distance/_distance.pyx":437 + /* "Orange/distance/_distance.pyx":461 * for row in range(n_rows): * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -9303,7 +10486,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val1) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":438 + /* "Orange/distance/_distance.pyx":462 * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -9313,7 +10496,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":439 + /* "Orange/distance/_distance.pyx":463 * if npy_isnan(val1): * if npy_isnan(val2): * unk1_unk2 += 1 # <<<<<<<<<<<<<< @@ -9322,7 +10505,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_unk1_unk2 = (__pyx_v_unk1_unk2 + 1); - /* "Orange/distance/_distance.pyx":438 + /* "Orange/distance/_distance.pyx":462 * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -9332,7 +10515,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L14; } - /* "Orange/distance/_distance.pyx":440 + /* "Orange/distance/_distance.pyx":464 * if npy_isnan(val2): * unk1_unk2 += 1 * elif val2 != 0: # <<<<<<<<<<<<<< @@ -9342,7 +10525,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":441 + /* "Orange/distance/_distance.pyx":465 * unk1_unk2 += 1 * elif val2 != 0: * unk1_in2 += 1 # <<<<<<<<<<<<<< @@ -9351,7 +10534,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_unk1_in2 = (__pyx_v_unk1_in2 + 1); - /* "Orange/distance/_distance.pyx":440 + /* "Orange/distance/_distance.pyx":464 * if npy_isnan(val2): * unk1_unk2 += 1 * elif val2 != 0: # <<<<<<<<<<<<<< @@ -9361,7 +10544,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L14; } - /* "Orange/distance/_distance.pyx":443 + /* "Orange/distance/_distance.pyx":467 * unk1_in2 += 1 * else: * unk1_not2 += 1 # <<<<<<<<<<<<<< @@ -9373,7 +10556,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU } __pyx_L14:; - /* "Orange/distance/_distance.pyx":437 + /* "Orange/distance/_distance.pyx":461 * for row in range(n_rows): * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -9383,7 +10566,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L13; } - /* "Orange/distance/_distance.pyx":444 + /* "Orange/distance/_distance.pyx":468 * else: * unk1_not2 += 1 * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -9393,7 +10576,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":445 + /* "Orange/distance/_distance.pyx":469 * unk1_not2 += 1 * elif npy_isnan(val2): * if val1 != 0: # <<<<<<<<<<<<<< @@ -9403,7 +10586,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = ((__pyx_v_val1 != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":446 + /* "Orange/distance/_distance.pyx":470 * elif npy_isnan(val2): * if val1 != 0: * in1_unk2 += 1 # <<<<<<<<<<<<<< @@ -9412,7 +10595,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_in1_unk2 = (__pyx_v_in1_unk2 + 1); - /* "Orange/distance/_distance.pyx":445 + /* "Orange/distance/_distance.pyx":469 * unk1_not2 += 1 * elif npy_isnan(val2): * if val1 != 0: # <<<<<<<<<<<<<< @@ -9422,7 +10605,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L15; } - /* "Orange/distance/_distance.pyx":448 + /* "Orange/distance/_distance.pyx":472 * in1_unk2 += 1 * else: * not1_unk2 += 1 # <<<<<<<<<<<<<< @@ -9434,7 +10617,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU } __pyx_L15:; - /* "Orange/distance/_distance.pyx":444 + /* "Orange/distance/_distance.pyx":468 * else: * unk1_not2 += 1 * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -9444,7 +10627,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L13; } - /* "Orange/distance/_distance.pyx":450 + /* "Orange/distance/_distance.pyx":474 * not1_unk2 += 1 * else: * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< @@ -9456,7 +10639,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_26 = __pyx_v_col1; __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":451 + /* "Orange/distance/_distance.pyx":475 * else: * ival1 = nonzeros[row, col1] * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< @@ -9467,7 +10650,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_28 = __pyx_v_col2; __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":452 + /* "Orange/distance/_distance.pyx":476 * ival1 = nonzeros[row, col1] * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 # <<<<<<<<<<<<<< @@ -9476,7 +10659,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); - /* "Orange/distance/_distance.pyx":453 + /* "Orange/distance/_distance.pyx":477 * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 * in_any += ival1 | ival2 # <<<<<<<<<<<<<< @@ -9488,7 +10671,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_L13:; } - /* "Orange/distance/_distance.pyx":455 + /* "Orange/distance/_distance.pyx":479 * in_any += ival1 | ival2 * union = (in_any + unk1_in2 + in1_unk2 * + ps[col1] * unk1_not2 # <<<<<<<<<<<<<< @@ -9497,7 +10680,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_29 = __pyx_v_col1; - /* "Orange/distance/_distance.pyx":456 + /* "Orange/distance/_distance.pyx":480 * union = (in_any + unk1_in2 + in1_unk2 * + ps[col1] * unk1_not2 * + ps[col2] * not1_unk2 # <<<<<<<<<<<<<< @@ -9506,7 +10689,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_30 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":457 + /* "Orange/distance/_distance.pyx":481 * + ps[col1] * unk1_not2 * + ps[col2] * not1_unk2 * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) # <<<<<<<<<<<<<< @@ -9517,7 +10700,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_32 = __pyx_v_col2; __pyx_v_union = (((((__pyx_v_in_any + __pyx_v_unk1_in2) + __pyx_v_in1_unk2) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_not2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_not1_unk2)) + ((1.0 - ((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_ps.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_ps.diminfo[0].strides))))) * __pyx_v_unk1_unk2)); - /* "Orange/distance/_distance.pyx":458 + /* "Orange/distance/_distance.pyx":482 * + ps[col2] * not1_unk2 * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) * if union != 0: # <<<<<<<<<<<<<< @@ -9527,7 +10710,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = ((__pyx_v_union != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":460 + /* "Orange/distance/_distance.pyx":484 * if union != 0: * intersection = (in_both * + ps[col1] * unk1_in2 + # <<<<<<<<<<<<<< @@ -9536,7 +10719,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_33 = __pyx_v_col1; - /* "Orange/distance/_distance.pyx":461 + /* "Orange/distance/_distance.pyx":485 * intersection = (in_both * + ps[col1] * unk1_in2 + * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< @@ -9545,7 +10728,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_34 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":462 + /* "Orange/distance/_distance.pyx":486 * + ps[col1] * unk1_in2 + * + ps[col2] * in1_unk2 + * + ps[col1] * ps[col2] * unk1_unk2) # <<<<<<<<<<<<<< @@ -9555,7 +10738,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_35 = __pyx_v_col1; __pyx_t_36 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":461 + /* "Orange/distance/_distance.pyx":485 * intersection = (in_both * + ps[col1] * unk1_in2 + * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< @@ -9564,7 +10747,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_intersection = (((__pyx_v_in_both + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_in2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_in1_unk2)) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_ps.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_ps.diminfo[0].strides))) * __pyx_v_unk1_unk2)); - /* "Orange/distance/_distance.pyx":464 + /* "Orange/distance/_distance.pyx":488 * + ps[col1] * ps[col2] * unk1_unk2) * distances[col1, col2] = distances[col2, col1] = \ * 1 - intersection / union # <<<<<<<<<<<<<< @@ -9573,7 +10756,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_37 = (1.0 - (__pyx_v_intersection / __pyx_v_union)); - /* "Orange/distance/_distance.pyx":463 + /* "Orange/distance/_distance.pyx":487 * + ps[col2] * in1_unk2 + * + ps[col1] * ps[col2] * unk1_unk2) * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< @@ -9587,7 +10770,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_41 = __pyx_v_col1; *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_40 * __pyx_v_distances.strides[0]) ) + __pyx_t_41 * __pyx_v_distances.strides[1]) )) = __pyx_t_37; - /* "Orange/distance/_distance.pyx":458 + /* "Orange/distance/_distance.pyx":482 * + ps[col2] * not1_unk2 * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) * if union != 0: # <<<<<<<<<<<<<< @@ -9597,7 +10780,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU } } - /* "Orange/distance/_distance.pyx":431 + /* "Orange/distance/_distance.pyx":455 * with nogil: * for col1 in range(n_cols): * if nans[col1]: # <<<<<<<<<<<<<< @@ -9607,7 +10790,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L8; } - /* "Orange/distance/_distance.pyx":466 + /* "Orange/distance/_distance.pyx":490 * 1 - intersection / union * else: * for col2 in range(col1): # <<<<<<<<<<<<<< @@ -9620,7 +10803,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_col2 = __pyx_t_15; - /* "Orange/distance/_distance.pyx":467 + /* "Orange/distance/_distance.pyx":491 * else: * for col2 in range(col1): * if nans[col2]: # <<<<<<<<<<<<<< @@ -9631,7 +10814,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_nans.diminfo[0].strides)) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":468 + /* "Orange/distance/_distance.pyx":492 * for col2 in range(col1): * if nans[col2]: * in_both = in_any = 0 # <<<<<<<<<<<<<< @@ -9641,7 +10824,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_in_both = 0; __pyx_v_in_any = 0; - /* "Orange/distance/_distance.pyx":469 + /* "Orange/distance/_distance.pyx":493 * if nans[col2]: * in_both = in_any = 0 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 # <<<<<<<<<<<<<< @@ -9654,7 +10837,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_unk1_not2 = 0; __pyx_v_not1_unk2 = 0; - /* "Orange/distance/_distance.pyx":470 + /* "Orange/distance/_distance.pyx":494 * in_both = in_any = 0 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 * for row in range(n_rows): # <<<<<<<<<<<<<< @@ -9666,7 +10849,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_row = __pyx_t_18; - /* "Orange/distance/_distance.pyx":471 + /* "Orange/distance/_distance.pyx":495 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 * for row in range(n_rows): * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< @@ -9677,7 +10860,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_44 = __pyx_v_col1; __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":472 + /* "Orange/distance/_distance.pyx":496 * for row in range(n_rows): * ival1 = nonzeros[row, col1] * val2 = x[row, col2] # <<<<<<<<<<<<<< @@ -9688,7 +10871,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_46 = __pyx_v_col2; __pyx_v_val2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_x.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":473 + /* "Orange/distance/_distance.pyx":497 * ival1 = nonzeros[row, col1] * val2 = x[row, col2] * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -9698,7 +10881,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":474 + /* "Orange/distance/_distance.pyx":498 * val2 = x[row, col2] * if npy_isnan(val2): * if ival1: # <<<<<<<<<<<<<< @@ -9708,7 +10891,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = (__pyx_v_ival1 != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":475 + /* "Orange/distance/_distance.pyx":499 * if npy_isnan(val2): * if ival1: * in1_unk2 += 1 # <<<<<<<<<<<<<< @@ -9717,7 +10900,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_in1_unk2 = (__pyx_v_in1_unk2 + 1); - /* "Orange/distance/_distance.pyx":474 + /* "Orange/distance/_distance.pyx":498 * val2 = x[row, col2] * if npy_isnan(val2): * if ival1: # <<<<<<<<<<<<<< @@ -9727,7 +10910,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L23; } - /* "Orange/distance/_distance.pyx":477 + /* "Orange/distance/_distance.pyx":501 * in1_unk2 += 1 * else: * not1_unk2 += 1 # <<<<<<<<<<<<<< @@ -9739,7 +10922,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU } __pyx_L23:; - /* "Orange/distance/_distance.pyx":473 + /* "Orange/distance/_distance.pyx":497 * ival1 = nonzeros[row, col1] * val2 = x[row, col2] * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -9749,7 +10932,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L22; } - /* "Orange/distance/_distance.pyx":479 + /* "Orange/distance/_distance.pyx":503 * not1_unk2 += 1 * else: * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< @@ -9761,7 +10944,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_48 = __pyx_v_col2; __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":480 + /* "Orange/distance/_distance.pyx":504 * else: * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 # <<<<<<<<<<<<<< @@ -9770,7 +10953,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); - /* "Orange/distance/_distance.pyx":481 + /* "Orange/distance/_distance.pyx":505 * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 * in_any += ival1 | ival2 # <<<<<<<<<<<<<< @@ -9782,7 +10965,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_L22:; } - /* "Orange/distance/_distance.pyx":484 + /* "Orange/distance/_distance.pyx":508 * distances[col1, col2] = distances[col2, col1] = \ * 1 - float(in_both * + ps[col1] * unk1_in2 + # <<<<<<<<<<<<<< @@ -9791,7 +10974,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_49 = __pyx_v_col1; - /* "Orange/distance/_distance.pyx":485 + /* "Orange/distance/_distance.pyx":509 * 1 - float(in_both * + ps[col1] * unk1_in2 + * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< @@ -9800,7 +10983,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_50 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":486 + /* "Orange/distance/_distance.pyx":510 * + ps[col1] * unk1_in2 + * + ps[col2] * in1_unk2 + * + ps[col1] * ps[col2] * unk1_unk2) / \ # <<<<<<<<<<<<<< @@ -9810,7 +10993,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_51 = __pyx_v_col1; __pyx_t_52 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":488 + /* "Orange/distance/_distance.pyx":512 * + ps[col1] * ps[col2] * unk1_unk2) / \ * (in_any + unk1_in2 + in1_unk2 + * + ps[col1] * unk1_not2 # <<<<<<<<<<<<<< @@ -9819,7 +11002,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_53 = __pyx_v_col1; - /* "Orange/distance/_distance.pyx":489 + /* "Orange/distance/_distance.pyx":513 * (in_any + unk1_in2 + in1_unk2 + * + ps[col1] * unk1_not2 * + ps[col2] * not1_unk2 # <<<<<<<<<<<<<< @@ -9828,7 +11011,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_54 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":490 + /* "Orange/distance/_distance.pyx":514 * + ps[col1] * unk1_not2 * + ps[col2] * not1_unk2 * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) # <<<<<<<<<<<<<< @@ -9838,16 +11021,16 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_55 = __pyx_v_col1; __pyx_t_56 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":483 + /* "Orange/distance/_distance.pyx":507 * in_any += ival1 | ival2 * distances[col1, col2] = distances[col2, col1] = \ * 1 - float(in_both # <<<<<<<<<<<<<< * + ps[col1] * unk1_in2 + * + ps[col2] * in1_unk2 + */ - __pyx_t_24 = (1.0 - (((__pyx_t_5numpy_float64_t)((double)(((__pyx_v_in_both + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_in2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_in1_unk2)) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_ps.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_ps.diminfo[0].strides))) * __pyx_v_unk1_unk2)))) / (((((__pyx_v_in_any + __pyx_v_unk1_in2) + __pyx_v_in1_unk2) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_not2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_not1_unk2)) + ((1.0 - ((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_ps.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_ps.diminfo[0].strides))))) * __pyx_v_unk1_unk2)))); + __pyx_t_24 = (1.0 - (((double)(((__pyx_v_in_both + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_in2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_in1_unk2)) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_ps.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_ps.diminfo[0].strides))) * __pyx_v_unk1_unk2))) / (((((__pyx_v_in_any + __pyx_v_unk1_in2) + __pyx_v_in1_unk2) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_not2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_not1_unk2)) + ((1.0 - ((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_ps.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_ps.diminfo[0].strides))))) * __pyx_v_unk1_unk2)))); - /* "Orange/distance/_distance.pyx":482 + /* "Orange/distance/_distance.pyx":506 * in_both += ival1 & ival2 * in_any += ival1 | ival2 * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< @@ -9861,7 +11044,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_60 = __pyx_v_col1; *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_59 * __pyx_v_distances.strides[0]) ) + __pyx_t_60 * __pyx_v_distances.strides[1]) )) = __pyx_t_24; - /* "Orange/distance/_distance.pyx":467 + /* "Orange/distance/_distance.pyx":491 * else: * for col2 in range(col1): * if nans[col2]: # <<<<<<<<<<<<<< @@ -9871,7 +11054,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L19; } - /* "Orange/distance/_distance.pyx":492 + /* "Orange/distance/_distance.pyx":516 * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) * else: * in_both = in_any = 0 # <<<<<<<<<<<<<< @@ -9882,7 +11065,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_in_both = 0; __pyx_v_in_any = 0; - /* "Orange/distance/_distance.pyx":493 + /* "Orange/distance/_distance.pyx":517 * else: * in_both = in_any = 0 * for row in range(n_rows): # <<<<<<<<<<<<<< @@ -9894,7 +11077,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_row = __pyx_t_18; - /* "Orange/distance/_distance.pyx":494 + /* "Orange/distance/_distance.pyx":518 * in_both = in_any = 0 * for row in range(n_rows): * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< @@ -9905,7 +11088,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_62 = __pyx_v_col1; __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_62, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":495 + /* "Orange/distance/_distance.pyx":519 * for row in range(n_rows): * ival1 = nonzeros[row, col1] * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< @@ -9916,7 +11099,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_64 = __pyx_v_col2; __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":496 + /* "Orange/distance/_distance.pyx":520 * ival1 = nonzeros[row, col1] * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 # <<<<<<<<<<<<<< @@ -9925,7 +11108,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); - /* "Orange/distance/_distance.pyx":497 + /* "Orange/distance/_distance.pyx":521 * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 * in_any += ival1 | ival2 # <<<<<<<<<<<<<< @@ -9935,7 +11118,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_in_any = (__pyx_v_in_any + (__pyx_v_ival1 | __pyx_v_ival2)); } - /* "Orange/distance/_distance.pyx":498 + /* "Orange/distance/_distance.pyx":522 * in_both += ival1 & ival2 * in_any += ival1 | ival2 * if in_any != 0: # <<<<<<<<<<<<<< @@ -9945,16 +11128,16 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = ((__pyx_v_in_any != 0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":500 + /* "Orange/distance/_distance.pyx":524 * if in_any != 0: * distances[col1, col2] = distances[col2, col1] = \ * 1 - float(in_both) / in_any # <<<<<<<<<<<<<< * * return distances */ - __pyx_t_37 = (1.0 - (((double)__pyx_v_in_both) / ((double)__pyx_v_in_any))); + __pyx_t_37 = (1.0 - (((double)__pyx_v_in_both) / __pyx_v_in_any)); - /* "Orange/distance/_distance.pyx":499 + /* "Orange/distance/_distance.pyx":523 * in_any += ival1 | ival2 * if in_any != 0: * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< @@ -9968,7 +11151,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_68 = __pyx_v_col1; *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_67 * __pyx_v_distances.strides[0]) ) + __pyx_t_68 * __pyx_v_distances.strides[1]) )) = __pyx_t_37; - /* "Orange/distance/_distance.pyx":498 + /* "Orange/distance/_distance.pyx":522 * in_both += ival1 & ival2 * in_any += ival1 | ival2 * if in_any != 0: # <<<<<<<<<<<<<< @@ -9984,7 +11167,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU } } - /* "Orange/distance/_distance.pyx":429 + /* "Orange/distance/_distance.pyx":453 * n_rows, n_cols = x.shape[0], x.shape[1] * distances = np.zeros((n_cols, n_cols), dtype=float) * with nogil: # <<<<<<<<<<<<<< @@ -10003,19 +11186,19 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU } } - /* "Orange/distance/_distance.pyx":502 + /* "Orange/distance/_distance.pyx":526 * 1 - float(in_both) / in_any * * return distances # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 502, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 526, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "Orange/distance/_distance.pyx":416 + /* "Orange/distance/_distance.pyx":440 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< @@ -10054,7 +11237,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":215 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -10092,8 +11275,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - char *__pyx_t_8; + PyArray_Descr *__pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; if (__pyx_v_info == NULL) { PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); return -1; @@ -10102,7 +11286,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":222 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":265 * * cdef int i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -10111,7 +11295,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_endian_detector = 1; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":223 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":266 * cdef int i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -10120,7 +11304,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":225 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":268 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -10129,11 +11313,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":227 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270 * ndim = PyArray_NDIM(self) * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); @@ -10143,53 +11327,53 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L4_bool_binop_done; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":228 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":271 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); + __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":227 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270 * ndim = PyArray_NDIM(self) * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ if (unlikely(__pyx_t_1)) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":229 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 229, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 229, __pyx_L1_error) + __PYX_ERR(1, 272, __pyx_L1_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":227 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":270 * ndim = PyArray_NDIM(self) * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":231 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); @@ -10199,49 +11383,49 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L7_bool_binop_done; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":232 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":275 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); + __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L7_bool_binop_done:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":231 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ if (unlikely(__pyx_t_1)) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":233 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 233, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 233, __pyx_L1_error) + __PYX_ERR(1, 276, __pyx_L1_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":231 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":274 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":235 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":278 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -10250,7 +11434,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":236 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":279 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -10259,7 +11443,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":237 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -10269,7 +11453,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":240 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":283 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) # <<<<<<<<<<<<<< @@ -10278,7 +11462,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim)))); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":241 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":284 * # This is allocated as one block, strides first. * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -10287,7 +11471,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":242 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":285 * info.strides = PyObject_Malloc(sizeof(Py_ssize_t) * 2 * ndim) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -10299,7 +11483,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":243 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":286 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -10308,7 +11492,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":244 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":287 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -10318,7 +11502,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":237 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":280 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -10328,7 +11512,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L9; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":246 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":289 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -10338,7 +11522,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P /*else*/ { __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":247 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":290 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -10349,7 +11533,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L9:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":248 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":291 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -10358,7 +11542,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->suboffsets = NULL; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":249 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":292 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -10367,7 +11551,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":250 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":293 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -10376,28 +11560,29 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":253 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":296 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< - * cdef dtype descr = self.descr + * cdef dtype descr = PyArray_DESCR(self) * cdef int offset */ __pyx_v_f = NULL; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":254 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":297 * cdef int t * cdef char* f = NULL - * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef dtype descr = PyArray_DESCR(self) # <<<<<<<<<<<<<< * cdef int offset * */ - __pyx_t_3 = ((PyObject *)__pyx_v_self->descr); + __pyx_t_7 = PyArray_DESCR(__pyx_v_self); + __pyx_t_3 = ((PyObject *)__pyx_t_7); __Pyx_INCREF(__pyx_t_3); __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":257 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":300 * cdef int offset * * info.obj = self # <<<<<<<<<<<<<< @@ -10410,7 +11595,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":259 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302 * info.obj = self * * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<< @@ -10420,7 +11605,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0); if (__pyx_t_1) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":260 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":303 * * if not PyDataType_HASFIELDS(descr): * t = descr.type_num # <<<<<<<<<<<<<< @@ -10430,7 +11615,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_4 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_4; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":261 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304 * if not PyDataType_HASFIELDS(descr): * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -10450,7 +11635,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L15_next_or:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":262 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":305 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< @@ -10467,7 +11652,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = __pyx_t_2; __pyx_L14_bool_binop_done:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":261 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304 * if not PyDataType_HASFIELDS(descr): * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -10476,20 +11661,20 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ if (unlikely(__pyx_t_1)) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":263 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 263, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 263, __pyx_L1_error) + __PYX_ERR(1, 306, __pyx_L1_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":261 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":304 * if not PyDataType_HASFIELDS(descr): * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -10498,7 +11683,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":264 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":307 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -10509,206 +11694,206 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P case NPY_BYTE: __pyx_v_f = ((char *)"b"); break; + case NPY_UBYTE: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":265 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":308 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ - case NPY_UBYTE: __pyx_v_f = ((char *)"B"); break; + case NPY_SHORT: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":266 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":309 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ - case NPY_SHORT: __pyx_v_f = ((char *)"h"); break; + case NPY_USHORT: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":267 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":310 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ - case NPY_USHORT: __pyx_v_f = ((char *)"H"); break; + case NPY_INT: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":268 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":311 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ - case NPY_INT: __pyx_v_f = ((char *)"i"); break; + case NPY_UINT: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":269 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":312 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ - case NPY_UINT: __pyx_v_f = ((char *)"I"); break; + case NPY_LONG: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":270 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":313 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ - case NPY_LONG: __pyx_v_f = ((char *)"l"); break; + case NPY_ULONG: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":271 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":314 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ - case NPY_ULONG: __pyx_v_f = ((char *)"L"); break; + case NPY_LONGLONG: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":272 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":315 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ - case NPY_LONGLONG: __pyx_v_f = ((char *)"q"); break; + case NPY_ULONGLONG: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":273 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":316 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ - case NPY_ULONGLONG: __pyx_v_f = ((char *)"Q"); break; + case NPY_FLOAT: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":274 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":317 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ - case NPY_FLOAT: __pyx_v_f = ((char *)"f"); break; + case NPY_DOUBLE: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":275 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":318 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ - case NPY_DOUBLE: __pyx_v_f = ((char *)"d"); break; + case NPY_LONGDOUBLE: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":276 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":319 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ - case NPY_LONGDOUBLE: __pyx_v_f = ((char *)"g"); break; + case NPY_CFLOAT: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":277 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":320 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ - case NPY_CFLOAT: __pyx_v_f = ((char *)"Zf"); break; + case NPY_CDOUBLE: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":278 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":321 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ - case NPY_CDOUBLE: __pyx_v_f = ((char *)"Zd"); break; + case NPY_CLONGDOUBLE: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":279 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":322 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ - case NPY_CLONGDOUBLE: __pyx_v_f = ((char *)"Zg"); break; + case NPY_OBJECT: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":280 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":323 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - case NPY_OBJECT: __pyx_v_f = ((char *)"O"); break; default: - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":282 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":325 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 282, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 325, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 282, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 282, __pyx_L1_error) + __PYX_ERR(1, 325, __pyx_L1_error) break; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":283 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":326 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -10717,7 +11902,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->format = __pyx_v_f; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":284 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":327 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -10727,7 +11912,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_r = 0; goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":259 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":302 * info.obj = self * * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<< @@ -10736,7 +11921,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":286 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":329 * return * else: * info.format = PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -10746,7 +11931,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P /*else*/ { __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF)); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":287 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":330 * else: * info.format = PyObject_Malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -10755,7 +11940,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->format[0]) = '^'; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":288 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":331 * info.format = PyObject_Malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -10764,17 +11949,17 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_offset = 0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":289 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":332 * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<< * info.format + _buffer_format_string_len, * &offset) */ - __pyx_t_8 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_8 == ((char *)NULL))) __PYX_ERR(1, 289, __pyx_L1_error) - __pyx_v_f = __pyx_t_8; + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 332, __pyx_L1_error) + __pyx_v_f = __pyx_t_9; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":292 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":335 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< @@ -10784,7 +11969,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P (__pyx_v_f[0]) = '\x00'; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":215 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":258 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -10797,7 +11982,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info->obj != NULL) { @@ -10816,7 +12001,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":294 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -10840,7 +12025,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":295 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -10850,7 +12035,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":296 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":339 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) # <<<<<<<<<<<<<< @@ -10859,7 +12044,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ PyObject_Free(__pyx_v_info->format); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":295 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":338 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -10868,7 +12053,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":297 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340 * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -10878,7 +12063,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":298 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":341 * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * PyObject_Free(info.strides) # <<<<<<<<<<<<<< @@ -10887,7 +12072,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ PyObject_Free(__pyx_v_info->strides); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":297 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":340 * if PyArray_HASFIELDS(self): * PyObject_Free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -10896,7 +12081,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":294 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":337 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -10908,7 +12093,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __Pyx_RefNannyFinishContext(); } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":775 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -10922,7 +12107,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":776 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":822 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -10930,13 +12115,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 776, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 822, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":775 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":821 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -10955,7 +12140,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":778 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -10969,7 +12154,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":779 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":825 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -10977,13 +12162,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 779, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":778 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":824 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -11002,7 +12187,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":781 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -11016,7 +12201,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":782 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":828 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -11024,13 +12209,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 782, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 828, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":781 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":827 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -11049,7 +12234,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":784 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -11063,7 +12248,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":785 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":831 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -11071,13 +12256,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 785, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":784 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":830 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -11096,7 +12281,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":787 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -11110,7 +12295,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":788 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":834 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -11118,13 +12303,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline tuple PyDataType_SHAPE(dtype d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 788, __pyx_L1_error) + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 834, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":787 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":833 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -11143,7 +12328,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":790 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< @@ -11157,7 +12342,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ int __pyx_t_1; __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":791 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837 * * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< @@ -11167,7 +12352,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0); if (__pyx_t_1) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":792 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":838 * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): * return d.subarray.shape # <<<<<<<<<<<<<< @@ -11179,7 +12364,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape); goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":791 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":837 * * cdef inline tuple PyDataType_SHAPE(dtype d): * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<< @@ -11188,7 +12373,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":794 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":840 * return d.subarray.shape * else: * return () # <<<<<<<<<<<<<< @@ -11202,7 +12387,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ goto __pyx_L0; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":790 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":836 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<< @@ -11217,7 +12402,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__ return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":796 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842 * return () * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -11246,7 +12431,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx char *__pyx_t_9; __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":801 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":847 * * cdef dtype child * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -11255,7 +12440,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":802 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":848 * cdef dtype child * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -11264,7 +12449,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":805 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -11273,21 +12458,21 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (unlikely(__pyx_v_descr->names == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - __PYX_ERR(1, 805, __pyx_L1_error) + __PYX_ERR(1, 851, __pyx_L1_error) } __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 805, __pyx_L1_error) + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 851, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 805, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":806 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":852 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< @@ -11296,15 +12481,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (unlikely(__pyx_v_descr->fields == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(1, 806, __pyx_L1_error) + __PYX_ERR(1, 852, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 806, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 806, __pyx_L1_error) + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 852, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":807 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":853 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -11317,7 +12502,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(1, 807, __pyx_L1_error) + __PYX_ERR(1, 853, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); @@ -11325,51 +12510,51 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 807, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 807, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 807, __pyx_L1_error) + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 853, __pyx_L1_error) } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 807, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 853, __pyx_L1_error) __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":809 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 809, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 809, __pyx_L1_error) + __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 809, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 855, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0); if (unlikely(__pyx_t_6)) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":810 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 810, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 810, __pyx_L1_error) + __PYX_ERR(1, 856, __pyx_L1_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":809 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":855 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< @@ -11378,7 +12563,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":812 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -11398,7 +12583,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } __pyx_L8_next_or:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":813 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":859 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< @@ -11415,7 +12600,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_6 = __pyx_t_7; __pyx_L7_bool_binop_done:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":812 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -11424,20 +12609,20 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (unlikely(__pyx_t_6)) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":814 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":860 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 814, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(1, 814, __pyx_L1_error) + __PYX_ERR(1, 860, __pyx_L1_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":812 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":858 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< @@ -11446,7 +12631,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":824 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":870 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -11454,15 +12639,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 824, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 870, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 824, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 870, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 824, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 870, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!__pyx_t_6) break; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":825 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":871 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -11471,7 +12656,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 0x78; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":826 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":872 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -11480,7 +12665,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":827 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":873 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< @@ -11491,7 +12676,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1); } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":829 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":875 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< @@ -11501,7 +12686,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_8 = 0; (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":831 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -11511,19 +12696,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); if (__pyx_t_6) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":832 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":878 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 832, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); __pyx_t_4 = 0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":833 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -11533,20 +12718,20 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); if (unlikely(__pyx_t_6)) { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":834 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 880, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(1, 834, __pyx_L1_error) + __PYX_ERR(1, 880, __pyx_L1_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":833 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":879 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -11555,252 +12740,252 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":837 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":883 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 837, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 837, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 837, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 883, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":838 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":884 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 838, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 838, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 884, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 838, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":839 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":885 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 839, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 885, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 885, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 839, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 885, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x68; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":840 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":886 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 840, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 886, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 840, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 886, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 840, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 886, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":841 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":887 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 841, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 887, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 841, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 887, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 841, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 887, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x69; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":842 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":888 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 842, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 888, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 842, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 888, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 842, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 888, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":843 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":889 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 843, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 843, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 889, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 843, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 889, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x6C; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":844 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":890 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 844, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 890, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 844, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 890, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":845 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":891 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 845, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 891, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 845, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 891, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 845, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 891, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x71; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":846 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":892 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 846, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 892, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 846, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 892, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 846, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 892, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":847 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":893 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 847, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 893, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 847, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 893, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 847, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 893, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x66; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":848 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":894 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 848, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 894, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 848, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 894, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 848, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 894, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x64; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":849 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":895 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 849, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 895, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 849, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 895, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 849, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 895, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 0x67; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":850 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":896 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 850, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 896, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 850, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 896, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 850, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 896, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -11809,18 +12994,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":851 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":897 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 851, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 897, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 897, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 851, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 897, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -11829,18 +13014,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":852 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":898 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 898, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 852, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 898, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 852, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 898, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -11849,25 +13034,25 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":853 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":899 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error) + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 899, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 853, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 899, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(__pyx_t_6)) { (__pyx_v_f[0]) = 79; goto __pyx_L15; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":855 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":901 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< @@ -11875,18 +13060,18 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * else: */ /*else*/ { - __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 901, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(1, 855, __pyx_L1_error) + __PYX_ERR(1, 901, __pyx_L1_error) } __pyx_L15:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":856 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":902 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -11895,7 +13080,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":831 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":877 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -11905,7 +13090,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx goto __pyx_L13; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":860 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":906 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< @@ -11913,12 +13098,12 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * */ /*else*/ { - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 860, __pyx_L1_error) + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 906, __pyx_L1_error) __pyx_v_f = __pyx_t_9; } __pyx_L13:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":805 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":851 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -11928,7 +13113,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":861 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":907 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -11938,7 +13123,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = __pyx_v_f; goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":796 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":842 * return () * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -11963,166 +13148,120 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":977 - * +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022 + * int _import_umath() except -1 * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * cdef PyObject* baseptr - * if base is None: + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { - PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; __Pyx_RefNannySetupContext("set_array_base", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":979 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1023 + * * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: - */ - __pyx_t_1 = (__pyx_v_base == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":980 - * cdef PyObject* baseptr - * if base is None: - * baseptr = NULL # <<<<<<<<<<<<<< - * else: - * Py_INCREF(base) # important to do this before decref below! + * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<< + * PyArray_SetBaseObject(arr, base) + * */ - __pyx_v_baseptr = NULL; + Py_INCREF(__pyx_v_base); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":979 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1024 * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): */ - goto __pyx_L3; - } + (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base)); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":982 - * baseptr = NULL - * else: - * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< - * baseptr = base - * Py_XDECREF(arr.base) - */ - /*else*/ { - Py_INCREF(__pyx_v_base); - - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":983 - * else: - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base # <<<<<<<<<<<<<< - * Py_XDECREF(arr.base) - * arr.base = baseptr - */ - __pyx_v_baseptr = ((PyObject *)__pyx_v_base); - } - __pyx_L3:; - - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":984 - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base - * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< - * arr.base = baseptr - * - */ - Py_XDECREF(__pyx_v_arr->base); - - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":985 - * baseptr = base - * Py_XDECREF(arr.base) - * arr.base = baseptr # <<<<<<<<<<<<<< - * - * cdef inline object get_array_base(ndarray arr): - */ - __pyx_v_arr->base = __pyx_v_baseptr; - - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":977 - * - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * cdef PyObject* baseptr - * if base is None: + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1022 + * int _import_umath() except -1 + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * Py_INCREF(base) # important to do this before stealing the reference below! + * PyArray_SetBaseObject(arr, base) */ /* function exit code */ __Pyx_RefNannyFinishContext(); } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":987 - * arr.base = baseptr +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026 + * PyArray_SetBaseObject(arr, base) * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None + * base = PyArray_BASE(arr) + * if base is NULL: */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_v_base; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":988 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1027 * * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) # <<<<<<<<<<<<<< + * if base is NULL: * return None - * else: */ - __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); - if (__pyx_t_1) { + __pyx_v_base = PyArray_BASE(__pyx_v_arr); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":989 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028 * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< + * return None + * return base + */ + __pyx_t_1 = ((__pyx_v_base == NULL) != 0); + if (__pyx_t_1) { + + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1029 + * base = PyArray_BASE(arr) + * if base is NULL: * return None # <<<<<<<<<<<<<< - * else: - * return arr.base + * return base + * */ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":988 - * + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1028 * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< + * base = PyArray_BASE(arr) + * if base is NULL: # <<<<<<<<<<<<<< * return None - * else: + * return base */ } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":991 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1030 + * if base is NULL: * return None - * else: - * return arr.base # <<<<<<<<<<<<<< - * + * return base # <<<<<<<<<<<<<< * + * # Versions of the import_* functions which are more suitable for */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); - __pyx_r = ((PyObject *)__pyx_v_arr->base); - goto __pyx_L0; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_base)); + __pyx_r = ((PyObject *)__pyx_v_base); + goto __pyx_L0; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":987 - * arr.base = baseptr + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1026 + * PyArray_SetBaseObject(arr, base) * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None + * base = PyArray_BASE(arr) + * if base is NULL: */ /* function exit code */ @@ -12132,7 +13271,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":996 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034 * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< @@ -12153,7 +13292,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_array", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":997 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -12169,16 +13308,16 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":998 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1036 * cdef inline int import_array() except -1: * try: * _import_array() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.multiarray failed to import") */ - __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 998, __pyx_L3_error) + __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1036, __pyx_L3_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":997 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -12192,7 +13331,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { goto __pyx_L8_try_end; __pyx_L3_error:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":999 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1037 * try: * _import_array() * except Exception: # <<<<<<<<<<<<<< @@ -12202,28 +13341,28 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 999, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1037, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1000 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038 * _import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1000, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1038, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 1000, __pyx_L5_except_error) + __PYX_ERR(1, 1038, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":997 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1035 * # Cython code. * cdef inline int import_array() except -1: * try: # <<<<<<<<<<<<<< @@ -12238,7 +13377,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { __pyx_L8_try_end:; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":996 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1034 * # Versions of the import_* functions which are more suitable for * # Cython code. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<< @@ -12261,7 +13400,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) { return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1002 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040 * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< @@ -12282,7 +13421,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_umath", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1003 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -12298,16 +13437,16 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1004 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1042 * cdef inline int import_umath() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1004, __pyx_L3_error) + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1042, __pyx_L3_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1003 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -12321,7 +13460,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { goto __pyx_L8_try_end; __pyx_L3_error:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1005 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1043 * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< @@ -12331,28 +13470,28 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1005, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1043, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1006 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1006, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1044, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 1006, __pyx_L5_except_error) + __PYX_ERR(1, 1044, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1003 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1041 * * cdef inline int import_umath() except -1: * try: # <<<<<<<<<<<<<< @@ -12367,7 +13506,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { __pyx_L8_try_end:; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1002 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1040 * raise ImportError("numpy.core.multiarray failed to import") * * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<< @@ -12390,7 +13529,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) { return __pyx_r; } -/* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1008 +/* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046 * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< @@ -12411,7 +13550,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("import_ufunc", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1009 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -12427,16 +13566,16 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1010 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1048 * cdef inline int import_ufunc() except -1: * try: * _import_umath() # <<<<<<<<<<<<<< * except Exception: * raise ImportError("numpy.core.umath failed to import") */ - __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1010, __pyx_L3_error) + __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1048, __pyx_L3_error) - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1009 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -12450,7 +13589,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { goto __pyx_L8_try_end; __pyx_L3_error:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1011 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1049 * try: * _import_umath() * except Exception: # <<<<<<<<<<<<<< @@ -12459,26 +13598,26 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); if (__pyx_t_4) { __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1011, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1049, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1012 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1050 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< */ - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1012, __pyx_L5_except_error) + __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1050, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __PYX_ERR(1, 1012, __pyx_L5_except_error) + __PYX_ERR(1, 1050, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1009 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1047 * * cdef inline int import_ufunc() except -1: * try: # <<<<<<<<<<<<<< @@ -12493,7 +13632,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { __pyx_L8_try_end:; } - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1008 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1046 * raise ImportError("numpy.core.umath failed to import") * * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<< @@ -12516,7 +13655,7 @@ static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) { return __pyx_r; } -/* "View.MemoryView":121 +/* "View.MemoryView":122 * cdef bint dtype_is_object * * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< @@ -12565,13 +13704,13 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 121, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 121, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: @@ -12587,7 +13726,7 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 121, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 122, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -12603,14 +13742,14 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P } } __pyx_v_shape = ((PyObject*)values[0]); - __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 121, __pyx_L3_error) + __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 122, __pyx_L3_error) __pyx_v_format = values[2]; __pyx_v_mode = values[3]; if (values[4]) { - __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 122, __pyx_L3_error) + __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error) } else { - /* "View.MemoryView":122 + /* "View.MemoryView":123 * * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<< @@ -12622,19 +13761,19 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 121, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 122, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 121, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 122, __pyx_L1_error) if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) { - PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 121, __pyx_L1_error) + PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 122, __pyx_L1_error) } __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer); - /* "View.MemoryView":121 + /* "View.MemoryView":122 * cdef bint dtype_is_object * * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< @@ -12664,16 +13803,16 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ PyObject *__pyx_t_3 = NULL; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; - char *__pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_6 = NULL; + char *__pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; PyObject *__pyx_t_10 = NULL; Py_ssize_t __pyx_t_11; __Pyx_RefNannySetupContext("__cinit__", 0); __Pyx_INCREF(__pyx_v_format); - /* "View.MemoryView":128 + /* "View.MemoryView":129 * cdef PyObject **p * * self.ndim = len(shape) # <<<<<<<<<<<<<< @@ -12682,12 +13821,12 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ if (unlikely(__pyx_v_shape == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 128, __pyx_L1_error) + __PYX_ERR(2, 129, __pyx_L1_error) } - __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 128, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 129, __pyx_L1_error) __pyx_v_self->ndim = ((int)__pyx_t_1); - /* "View.MemoryView":129 + /* "View.MemoryView":130 * * self.ndim = len(shape) * self.itemsize = itemsize # <<<<<<<<<<<<<< @@ -12696,7 +13835,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_self->itemsize = __pyx_v_itemsize; - /* "View.MemoryView":131 + /* "View.MemoryView":132 * self.itemsize = itemsize * * if not self.ndim: # <<<<<<<<<<<<<< @@ -12706,20 +13845,20 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0); if (unlikely(__pyx_t_2)) { - /* "View.MemoryView":132 + /* "View.MemoryView":133 * * if not self.ndim: * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< * * if itemsize <= 0: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 132, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 132, __pyx_L1_error) + __PYX_ERR(2, 133, __pyx_L1_error) - /* "View.MemoryView":131 + /* "View.MemoryView":132 * self.itemsize = itemsize * * if not self.ndim: # <<<<<<<<<<<<<< @@ -12728,7 +13867,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":134 + /* "View.MemoryView":135 * raise ValueError("Empty shape tuple for cython.array") * * if itemsize <= 0: # <<<<<<<<<<<<<< @@ -12738,20 +13877,20 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0); if (unlikely(__pyx_t_2)) { - /* "View.MemoryView":135 + /* "View.MemoryView":136 * * if itemsize <= 0: * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< * * if not isinstance(format, bytes): */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 135, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 135, __pyx_L1_error) + __PYX_ERR(2, 136, __pyx_L1_error) - /* "View.MemoryView":134 + /* "View.MemoryView":135 * raise ValueError("Empty shape tuple for cython.array") * * if itemsize <= 0: # <<<<<<<<<<<<<< @@ -12760,7 +13899,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":137 + /* "View.MemoryView":138 * raise ValueError("itemsize <= 0 for cython.array") * * if not isinstance(format, bytes): # <<<<<<<<<<<<<< @@ -12771,22 +13910,34 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0); if (__pyx_t_4) { - /* "View.MemoryView":138 + /* "View.MemoryView":139 * * if not isinstance(format, bytes): * format = format.encode('ASCII') # <<<<<<<<<<<<<< * self._format = format # keep a reference to the byte string * self.format = self._format */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 138, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_5); - __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":137 + /* "View.MemoryView":138 * raise ValueError("itemsize <= 0 for cython.array") * * if not isinstance(format, bytes): # <<<<<<<<<<<<<< @@ -12795,23 +13946,23 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":139 + /* "View.MemoryView":140 * if not isinstance(format, bytes): * format = format.encode('ASCII') * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<< * self.format = self._format * */ - if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 139, __pyx_L1_error) - __pyx_t_5 = __pyx_v_format; - __Pyx_INCREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); + if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 140, __pyx_L1_error) + __pyx_t_3 = __pyx_v_format; + __Pyx_INCREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->_format); __Pyx_DECREF(__pyx_v_self->_format); - __pyx_v_self->_format = ((PyObject*)__pyx_t_5); - __pyx_t_5 = 0; + __pyx_v_self->_format = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "View.MemoryView":140 + /* "View.MemoryView":141 * format = format.encode('ASCII') * self._format = format # keep a reference to the byte string * self.format = self._format # <<<<<<<<<<<<<< @@ -12820,12 +13971,12 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ if (unlikely(__pyx_v_self->_format == Py_None)) { PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found"); - __PYX_ERR(2, 140, __pyx_L1_error) + __PYX_ERR(2, 141, __pyx_L1_error) } - __pyx_t_6 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(2, 140, __pyx_L1_error) - __pyx_v_self->format = __pyx_t_6; + __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 141, __pyx_L1_error) + __pyx_v_self->format = __pyx_t_7; - /* "View.MemoryView":143 + /* "View.MemoryView":144 * * * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<< @@ -12834,7 +13985,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2))); - /* "View.MemoryView":144 + /* "View.MemoryView":145 * * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<< @@ -12843,7 +13994,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim); - /* "View.MemoryView":146 + /* "View.MemoryView":147 * self._strides = self._shape + self.ndim * * if not self._shape: # <<<<<<<<<<<<<< @@ -12853,20 +14004,20 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0); if (unlikely(__pyx_t_4)) { - /* "View.MemoryView":147 + /* "View.MemoryView":148 * * if not self._shape: * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< * * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_Raise(__pyx_t_5, 0, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(2, 147, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(2, 148, __pyx_L1_error) - /* "View.MemoryView":146 + /* "View.MemoryView":147 * self._strides = self._shape + self.ndim * * if not self._shape: # <<<<<<<<<<<<<< @@ -12875,30 +14026,30 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":150 + /* "View.MemoryView":151 * * * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< * if dim <= 0: * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) */ - __pyx_t_7 = 0; - __pyx_t_5 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0; + __pyx_t_8 = 0; + __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 150, __pyx_L1_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(2, 151, __pyx_L1_error) #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); #endif - __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 150, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_dim = __pyx_t_8; - __pyx_v_idx = __pyx_t_7; - __pyx_t_7 = (__pyx_t_7 + 1); + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 151, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_dim = __pyx_t_9; + __pyx_v_idx = __pyx_t_8; + __pyx_t_8 = (__pyx_t_8 + 1); - /* "View.MemoryView":151 + /* "View.MemoryView":152 * * for idx, dim in enumerate(shape): * if dim <= 0: # <<<<<<<<<<<<<< @@ -12908,36 +14059,36 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_4 = ((__pyx_v_dim <= 0) != 0); if (unlikely(__pyx_t_4)) { - /* "View.MemoryView":152 + /* "View.MemoryView":153 * for idx, dim in enumerate(shape): * if dim <= 0: * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<< * self._shape[idx] = dim * */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 152, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9); - __pyx_t_3 = 0; - __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 152, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 152, __pyx_L1_error) + __PYX_ERR(2, 153, __pyx_L1_error) - /* "View.MemoryView":151 + /* "View.MemoryView":152 * * for idx, dim in enumerate(shape): * if dim <= 0: # <<<<<<<<<<<<<< @@ -12946,7 +14097,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":153 + /* "View.MemoryView":154 * if dim <= 0: * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) * self._shape[idx] = dim # <<<<<<<<<<<<<< @@ -12955,7 +14106,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim; - /* "View.MemoryView":150 + /* "View.MemoryView":151 * * * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<< @@ -12963,19 +14114,19 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) */ } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":156 + /* "View.MemoryView":157 * * cdef char order * if mode == 'fortran': # <<<<<<<<<<<<<< * order = b'F' * self.mode = u'fortran' */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 156, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 157, __pyx_L1_error) if (__pyx_t_4) { - /* "View.MemoryView":157 + /* "View.MemoryView":158 * cdef char order * if mode == 'fortran': * order = b'F' # <<<<<<<<<<<<<< @@ -12984,7 +14135,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_order = 'F'; - /* "View.MemoryView":158 + /* "View.MemoryView":159 * if mode == 'fortran': * order = b'F' * self.mode = u'fortran' # <<<<<<<<<<<<<< @@ -12997,7 +14148,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __Pyx_DECREF(__pyx_v_self->mode); __pyx_v_self->mode = __pyx_n_u_fortran; - /* "View.MemoryView":156 + /* "View.MemoryView":157 * * cdef char order * if mode == 'fortran': # <<<<<<<<<<<<<< @@ -13007,17 +14158,17 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ goto __pyx_L10; } - /* "View.MemoryView":159 + /* "View.MemoryView":160 * order = b'F' * self.mode = u'fortran' * elif mode == 'c': # <<<<<<<<<<<<<< * order = b'C' * self.mode = u'c' */ - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 159, __pyx_L1_error) + __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 160, __pyx_L1_error) if (likely(__pyx_t_4)) { - /* "View.MemoryView":160 + /* "View.MemoryView":161 * self.mode = u'fortran' * elif mode == 'c': * order = b'C' # <<<<<<<<<<<<<< @@ -13026,7 +14177,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_order = 'C'; - /* "View.MemoryView":161 + /* "View.MemoryView":162 * elif mode == 'c': * order = b'C' * self.mode = u'c' # <<<<<<<<<<<<<< @@ -13039,7 +14190,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __Pyx_DECREF(__pyx_v_self->mode); __pyx_v_self->mode = __pyx_n_u_c; - /* "View.MemoryView":159 + /* "View.MemoryView":160 * order = b'F' * self.mode = u'fortran' * elif mode == 'c': # <<<<<<<<<<<<<< @@ -13049,7 +14200,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ goto __pyx_L10; } - /* "View.MemoryView":163 + /* "View.MemoryView":164 * self.mode = u'c' * else: * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<< @@ -13057,18 +14208,18 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ * self.len = fill_contig_strides_array(self._shape, self._strides, */ /*else*/ { - __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 163, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 163, __pyx_L1_error) + __PYX_ERR(2, 164, __pyx_L1_error) } __pyx_L10:; - /* "View.MemoryView":165 + /* "View.MemoryView":166 * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) * * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<< @@ -13077,7 +14228,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order); - /* "View.MemoryView":168 + /* "View.MemoryView":169 * itemsize, self.ndim, order) * * self.free_data = allocate_buffer # <<<<<<<<<<<<<< @@ -13086,19 +14237,19 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_self->free_data = __pyx_v_allocate_buffer; - /* "View.MemoryView":169 + /* "View.MemoryView":170 * * self.free_data = allocate_buffer * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<< * if allocate_buffer: * */ - __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 169, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 169, __pyx_L1_error) + __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 170, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 170, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_v_self->dtype_is_object = __pyx_t_4; - /* "View.MemoryView":170 + /* "View.MemoryView":171 * self.free_data = allocate_buffer * self.dtype_is_object = format == b'O' * if allocate_buffer: # <<<<<<<<<<<<<< @@ -13108,7 +14259,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_4 = (__pyx_v_allocate_buffer != 0); if (__pyx_t_4) { - /* "View.MemoryView":173 + /* "View.MemoryView":174 * * * self.data = malloc(self.len) # <<<<<<<<<<<<<< @@ -13117,7 +14268,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len)); - /* "View.MemoryView":174 + /* "View.MemoryView":175 * * self.data = malloc(self.len) * if not self.data: # <<<<<<<<<<<<<< @@ -13127,20 +14278,20 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0); if (unlikely(__pyx_t_4)) { - /* "View.MemoryView":175 + /* "View.MemoryView":176 * self.data = malloc(self.len) * if not self.data: * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< * * if self.dtype_is_object: */ - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 175, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_Raise(__pyx_t_10, 0, 0, 0); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __PYX_ERR(2, 175, __pyx_L1_error) + __PYX_ERR(2, 176, __pyx_L1_error) - /* "View.MemoryView":174 + /* "View.MemoryView":175 * * self.data = malloc(self.len) * if not self.data: # <<<<<<<<<<<<<< @@ -13149,7 +14300,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":177 + /* "View.MemoryView":178 * raise MemoryError("unable to allocate array data.") * * if self.dtype_is_object: # <<<<<<<<<<<<<< @@ -13159,7 +14310,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0); if (__pyx_t_4) { - /* "View.MemoryView":178 + /* "View.MemoryView":179 * * if self.dtype_is_object: * p = self.data # <<<<<<<<<<<<<< @@ -13168,7 +14319,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ __pyx_v_p = ((PyObject **)__pyx_v_self->data); - /* "View.MemoryView":179 + /* "View.MemoryView":180 * if self.dtype_is_object: * p = self.data * for i in range(self.len / itemsize): # <<<<<<<<<<<<<< @@ -13177,18 +14328,18 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ if (unlikely(__pyx_v_itemsize == 0)) { PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 179, __pyx_L1_error) + __PYX_ERR(2, 180, __pyx_L1_error) } else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) { PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 179, __pyx_L1_error) + __PYX_ERR(2, 180, __pyx_L1_error) } __pyx_t_1 = (__pyx_v_self->len / __pyx_v_itemsize); - __pyx_t_8 = __pyx_t_1; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_8; __pyx_t_11+=1) { + __pyx_t_9 = __pyx_t_1; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; - /* "View.MemoryView":180 + /* "View.MemoryView":181 * p = self.data * for i in range(self.len / itemsize): * p[i] = Py_None # <<<<<<<<<<<<<< @@ -13197,7 +14348,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ (__pyx_v_p[__pyx_v_i]) = Py_None; - /* "View.MemoryView":181 + /* "View.MemoryView":182 * for i in range(self.len / itemsize): * p[i] = Py_None * Py_INCREF(Py_None) # <<<<<<<<<<<<<< @@ -13207,7 +14358,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ Py_INCREF(Py_None); } - /* "View.MemoryView":177 + /* "View.MemoryView":178 * raise MemoryError("unable to allocate array data.") * * if self.dtype_is_object: # <<<<<<<<<<<<<< @@ -13216,7 +14367,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":170 + /* "View.MemoryView":171 * self.free_data = allocate_buffer * self.dtype_is_object = format == b'O' * if allocate_buffer: # <<<<<<<<<<<<<< @@ -13225,7 +14376,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ */ } - /* "View.MemoryView":121 + /* "View.MemoryView":122 * cdef bint dtype_is_object * * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<< @@ -13239,7 +14390,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; @@ -13249,7 +14400,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ return __pyx_r; } -/* "View.MemoryView":184 +/* "View.MemoryView":185 * * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< @@ -13289,7 +14440,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); - /* "View.MemoryView":185 + /* "View.MemoryView":186 * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): * cdef int bufmode = -1 # <<<<<<<<<<<<<< @@ -13298,18 +14449,18 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru */ __pyx_v_bufmode = -1; - /* "View.MemoryView":186 + /* "View.MemoryView":187 * def __getbuffer__(self, Py_buffer *info, int flags): * cdef int bufmode = -1 * if self.mode == u"c": # <<<<<<<<<<<<<< * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * elif self.mode == u"fortran": */ - __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 186, __pyx_L1_error) + __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 187, __pyx_L1_error) __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":187 + /* "View.MemoryView":188 * cdef int bufmode = -1 * if self.mode == u"c": * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< @@ -13318,7 +14469,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru */ __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - /* "View.MemoryView":186 + /* "View.MemoryView":187 * def __getbuffer__(self, Py_buffer *info, int flags): * cdef int bufmode = -1 * if self.mode == u"c": # <<<<<<<<<<<<<< @@ -13328,18 +14479,18 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru goto __pyx_L3; } - /* "View.MemoryView":188 + /* "View.MemoryView":189 * if self.mode == u"c": * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * elif self.mode == u"fortran": # <<<<<<<<<<<<<< * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): */ - __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 188, __pyx_L1_error) + __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 189, __pyx_L1_error) __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "View.MemoryView":189 + /* "View.MemoryView":190 * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * elif self.mode == u"fortran": * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<< @@ -13348,7 +14499,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru */ __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS); - /* "View.MemoryView":188 + /* "View.MemoryView":189 * if self.mode == u"c": * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * elif self.mode == u"fortran": # <<<<<<<<<<<<<< @@ -13358,7 +14509,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru } __pyx_L3:; - /* "View.MemoryView":190 + /* "View.MemoryView":191 * elif self.mode == u"fortran": * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): # <<<<<<<<<<<<<< @@ -13368,20 +14519,20 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0); if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":191 + /* "View.MemoryView":192 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< * info.buf = self.data * info.len = self.len */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 191, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 191, __pyx_L1_error) + __PYX_ERR(2, 192, __pyx_L1_error) - /* "View.MemoryView":190 + /* "View.MemoryView":191 * elif self.mode == u"fortran": * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): # <<<<<<<<<<<<<< @@ -13390,7 +14541,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru */ } - /* "View.MemoryView":192 + /* "View.MemoryView":193 * if not (flags & bufmode): * raise ValueError("Can only create a buffer that is contiguous in memory.") * info.buf = self.data # <<<<<<<<<<<<<< @@ -13400,7 +14551,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_4 = __pyx_v_self->data; __pyx_v_info->buf = __pyx_t_4; - /* "View.MemoryView":193 + /* "View.MemoryView":194 * raise ValueError("Can only create a buffer that is contiguous in memory.") * info.buf = self.data * info.len = self.len # <<<<<<<<<<<<<< @@ -13410,7 +14561,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_5 = __pyx_v_self->len; __pyx_v_info->len = __pyx_t_5; - /* "View.MemoryView":194 + /* "View.MemoryView":195 * info.buf = self.data * info.len = self.len * info.ndim = self.ndim # <<<<<<<<<<<<<< @@ -13420,7 +14571,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_6 = __pyx_v_self->ndim; __pyx_v_info->ndim = __pyx_t_6; - /* "View.MemoryView":195 + /* "View.MemoryView":196 * info.len = self.len * info.ndim = self.ndim * info.shape = self._shape # <<<<<<<<<<<<<< @@ -13430,7 +14581,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_7 = __pyx_v_self->_shape; __pyx_v_info->shape = __pyx_t_7; - /* "View.MemoryView":196 + /* "View.MemoryView":197 * info.ndim = self.ndim * info.shape = self._shape * info.strides = self._strides # <<<<<<<<<<<<<< @@ -13440,7 +14591,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_7 = __pyx_v_self->_strides; __pyx_v_info->strides = __pyx_t_7; - /* "View.MemoryView":197 + /* "View.MemoryView":198 * info.shape = self._shape * info.strides = self._strides * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -13449,7 +14600,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru */ __pyx_v_info->suboffsets = NULL; - /* "View.MemoryView":198 + /* "View.MemoryView":199 * info.strides = self._strides * info.suboffsets = NULL * info.itemsize = self.itemsize # <<<<<<<<<<<<<< @@ -13459,7 +14610,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_5 = __pyx_v_self->itemsize; __pyx_v_info->itemsize = __pyx_t_5; - /* "View.MemoryView":199 + /* "View.MemoryView":200 * info.suboffsets = NULL * info.itemsize = self.itemsize * info.readonly = 0 # <<<<<<<<<<<<<< @@ -13468,7 +14619,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru */ __pyx_v_info->readonly = 0; - /* "View.MemoryView":201 + /* "View.MemoryView":202 * info.readonly = 0 * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -13478,7 +14629,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); if (__pyx_t_1) { - /* "View.MemoryView":202 + /* "View.MemoryView":203 * * if flags & PyBUF_FORMAT: * info.format = self.format # <<<<<<<<<<<<<< @@ -13488,7 +14639,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __pyx_t_4 = __pyx_v_self->format; __pyx_v_info->format = __pyx_t_4; - /* "View.MemoryView":201 + /* "View.MemoryView":202 * info.readonly = 0 * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -13498,7 +14649,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru goto __pyx_L5; } - /* "View.MemoryView":204 + /* "View.MemoryView":205 * info.format = self.format * else: * info.format = NULL # <<<<<<<<<<<<<< @@ -13510,7 +14661,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru } __pyx_L5:; - /* "View.MemoryView":206 + /* "View.MemoryView":207 * info.format = NULL * * info.obj = self # <<<<<<<<<<<<<< @@ -13523,7 +14674,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "View.MemoryView":184 + /* "View.MemoryView":185 * * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< @@ -13553,7 +14704,7 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru return __pyx_r; } -/* "View.MemoryView":210 +/* "View.MemoryView":211 * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") * * def __dealloc__(array self): # <<<<<<<<<<<<<< @@ -13577,7 +14728,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "View.MemoryView":211 + /* "View.MemoryView":212 * * def __dealloc__(array self): * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< @@ -13587,7 +14738,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":212 + /* "View.MemoryView":213 * def __dealloc__(array self): * if self.callback_free_data != NULL: * self.callback_free_data(self.data) # <<<<<<<<<<<<<< @@ -13596,7 +14747,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc */ __pyx_v_self->callback_free_data(__pyx_v_self->data); - /* "View.MemoryView":211 + /* "View.MemoryView":212 * * def __dealloc__(array self): * if self.callback_free_data != NULL: # <<<<<<<<<<<<<< @@ -13606,7 +14757,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc goto __pyx_L3; } - /* "View.MemoryView":213 + /* "View.MemoryView":214 * if self.callback_free_data != NULL: * self.callback_free_data(self.data) * elif self.free_data: # <<<<<<<<<<<<<< @@ -13616,7 +14767,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc __pyx_t_1 = (__pyx_v_self->free_data != 0); if (__pyx_t_1) { - /* "View.MemoryView":214 + /* "View.MemoryView":215 * self.callback_free_data(self.data) * elif self.free_data: * if self.dtype_is_object: # <<<<<<<<<<<<<< @@ -13626,7 +14777,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); if (__pyx_t_1) { - /* "View.MemoryView":215 + /* "View.MemoryView":216 * elif self.free_data: * if self.dtype_is_object: * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<< @@ -13635,7 +14786,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc */ __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0); - /* "View.MemoryView":214 + /* "View.MemoryView":215 * self.callback_free_data(self.data) * elif self.free_data: * if self.dtype_is_object: # <<<<<<<<<<<<<< @@ -13644,7 +14795,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc */ } - /* "View.MemoryView":217 + /* "View.MemoryView":218 * refcount_objects_in_slice(self.data, self._shape, * self._strides, self.ndim, False) * free(self.data) # <<<<<<<<<<<<<< @@ -13653,7 +14804,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc */ free(__pyx_v_self->data); - /* "View.MemoryView":213 + /* "View.MemoryView":214 * if self.callback_free_data != NULL: * self.callback_free_data(self.data) * elif self.free_data: # <<<<<<<<<<<<<< @@ -13663,7 +14814,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc } __pyx_L3:; - /* "View.MemoryView":218 + /* "View.MemoryView":219 * self._strides, self.ndim, False) * free(self.data) * PyObject_Free(self._shape) # <<<<<<<<<<<<<< @@ -13672,7 +14823,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc */ PyObject_Free(__pyx_v_self->_shape); - /* "View.MemoryView":210 + /* "View.MemoryView":211 * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") * * def __dealloc__(array self): # <<<<<<<<<<<<<< @@ -13684,7 +14835,7 @@ static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struc __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":221 +/* "View.MemoryView":222 * * @property * def memview(self): # <<<<<<<<<<<<<< @@ -13711,7 +14862,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct _ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":222 + /* "View.MemoryView":223 * @property * def memview(self): * return self.get_memview() # <<<<<<<<<<<<<< @@ -13719,13 +14870,13 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct _ * @cname('get_memview') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 222, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":221 + /* "View.MemoryView":222 * * @property * def memview(self): # <<<<<<<<<<<<<< @@ -13744,7 +14895,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct _ return __pyx_r; } -/* "View.MemoryView":225 +/* "View.MemoryView":226 * * @cname('get_memview') * cdef get_memview(self): # <<<<<<<<<<<<<< @@ -13761,7 +14912,7 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("get_memview", 0); - /* "View.MemoryView":226 + /* "View.MemoryView":227 * @cname('get_memview') * cdef get_memview(self): * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<< @@ -13770,7 +14921,7 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { */ __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE); - /* "View.MemoryView":227 + /* "View.MemoryView":228 * cdef get_memview(self): * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<< @@ -13778,11 +14929,11 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { * def __len__(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 227, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 227, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 227, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); @@ -13793,14 +14944,14 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 227, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":225 + /* "View.MemoryView":226 * * @cname('get_memview') * cdef get_memview(self): # <<<<<<<<<<<<<< @@ -13821,7 +14972,7 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { return __pyx_r; } -/* "View.MemoryView":229 +/* "View.MemoryView":230 * return memoryview(self, flags, self.dtype_is_object) * * def __len__(self): # <<<<<<<<<<<<<< @@ -13847,7 +14998,7 @@ static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(str __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); - /* "View.MemoryView":230 + /* "View.MemoryView":231 * * def __len__(self): * return self._shape[0] # <<<<<<<<<<<<<< @@ -13857,7 +15008,7 @@ static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(str __pyx_r = (__pyx_v_self->_shape[0]); goto __pyx_L0; - /* "View.MemoryView":229 + /* "View.MemoryView":230 * return memoryview(self, flags, self.dtype_is_object) * * def __len__(self): # <<<<<<<<<<<<<< @@ -13871,7 +15022,7 @@ static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(str return __pyx_r; } -/* "View.MemoryView":232 +/* "View.MemoryView":233 * return self._shape[0] * * def __getattr__(self, attr): # <<<<<<<<<<<<<< @@ -13899,7 +15050,7 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__( PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__getattr__", 0); - /* "View.MemoryView":233 + /* "View.MemoryView":234 * * def __getattr__(self, attr): * return getattr(self.memview, attr) # <<<<<<<<<<<<<< @@ -13907,16 +15058,16 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__( * def __getitem__(self, item): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 233, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 233, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":232 + /* "View.MemoryView":233 * return self._shape[0] * * def __getattr__(self, attr): # <<<<<<<<<<<<<< @@ -13936,7 +15087,7 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__( return __pyx_r; } -/* "View.MemoryView":235 +/* "View.MemoryView":236 * return getattr(self.memview, attr) * * def __getitem__(self, item): # <<<<<<<<<<<<<< @@ -13964,7 +15115,7 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__ PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "View.MemoryView":236 + /* "View.MemoryView":237 * * def __getitem__(self, item): * return self.memview[item] # <<<<<<<<<<<<<< @@ -13972,16 +15123,16 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__ * def __setitem__(self, item, value): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 236, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 236, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":235 + /* "View.MemoryView":236 * return getattr(self.memview, attr) * * def __getitem__(self, item): # <<<<<<<<<<<<<< @@ -14001,7 +15152,7 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__ return __pyx_r; } -/* "View.MemoryView":238 +/* "View.MemoryView":239 * return self.memview[item] * * def __setitem__(self, item, value): # <<<<<<<<<<<<<< @@ -14028,19 +15179,19 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struc PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__setitem__", 0); - /* "View.MemoryView":239 + /* "View.MemoryView":240 * * def __setitem__(self, item, value): * self.memview[item] = value # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 239, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 240, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 239, __pyx_L1_error) + if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 240, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":238 + /* "View.MemoryView":239 * return self.memview[item] * * def __setitem__(self, item, value): # <<<<<<<<<<<<<< @@ -14091,7 +15242,7 @@ static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __p * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -14144,7 +15295,7 @@ static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -14167,7 +15318,7 @@ static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct return __pyx_r; } -/* "View.MemoryView":243 +/* "View.MemoryView":244 * * @cname("__pyx_array_new") * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< @@ -14186,7 +15337,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("array_cwrapper", 0); - /* "View.MemoryView":247 + /* "View.MemoryView":248 * cdef array result * * if buf == NULL: # <<<<<<<<<<<<<< @@ -14196,20 +15347,20 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize __pyx_t_1 = ((__pyx_v_buf == NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":248 + /* "View.MemoryView":249 * * if buf == NULL: * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<< * else: * result = array(shape, itemsize, format, mode.decode('ASCII'), */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 248, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 248, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 248, __pyx_L1_error) + __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 248, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_shape); __Pyx_GIVEREF(__pyx_v_shape); @@ -14223,13 +15374,13 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 248, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":247 + /* "View.MemoryView":248 * cdef array result * * if buf == NULL: # <<<<<<<<<<<<<< @@ -14239,7 +15390,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize goto __pyx_L3; } - /* "View.MemoryView":250 + /* "View.MemoryView":251 * result = array(shape, itemsize, format, mode.decode('ASCII')) * else: * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< @@ -14247,13 +15398,13 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize * result.data = buf */ /*else*/ { - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error) + __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 250, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 250, __pyx_L1_error) + __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 250, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_shape); __Pyx_GIVEREF(__pyx_v_shape); @@ -14268,32 +15419,32 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize __pyx_t_5 = 0; __pyx_t_3 = 0; - /* "View.MemoryView":251 + /* "View.MemoryView":252 * else: * result = array(shape, itemsize, format, mode.decode('ASCII'), * allocate_buffer=False) # <<<<<<<<<<<<<< * result.data = buf * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 251, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 251, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 252, __pyx_L1_error) - /* "View.MemoryView":250 + /* "View.MemoryView":251 * result = array(shape, itemsize, format, mode.decode('ASCII')) * else: * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<< * allocate_buffer=False) * result.data = buf */ - __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 250, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5); __pyx_t_5 = 0; - /* "View.MemoryView":252 + /* "View.MemoryView":253 * result = array(shape, itemsize, format, mode.decode('ASCII'), * allocate_buffer=False) * result.data = buf # <<<<<<<<<<<<<< @@ -14304,7 +15455,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize } __pyx_L3:; - /* "View.MemoryView":254 + /* "View.MemoryView":255 * result.data = buf * * return result # <<<<<<<<<<<<<< @@ -14316,7 +15467,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "View.MemoryView":243 + /* "View.MemoryView":244 * * @cname("__pyx_array_new") * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<< @@ -14339,7 +15490,7 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize return __pyx_r; } -/* "View.MemoryView":280 +/* "View.MemoryView":281 * cdef class Enum(object): * cdef object name * def __init__(self, name): # <<<<<<<<<<<<<< @@ -14373,7 +15524,7 @@ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_ar else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 280, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 281, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -14384,7 +15535,7 @@ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_ar } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 280, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 281, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -14402,7 +15553,7 @@ static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struc __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "View.MemoryView":281 + /* "View.MemoryView":282 * cdef object name * def __init__(self, name): * self.name = name # <<<<<<<<<<<<<< @@ -14415,7 +15566,7 @@ static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struc __Pyx_DECREF(__pyx_v_self->name); __pyx_v_self->name = __pyx_v_name; - /* "View.MemoryView":280 + /* "View.MemoryView":281 * cdef class Enum(object): * cdef object name * def __init__(self, name): # <<<<<<<<<<<<<< @@ -14429,7 +15580,7 @@ static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struc return __pyx_r; } -/* "View.MemoryView":282 +/* "View.MemoryView":283 * def __init__(self, name): * self.name = name * def __repr__(self): # <<<<<<<<<<<<<< @@ -14455,7 +15606,7 @@ static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__", 0); - /* "View.MemoryView":283 + /* "View.MemoryView":284 * self.name = name * def __repr__(self): * return self.name # <<<<<<<<<<<<<< @@ -14467,7 +15618,7 @@ static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr_ __pyx_r = __pyx_v_self->name; goto __pyx_L0; - /* "View.MemoryView":282 + /* "View.MemoryView":283 * def __init__(self, name): * self.name = name * def __repr__(self): # <<<<<<<<<<<<<< @@ -14484,8 +15635,8 @@ static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr_ /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef bint use_setstate - * state = (self.name,) + * cdef tuple state + * cdef object _dict */ /* Python wrapper */ @@ -14502,9 +15653,9 @@ static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v } static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; int __pyx_v_use_setstate; - PyObject *__pyx_v_state = NULL; - PyObject *__pyx_v__dict = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -14514,14 +15665,14 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__reduce_cython__", 0); - /* "(tree fragment)":3 - * def __reduce_cython__(self): + /* "(tree fragment)":5 + * cdef object _dict * cdef bint use_setstate * state = (self.name,) # <<<<<<<<<<<<<< * _dict = getattr(self, '__dict__', None) * if _dict is not None: */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 3, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_self->name); __Pyx_GIVEREF(__pyx_v_self->name); @@ -14529,19 +15680,19 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi __pyx_v_state = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "(tree fragment)":4 + /* "(tree fragment)":6 * cdef bint use_setstate * state = (self.name,) * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< * if _dict is not None: * state += (_dict,) */ - __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v__dict = __pyx_t_1; __pyx_t_1 = 0; - /* "(tree fragment)":5 + /* "(tree fragment)":7 * state = (self.name,) * _dict = getattr(self, '__dict__', None) * if _dict is not None: # <<<<<<<<<<<<<< @@ -14552,25 +15703,25 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "(tree fragment)":6 + /* "(tree fragment)":8 * _dict = getattr(self, '__dict__', None) * if _dict is not None: * state += (_dict,) # <<<<<<<<<<<<<< * use_setstate = True * else: */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v__dict); __Pyx_GIVEREF(__pyx_v__dict); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error) + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); __pyx_t_4 = 0; - /* "(tree fragment)":7 + /* "(tree fragment)":9 * if _dict is not None: * state += (_dict,) * use_setstate = True # <<<<<<<<<<<<<< @@ -14579,7 +15730,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi */ __pyx_v_use_setstate = 1; - /* "(tree fragment)":5 + /* "(tree fragment)":7 * state = (self.name,) * _dict = getattr(self, '__dict__', None) * if _dict is not None: # <<<<<<<<<<<<<< @@ -14589,7 +15740,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi goto __pyx_L3; } - /* "(tree fragment)":9 + /* "(tree fragment)":11 * use_setstate = True * else: * use_setstate = self.name is not None # <<<<<<<<<<<<<< @@ -14602,7 +15753,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi } __pyx_L3:; - /* "(tree fragment)":10 + /* "(tree fragment)":12 * else: * use_setstate = self.name is not None * if use_setstate: # <<<<<<<<<<<<<< @@ -14612,7 +15763,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi __pyx_t_3 = (__pyx_v_use_setstate != 0); if (__pyx_t_3) { - /* "(tree fragment)":11 + /* "(tree fragment)":13 * use_setstate = self.name is not None * if use_setstate: * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<< @@ -14620,9 +15771,9 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 11, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 11, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); @@ -14633,7 +15784,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 11, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); @@ -14648,7 +15799,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi __pyx_t_5 = 0; goto __pyx_L0; - /* "(tree fragment)":10 + /* "(tree fragment)":12 * else: * use_setstate = self.name is not None * if use_setstate: # <<<<<<<<<<<<<< @@ -14657,7 +15808,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi */ } - /* "(tree fragment)":13 + /* "(tree fragment)":15 * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state * else: * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<< @@ -14666,9 +15817,9 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error) + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); @@ -14679,7 +15830,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi __Pyx_INCREF(__pyx_v_state); __Pyx_GIVEREF(__pyx_v_state); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); @@ -14694,8 +15845,8 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * cdef bint use_setstate - * state = (self.name,) + * cdef tuple state + * cdef object _dict */ /* function exit code */ @@ -14713,7 +15864,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi return __pyx_r; } -/* "(tree fragment)":14 +/* "(tree fragment)":16 * else: * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< @@ -14739,17 +15890,17 @@ static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_Me PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__setstate_cython__", 0); - /* "(tree fragment)":15 + /* "(tree fragment)":17 * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) * def __setstate_cython__(self, __pyx_state): * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 15, __pyx_L1_error) - __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error) + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "(tree fragment)":14 + /* "(tree fragment)":16 * else: * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< @@ -14769,7 +15920,7 @@ static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_Me return __pyx_r; } -/* "View.MemoryView":297 +/* "View.MemoryView":298 * * @cname('__pyx_align_pointer') * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< @@ -14783,7 +15934,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) void *__pyx_r; int __pyx_t_1; - /* "View.MemoryView":299 + /* "View.MemoryView":300 * cdef void *align_pointer(void *memory, size_t alignment) nogil: * "Align pointer memory on a given boundary" * cdef Py_intptr_t aligned_p = memory # <<<<<<<<<<<<<< @@ -14792,7 +15943,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) */ __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory); - /* "View.MemoryView":303 + /* "View.MemoryView":304 * * with cython.cdivision(True): * offset = aligned_p % alignment # <<<<<<<<<<<<<< @@ -14801,7 +15952,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) */ __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment); - /* "View.MemoryView":305 + /* "View.MemoryView":306 * offset = aligned_p % alignment * * if offset > 0: # <<<<<<<<<<<<<< @@ -14811,7 +15962,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) __pyx_t_1 = ((__pyx_v_offset > 0) != 0); if (__pyx_t_1) { - /* "View.MemoryView":306 + /* "View.MemoryView":307 * * if offset > 0: * aligned_p += alignment - offset # <<<<<<<<<<<<<< @@ -14820,7 +15971,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) */ __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset)); - /* "View.MemoryView":305 + /* "View.MemoryView":306 * offset = aligned_p % alignment * * if offset > 0: # <<<<<<<<<<<<<< @@ -14829,7 +15980,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) */ } - /* "View.MemoryView":308 + /* "View.MemoryView":309 * aligned_p += alignment - offset * * return aligned_p # <<<<<<<<<<<<<< @@ -14839,7 +15990,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) __pyx_r = ((void *)__pyx_v_aligned_p); goto __pyx_L0; - /* "View.MemoryView":297 + /* "View.MemoryView":298 * * @cname('__pyx_align_pointer') * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<< @@ -14852,7 +16003,7 @@ static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) return __pyx_r; } -/* "View.MemoryView":344 +/* "View.MemoryView":345 * cdef __Pyx_TypeInfo *typeinfo * * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< @@ -14894,7 +16045,7 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 344, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -14904,7 +16055,7 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 344, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 345, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -14917,16 +16068,16 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar } } __pyx_v_obj = values[0]; - __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 344, __pyx_L3_error) + __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error) if (values[2]) { - __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 344, __pyx_L3_error) + __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error) } else { __pyx_v_dtype_is_object = ((int)0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 344, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 345, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -14948,7 +16099,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ int __pyx_t_4; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "View.MemoryView":345 + /* "View.MemoryView":346 * * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): * self.obj = obj # <<<<<<<<<<<<<< @@ -14961,7 +16112,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __Pyx_DECREF(__pyx_v_self->obj); __pyx_v_self->obj = __pyx_v_obj; - /* "View.MemoryView":346 + /* "View.MemoryView":347 * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): * self.obj = obj * self.flags = flags # <<<<<<<<<<<<<< @@ -14970,7 +16121,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ __pyx_v_self->flags = __pyx_v_flags; - /* "View.MemoryView":347 + /* "View.MemoryView":348 * self.obj = obj * self.flags = flags * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< @@ -14990,16 +16141,16 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __pyx_L4_bool_binop_done:; if (__pyx_t_1) { - /* "View.MemoryView":348 + /* "View.MemoryView":349 * self.flags = flags * if type(self) is memoryview or obj is not None: * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<< * if self.view.obj == NULL: * (<__pyx_buffer *> &self.view).obj = Py_None */ - __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 348, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 349, __pyx_L1_error) - /* "View.MemoryView":349 + /* "View.MemoryView":350 * if type(self) is memoryview or obj is not None: * __Pyx_GetBuffer(obj, &self.view, flags) * if self.view.obj == NULL: # <<<<<<<<<<<<<< @@ -15009,7 +16160,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":350 + /* "View.MemoryView":351 * __Pyx_GetBuffer(obj, &self.view, flags) * if self.view.obj == NULL: * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<< @@ -15018,7 +16169,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None; - /* "View.MemoryView":351 + /* "View.MemoryView":352 * if self.view.obj == NULL: * (<__pyx_buffer *> &self.view).obj = Py_None * Py_INCREF(Py_None) # <<<<<<<<<<<<<< @@ -15027,7 +16178,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ Py_INCREF(Py_None); - /* "View.MemoryView":349 + /* "View.MemoryView":350 * if type(self) is memoryview or obj is not None: * __Pyx_GetBuffer(obj, &self.view, flags) * if self.view.obj == NULL: # <<<<<<<<<<<<<< @@ -15036,7 +16187,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ } - /* "View.MemoryView":347 + /* "View.MemoryView":348 * self.obj = obj * self.flags = flags * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<< @@ -15045,7 +16196,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ } - /* "View.MemoryView":354 + /* "View.MemoryView":355 * * global __pyx_memoryview_thread_locks_used * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< @@ -15055,7 +16206,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0); if (__pyx_t_1) { - /* "View.MemoryView":355 + /* "View.MemoryView":356 * global __pyx_memoryview_thread_locks_used * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<< @@ -15064,7 +16215,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); - /* "View.MemoryView":356 + /* "View.MemoryView":357 * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<< @@ -15073,7 +16224,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1); - /* "View.MemoryView":354 + /* "View.MemoryView":355 * * global __pyx_memoryview_thread_locks_used * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<< @@ -15082,7 +16233,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ } - /* "View.MemoryView":357 + /* "View.MemoryView":358 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] * __pyx_memoryview_thread_locks_used += 1 * if self.lock is NULL: # <<<<<<<<<<<<<< @@ -15092,7 +16243,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":358 + /* "View.MemoryView":359 * __pyx_memoryview_thread_locks_used += 1 * if self.lock is NULL: * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<< @@ -15101,7 +16252,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ __pyx_v_self->lock = PyThread_allocate_lock(); - /* "View.MemoryView":359 + /* "View.MemoryView":360 * if self.lock is NULL: * self.lock = PyThread_allocate_lock() * if self.lock is NULL: # <<<<<<<<<<<<<< @@ -15111,16 +16262,16 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":360 + /* "View.MemoryView":361 * self.lock = PyThread_allocate_lock() * if self.lock is NULL: * raise MemoryError # <<<<<<<<<<<<<< * * if flags & PyBUF_FORMAT: */ - PyErr_NoMemory(); __PYX_ERR(2, 360, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error) - /* "View.MemoryView":359 + /* "View.MemoryView":360 * if self.lock is NULL: * self.lock = PyThread_allocate_lock() * if self.lock is NULL: # <<<<<<<<<<<<<< @@ -15129,7 +16280,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ } - /* "View.MemoryView":357 + /* "View.MemoryView":358 * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] * __pyx_memoryview_thread_locks_used += 1 * if self.lock is NULL: # <<<<<<<<<<<<<< @@ -15138,7 +16289,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ } - /* "View.MemoryView":362 + /* "View.MemoryView":363 * raise MemoryError * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -15148,7 +16299,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); if (__pyx_t_1) { - /* "View.MemoryView":363 + /* "View.MemoryView":364 * * if flags & PyBUF_FORMAT: * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<< @@ -15166,7 +16317,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ __pyx_L11_bool_binop_done:; __pyx_v_self->dtype_is_object = __pyx_t_1; - /* "View.MemoryView":362 + /* "View.MemoryView":363 * raise MemoryError * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -15176,7 +16327,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ goto __pyx_L10; } - /* "View.MemoryView":365 + /* "View.MemoryView":366 * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') * else: * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<< @@ -15188,7 +16339,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ } __pyx_L10:; - /* "View.MemoryView":367 + /* "View.MemoryView":368 * self.dtype_is_object = dtype_is_object * * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<< @@ -15197,7 +16348,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int)))); - /* "View.MemoryView":369 + /* "View.MemoryView":370 * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( * &self.acquisition_count[0], sizeof(__pyx_atomic_int)) * self.typeinfo = NULL # <<<<<<<<<<<<<< @@ -15206,7 +16357,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ */ __pyx_v_self->typeinfo = NULL; - /* "View.MemoryView":344 + /* "View.MemoryView":345 * cdef __Pyx_TypeInfo *typeinfo * * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<< @@ -15225,7 +16376,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ return __pyx_r; } -/* "View.MemoryView":371 +/* "View.MemoryView":372 * self.typeinfo = NULL * * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< @@ -15256,36 +16407,75 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal PyThread_type_lock __pyx_t_7; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "View.MemoryView":372 + /* "View.MemoryView":373 * * def __dealloc__(memoryview self): * if self.obj is not None: # <<<<<<<<<<<<<< * __Pyx_ReleaseBuffer(&self.view) - * + * elif (<__pyx_buffer *> &self.view).obj == Py_None: */ __pyx_t_1 = (__pyx_v_self->obj != Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":373 + /* "View.MemoryView":374 * def __dealloc__(memoryview self): * if self.obj is not None: * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<< + * elif (<__pyx_buffer *> &self.view).obj == Py_None: * - * cdef int i */ __Pyx_ReleaseBuffer((&__pyx_v_self->view)); - /* "View.MemoryView":372 + /* "View.MemoryView":373 * * def __dealloc__(memoryview self): * if self.obj is not None: # <<<<<<<<<<<<<< * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + */ + goto __pyx_L3; + } + + /* "View.MemoryView":375 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< + * + * (<__pyx_buffer *> &self.view).obj = NULL + */ + __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0); + if (__pyx_t_2) { + + /* "View.MemoryView":377 + * elif (<__pyx_buffer *> &self.view).obj == Py_None: + * + * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<< + * Py_DECREF(Py_None) + * + */ + ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL; + + /* "View.MemoryView":378 + * + * (<__pyx_buffer *> &self.view).obj = NULL + * Py_DECREF(Py_None) # <<<<<<<<<<<<<< + * + * cdef int i + */ + Py_DECREF(Py_None); + + /* "View.MemoryView":375 + * if self.obj is not None: + * __Pyx_ReleaseBuffer(&self.view) + * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<< * + * (<__pyx_buffer *> &self.view).obj = NULL */ } + __pyx_L3:; - /* "View.MemoryView":377 + /* "View.MemoryView":382 * cdef int i * global __pyx_memoryview_thread_locks_used * if self.lock != NULL: # <<<<<<<<<<<<<< @@ -15295,7 +16485,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0); if (__pyx_t_2) { - /* "View.MemoryView":378 + /* "View.MemoryView":383 * global __pyx_memoryview_thread_locks_used * if self.lock != NULL: * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<< @@ -15307,7 +16497,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "View.MemoryView":379 + /* "View.MemoryView":384 * if self.lock != NULL: * for i in range(__pyx_memoryview_thread_locks_used): * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< @@ -15317,7 +16507,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0); if (__pyx_t_2) { - /* "View.MemoryView":380 + /* "View.MemoryView":385 * for i in range(__pyx_memoryview_thread_locks_used): * if __pyx_memoryview_thread_locks[i] is self.lock: * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<< @@ -15326,7 +16516,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal */ __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1); - /* "View.MemoryView":381 + /* "View.MemoryView":386 * if __pyx_memoryview_thread_locks[i] is self.lock: * __pyx_memoryview_thread_locks_used -= 1 * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< @@ -15336,7 +16526,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0); if (__pyx_t_2) { - /* "View.MemoryView":383 + /* "View.MemoryView":388 * if i != __pyx_memoryview_thread_locks_used: * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<< @@ -15346,7 +16536,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]); __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]); - /* "View.MemoryView":382 + /* "View.MemoryView":387 * __pyx_memoryview_thread_locks_used -= 1 * if i != __pyx_memoryview_thread_locks_used: * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<< @@ -15356,7 +16546,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6; (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7; - /* "View.MemoryView":381 + /* "View.MemoryView":386 * if __pyx_memoryview_thread_locks[i] is self.lock: * __pyx_memoryview_thread_locks_used -= 1 * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<< @@ -15365,7 +16555,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal */ } - /* "View.MemoryView":384 + /* "View.MemoryView":389 * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) * break # <<<<<<<<<<<<<< @@ -15374,7 +16564,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal */ goto __pyx_L6_break; - /* "View.MemoryView":379 + /* "View.MemoryView":384 * if self.lock != NULL: * for i in range(__pyx_memoryview_thread_locks_used): * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<< @@ -15385,7 +16575,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal } /*else*/ { - /* "View.MemoryView":386 + /* "View.MemoryView":391 * break * else: * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<< @@ -15396,7 +16586,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal } __pyx_L6_break:; - /* "View.MemoryView":377 + /* "View.MemoryView":382 * cdef int i * global __pyx_memoryview_thread_locks_used * if self.lock != NULL: # <<<<<<<<<<<<<< @@ -15405,7 +16595,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal */ } - /* "View.MemoryView":371 + /* "View.MemoryView":372 * self.typeinfo = NULL * * def __dealloc__(memoryview self): # <<<<<<<<<<<<<< @@ -15417,7 +16607,7 @@ static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__deal __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":388 +/* "View.MemoryView":393 * PyThread_free_lock(self.lock) * * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< @@ -15440,7 +16630,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py char *__pyx_t_7; __Pyx_RefNannySetupContext("get_item_pointer", 0); - /* "View.MemoryView":390 + /* "View.MemoryView":395 * cdef char *get_item_pointer(memoryview self, object index) except NULL: * cdef Py_ssize_t dim * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<< @@ -15449,7 +16639,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py */ __pyx_v_itemp = ((char *)__pyx_v_self->view.buf); - /* "View.MemoryView":392 + /* "View.MemoryView":397 * cdef char *itemp = self.view.buf * * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< @@ -15461,26 +16651,26 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 392, __pyx_L1_error) + __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 392, __pyx_L1_error) + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 397, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 392, __pyx_L1_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 392, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 392, __pyx_L1_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(2, 397, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 392, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } @@ -15490,7 +16680,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 392, __pyx_L1_error) + else __PYX_ERR(2, 397, __pyx_L1_error) } break; } @@ -15501,18 +16691,18 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py __pyx_v_dim = __pyx_t_1; __pyx_t_1 = (__pyx_t_1 + 1); - /* "View.MemoryView":393 + /* "View.MemoryView":398 * * for dim, idx in enumerate(index): * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<< * * return itemp */ - __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 393, __pyx_L1_error) - __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 393, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 398, __pyx_L1_error) + __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(2, 398, __pyx_L1_error) __pyx_v_itemp = __pyx_t_7; - /* "View.MemoryView":392 + /* "View.MemoryView":397 * cdef char *itemp = self.view.buf * * for dim, idx in enumerate(index): # <<<<<<<<<<<<<< @@ -15522,7 +16712,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":395 + /* "View.MemoryView":400 * itemp = pybuffer_index(&self.view, itemp, idx, dim) * * return itemp # <<<<<<<<<<<<<< @@ -15532,7 +16722,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py __pyx_r = __pyx_v_itemp; goto __pyx_L0; - /* "View.MemoryView":388 + /* "View.MemoryView":393 * PyThread_free_lock(self.lock) * * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<< @@ -15552,7 +16742,7 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py return __pyx_r; } -/* "View.MemoryView":398 +/* "View.MemoryView":403 * * * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< @@ -15587,7 +16777,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ char *__pyx_t_6; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "View.MemoryView":399 + /* "View.MemoryView":404 * * def __getitem__(memoryview self, object index): * if index is Ellipsis: # <<<<<<<<<<<<<< @@ -15598,7 +16788,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":400 + /* "View.MemoryView":405 * def __getitem__(memoryview self, object index): * if index is Ellipsis: * return self # <<<<<<<<<<<<<< @@ -15610,7 +16800,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; - /* "View.MemoryView":399 + /* "View.MemoryView":404 * * def __getitem__(memoryview self, object index): * if index is Ellipsis: # <<<<<<<<<<<<<< @@ -15619,14 +16809,14 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ */ } - /* "View.MemoryView":402 + /* "View.MemoryView":407 * return self * * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< * * cdef char *itemp */ - __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 402, __pyx_L1_error) + __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (likely(__pyx_t_3 != Py_None)) { PyObject* sequence = __pyx_t_3; @@ -15634,7 +16824,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 402, __pyx_L1_error) + __PYX_ERR(2, 407, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); @@ -15642,31 +16832,31 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); #else - __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 402, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 402, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 402, __pyx_L1_error) + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 407, __pyx_L1_error) } __pyx_v_have_slices = __pyx_t_4; __pyx_t_4 = 0; __pyx_v_indices = __pyx_t_5; __pyx_t_5 = 0; - /* "View.MemoryView":405 + /* "View.MemoryView":410 * * cdef char *itemp * if have_slices: # <<<<<<<<<<<<<< * return memview_slice(self, indices) * else: */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 405, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 410, __pyx_L1_error) if (__pyx_t_2) { - /* "View.MemoryView":406 + /* "View.MemoryView":411 * cdef char *itemp * if have_slices: * return memview_slice(self, indices) # <<<<<<<<<<<<<< @@ -15674,13 +16864,13 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ * itemp = self.get_item_pointer(indices) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 406, __pyx_L1_error) + __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 411, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "View.MemoryView":405 + /* "View.MemoryView":410 * * cdef char *itemp * if have_slices: # <<<<<<<<<<<<<< @@ -15689,7 +16879,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ */ } - /* "View.MemoryView":408 + /* "View.MemoryView":413 * return memview_slice(self, indices) * else: * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<< @@ -15697,10 +16887,10 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ * */ /*else*/ { - __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 408, __pyx_L1_error) + __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(2, 413, __pyx_L1_error) __pyx_v_itemp = __pyx_t_6; - /* "View.MemoryView":409 + /* "View.MemoryView":414 * else: * itemp = self.get_item_pointer(indices) * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<< @@ -15708,14 +16898,14 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ * def __setitem__(memoryview self, object index, object value): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 409, __pyx_L1_error) + __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; } - /* "View.MemoryView":398 + /* "View.MemoryView":403 * * * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<< @@ -15738,7 +16928,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ return __pyx_r; } -/* "View.MemoryView":411 +/* "View.MemoryView":416 * return self.convert_item_to_object(itemp) * * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< @@ -15771,7 +16961,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit __Pyx_RefNannySetupContext("__setitem__", 0); __Pyx_INCREF(__pyx_v_index); - /* "View.MemoryView":412 + /* "View.MemoryView":417 * * def __setitem__(memoryview self, object index, object value): * if self.view.readonly: # <<<<<<<<<<<<<< @@ -15781,20 +16971,20 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit __pyx_t_1 = (__pyx_v_self->view.readonly != 0); if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":413 + /* "View.MemoryView":418 * def __setitem__(memoryview self, object index, object value): * if self.view.readonly: * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< * * have_slices, index = _unellipsify(index, self.view.ndim) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 413, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 418, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 413, __pyx_L1_error) + __PYX_ERR(2, 418, __pyx_L1_error) - /* "View.MemoryView":412 + /* "View.MemoryView":417 * * def __setitem__(memoryview self, object index, object value): * if self.view.readonly: # <<<<<<<<<<<<<< @@ -15803,14 +16993,14 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit */ } - /* "View.MemoryView":415 + /* "View.MemoryView":420 * raise TypeError("Cannot assign to read-only memoryview") * * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<< * * if have_slices: */ - __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 415, __pyx_L1_error) + __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (likely(__pyx_t_2 != Py_None)) { PyObject* sequence = __pyx_t_2; @@ -15818,7 +17008,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(2, 415, __pyx_L1_error) + __PYX_ERR(2, 420, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); @@ -15826,67 +17016,67 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 415, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 420, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 415, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 420, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 415, __pyx_L1_error) + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 420, __pyx_L1_error) } __pyx_v_have_slices = __pyx_t_3; __pyx_t_3 = 0; __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":417 + /* "View.MemoryView":422 * have_slices, index = _unellipsify(index, self.view.ndim) * * if have_slices: # <<<<<<<<<<<<<< * obj = self.is_slice(value) * if obj: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 417, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 422, __pyx_L1_error) if (__pyx_t_1) { - /* "View.MemoryView":418 + /* "View.MemoryView":423 * * if have_slices: * obj = self.is_slice(value) # <<<<<<<<<<<<<< * if obj: * self.setitem_slice_assignment(self[index], obj) */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 418, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_obj = __pyx_t_2; __pyx_t_2 = 0; - /* "View.MemoryView":419 + /* "View.MemoryView":424 * if have_slices: * obj = self.is_slice(value) * if obj: # <<<<<<<<<<<<<< * self.setitem_slice_assignment(self[index], obj) * else: */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 419, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error) if (__pyx_t_1) { - /* "View.MemoryView":420 + /* "View.MemoryView":425 * obj = self.is_slice(value) * if obj: * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<< * else: * self.setitem_slice_assign_scalar(self[index], value) */ - __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 420, __pyx_L1_error) + __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":419 + /* "View.MemoryView":424 * if have_slices: * obj = self.is_slice(value) * if obj: # <<<<<<<<<<<<<< @@ -15896,7 +17086,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit goto __pyx_L5; } - /* "View.MemoryView":422 + /* "View.MemoryView":427 * self.setitem_slice_assignment(self[index], obj) * else: * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<< @@ -15904,17 +17094,17 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit * self.setitem_indexed(index, value) */ /*else*/ { - __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 422, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 422, __pyx_L1_error) - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 422, __pyx_L1_error) + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 427, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_L5:; - /* "View.MemoryView":417 + /* "View.MemoryView":422 * have_slices, index = _unellipsify(index, self.view.ndim) * * if have_slices: # <<<<<<<<<<<<<< @@ -15924,7 +17114,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit goto __pyx_L4; } - /* "View.MemoryView":424 + /* "View.MemoryView":429 * self.setitem_slice_assign_scalar(self[index], value) * else: * self.setitem_indexed(index, value) # <<<<<<<<<<<<<< @@ -15932,13 +17122,13 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit * cdef is_slice(self, obj): */ /*else*/ { - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 424, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_L4:; - /* "View.MemoryView":411 + /* "View.MemoryView":416 * return self.convert_item_to_object(itemp) * * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<< @@ -15963,7 +17153,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit return __pyx_r; } -/* "View.MemoryView":426 +/* "View.MemoryView":431 * self.setitem_indexed(index, value) * * cdef is_slice(self, obj): # <<<<<<<<<<<<<< @@ -15986,22 +17176,22 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_RefNannySetupContext("is_slice", 0); __Pyx_INCREF(__pyx_v_obj); - /* "View.MemoryView":427 + /* "View.MemoryView":432 * * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< * try: - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type); __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":428 + /* "View.MemoryView":433 * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) */ { @@ -16013,34 +17203,34 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __Pyx_XGOTREF(__pyx_t_5); /*try:*/ { - /* "View.MemoryView":429 + /* "View.MemoryView":434 * if not isinstance(obj, memoryview): * try: - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< * self.dtype_is_object) * except TypeError: */ - __pyx_t_6 = __Pyx_PyInt_From_int((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 429, __pyx_L4_error) + __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 434, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_6); - /* "View.MemoryView":430 + /* "View.MemoryView":435 * try: - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) # <<<<<<<<<<<<<< * except TypeError: * return None */ - __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 430, __pyx_L4_error) + __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 435, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_7); - /* "View.MemoryView":429 + /* "View.MemoryView":434 * if not isinstance(obj, memoryview): * try: - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<< * self.dtype_is_object) * except TypeError: */ - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 429, __pyx_L4_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 434, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_obj); __Pyx_GIVEREF(__pyx_v_obj); @@ -16051,17 +17241,17 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); __pyx_t_6 = 0; __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 429, __pyx_L4_error) + __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 434, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":428 + /* "View.MemoryView":433 * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) */ } @@ -16071,11 +17261,11 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ goto __pyx_L9_try_end; __pyx_L4_error:; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "View.MemoryView":431 - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, + /* "View.MemoryView":436 + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) * except TypeError: # <<<<<<<<<<<<<< * return None @@ -16084,12 +17274,12 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError); if (__pyx_t_9) { __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 431, __pyx_L6_except_error) + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 436, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_8); __Pyx_GOTREF(__pyx_t_6); - /* "View.MemoryView":432 + /* "View.MemoryView":437 * self.dtype_is_object) * except TypeError: * return None # <<<<<<<<<<<<<< @@ -16106,11 +17296,11 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ goto __pyx_L6_except_error; __pyx_L6_except_error:; - /* "View.MemoryView":428 + /* "View.MemoryView":433 * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): * try: # <<<<<<<<<<<<<< - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, * self.dtype_is_object) */ __Pyx_XGIVEREF(__pyx_t_3); @@ -16127,16 +17317,16 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __pyx_L9_try_end:; } - /* "View.MemoryView":427 + /* "View.MemoryView":432 * * cdef is_slice(self, obj): * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<< * try: - * obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, + * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, */ } - /* "View.MemoryView":434 + /* "View.MemoryView":439 * return None * * return obj # <<<<<<<<<<<<<< @@ -16148,7 +17338,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ __pyx_r = __pyx_v_obj; goto __pyx_L0; - /* "View.MemoryView":426 + /* "View.MemoryView":431 * self.setitem_indexed(index, value) * * cdef is_slice(self, obj): # <<<<<<<<<<<<<< @@ -16170,7 +17360,7 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ return __pyx_r; } -/* "View.MemoryView":436 +/* "View.MemoryView":441 * return obj * * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< @@ -16189,50 +17379,50 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi int __pyx_t_4; __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); - /* "View.MemoryView":440 + /* "View.MemoryView":445 * cdef __Pyx_memviewslice src_slice * * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< * get_slice_from_memview(dst, &dst_slice)[0], * src.ndim, dst.ndim, self.dtype_is_object) */ - if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 440, __pyx_L1_error) + if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 445, __pyx_L1_error) - /* "View.MemoryView":441 + /* "View.MemoryView":446 * * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<< * src.ndim, dst.ndim, self.dtype_is_object) * */ - if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 441, __pyx_L1_error) + if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 446, __pyx_L1_error) - /* "View.MemoryView":442 + /* "View.MemoryView":447 * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], * get_slice_from_memview(dst, &dst_slice)[0], * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<< * * cdef setitem_slice_assign_scalar(self, memoryview dst, value): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 442, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 442, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 442, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 447, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 442, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":440 + /* "View.MemoryView":445 * cdef __Pyx_memviewslice src_slice * * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<< * get_slice_from_memview(dst, &dst_slice)[0], * src.ndim, dst.ndim, self.dtype_is_object) */ - __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 440, __pyx_L1_error) + __pyx_t_4 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice))[0]), __pyx_t_2, __pyx_t_3, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 445, __pyx_L1_error) - /* "View.MemoryView":436 + /* "View.MemoryView":441 * return obj * * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<< @@ -16253,7 +17443,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi return __pyx_r; } -/* "View.MemoryView":444 +/* "View.MemoryView":449 * src.ndim, dst.ndim, self.dtype_is_object) * * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< @@ -16282,7 +17472,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor PyObject *__pyx_t_11 = NULL; __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); - /* "View.MemoryView":446 + /* "View.MemoryView":451 * cdef setitem_slice_assign_scalar(self, memoryview dst, value): * cdef int array[128] * cdef void *tmp = NULL # <<<<<<<<<<<<<< @@ -16291,7 +17481,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ __pyx_v_tmp = NULL; - /* "View.MemoryView":451 + /* "View.MemoryView":456 * cdef __Pyx_memviewslice *dst_slice * cdef __Pyx_memviewslice tmp_slice * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<< @@ -16300,7 +17490,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ __pyx_v_dst_slice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); - /* "View.MemoryView":453 + /* "View.MemoryView":458 * dst_slice = get_slice_from_memview(dst, &tmp_slice) * * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< @@ -16310,7 +17500,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_t_1 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0); if (__pyx_t_1) { - /* "View.MemoryView":454 + /* "View.MemoryView":459 * * if self.view.itemsize > sizeof(array): * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<< @@ -16319,7 +17509,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize); - /* "View.MemoryView":455 + /* "View.MemoryView":460 * if self.view.itemsize > sizeof(array): * tmp = PyMem_Malloc(self.view.itemsize) * if tmp == NULL: # <<<<<<<<<<<<<< @@ -16329,16 +17519,16 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_t_1 = ((__pyx_v_tmp == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":456 + /* "View.MemoryView":461 * tmp = PyMem_Malloc(self.view.itemsize) * if tmp == NULL: * raise MemoryError # <<<<<<<<<<<<<< * item = tmp * else: */ - PyErr_NoMemory(); __PYX_ERR(2, 456, __pyx_L1_error) + PyErr_NoMemory(); __PYX_ERR(2, 461, __pyx_L1_error) - /* "View.MemoryView":455 + /* "View.MemoryView":460 * if self.view.itemsize > sizeof(array): * tmp = PyMem_Malloc(self.view.itemsize) * if tmp == NULL: # <<<<<<<<<<<<<< @@ -16347,7 +17537,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ } - /* "View.MemoryView":457 + /* "View.MemoryView":462 * if tmp == NULL: * raise MemoryError * item = tmp # <<<<<<<<<<<<<< @@ -16356,7 +17546,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ __pyx_v_item = __pyx_v_tmp; - /* "View.MemoryView":453 + /* "View.MemoryView":458 * dst_slice = get_slice_from_memview(dst, &tmp_slice) * * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<< @@ -16366,7 +17556,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor goto __pyx_L3; } - /* "View.MemoryView":459 + /* "View.MemoryView":464 * item = tmp * else: * item = array # <<<<<<<<<<<<<< @@ -16378,7 +17568,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor } __pyx_L3:; - /* "View.MemoryView":461 + /* "View.MemoryView":466 * item = array * * try: # <<<<<<<<<<<<<< @@ -16387,7 +17577,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ /*try:*/ { - /* "View.MemoryView":462 + /* "View.MemoryView":467 * * try: * if self.dtype_is_object: # <<<<<<<<<<<<<< @@ -16397,7 +17587,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0); if (__pyx_t_1) { - /* "View.MemoryView":463 + /* "View.MemoryView":468 * try: * if self.dtype_is_object: * ( item)[0] = value # <<<<<<<<<<<<<< @@ -16406,7 +17596,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value); - /* "View.MemoryView":462 + /* "View.MemoryView":467 * * try: * if self.dtype_is_object: # <<<<<<<<<<<<<< @@ -16416,7 +17606,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor goto __pyx_L8; } - /* "View.MemoryView":465 + /* "View.MemoryView":470 * ( item)[0] = value * else: * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<< @@ -16424,13 +17614,13 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor * */ /*else*/ { - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 465, __pyx_L6_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 470, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __pyx_L8:; - /* "View.MemoryView":469 + /* "View.MemoryView":474 * * * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< @@ -16440,18 +17630,18 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_t_1 = ((__pyx_v_self->view.suboffsets != NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":470 + /* "View.MemoryView":475 * * if self.view.suboffsets != NULL: * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<< * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, * item, self.dtype_is_object) */ - __pyx_t_2 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 470, __pyx_L6_error) + __pyx_t_2 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 475, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":469 + /* "View.MemoryView":474 * * * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<< @@ -16460,7 +17650,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor */ } - /* "View.MemoryView":471 + /* "View.MemoryView":476 * if self.view.suboffsets != NULL: * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<< @@ -16470,7 +17660,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object); } - /* "View.MemoryView":474 + /* "View.MemoryView":479 * item, self.dtype_is_object) * finally: * PyMem_Free(tmp) # <<<<<<<<<<<<<< @@ -16517,7 +17707,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor __pyx_L7:; } - /* "View.MemoryView":444 + /* "View.MemoryView":449 * src.ndim, dst.ndim, self.dtype_is_object) * * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<< @@ -16538,7 +17728,7 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor return __pyx_r; } -/* "View.MemoryView":476 +/* "View.MemoryView":481 * PyMem_Free(tmp) * * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< @@ -16554,28 +17744,28 @@ static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *_ PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("setitem_indexed", 0); - /* "View.MemoryView":477 + /* "View.MemoryView":482 * * cdef setitem_indexed(self, index, value): * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<< * self.assign_item_from_object(itemp, value) * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 477, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(2, 482, __pyx_L1_error) __pyx_v_itemp = __pyx_t_1; - /* "View.MemoryView":478 + /* "View.MemoryView":483 * cdef setitem_indexed(self, index, value): * cdef char *itemp = self.get_item_pointer(index) * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<< * * cdef convert_item_to_object(self, char *itemp): */ - __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 478, __pyx_L1_error) + __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":476 + /* "View.MemoryView":481 * PyMem_Free(tmp) * * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<< @@ -16596,7 +17786,7 @@ static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *_ return __pyx_r; } -/* "View.MemoryView":480 +/* "View.MemoryView":485 * self.assign_item_from_object(itemp, value) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< @@ -16623,31 +17813,31 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview int __pyx_t_11; __Pyx_RefNannySetupContext("convert_item_to_object", 0); - /* "View.MemoryView":483 + /* "View.MemoryView":488 * """Only used if instantiated manually by the user, or if Cython doesn't * know how to convert the type""" * import struct # <<<<<<<<<<<<<< * cdef bytes bytesitem * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 483, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_struct = __pyx_t_1; __pyx_t_1 = 0; - /* "View.MemoryView":486 + /* "View.MemoryView":491 * cdef bytes bytesitem * * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<< * try: * result = struct.unpack(self.view.format, bytesitem) */ - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 486, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_bytesitem = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":487 + /* "View.MemoryView":492 * * bytesitem = itemp[:self.view.itemsize] * try: # <<<<<<<<<<<<<< @@ -16663,16 +17853,16 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __Pyx_XGOTREF(__pyx_t_4); /*try:*/ { - /* "View.MemoryView":488 + /* "View.MemoryView":493 * bytesitem = itemp[:self.view.itemsize] * try: * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<< * except struct.error: * raise ValueError("Unable to convert item to object") */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 488, __pyx_L3_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 493, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 488, __pyx_L3_error) + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 493, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_8 = 0; @@ -16689,7 +17879,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L3_error) + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -16698,14 +17888,14 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L3_error) + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 488, __pyx_L3_error) + __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 493, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_7) { __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; @@ -16716,7 +17906,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __Pyx_GIVEREF(__pyx_v_bytesitem); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem); __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L3_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } @@ -16724,7 +17914,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; - /* "View.MemoryView":487 + /* "View.MemoryView":492 * * bytesitem = itemp[:self.view.itemsize] * try: # <<<<<<<<<<<<<< @@ -16733,7 +17923,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview */ } - /* "View.MemoryView":492 + /* "View.MemoryView":497 * raise ValueError("Unable to convert item to object") * else: * if len(self.view.format) == 1: # <<<<<<<<<<<<<< @@ -16745,7 +17935,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __pyx_t_11 = ((__pyx_t_10 == 1) != 0); if (__pyx_t_11) { - /* "View.MemoryView":493 + /* "View.MemoryView":498 * else: * if len(self.view.format) == 1: * return result[0] # <<<<<<<<<<<<<< @@ -16753,13 +17943,13 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L5_except_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 498, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L6_except_return; - /* "View.MemoryView":492 + /* "View.MemoryView":497 * raise ValueError("Unable to convert item to object") * else: * if len(self.view.format) == 1: # <<<<<<<<<<<<<< @@ -16768,7 +17958,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview */ } - /* "View.MemoryView":494 + /* "View.MemoryView":499 * if len(self.view.format) == 1: * return result[0] * return result # <<<<<<<<<<<<<< @@ -16781,13 +17971,13 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview goto __pyx_L6_except_return; } __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":489 + /* "View.MemoryView":494 * try: * result = struct.unpack(self.view.format, bytesitem) * except struct.error: # <<<<<<<<<<<<<< @@ -16795,7 +17985,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview * else: */ __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 489, __pyx_L5_except_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 494, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -16803,28 +17993,28 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0; if (__pyx_t_8) { __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 489, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 494, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_1); - /* "View.MemoryView":490 + /* "View.MemoryView":495 * result = struct.unpack(self.view.format, bytesitem) * except struct.error: * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< * else: * if len(self.view.format) == 1: */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 490, __pyx_L5_except_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(2, 490, __pyx_L5_except_error) + __PYX_ERR(2, 495, __pyx_L5_except_error) } goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "View.MemoryView":487 + /* "View.MemoryView":492 * * bytesitem = itemp[:self.view.itemsize] * try: # <<<<<<<<<<<<<< @@ -16844,7 +18034,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview goto __pyx_L0; } - /* "View.MemoryView":480 + /* "View.MemoryView":485 * self.assign_item_from_object(itemp, value) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< @@ -16870,7 +18060,7 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview return __pyx_r; } -/* "View.MemoryView":496 +/* "View.MemoryView":501 * return result * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< @@ -16901,19 +18091,19 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie char *__pyx_t_14; __Pyx_RefNannySetupContext("assign_item_from_object", 0); - /* "View.MemoryView":499 + /* "View.MemoryView":504 * """Only used if instantiated manually by the user, or if Cython doesn't * know how to convert the type""" * import struct # <<<<<<<<<<<<<< * cdef char c * cdef bytes bytesvalue */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 499, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 504, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_struct = __pyx_t_1; __pyx_t_1 = 0; - /* "View.MemoryView":504 + /* "View.MemoryView":509 * cdef Py_ssize_t i * * if isinstance(value, tuple): # <<<<<<<<<<<<<< @@ -16924,37 +18114,37 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "View.MemoryView":505 + /* "View.MemoryView":510 * * if isinstance(value, tuple): * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<< * else: * bytesvalue = struct.pack(self.view.format, value) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 505, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 505, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 505, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 505, __pyx_L1_error) + __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 505, __pyx_L1_error) + __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 505, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 505, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 510, __pyx_L1_error) __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; - /* "View.MemoryView":504 + /* "View.MemoryView":509 * cdef Py_ssize_t i * * if isinstance(value, tuple): # <<<<<<<<<<<<<< @@ -16964,7 +18154,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie goto __pyx_L3; } - /* "View.MemoryView":507 + /* "View.MemoryView":512 * bytesvalue = struct.pack(self.view.format, *value) * else: * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<< @@ -16972,9 +18162,9 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie * for i, c in enumerate(bytesvalue): */ /*else*/ { - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 507, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 507, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = NULL; __pyx_t_7 = 0; @@ -16991,7 +18181,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 507, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17000,14 +18190,14 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 507, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else #endif { - __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 507, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL; @@ -17018,18 +18208,18 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie __Pyx_GIVEREF(__pyx_v_value); PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 507, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 507, __pyx_L1_error) + if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error) __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; } __pyx_L3:; - /* "View.MemoryView":509 + /* "View.MemoryView":514 * bytesvalue = struct.pack(self.view.format, value) * * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< @@ -17039,7 +18229,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie __pyx_t_9 = 0; if (unlikely(__pyx_v_bytesvalue == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable"); - __PYX_ERR(2, 509, __pyx_L1_error) + __PYX_ERR(2, 514, __pyx_L1_error) } __Pyx_INCREF(__pyx_v_bytesvalue); __pyx_t_10 = __pyx_v_bytesvalue; @@ -17049,7 +18239,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie __pyx_t_11 = __pyx_t_14; __pyx_v_c = (__pyx_t_11[0]); - /* "View.MemoryView":510 + /* "View.MemoryView":515 * * for i, c in enumerate(bytesvalue): * itemp[i] = c # <<<<<<<<<<<<<< @@ -17058,7 +18248,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie */ __pyx_v_i = __pyx_t_9; - /* "View.MemoryView":509 + /* "View.MemoryView":514 * bytesvalue = struct.pack(self.view.format, value) * * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<< @@ -17067,7 +18257,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie */ __pyx_t_9 = (__pyx_t_9 + 1); - /* "View.MemoryView":510 + /* "View.MemoryView":515 * * for i, c in enumerate(bytesvalue): * itemp[i] = c # <<<<<<<<<<<<<< @@ -17078,7 +18268,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie } __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "View.MemoryView":496 + /* "View.MemoryView":501 * return result * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< @@ -17106,7 +18296,7 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie return __pyx_r; } -/* "View.MemoryView":513 +/* "View.MemoryView":518 * * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< @@ -17146,7 +18336,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); - /* "View.MemoryView":514 + /* "View.MemoryView":519 * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< @@ -17164,20 +18354,20 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_L4_bool_binop_done:; if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":515 + /* "View.MemoryView":520 * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_WRITABLE and self.view.readonly: * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< * - * if flags & PyBUF_STRIDES: + * if flags & PyBUF_ND: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 515, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 520, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 515, __pyx_L1_error) + __PYX_ERR(2, 520, __pyx_L1_error) - /* "View.MemoryView":514 + /* "View.MemoryView":519 * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<< @@ -17186,19 +18376,19 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu */ } - /* "View.MemoryView":517 + /* "View.MemoryView":522 * raise ValueError("Cannot create writable memory view from read-only memoryview") * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< * info.shape = self.view.shape * else: */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); + __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0); if (__pyx_t_1) { - /* "View.MemoryView":518 + /* "View.MemoryView":523 * - * if flags & PyBUF_STRIDES: + * if flags & PyBUF_ND: * info.shape = self.view.shape # <<<<<<<<<<<<<< * else: * info.shape = NULL @@ -17206,17 +18396,17 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_4 = __pyx_v_self->view.shape; __pyx_v_info->shape = __pyx_t_4; - /* "View.MemoryView":517 + /* "View.MemoryView":522 * raise ValueError("Cannot create writable memory view from read-only memoryview") * - * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< + * if flags & PyBUF_ND: # <<<<<<<<<<<<<< * info.shape = self.view.shape * else: */ goto __pyx_L6; } - /* "View.MemoryView":520 + /* "View.MemoryView":525 * info.shape = self.view.shape * else: * info.shape = NULL # <<<<<<<<<<<<<< @@ -17228,7 +18418,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu } __pyx_L6:; - /* "View.MemoryView":522 + /* "View.MemoryView":527 * info.shape = NULL * * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< @@ -17238,7 +18428,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0); if (__pyx_t_1) { - /* "View.MemoryView":523 + /* "View.MemoryView":528 * * if flags & PyBUF_STRIDES: * info.strides = self.view.strides # <<<<<<<<<<<<<< @@ -17248,7 +18438,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_4 = __pyx_v_self->view.strides; __pyx_v_info->strides = __pyx_t_4; - /* "View.MemoryView":522 + /* "View.MemoryView":527 * info.shape = NULL * * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<< @@ -17258,7 +18448,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu goto __pyx_L7; } - /* "View.MemoryView":525 + /* "View.MemoryView":530 * info.strides = self.view.strides * else: * info.strides = NULL # <<<<<<<<<<<<<< @@ -17270,7 +18460,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu } __pyx_L7:; - /* "View.MemoryView":527 + /* "View.MemoryView":532 * info.strides = NULL * * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< @@ -17280,7 +18470,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0); if (__pyx_t_1) { - /* "View.MemoryView":528 + /* "View.MemoryView":533 * * if flags & PyBUF_INDIRECT: * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<< @@ -17290,7 +18480,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_4 = __pyx_v_self->view.suboffsets; __pyx_v_info->suboffsets = __pyx_t_4; - /* "View.MemoryView":527 + /* "View.MemoryView":532 * info.strides = NULL * * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<< @@ -17300,7 +18490,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu goto __pyx_L8; } - /* "View.MemoryView":530 + /* "View.MemoryView":535 * info.suboffsets = self.view.suboffsets * else: * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -17312,7 +18502,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu } __pyx_L8:; - /* "View.MemoryView":532 + /* "View.MemoryView":537 * info.suboffsets = NULL * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -17322,7 +18512,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0); if (__pyx_t_1) { - /* "View.MemoryView":533 + /* "View.MemoryView":538 * * if flags & PyBUF_FORMAT: * info.format = self.view.format # <<<<<<<<<<<<<< @@ -17332,7 +18522,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_5 = __pyx_v_self->view.format; __pyx_v_info->format = __pyx_t_5; - /* "View.MemoryView":532 + /* "View.MemoryView":537 * info.suboffsets = NULL * * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<< @@ -17342,7 +18532,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu goto __pyx_L9; } - /* "View.MemoryView":535 + /* "View.MemoryView":540 * info.format = self.view.format * else: * info.format = NULL # <<<<<<<<<<<<<< @@ -17354,7 +18544,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu } __pyx_L9:; - /* "View.MemoryView":537 + /* "View.MemoryView":542 * info.format = NULL * * info.buf = self.view.buf # <<<<<<<<<<<<<< @@ -17364,7 +18554,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_6 = __pyx_v_self->view.buf; __pyx_v_info->buf = __pyx_t_6; - /* "View.MemoryView":538 + /* "View.MemoryView":543 * * info.buf = self.view.buf * info.ndim = self.view.ndim # <<<<<<<<<<<<<< @@ -17374,7 +18564,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_7 = __pyx_v_self->view.ndim; __pyx_v_info->ndim = __pyx_t_7; - /* "View.MemoryView":539 + /* "View.MemoryView":544 * info.buf = self.view.buf * info.ndim = self.view.ndim * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<< @@ -17384,7 +18574,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_8 = __pyx_v_self->view.itemsize; __pyx_v_info->itemsize = __pyx_t_8; - /* "View.MemoryView":540 + /* "View.MemoryView":545 * info.ndim = self.view.ndim * info.itemsize = self.view.itemsize * info.len = self.view.len # <<<<<<<<<<<<<< @@ -17394,7 +18584,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_8 = __pyx_v_self->view.len; __pyx_v_info->len = __pyx_t_8; - /* "View.MemoryView":541 + /* "View.MemoryView":546 * info.itemsize = self.view.itemsize * info.len = self.view.len * info.readonly = self.view.readonly # <<<<<<<<<<<<<< @@ -17404,7 +18594,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __pyx_t_1 = __pyx_v_self->view.readonly; __pyx_v_info->readonly = __pyx_t_1; - /* "View.MemoryView":542 + /* "View.MemoryView":547 * info.len = self.view.len * info.readonly = self.view.readonly * info.obj = self # <<<<<<<<<<<<<< @@ -17417,7 +18607,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); - /* "View.MemoryView":513 + /* "View.MemoryView":518 * * @cname('getbuffer') * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<< @@ -17447,7 +18637,7 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu return __pyx_r; } -/* "View.MemoryView":548 +/* "View.MemoryView":553 * * @property * def T(self): # <<<<<<<<<<<<<< @@ -17476,29 +18666,29 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct _ int __pyx_t_2; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":549 + /* "View.MemoryView":554 * @property * def T(self): * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<< * transpose_memslice(&result.from_slice) * return result */ - __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 549, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 549, __pyx_L1_error) + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 554, __pyx_L1_error) __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":550 + /* "View.MemoryView":555 * def T(self): * cdef _memoryviewslice result = memoryview_copy(self) * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<< * return result * */ - __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 550, __pyx_L1_error) + __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 555, __pyx_L1_error) - /* "View.MemoryView":551 + /* "View.MemoryView":556 * cdef _memoryviewslice result = memoryview_copy(self) * transpose_memslice(&result.from_slice) * return result # <<<<<<<<<<<<<< @@ -17510,7 +18700,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct _ __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - /* "View.MemoryView":548 + /* "View.MemoryView":553 * * @property * def T(self): # <<<<<<<<<<<<<< @@ -17530,7 +18720,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct _ return __pyx_r; } -/* "View.MemoryView":554 +/* "View.MemoryView":559 * * @property * def base(self): # <<<<<<<<<<<<<< @@ -17556,7 +18746,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struc __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":555 + /* "View.MemoryView":560 * @property * def base(self): * return self.obj # <<<<<<<<<<<<<< @@ -17568,7 +18758,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struc __pyx_r = __pyx_v_self->obj; goto __pyx_L0; - /* "View.MemoryView":554 + /* "View.MemoryView":559 * * @property * def base(self): # <<<<<<<<<<<<<< @@ -17583,7 +18773,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struc return __pyx_r; } -/* "View.MemoryView":558 +/* "View.MemoryView":563 * * @property * def shape(self): # <<<<<<<<<<<<<< @@ -17615,7 +18805,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(stru PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":559 + /* "View.MemoryView":564 * @property * def shape(self): * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<< @@ -17623,25 +18813,25 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(stru * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 559, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) { __pyx_t_2 = __pyx_t_4; __pyx_v_length = (__pyx_t_2[0]); - __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 559, __pyx_L1_error) + __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 559, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 564, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 559, __pyx_L1_error) + __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - /* "View.MemoryView":558 + /* "View.MemoryView":563 * * @property * def shape(self): # <<<<<<<<<<<<<< @@ -17661,7 +18851,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(stru return __pyx_r; } -/* "View.MemoryView":562 +/* "View.MemoryView":567 * * @property * def strides(self): # <<<<<<<<<<<<<< @@ -17694,7 +18884,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":563 + /* "View.MemoryView":568 * @property * def strides(self): * if self.view.strides == NULL: # <<<<<<<<<<<<<< @@ -17704,20 +18894,20 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":565 + /* "View.MemoryView":570 * if self.view.strides == NULL: * * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< * * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 565, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 570, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 565, __pyx_L1_error) + __PYX_ERR(2, 570, __pyx_L1_error) - /* "View.MemoryView":563 + /* "View.MemoryView":568 * @property * def strides(self): * if self.view.strides == NULL: # <<<<<<<<<<<<<< @@ -17726,7 +18916,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st */ } - /* "View.MemoryView":567 + /* "View.MemoryView":572 * raise ValueError("Buffer view does not expose strides") * * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<< @@ -17734,25 +18924,25 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 567, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim); for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { __pyx_t_3 = __pyx_t_5; __pyx_v_stride = (__pyx_t_3[0]); - __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 567, __pyx_L1_error) + __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 567, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 572, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 567, __pyx_L1_error) + __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; - /* "View.MemoryView":562 + /* "View.MemoryView":567 * * @property * def strides(self): # <<<<<<<<<<<<<< @@ -17772,7 +18962,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st return __pyx_r; } -/* "View.MemoryView":570 +/* "View.MemoryView":575 * * @property * def suboffsets(self): # <<<<<<<<<<<<<< @@ -17805,7 +18995,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ Py_ssize_t *__pyx_t_6; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":571 + /* "View.MemoryView":576 * @property * def suboffsets(self): * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< @@ -17815,7 +19005,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":572 + /* "View.MemoryView":577 * def suboffsets(self): * if self.view.suboffsets == NULL: * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< @@ -17823,16 +19013,16 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 577, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__22, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 572, __pyx_L1_error) + __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__19, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 577, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "View.MemoryView":571 + /* "View.MemoryView":576 * @property * def suboffsets(self): * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<< @@ -17841,7 +19031,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ */ } - /* "View.MemoryView":574 + /* "View.MemoryView":579 * return (-1,) * self.view.ndim * * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<< @@ -17849,25 +19039,25 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 574, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim); for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) { __pyx_t_4 = __pyx_t_6; __pyx_v_suboffset = (__pyx_t_4[0]); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 574, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 574, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 579, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 574, __pyx_L1_error) + __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":570 + /* "View.MemoryView":575 * * @property * def suboffsets(self): # <<<<<<<<<<<<<< @@ -17887,7 +19077,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ return __pyx_r; } -/* "View.MemoryView":577 +/* "View.MemoryView":582 * * @property * def ndim(self): # <<<<<<<<<<<<<< @@ -17914,7 +19104,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struc PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":578 + /* "View.MemoryView":583 * @property * def ndim(self): * return self.view.ndim # <<<<<<<<<<<<<< @@ -17922,13 +19112,13 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struc * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 578, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 583, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":577 + /* "View.MemoryView":582 * * @property * def ndim(self): # <<<<<<<<<<<<<< @@ -17947,7 +19137,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struc return __pyx_r; } -/* "View.MemoryView":581 +/* "View.MemoryView":586 * * @property * def itemsize(self): # <<<<<<<<<<<<<< @@ -17974,7 +19164,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(s PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":582 + /* "View.MemoryView":587 * @property * def itemsize(self): * return self.view.itemsize # <<<<<<<<<<<<<< @@ -17982,13 +19172,13 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(s * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 582, __pyx_L1_error) + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 587, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":581 + /* "View.MemoryView":586 * * @property * def itemsize(self): # <<<<<<<<<<<<<< @@ -18007,7 +19197,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(s return __pyx_r; } -/* "View.MemoryView":585 +/* "View.MemoryView":590 * * @property * def nbytes(self): # <<<<<<<<<<<<<< @@ -18036,7 +19226,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(str PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":586 + /* "View.MemoryView":591 * @property * def nbytes(self): * return self.size * self.view.itemsize # <<<<<<<<<<<<<< @@ -18044,11 +19234,11 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(str * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 586, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 591, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 586, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 591, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 586, __pyx_L1_error) + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 591, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -18056,7 +19246,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(str __pyx_t_3 = 0; goto __pyx_L0; - /* "View.MemoryView":585 + /* "View.MemoryView":590 * * @property * def nbytes(self): # <<<<<<<<<<<<<< @@ -18077,7 +19267,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(str return __pyx_r; } -/* "View.MemoryView":589 +/* "View.MemoryView":594 * * @property * def size(self): # <<<<<<<<<<<<<< @@ -18111,7 +19301,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":590 + /* "View.MemoryView":595 * @property * def size(self): * if self._size is None: # <<<<<<<<<<<<<< @@ -18122,7 +19312,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":591 + /* "View.MemoryView":596 * def size(self): * if self._size is None: * result = 1 # <<<<<<<<<<<<<< @@ -18132,7 +19322,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc __Pyx_INCREF(__pyx_int_1); __pyx_v_result = __pyx_int_1; - /* "View.MemoryView":593 + /* "View.MemoryView":598 * result = 1 * * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<< @@ -18142,25 +19332,25 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim); for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) { __pyx_t_3 = __pyx_t_5; - __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 593, __pyx_L1_error) + __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 598, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6); __pyx_t_6 = 0; - /* "View.MemoryView":594 + /* "View.MemoryView":599 * * for length in self.view.shape[:self.view.ndim]: * result *= length # <<<<<<<<<<<<<< * * self._size = result */ - __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 594, __pyx_L1_error) + __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 599, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6); __pyx_t_6 = 0; } - /* "View.MemoryView":596 + /* "View.MemoryView":601 * result *= length * * self._size = result # <<<<<<<<<<<<<< @@ -18173,7 +19363,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc __Pyx_DECREF(__pyx_v_self->_size); __pyx_v_self->_size = __pyx_v_result; - /* "View.MemoryView":590 + /* "View.MemoryView":595 * @property * def size(self): * if self._size is None: # <<<<<<<<<<<<<< @@ -18182,7 +19372,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc */ } - /* "View.MemoryView":598 + /* "View.MemoryView":603 * self._size = result * * return self._size # <<<<<<<<<<<<<< @@ -18194,7 +19384,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc __pyx_r = __pyx_v_self->_size; goto __pyx_L0; - /* "View.MemoryView":589 + /* "View.MemoryView":594 * * @property * def size(self): # <<<<<<<<<<<<<< @@ -18215,7 +19405,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc return __pyx_r; } -/* "View.MemoryView":600 +/* "View.MemoryView":605 * return self._size * * def __len__(self): # <<<<<<<<<<<<<< @@ -18242,7 +19432,7 @@ static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_1 int __pyx_t_1; __Pyx_RefNannySetupContext("__len__", 0); - /* "View.MemoryView":601 + /* "View.MemoryView":606 * * def __len__(self): * if self.view.ndim >= 1: # <<<<<<<<<<<<<< @@ -18252,7 +19442,7 @@ static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_1 __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0); if (__pyx_t_1) { - /* "View.MemoryView":602 + /* "View.MemoryView":607 * def __len__(self): * if self.view.ndim >= 1: * return self.view.shape[0] # <<<<<<<<<<<<<< @@ -18262,7 +19452,7 @@ static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_1 __pyx_r = (__pyx_v_self->view.shape[0]); goto __pyx_L0; - /* "View.MemoryView":601 + /* "View.MemoryView":606 * * def __len__(self): * if self.view.ndim >= 1: # <<<<<<<<<<<<<< @@ -18271,7 +19461,7 @@ static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_1 */ } - /* "View.MemoryView":604 + /* "View.MemoryView":609 * return self.view.shape[0] * * return 0 # <<<<<<<<<<<<<< @@ -18281,7 +19471,7 @@ static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_1 __pyx_r = 0; goto __pyx_L0; - /* "View.MemoryView":600 + /* "View.MemoryView":605 * return self._size * * def __len__(self): # <<<<<<<<<<<<<< @@ -18295,7 +19485,7 @@ static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_1 return __pyx_r; } -/* "View.MemoryView":606 +/* "View.MemoryView":611 * return 0 * * def __repr__(self): # <<<<<<<<<<<<<< @@ -18324,7 +19514,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12 PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("__repr__", 0); - /* "View.MemoryView":607 + /* "View.MemoryView":612 * * def __repr__(self): * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< @@ -18332,33 +19522,33 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12 * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 607, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 607, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 607, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":608 + /* "View.MemoryView":613 * def __repr__(self): * return "" % (self.base.__class__.__name__, * id(self)) # <<<<<<<<<<<<<< * * def __str__(self): */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 608, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 613, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "View.MemoryView":607 + /* "View.MemoryView":612 * * def __repr__(self): * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<< * id(self)) * */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 607, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); @@ -18366,14 +19556,14 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 607, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":606 + /* "View.MemoryView":611 * return 0 * * def __repr__(self): # <<<<<<<<<<<<<< @@ -18394,7 +19584,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12 return __pyx_r; } -/* "View.MemoryView":610 +/* "View.MemoryView":615 * id(self)) * * def __str__(self): # <<<<<<<<<<<<<< @@ -18422,7 +19612,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14 PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__str__", 0); - /* "View.MemoryView":611 + /* "View.MemoryView":616 * * def __str__(self): * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<< @@ -18430,27 +19620,27 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14 * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 611, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 611, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 611, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 611, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 611, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":610 + /* "View.MemoryView":615 * id(self)) * * def __str__(self): # <<<<<<<<<<<<<< @@ -18470,7 +19660,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14 return __pyx_r; } -/* "View.MemoryView":614 +/* "View.MemoryView":619 * * * def is_c_contig(self): # <<<<<<<<<<<<<< @@ -18499,7 +19689,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16 PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("is_c_contig", 0); - /* "View.MemoryView":617 + /* "View.MemoryView":622 * cdef __Pyx_memviewslice *mslice * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< @@ -18508,7 +19698,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16 */ __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); - /* "View.MemoryView":618 + /* "View.MemoryView":623 * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<< @@ -18516,13 +19706,13 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16 * def is_f_contig(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":614 + /* "View.MemoryView":619 * * * def is_c_contig(self): # <<<<<<<<<<<<<< @@ -18541,7 +19731,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16 return __pyx_r; } -/* "View.MemoryView":620 +/* "View.MemoryView":625 * return slice_is_contig(mslice[0], 'C', self.view.ndim) * * def is_f_contig(self): # <<<<<<<<<<<<<< @@ -18570,7 +19760,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18 PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("is_f_contig", 0); - /* "View.MemoryView":623 + /* "View.MemoryView":628 * cdef __Pyx_memviewslice *mslice * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<< @@ -18579,7 +19769,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18 */ __pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); - /* "View.MemoryView":624 + /* "View.MemoryView":629 * cdef __Pyx_memviewslice tmp * mslice = get_slice_from_memview(self, &tmp) * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<< @@ -18587,13 +19777,13 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18 * def copy(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 624, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 629, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":620 + /* "View.MemoryView":625 * return slice_is_contig(mslice[0], 'C', self.view.ndim) * * def is_f_contig(self): # <<<<<<<<<<<<<< @@ -18612,7 +19802,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18 return __pyx_r; } -/* "View.MemoryView":626 +/* "View.MemoryView":631 * return slice_is_contig(mslice[0], 'F', self.view.ndim) * * def copy(self): # <<<<<<<<<<<<<< @@ -18642,7 +19832,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20 PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("copy", 0); - /* "View.MemoryView":628 + /* "View.MemoryView":633 * def copy(self): * cdef __Pyx_memviewslice mslice * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<< @@ -18651,7 +19841,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20 */ __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS)); - /* "View.MemoryView":630 + /* "View.MemoryView":635 * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS * * slice_copy(self, &mslice) # <<<<<<<<<<<<<< @@ -18660,17 +19850,17 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20 */ __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice)); - /* "View.MemoryView":631 + /* "View.MemoryView":636 * * slice_copy(self, &mslice) * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<< * self.view.itemsize, * flags|PyBUF_C_CONTIGUOUS, */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 631, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 636, __pyx_L1_error) __pyx_v_mslice = __pyx_t_1; - /* "View.MemoryView":636 + /* "View.MemoryView":641 * self.dtype_is_object) * * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<< @@ -18678,13 +19868,13 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20 * def copy_fortran(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 636, __pyx_L1_error) + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 641, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":626 + /* "View.MemoryView":631 * return slice_is_contig(mslice[0], 'F', self.view.ndim) * * def copy(self): # <<<<<<<<<<<<<< @@ -18703,7 +19893,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20 return __pyx_r; } -/* "View.MemoryView":638 +/* "View.MemoryView":643 * return memoryview_copy_from_slice(self, &mslice) * * def copy_fortran(self): # <<<<<<<<<<<<<< @@ -18734,7 +19924,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("copy_fortran", 0); - /* "View.MemoryView":640 + /* "View.MemoryView":645 * def copy_fortran(self): * cdef __Pyx_memviewslice src, dst * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<< @@ -18743,7 +19933,7 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 */ __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS)); - /* "View.MemoryView":642 + /* "View.MemoryView":647 * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS * * slice_copy(self, &src) # <<<<<<<<<<<<<< @@ -18752,17 +19942,17 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 */ __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src)); - /* "View.MemoryView":643 + /* "View.MemoryView":648 * * slice_copy(self, &src) * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<< * self.view.itemsize, * flags|PyBUF_F_CONTIGUOUS, */ - __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 643, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 648, __pyx_L1_error) __pyx_v_dst = __pyx_t_1; - /* "View.MemoryView":648 + /* "View.MemoryView":653 * self.dtype_is_object) * * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<< @@ -18770,13 +19960,13 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 648, __pyx_L1_error) + __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 653, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":638 + /* "View.MemoryView":643 * return memoryview_copy_from_slice(self, &mslice) * * def copy_fortran(self): # <<<<<<<<<<<<<< @@ -18826,7 +20016,7 @@ static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struc * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -18879,7 +20069,7 @@ static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED st * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -18902,7 +20092,7 @@ static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED st return __pyx_r; } -/* "View.MemoryView":652 +/* "View.MemoryView":657 * * @cname('__pyx_memoryview_new') * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< @@ -18919,18 +20109,18 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); - /* "View.MemoryView":653 + /* "View.MemoryView":658 * @cname('__pyx_memoryview_new') * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<< * result.typeinfo = typeinfo * return result */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 653, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 653, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 653, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_o); __Pyx_GIVEREF(__pyx_v_o); @@ -18941,13 +20131,13 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 653, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":654 + /* "View.MemoryView":659 * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): * cdef memoryview result = memoryview(o, flags, dtype_is_object) * result.typeinfo = typeinfo # <<<<<<<<<<<<<< @@ -18956,7 +20146,7 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in */ __pyx_v_result->typeinfo = __pyx_v_typeinfo; - /* "View.MemoryView":655 + /* "View.MemoryView":660 * cdef memoryview result = memoryview(o, flags, dtype_is_object) * result.typeinfo = typeinfo * return result # <<<<<<<<<<<<<< @@ -18968,7 +20158,7 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - /* "View.MemoryView":652 + /* "View.MemoryView":657 * * @cname('__pyx_memoryview_new') * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<< @@ -18990,7 +20180,7 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in return __pyx_r; } -/* "View.MemoryView":658 +/* "View.MemoryView":663 * * @cname('__pyx_memoryview_check') * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< @@ -19004,7 +20194,7 @@ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { int __pyx_t_1; __Pyx_RefNannySetupContext("memoryview_check", 0); - /* "View.MemoryView":659 + /* "View.MemoryView":664 * @cname('__pyx_memoryview_check') * cdef inline bint memoryview_check(object o): * return isinstance(o, memoryview) # <<<<<<<<<<<<<< @@ -19015,7 +20205,7 @@ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { __pyx_r = __pyx_t_1; goto __pyx_L0; - /* "View.MemoryView":658 + /* "View.MemoryView":663 * * @cname('__pyx_memoryview_check') * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<< @@ -19029,7 +20219,7 @@ static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) { return __pyx_r; } -/* "View.MemoryView":661 +/* "View.MemoryView":666 * return isinstance(o, memoryview) * * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< @@ -19060,7 +20250,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { PyObject *__pyx_t_11 = NULL; __Pyx_RefNannySetupContext("_unellipsify", 0); - /* "View.MemoryView":666 + /* "View.MemoryView":671 * full slices. * """ * if not isinstance(index, tuple): # <<<<<<<<<<<<<< @@ -19071,14 +20261,14 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":667 + /* "View.MemoryView":672 * """ * if not isinstance(index, tuple): * tup = (index,) # <<<<<<<<<<<<<< * else: * tup = index */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 667, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 672, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_index); __Pyx_GIVEREF(__pyx_v_index); @@ -19086,7 +20276,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_v_tup = __pyx_t_3; __pyx_t_3 = 0; - /* "View.MemoryView":666 + /* "View.MemoryView":671 * full slices. * """ * if not isinstance(index, tuple): # <<<<<<<<<<<<<< @@ -19096,7 +20286,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { goto __pyx_L3; } - /* "View.MemoryView":669 + /* "View.MemoryView":674 * tup = (index,) * else: * tup = index # <<<<<<<<<<<<<< @@ -19109,19 +20299,19 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { } __pyx_L3:; - /* "View.MemoryView":671 + /* "View.MemoryView":676 * tup = index * * result = [] # <<<<<<<<<<<<<< * have_slices = False * seen_ellipsis = False */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 671, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 676, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_result = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":672 + /* "View.MemoryView":677 * * result = [] * have_slices = False # <<<<<<<<<<<<<< @@ -19130,7 +20320,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { */ __pyx_v_have_slices = 0; - /* "View.MemoryView":673 + /* "View.MemoryView":678 * result = [] * have_slices = False * seen_ellipsis = False # <<<<<<<<<<<<<< @@ -19139,7 +20329,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { */ __pyx_v_seen_ellipsis = 0; - /* "View.MemoryView":674 + /* "View.MemoryView":679 * have_slices = False * seen_ellipsis = False * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< @@ -19152,26 +20342,26 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; __pyx_t_6 = NULL; } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 674, __pyx_L1_error) + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 679, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 674, __pyx_L1_error) + __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 679, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_6)) { if (likely(PyList_CheckExact(__pyx_t_4))) { if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 674, __pyx_L1_error) + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 674, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } else { if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 674, __pyx_L1_error) + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(2, 679, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 674, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -19181,7 +20371,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 674, __pyx_L1_error) + else __PYX_ERR(2, 679, __pyx_L1_error) } break; } @@ -19191,13 +20381,13 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_7 = 0; __Pyx_INCREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3); - __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 674, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_7; __pyx_t_7 = 0; - /* "View.MemoryView":675 + /* "View.MemoryView":680 * seen_ellipsis = False * for idx, item in enumerate(tup): * if item is Ellipsis: # <<<<<<<<<<<<<< @@ -19208,7 +20398,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "View.MemoryView":676 + /* "View.MemoryView":681 * for idx, item in enumerate(tup): * if item is Ellipsis: * if not seen_ellipsis: # <<<<<<<<<<<<<< @@ -19218,27 +20408,27 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0); if (__pyx_t_1) { - /* "View.MemoryView":677 + /* "View.MemoryView":682 * if item is Ellipsis: * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< * seen_ellipsis = True * else: */ - __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 677, __pyx_L1_error) - __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 677, __pyx_L1_error) + __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 682, __pyx_L1_error) + __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 682, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__25); - __Pyx_GIVEREF(__pyx_slice__25); - PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__25); + __Pyx_INCREF(__pyx_slice__22); + __Pyx_GIVEREF(__pyx_slice__22); + PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__22); } } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 677, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 682, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "View.MemoryView":678 + /* "View.MemoryView":683 * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) * seen_ellipsis = True # <<<<<<<<<<<<<< @@ -19247,7 +20437,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { */ __pyx_v_seen_ellipsis = 1; - /* "View.MemoryView":676 + /* "View.MemoryView":681 * for idx, item in enumerate(tup): * if item is Ellipsis: * if not seen_ellipsis: # <<<<<<<<<<<<<< @@ -19257,7 +20447,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { goto __pyx_L7; } - /* "View.MemoryView":680 + /* "View.MemoryView":685 * seen_ellipsis = True * else: * result.append(slice(None)) # <<<<<<<<<<<<<< @@ -19265,11 +20455,11 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { * else: */ /*else*/ { - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__26); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 680, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__22); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 685, __pyx_L1_error) } __pyx_L7:; - /* "View.MemoryView":681 + /* "View.MemoryView":686 * else: * result.append(slice(None)) * have_slices = True # <<<<<<<<<<<<<< @@ -19278,7 +20468,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { */ __pyx_v_have_slices = 1; - /* "View.MemoryView":675 + /* "View.MemoryView":680 * seen_ellipsis = False * for idx, item in enumerate(tup): * if item is Ellipsis: # <<<<<<<<<<<<<< @@ -19288,7 +20478,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { goto __pyx_L6; } - /* "View.MemoryView":683 + /* "View.MemoryView":688 * have_slices = True * else: * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< @@ -19308,23 +20498,23 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_L9_bool_binop_done:; if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":684 + /* "View.MemoryView":689 * else: * if not isinstance(item, slice) and not PyIndex_Check(item): * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<< * * have_slices = have_slices or isinstance(item, slice) */ - __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 684, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 689, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 684, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 689, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_Raise(__pyx_t_11, 0, 0, 0); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __PYX_ERR(2, 684, __pyx_L1_error) + __PYX_ERR(2, 689, __pyx_L1_error) - /* "View.MemoryView":683 + /* "View.MemoryView":688 * have_slices = True * else: * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<< @@ -19333,7 +20523,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { */ } - /* "View.MemoryView":686 + /* "View.MemoryView":691 * raise TypeError("Cannot index with type '%s'" % type(item)) * * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<< @@ -19352,18 +20542,18 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_L11_bool_binop_done:; __pyx_v_have_slices = __pyx_t_1; - /* "View.MemoryView":687 + /* "View.MemoryView":692 * * have_slices = have_slices or isinstance(item, slice) * result.append(item) # <<<<<<<<<<<<<< * * nslices = ndim - len(result) */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 687, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 692, __pyx_L1_error) } __pyx_L6:; - /* "View.MemoryView":674 + /* "View.MemoryView":679 * have_slices = False * seen_ellipsis = False * for idx, item in enumerate(tup): # <<<<<<<<<<<<<< @@ -19374,17 +20564,17 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":689 + /* "View.MemoryView":694 * result.append(item) * * nslices = ndim - len(result) # <<<<<<<<<<<<<< * if nslices: * result.extend([slice(None)] * nslices) */ - __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 689, __pyx_L1_error) + __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 694, __pyx_L1_error) __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5); - /* "View.MemoryView":690 + /* "View.MemoryView":695 * * nslices = ndim - len(result) * if nslices: # <<<<<<<<<<<<<< @@ -19394,26 +20584,26 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_1 = (__pyx_v_nslices != 0); if (__pyx_t_1) { - /* "View.MemoryView":691 + /* "View.MemoryView":696 * nslices = ndim - len(result) * if nslices: * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< * * return have_slices or nslices, tuple(result) */ - __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 691, __pyx_L1_error) + __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 696, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); { Py_ssize_t __pyx_temp; for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) { - __Pyx_INCREF(__pyx_slice__27); - __Pyx_GIVEREF(__pyx_slice__27); - PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__27); + __Pyx_INCREF(__pyx_slice__22); + __Pyx_GIVEREF(__pyx_slice__22); + PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__22); } } - __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 691, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 696, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":690 + /* "View.MemoryView":695 * * nslices = ndim - len(result) * if nslices: # <<<<<<<<<<<<<< @@ -19422,7 +20612,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { */ } - /* "View.MemoryView":693 + /* "View.MemoryView":698 * result.extend([slice(None)] * nslices) * * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<< @@ -19432,20 +20622,20 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __Pyx_XDECREF(__pyx_r); if (!__pyx_v_have_slices) { } else { - __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 693, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L14_bool_binop_done; } - __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 693, __pyx_L1_error) + __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __pyx_t_4; __pyx_t_4 = 0; __pyx_L14_bool_binop_done:; - __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 693, __pyx_L1_error) + __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 693, __pyx_L1_error) + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 698, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); @@ -19457,7 +20647,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { __pyx_t_11 = 0; goto __pyx_L0; - /* "View.MemoryView":661 + /* "View.MemoryView":666 * return isinstance(o, memoryview) * * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<< @@ -19483,7 +20673,7 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { return __pyx_r; } -/* "View.MemoryView":695 +/* "View.MemoryView":700 * return have_slices or nslices, tuple(result) * * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< @@ -19502,7 +20692,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); - /* "View.MemoryView":696 + /* "View.MemoryView":701 * * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<< @@ -19514,7 +20704,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ __pyx_t_1 = __pyx_t_3; __pyx_v_suboffset = (__pyx_t_1[0]); - /* "View.MemoryView":697 + /* "View.MemoryView":702 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): * for suboffset in suboffsets[:ndim]: * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -19524,20 +20714,20 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0); if (unlikely(__pyx_t_4)) { - /* "View.MemoryView":698 + /* "View.MemoryView":703 * for suboffset in suboffsets[:ndim]: * if suboffset >= 0: * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< * * */ - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 698, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 703, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __PYX_ERR(2, 698, __pyx_L1_error) + __PYX_ERR(2, 703, __pyx_L1_error) - /* "View.MemoryView":697 + /* "View.MemoryView":702 * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): * for suboffset in suboffsets[:ndim]: * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -19547,7 +20737,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ } } - /* "View.MemoryView":695 + /* "View.MemoryView":700 * return have_slices or nslices, tuple(result) * * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<< @@ -19568,7 +20758,7 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ return __pyx_r; } -/* "View.MemoryView":705 +/* "View.MemoryView":710 * * @cname('__pyx_memview_slice') * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< @@ -19609,7 +20799,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ Py_ssize_t __pyx_t_12; __Pyx_RefNannySetupContext("memview_slice", 0); - /* "View.MemoryView":706 + /* "View.MemoryView":711 * @cname('__pyx_memview_slice') * cdef memoryview memview_slice(memoryview memview, object indices): * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<< @@ -19619,7 +20809,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_v_new_ndim = 0; __pyx_v_suboffset_dim = -1; - /* "View.MemoryView":713 + /* "View.MemoryView":718 * * * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<< @@ -19628,7 +20818,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)))); - /* "View.MemoryView":717 + /* "View.MemoryView":722 * cdef _memoryviewslice memviewsliceobj * * assert memview.view.ndim > 0 # <<<<<<<<<<<<<< @@ -19639,12 +20829,12 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) { PyErr_SetNone(PyExc_AssertionError); - __PYX_ERR(2, 717, __pyx_L1_error) + __PYX_ERR(2, 722, __pyx_L1_error) } } #endif - /* "View.MemoryView":719 + /* "View.MemoryView":724 * assert memview.view.ndim > 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -19655,20 +20845,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":720 + /* "View.MemoryView":725 * * if isinstance(memview, _memoryviewslice): * memviewsliceobj = memview # <<<<<<<<<<<<<< * p_src = &memviewsliceobj.from_slice * else: */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 720, __pyx_L1_error) + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 725, __pyx_L1_error) __pyx_t_3 = ((PyObject *)__pyx_v_memview); __Pyx_INCREF(__pyx_t_3); __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":721 + /* "View.MemoryView":726 * if isinstance(memview, _memoryviewslice): * memviewsliceobj = memview * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<< @@ -19677,7 +20867,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice); - /* "View.MemoryView":719 + /* "View.MemoryView":724 * assert memview.view.ndim > 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -19687,7 +20877,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ goto __pyx_L3; } - /* "View.MemoryView":723 + /* "View.MemoryView":728 * p_src = &memviewsliceobj.from_slice * else: * slice_copy(memview, &src) # <<<<<<<<<<<<<< @@ -19697,7 +20887,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ /*else*/ { __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src)); - /* "View.MemoryView":724 + /* "View.MemoryView":729 * else: * slice_copy(memview, &src) * p_src = &src # <<<<<<<<<<<<<< @@ -19708,7 +20898,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ } __pyx_L3:; - /* "View.MemoryView":730 + /* "View.MemoryView":735 * * * dst.memview = p_src.memview # <<<<<<<<<<<<<< @@ -19718,7 +20908,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_4 = __pyx_v_p_src->memview; __pyx_v_dst.memview = __pyx_t_4; - /* "View.MemoryView":731 + /* "View.MemoryView":736 * * dst.memview = p_src.memview * dst.data = p_src.data # <<<<<<<<<<<<<< @@ -19728,7 +20918,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_5 = __pyx_v_p_src->data; __pyx_v_dst.data = __pyx_t_5; - /* "View.MemoryView":736 + /* "View.MemoryView":741 * * * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<< @@ -19737,7 +20927,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __pyx_v_p_dst = (&__pyx_v_dst); - /* "View.MemoryView":737 + /* "View.MemoryView":742 * * cdef __Pyx_memviewslice *p_dst = &dst * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<< @@ -19746,7 +20936,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim); - /* "View.MemoryView":741 + /* "View.MemoryView":746 * cdef bint have_start, have_stop, have_step * * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< @@ -19758,26 +20948,26 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; __pyx_t_8 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 741, __pyx_L1_error) + __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 746, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 741, __pyx_L1_error) + __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 746, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_8)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 741, __pyx_L1_error) + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error) #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 741, __pyx_L1_error) + __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } else { if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 741, __pyx_L1_error) + __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(2, 746, __pyx_L1_error) #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 741, __pyx_L1_error) + __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } @@ -19787,7 +20977,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(2, 741, __pyx_L1_error) + else __PYX_ERR(2, 746, __pyx_L1_error) } break; } @@ -19798,7 +20988,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_v_dim = __pyx_t_6; __pyx_t_6 = (__pyx_t_6 + 1); - /* "View.MemoryView":742 + /* "View.MemoryView":747 * * for dim, index in enumerate(indices): * if PyIndex_Check(index): # <<<<<<<<<<<<<< @@ -19808,25 +20998,25 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0); if (__pyx_t_2) { - /* "View.MemoryView":746 + /* "View.MemoryView":751 * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], * dim, new_ndim, p_suboffset_dim, * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<< * 0, 0, 0, # have_{start,stop,step} * False) */ - __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 746, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 751, __pyx_L1_error) - /* "View.MemoryView":743 + /* "View.MemoryView":748 * for dim, index in enumerate(indices): * if PyIndex_Check(index): * slice_memviewslice( # <<<<<<<<<<<<<< * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], * dim, new_ndim, p_suboffset_dim, */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 743, __pyx_L1_error) + __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 748, __pyx_L1_error) - /* "View.MemoryView":742 + /* "View.MemoryView":747 * * for dim, index in enumerate(indices): * if PyIndex_Check(index): # <<<<<<<<<<<<<< @@ -19836,7 +21026,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ goto __pyx_L6; } - /* "View.MemoryView":749 + /* "View.MemoryView":754 * 0, 0, 0, # have_{start,stop,step} * False) * elif index is None: # <<<<<<<<<<<<<< @@ -19847,7 +21037,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "View.MemoryView":750 + /* "View.MemoryView":755 * False) * elif index is None: * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<< @@ -19856,7 +21046,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1; - /* "View.MemoryView":751 + /* "View.MemoryView":756 * elif index is None: * p_dst.shape[new_ndim] = 1 * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<< @@ -19865,7 +21055,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0; - /* "View.MemoryView":752 + /* "View.MemoryView":757 * p_dst.shape[new_ndim] = 1 * p_dst.strides[new_ndim] = 0 * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<< @@ -19874,7 +21064,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L; - /* "View.MemoryView":753 + /* "View.MemoryView":758 * p_dst.strides[new_ndim] = 0 * p_dst.suboffsets[new_ndim] = -1 * new_ndim += 1 # <<<<<<<<<<<<<< @@ -19883,7 +21073,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __pyx_v_new_ndim = (__pyx_v_new_ndim + 1); - /* "View.MemoryView":749 + /* "View.MemoryView":754 * 0, 0, 0, # have_{start,stop,step} * False) * elif index is None: # <<<<<<<<<<<<<< @@ -19893,7 +21083,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ goto __pyx_L6; } - /* "View.MemoryView":755 + /* "View.MemoryView":760 * new_ndim += 1 * else: * start = index.start or 0 # <<<<<<<<<<<<<< @@ -19901,13 +21091,13 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ * step = index.step or 0 */ /*else*/ { - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 755, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 755, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 760, __pyx_L1_error) if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 755, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 760, __pyx_L1_error) __pyx_t_10 = __pyx_t_12; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L7_bool_binop_done; @@ -19916,20 +21106,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_L7_bool_binop_done:; __pyx_v_start = __pyx_t_10; - /* "View.MemoryView":756 + /* "View.MemoryView":761 * else: * start = index.start or 0 * stop = index.stop or 0 # <<<<<<<<<<<<<< * step = index.step or 0 * */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 756, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 761, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 756, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 761, __pyx_L1_error) if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 756, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 761, __pyx_L1_error) __pyx_t_10 = __pyx_t_12; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L9_bool_binop_done; @@ -19938,20 +21128,20 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_L9_bool_binop_done:; __pyx_v_stop = __pyx_t_10; - /* "View.MemoryView":757 + /* "View.MemoryView":762 * start = index.start or 0 * stop = index.stop or 0 * step = index.step or 0 # <<<<<<<<<<<<<< * * have_start = index.start is not None */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 757, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 757, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error) if (!__pyx_t_1) { __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 757, __pyx_L1_error) + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error) __pyx_t_10 = __pyx_t_12; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L11_bool_binop_done; @@ -19960,55 +21150,55 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_L11_bool_binop_done:; __pyx_v_step = __pyx_t_10; - /* "View.MemoryView":759 + /* "View.MemoryView":764 * step = index.step or 0 * * have_start = index.start is not None # <<<<<<<<<<<<<< * have_stop = index.stop is not None * have_step = index.step is not None */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 759, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = (__pyx_t_9 != Py_None); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_have_start = __pyx_t_1; - /* "View.MemoryView":760 + /* "View.MemoryView":765 * * have_start = index.start is not None * have_stop = index.stop is not None # <<<<<<<<<<<<<< * have_step = index.step is not None * */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 760, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 765, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = (__pyx_t_9 != Py_None); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_have_stop = __pyx_t_1; - /* "View.MemoryView":761 + /* "View.MemoryView":766 * have_start = index.start is not None * have_stop = index.stop is not None * have_step = index.step is not None # <<<<<<<<<<<<<< * * slice_memviewslice( */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 761, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = (__pyx_t_9 != Py_None); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_have_step = __pyx_t_1; - /* "View.MemoryView":763 + /* "View.MemoryView":768 * have_step = index.step is not None * * slice_memviewslice( # <<<<<<<<<<<<<< * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim], * dim, new_ndim, p_suboffset_dim, */ - __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 763, __pyx_L1_error) + __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(2, 768, __pyx_L1_error) - /* "View.MemoryView":769 + /* "View.MemoryView":774 * have_start, have_stop, have_step, * True) * new_ndim += 1 # <<<<<<<<<<<<<< @@ -20019,7 +21209,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ } __pyx_L6:; - /* "View.MemoryView":741 + /* "View.MemoryView":746 * cdef bint have_start, have_stop, have_step * * for dim, index in enumerate(indices): # <<<<<<<<<<<<<< @@ -20029,7 +21219,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":771 + /* "View.MemoryView":776 * new_ndim += 1 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -20040,7 +21230,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":772 + /* "View.MemoryView":777 * * if isinstance(memview, _memoryviewslice): * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< @@ -20049,39 +21239,39 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - /* "View.MemoryView":773 + /* "View.MemoryView":778 * if isinstance(memview, _memoryviewslice): * return memoryview_fromslice(dst, new_ndim, * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<< * memviewsliceobj.to_dtype_func, * memview.dtype_is_object) */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 773, __pyx_L1_error) } + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 778, __pyx_L1_error) } - /* "View.MemoryView":774 + /* "View.MemoryView":779 * return memoryview_fromslice(dst, new_ndim, * memviewsliceobj.to_object_func, * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<< * memview.dtype_is_object) * else: */ - if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 774, __pyx_L1_error) } + if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 779, __pyx_L1_error) } - /* "View.MemoryView":772 + /* "View.MemoryView":777 * * if isinstance(memview, _memoryviewslice): * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<< * memviewsliceobj.to_object_func, * memviewsliceobj.to_dtype_func, */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 772, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 777, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 772, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 777, __pyx_L1_error) __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; - /* "View.MemoryView":771 + /* "View.MemoryView":776 * new_ndim += 1 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -20090,7 +21280,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ */ } - /* "View.MemoryView":777 + /* "View.MemoryView":782 * memview.dtype_is_object) * else: * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< @@ -20100,30 +21290,30 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ /*else*/ { __Pyx_XDECREF(((PyObject *)__pyx_r)); - /* "View.MemoryView":778 + /* "View.MemoryView":783 * else: * return memoryview_fromslice(dst, new_ndim, NULL, NULL, * memview.dtype_is_object) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 777, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 782, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "View.MemoryView":777 + /* "View.MemoryView":782 * memview.dtype_is_object) * else: * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<< * memview.dtype_is_object) * */ - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 777, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 782, __pyx_L1_error) __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; } - /* "View.MemoryView":705 + /* "View.MemoryView":710 * * @cname('__pyx_memview_slice') * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<< @@ -20145,7 +21335,7 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ return __pyx_r; } -/* "View.MemoryView":802 +/* "View.MemoryView":807 * * @cname('__pyx_memoryview_slice_memviewslice') * cdef int slice_memviewslice( # <<<<<<<<<<<<<< @@ -20161,7 +21351,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, int __pyx_t_2; int __pyx_t_3; - /* "View.MemoryView":822 + /* "View.MemoryView":827 * cdef bint negative_step * * if not is_slice: # <<<<<<<<<<<<<< @@ -20171,7 +21361,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0); if (__pyx_t_1) { - /* "View.MemoryView":824 + /* "View.MemoryView":829 * if not is_slice: * * if start < 0: # <<<<<<<<<<<<<< @@ -20181,7 +21371,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_1 = ((__pyx_v_start < 0) != 0); if (__pyx_t_1) { - /* "View.MemoryView":825 + /* "View.MemoryView":830 * * if start < 0: * start += shape # <<<<<<<<<<<<<< @@ -20190,7 +21380,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "View.MemoryView":824 + /* "View.MemoryView":829 * if not is_slice: * * if start < 0: # <<<<<<<<<<<<<< @@ -20199,7 +21389,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":826 + /* "View.MemoryView":831 * if start < 0: * start += shape * if not 0 <= start < shape: # <<<<<<<<<<<<<< @@ -20213,16 +21403,16 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":827 + /* "View.MemoryView":832 * start += shape * if not 0 <= start < shape: * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<< * else: * */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 832, __pyx_L1_error) - /* "View.MemoryView":826 + /* "View.MemoryView":831 * if start < 0: * start += shape * if not 0 <= start < shape: # <<<<<<<<<<<<<< @@ -20231,7 +21421,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":822 + /* "View.MemoryView":827 * cdef bint negative_step * * if not is_slice: # <<<<<<<<<<<<<< @@ -20241,7 +21431,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L3; } - /* "View.MemoryView":830 + /* "View.MemoryView":835 * else: * * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<< @@ -20260,7 +21450,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_L6_bool_binop_done:; __pyx_v_negative_step = __pyx_t_2; - /* "View.MemoryView":832 + /* "View.MemoryView":837 * negative_step = have_step != 0 and step < 0 * * if have_step and step == 0: # <<<<<<<<<<<<<< @@ -20278,16 +21468,16 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_L9_bool_binop_done:; if (__pyx_t_2) { - /* "View.MemoryView":833 + /* "View.MemoryView":838 * * if have_step and step == 0: * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 833, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 838, __pyx_L1_error) - /* "View.MemoryView":832 + /* "View.MemoryView":837 * negative_step = have_step != 0 and step < 0 * * if have_step and step == 0: # <<<<<<<<<<<<<< @@ -20296,7 +21486,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":836 + /* "View.MemoryView":841 * * * if have_start: # <<<<<<<<<<<<<< @@ -20306,7 +21496,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (__pyx_v_have_start != 0); if (__pyx_t_2) { - /* "View.MemoryView":837 + /* "View.MemoryView":842 * * if have_start: * if start < 0: # <<<<<<<<<<<<<< @@ -20316,7 +21506,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_start < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":838 + /* "View.MemoryView":843 * if have_start: * if start < 0: * start += shape # <<<<<<<<<<<<<< @@ -20325,7 +21515,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_start = (__pyx_v_start + __pyx_v_shape); - /* "View.MemoryView":839 + /* "View.MemoryView":844 * if start < 0: * start += shape * if start < 0: # <<<<<<<<<<<<<< @@ -20335,7 +21525,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_start < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":840 + /* "View.MemoryView":845 * start += shape * if start < 0: * start = 0 # <<<<<<<<<<<<<< @@ -20344,7 +21534,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_start = 0; - /* "View.MemoryView":839 + /* "View.MemoryView":844 * if start < 0: * start += shape * if start < 0: # <<<<<<<<<<<<<< @@ -20353,7 +21543,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":837 + /* "View.MemoryView":842 * * if have_start: * if start < 0: # <<<<<<<<<<<<<< @@ -20363,7 +21553,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L12; } - /* "View.MemoryView":841 + /* "View.MemoryView":846 * if start < 0: * start = 0 * elif start >= shape: # <<<<<<<<<<<<<< @@ -20373,7 +21563,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0); if (__pyx_t_2) { - /* "View.MemoryView":842 + /* "View.MemoryView":847 * start = 0 * elif start >= shape: * if negative_step: # <<<<<<<<<<<<<< @@ -20383,7 +21573,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (__pyx_v_negative_step != 0); if (__pyx_t_2) { - /* "View.MemoryView":843 + /* "View.MemoryView":848 * elif start >= shape: * if negative_step: * start = shape - 1 # <<<<<<<<<<<<<< @@ -20392,7 +21582,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_start = (__pyx_v_shape - 1); - /* "View.MemoryView":842 + /* "View.MemoryView":847 * start = 0 * elif start >= shape: * if negative_step: # <<<<<<<<<<<<<< @@ -20402,7 +21592,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L14; } - /* "View.MemoryView":845 + /* "View.MemoryView":850 * start = shape - 1 * else: * start = shape # <<<<<<<<<<<<<< @@ -20414,7 +21604,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L14:; - /* "View.MemoryView":841 + /* "View.MemoryView":846 * if start < 0: * start = 0 * elif start >= shape: # <<<<<<<<<<<<<< @@ -20424,7 +21614,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L12:; - /* "View.MemoryView":836 + /* "View.MemoryView":841 * * * if have_start: # <<<<<<<<<<<<<< @@ -20434,7 +21624,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L11; } - /* "View.MemoryView":847 + /* "View.MemoryView":852 * start = shape * else: * if negative_step: # <<<<<<<<<<<<<< @@ -20445,7 +21635,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (__pyx_v_negative_step != 0); if (__pyx_t_2) { - /* "View.MemoryView":848 + /* "View.MemoryView":853 * else: * if negative_step: * start = shape - 1 # <<<<<<<<<<<<<< @@ -20454,7 +21644,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_start = (__pyx_v_shape - 1); - /* "View.MemoryView":847 + /* "View.MemoryView":852 * start = shape * else: * if negative_step: # <<<<<<<<<<<<<< @@ -20464,7 +21654,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L15; } - /* "View.MemoryView":850 + /* "View.MemoryView":855 * start = shape - 1 * else: * start = 0 # <<<<<<<<<<<<<< @@ -20478,7 +21668,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L11:; - /* "View.MemoryView":852 + /* "View.MemoryView":857 * start = 0 * * if have_stop: # <<<<<<<<<<<<<< @@ -20488,7 +21678,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (__pyx_v_have_stop != 0); if (__pyx_t_2) { - /* "View.MemoryView":853 + /* "View.MemoryView":858 * * if have_stop: * if stop < 0: # <<<<<<<<<<<<<< @@ -20498,7 +21688,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_stop < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":854 + /* "View.MemoryView":859 * if have_stop: * if stop < 0: * stop += shape # <<<<<<<<<<<<<< @@ -20507,7 +21697,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape); - /* "View.MemoryView":855 + /* "View.MemoryView":860 * if stop < 0: * stop += shape * if stop < 0: # <<<<<<<<<<<<<< @@ -20517,7 +21707,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_stop < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":856 + /* "View.MemoryView":861 * stop += shape * if stop < 0: * stop = 0 # <<<<<<<<<<<<<< @@ -20526,7 +21716,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_stop = 0; - /* "View.MemoryView":855 + /* "View.MemoryView":860 * if stop < 0: * stop += shape * if stop < 0: # <<<<<<<<<<<<<< @@ -20535,7 +21725,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":853 + /* "View.MemoryView":858 * * if have_stop: * if stop < 0: # <<<<<<<<<<<<<< @@ -20545,7 +21735,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L17; } - /* "View.MemoryView":857 + /* "View.MemoryView":862 * if stop < 0: * stop = 0 * elif stop > shape: # <<<<<<<<<<<<<< @@ -20555,7 +21745,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0); if (__pyx_t_2) { - /* "View.MemoryView":858 + /* "View.MemoryView":863 * stop = 0 * elif stop > shape: * stop = shape # <<<<<<<<<<<<<< @@ -20564,7 +21754,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_stop = __pyx_v_shape; - /* "View.MemoryView":857 + /* "View.MemoryView":862 * if stop < 0: * stop = 0 * elif stop > shape: # <<<<<<<<<<<<<< @@ -20574,7 +21764,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L17:; - /* "View.MemoryView":852 + /* "View.MemoryView":857 * start = 0 * * if have_stop: # <<<<<<<<<<<<<< @@ -20584,7 +21774,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L16; } - /* "View.MemoryView":860 + /* "View.MemoryView":865 * stop = shape * else: * if negative_step: # <<<<<<<<<<<<<< @@ -20595,7 +21785,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (__pyx_v_negative_step != 0); if (__pyx_t_2) { - /* "View.MemoryView":861 + /* "View.MemoryView":866 * else: * if negative_step: * stop = -1 # <<<<<<<<<<<<<< @@ -20604,7 +21794,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_stop = -1L; - /* "View.MemoryView":860 + /* "View.MemoryView":865 * stop = shape * else: * if negative_step: # <<<<<<<<<<<<<< @@ -20614,7 +21804,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L19; } - /* "View.MemoryView":863 + /* "View.MemoryView":868 * stop = -1 * else: * stop = shape # <<<<<<<<<<<<<< @@ -20628,7 +21818,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L16:; - /* "View.MemoryView":865 + /* "View.MemoryView":870 * stop = shape * * if not have_step: # <<<<<<<<<<<<<< @@ -20638,7 +21828,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":866 + /* "View.MemoryView":871 * * if not have_step: * step = 1 # <<<<<<<<<<<<<< @@ -20647,7 +21837,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_step = 1; - /* "View.MemoryView":865 + /* "View.MemoryView":870 * stop = shape * * if not have_step: # <<<<<<<<<<<<<< @@ -20656,7 +21846,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":870 + /* "View.MemoryView":875 * * with cython.cdivision(True): * new_shape = (stop - start) // step # <<<<<<<<<<<<<< @@ -20665,7 +21855,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step); - /* "View.MemoryView":872 + /* "View.MemoryView":877 * new_shape = (stop - start) // step * * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< @@ -20675,7 +21865,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":873 + /* "View.MemoryView":878 * * if (stop - start) - step * new_shape: * new_shape += 1 # <<<<<<<<<<<<<< @@ -20684,7 +21874,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_new_shape = (__pyx_v_new_shape + 1); - /* "View.MemoryView":872 + /* "View.MemoryView":877 * new_shape = (stop - start) // step * * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<< @@ -20693,7 +21883,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":875 + /* "View.MemoryView":880 * new_shape += 1 * * if new_shape < 0: # <<<<<<<<<<<<<< @@ -20703,7 +21893,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":876 + /* "View.MemoryView":881 * * if new_shape < 0: * new_shape = 0 # <<<<<<<<<<<<<< @@ -20712,7 +21902,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_new_shape = 0; - /* "View.MemoryView":875 + /* "View.MemoryView":880 * new_shape += 1 * * if new_shape < 0: # <<<<<<<<<<<<<< @@ -20721,7 +21911,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":879 + /* "View.MemoryView":884 * * * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<< @@ -20730,7 +21920,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step); - /* "View.MemoryView":880 + /* "View.MemoryView":885 * * dst.strides[new_ndim] = stride * step * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<< @@ -20739,7 +21929,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape; - /* "View.MemoryView":881 + /* "View.MemoryView":886 * dst.strides[new_ndim] = stride * step * dst.shape[new_ndim] = new_shape * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<< @@ -20750,7 +21940,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L3:; - /* "View.MemoryView":884 + /* "View.MemoryView":889 * * * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< @@ -20760,7 +21950,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":885 + /* "View.MemoryView":890 * * if suboffset_dim[0] < 0: * dst.data += start * stride # <<<<<<<<<<<<<< @@ -20769,7 +21959,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride)); - /* "View.MemoryView":884 + /* "View.MemoryView":889 * * * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<< @@ -20779,7 +21969,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L23; } - /* "View.MemoryView":887 + /* "View.MemoryView":892 * dst.data += start * stride * else: * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<< @@ -20792,7 +21982,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L23:; - /* "View.MemoryView":889 + /* "View.MemoryView":894 * dst.suboffsets[suboffset_dim[0]] += start * stride * * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -20802,7 +21992,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":890 + /* "View.MemoryView":895 * * if suboffset >= 0: * if not is_slice: # <<<<<<<<<<<<<< @@ -20812,7 +22002,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":891 + /* "View.MemoryView":896 * if suboffset >= 0: * if not is_slice: * if new_ndim == 0: # <<<<<<<<<<<<<< @@ -20822,7 +22012,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":892 + /* "View.MemoryView":897 * if not is_slice: * if new_ndim == 0: * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<< @@ -20831,7 +22021,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset); - /* "View.MemoryView":891 + /* "View.MemoryView":896 * if suboffset >= 0: * if not is_slice: * if new_ndim == 0: # <<<<<<<<<<<<<< @@ -20841,7 +22031,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L26; } - /* "View.MemoryView":894 + /* "View.MemoryView":899 * dst.data = ( dst.data)[0] + suboffset * else: * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<< @@ -20850,18 +22040,18 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ /*else*/ { - /* "View.MemoryView":895 + /* "View.MemoryView":900 * else: * _err_dim(IndexError, "All dimensions preceding dimension %d " * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<< * else: * suboffset_dim[0] = new_ndim */ - __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 894, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 899, __pyx_L1_error) } __pyx_L26:; - /* "View.MemoryView":890 + /* "View.MemoryView":895 * * if suboffset >= 0: * if not is_slice: # <<<<<<<<<<<<<< @@ -20871,7 +22061,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, goto __pyx_L25; } - /* "View.MemoryView":897 + /* "View.MemoryView":902 * "must be indexed and not sliced", dim) * else: * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<< @@ -20883,7 +22073,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, } __pyx_L25:; - /* "View.MemoryView":889 + /* "View.MemoryView":894 * dst.suboffsets[suboffset_dim[0]] += start * stride * * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -20892,7 +22082,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, */ } - /* "View.MemoryView":899 + /* "View.MemoryView":904 * suboffset_dim[0] = new_ndim * * return 0 # <<<<<<<<<<<<<< @@ -20902,7 +22092,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, __pyx_r = 0; goto __pyx_L0; - /* "View.MemoryView":802 + /* "View.MemoryView":807 * * @cname('__pyx_memoryview_slice_memviewslice') * cdef int slice_memviewslice( # <<<<<<<<<<<<<< @@ -20926,7 +22116,7 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, return __pyx_r; } -/* "View.MemoryView":905 +/* "View.MemoryView":910 * * @cname('__pyx_pybuffer_index') * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< @@ -20948,7 +22138,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("pybuffer_index", 0); - /* "View.MemoryView":907 + /* "View.MemoryView":912 * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, * Py_ssize_t dim) except NULL: * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<< @@ -20957,7 +22147,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_suboffset = -1L; - /* "View.MemoryView":908 + /* "View.MemoryView":913 * Py_ssize_t dim) except NULL: * cdef Py_ssize_t shape, stride, suboffset = -1 * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<< @@ -20967,7 +22157,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_1 = __pyx_v_view->itemsize; __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":911 + /* "View.MemoryView":916 * cdef char *resultp * * if view.ndim == 0: # <<<<<<<<<<<<<< @@ -20977,7 +22167,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":912 + /* "View.MemoryView":917 * * if view.ndim == 0: * shape = view.len / itemsize # <<<<<<<<<<<<<< @@ -20986,15 +22176,15 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ if (unlikely(__pyx_v_itemsize == 0)) { PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - __PYX_ERR(2, 912, __pyx_L1_error) + __PYX_ERR(2, 917, __pyx_L1_error) } else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) { PyErr_SetString(PyExc_OverflowError, "value too large to perform division"); - __PYX_ERR(2, 912, __pyx_L1_error) + __PYX_ERR(2, 917, __pyx_L1_error) } __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize); - /* "View.MemoryView":913 + /* "View.MemoryView":918 * if view.ndim == 0: * shape = view.len / itemsize * stride = itemsize # <<<<<<<<<<<<<< @@ -21003,7 +22193,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_stride = __pyx_v_itemsize; - /* "View.MemoryView":911 + /* "View.MemoryView":916 * cdef char *resultp * * if view.ndim == 0: # <<<<<<<<<<<<<< @@ -21013,7 +22203,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P goto __pyx_L3; } - /* "View.MemoryView":915 + /* "View.MemoryView":920 * stride = itemsize * else: * shape = view.shape[dim] # <<<<<<<<<<<<<< @@ -21023,7 +22213,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P /*else*/ { __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]); - /* "View.MemoryView":916 + /* "View.MemoryView":921 * else: * shape = view.shape[dim] * stride = view.strides[dim] # <<<<<<<<<<<<<< @@ -21032,7 +22222,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]); - /* "View.MemoryView":917 + /* "View.MemoryView":922 * shape = view.shape[dim] * stride = view.strides[dim] * if view.suboffsets != NULL: # <<<<<<<<<<<<<< @@ -21042,7 +22232,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0); if (__pyx_t_2) { - /* "View.MemoryView":918 + /* "View.MemoryView":923 * stride = view.strides[dim] * if view.suboffsets != NULL: * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<< @@ -21051,7 +22241,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]); - /* "View.MemoryView":917 + /* "View.MemoryView":922 * shape = view.shape[dim] * stride = view.strides[dim] * if view.suboffsets != NULL: # <<<<<<<<<<<<<< @@ -21062,7 +22252,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P } __pyx_L3:; - /* "View.MemoryView":920 + /* "View.MemoryView":925 * suboffset = view.suboffsets[dim] * * if index < 0: # <<<<<<<<<<<<<< @@ -21072,7 +22262,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_index < 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":921 + /* "View.MemoryView":926 * * if index < 0: * index += view.shape[dim] # <<<<<<<<<<<<<< @@ -21081,7 +22271,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim])); - /* "View.MemoryView":922 + /* "View.MemoryView":927 * if index < 0: * index += view.shape[dim] * if index < 0: # <<<<<<<<<<<<<< @@ -21091,26 +22281,26 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_index < 0) != 0); if (unlikely(__pyx_t_2)) { - /* "View.MemoryView":923 + /* "View.MemoryView":928 * index += view.shape[dim] * if index < 0: * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< * * if index >= shape: */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 923, __pyx_L1_error) + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 923, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 928, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 923, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 923, __pyx_L1_error) + __PYX_ERR(2, 928, __pyx_L1_error) - /* "View.MemoryView":922 + /* "View.MemoryView":927 * if index < 0: * index += view.shape[dim] * if index < 0: # <<<<<<<<<<<<<< @@ -21119,7 +22309,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ } - /* "View.MemoryView":920 + /* "View.MemoryView":925 * suboffset = view.suboffsets[dim] * * if index < 0: # <<<<<<<<<<<<<< @@ -21128,7 +22318,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ } - /* "View.MemoryView":925 + /* "View.MemoryView":930 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * * if index >= shape: # <<<<<<<<<<<<<< @@ -21138,26 +22328,26 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0); if (unlikely(__pyx_t_2)) { - /* "View.MemoryView":926 + /* "View.MemoryView":931 * * if index >= shape: * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<< * * resultp = bufp + index * stride */ - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 926, __pyx_L1_error) + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 926, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 931, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 926, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 926, __pyx_L1_error) + __PYX_ERR(2, 931, __pyx_L1_error) - /* "View.MemoryView":925 + /* "View.MemoryView":930 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * * if index >= shape: # <<<<<<<<<<<<<< @@ -21166,7 +22356,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ } - /* "View.MemoryView":928 + /* "View.MemoryView":933 * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) * * resultp = bufp + index * stride # <<<<<<<<<<<<<< @@ -21175,7 +22365,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride)); - /* "View.MemoryView":929 + /* "View.MemoryView":934 * * resultp = bufp + index * stride * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -21185,7 +22375,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":930 + /* "View.MemoryView":935 * resultp = bufp + index * stride * if suboffset >= 0: * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<< @@ -21194,7 +22384,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset); - /* "View.MemoryView":929 + /* "View.MemoryView":934 * * resultp = bufp + index * stride * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -21203,7 +22393,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P */ } - /* "View.MemoryView":932 + /* "View.MemoryView":937 * resultp = ( resultp)[0] + suboffset * * return resultp # <<<<<<<<<<<<<< @@ -21213,7 +22403,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P __pyx_r = __pyx_v_resultp; goto __pyx_L0; - /* "View.MemoryView":905 + /* "View.MemoryView":910 * * @cname('__pyx_pybuffer_index') * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<< @@ -21232,7 +22422,7 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P return __pyx_r; } -/* "View.MemoryView":938 +/* "View.MemoryView":943 * * @cname('__pyx_memslice_transpose') * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< @@ -21257,7 +22447,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { int __pyx_t_8; int __pyx_t_9; - /* "View.MemoryView":939 + /* "View.MemoryView":944 * @cname('__pyx_memslice_transpose') * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<< @@ -21267,7 +22457,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_t_1 = __pyx_v_memslice->memview->view.ndim; __pyx_v_ndim = __pyx_t_1; - /* "View.MemoryView":941 + /* "View.MemoryView":946 * cdef int ndim = memslice.memview.view.ndim * * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<< @@ -21277,7 +22467,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_t_2 = __pyx_v_memslice->shape; __pyx_v_shape = __pyx_t_2; - /* "View.MemoryView":942 + /* "View.MemoryView":947 * * cdef Py_ssize_t *shape = memslice.shape * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<< @@ -21287,7 +22477,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_t_2 = __pyx_v_memslice->strides; __pyx_v_strides = __pyx_t_2; - /* "View.MemoryView":946 + /* "View.MemoryView":951 * * cdef int i, j * for i in range(ndim / 2): # <<<<<<<<<<<<<< @@ -21299,7 +22489,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) { __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":947 + /* "View.MemoryView":952 * cdef int i, j * for i in range(ndim / 2): * j = ndim - 1 - i # <<<<<<<<<<<<<< @@ -21308,7 +22498,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { */ __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i); - /* "View.MemoryView":948 + /* "View.MemoryView":953 * for i in range(ndim / 2): * j = ndim - 1 - i * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<< @@ -21320,7 +22510,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5; (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6; - /* "View.MemoryView":949 + /* "View.MemoryView":954 * j = ndim - 1 - i * strides[i], strides[j] = strides[j], strides[i] * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<< @@ -21332,7 +22522,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6; (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5; - /* "View.MemoryView":951 + /* "View.MemoryView":956 * shape[i], shape[j] = shape[j], shape[i] * * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< @@ -21350,16 +22540,16 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_L6_bool_binop_done:; if (__pyx_t_7) { - /* "View.MemoryView":952 + /* "View.MemoryView":957 * * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<< * * return 1 */ - __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 952, __pyx_L1_error) + __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 957, __pyx_L1_error) - /* "View.MemoryView":951 + /* "View.MemoryView":956 * shape[i], shape[j] = shape[j], shape[i] * * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<< @@ -21369,7 +22559,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { } } - /* "View.MemoryView":954 + /* "View.MemoryView":959 * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") * * return 1 # <<<<<<<<<<<<<< @@ -21379,7 +22569,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { __pyx_r = 1; goto __pyx_L0; - /* "View.MemoryView":938 + /* "View.MemoryView":943 * * @cname('__pyx_memslice_transpose') * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<< @@ -21403,7 +22593,7 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { return __pyx_r; } -/* "View.MemoryView":971 +/* "View.MemoryView":976 * cdef int (*to_dtype_func)(char *, object) except 0 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -21426,7 +22616,7 @@ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewsl __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "View.MemoryView":972 + /* "View.MemoryView":977 * * def __dealloc__(self): * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<< @@ -21435,7 +22625,7 @@ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewsl */ __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1); - /* "View.MemoryView":971 + /* "View.MemoryView":976 * cdef int (*to_dtype_func)(char *, object) except 0 * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -21447,7 +22637,7 @@ static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewsl __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":974 +/* "View.MemoryView":979 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< @@ -21462,7 +22652,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("convert_item_to_object", 0); - /* "View.MemoryView":975 + /* "View.MemoryView":980 * * cdef convert_item_to_object(self, char *itemp): * if self.to_object_func != NULL: # <<<<<<<<<<<<<< @@ -21472,7 +22662,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":976 + /* "View.MemoryView":981 * cdef convert_item_to_object(self, char *itemp): * if self.to_object_func != NULL: * return self.to_object_func(itemp) # <<<<<<<<<<<<<< @@ -21480,13 +22670,13 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor * return memoryview.convert_item_to_object(self, itemp) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 976, __pyx_L1_error) + __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 981, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "View.MemoryView":975 + /* "View.MemoryView":980 * * cdef convert_item_to_object(self, char *itemp): * if self.to_object_func != NULL: # <<<<<<<<<<<<<< @@ -21495,7 +22685,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor */ } - /* "View.MemoryView":978 + /* "View.MemoryView":983 * return self.to_object_func(itemp) * else: * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<< @@ -21504,14 +22694,14 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 978, __pyx_L1_error) + __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; } - /* "View.MemoryView":974 + /* "View.MemoryView":979 * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) * * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<< @@ -21530,7 +22720,7 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor return __pyx_r; } -/* "View.MemoryView":980 +/* "View.MemoryView":985 * return memoryview.convert_item_to_object(self, itemp) * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< @@ -21546,7 +22736,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("assign_item_from_object", 0); - /* "View.MemoryView":981 + /* "View.MemoryView":986 * * cdef assign_item_from_object(self, char *itemp, object value): * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< @@ -21556,16 +22746,16 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0); if (__pyx_t_1) { - /* "View.MemoryView":982 + /* "View.MemoryView":987 * cdef assign_item_from_object(self, char *itemp, object value): * if self.to_dtype_func != NULL: * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<< * else: * memoryview.assign_item_from_object(self, itemp, value) */ - __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 982, __pyx_L1_error) + __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 987, __pyx_L1_error) - /* "View.MemoryView":981 + /* "View.MemoryView":986 * * cdef assign_item_from_object(self, char *itemp, object value): * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<< @@ -21575,7 +22765,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo goto __pyx_L3; } - /* "View.MemoryView":984 + /* "View.MemoryView":989 * self.to_dtype_func(itemp, value) * else: * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<< @@ -21583,13 +22773,13 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo * @property */ /*else*/ { - __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 984, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 989, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_L3:; - /* "View.MemoryView":980 + /* "View.MemoryView":985 * return memoryview.convert_item_to_object(self, itemp) * * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<< @@ -21610,7 +22800,7 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo return __pyx_r; } -/* "View.MemoryView":987 +/* "View.MemoryView":992 * * @property * def base(self): # <<<<<<<<<<<<<< @@ -21636,7 +22826,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); - /* "View.MemoryView":988 + /* "View.MemoryView":993 * @property * def base(self): * return self.from_object # <<<<<<<<<<<<<< @@ -21648,7 +22838,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__ __pyx_r = __pyx_v_self->from_object; goto __pyx_L0; - /* "View.MemoryView":987 + /* "View.MemoryView":992 * * @property * def base(self): # <<<<<<<<<<<<<< @@ -21694,7 +22884,7 @@ static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -21747,7 +22937,7 @@ static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUS * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -21770,7 +22960,7 @@ static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUS return __pyx_r; } -/* "View.MemoryView":994 +/* "View.MemoryView":999 * * @cname('__pyx_memoryview_fromslice') * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< @@ -21795,7 +22985,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl Py_ssize_t __pyx_t_9; __Pyx_RefNannySetupContext("memoryview_fromslice", 0); - /* "View.MemoryView":1002 + /* "View.MemoryView":1007 * cdef _memoryviewslice result * * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< @@ -21805,7 +22995,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1003 + /* "View.MemoryView":1008 * * if memviewslice.memview == Py_None: * return None # <<<<<<<<<<<<<< @@ -21816,7 +23006,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "View.MemoryView":1002 + /* "View.MemoryView":1007 * cdef _memoryviewslice result * * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<< @@ -21825,16 +23015,16 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ } - /* "View.MemoryView":1008 + /* "View.MemoryView":1013 * * * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<< * * result.from_slice = memviewslice */ - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1008, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1008, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); @@ -21845,13 +23035,13 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1008, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":1010 + /* "View.MemoryView":1015 * result = _memoryviewslice(None, 0, dtype_is_object) * * result.from_slice = memviewslice # <<<<<<<<<<<<<< @@ -21860,7 +23050,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->from_slice = __pyx_v_memviewslice; - /* "View.MemoryView":1011 + /* "View.MemoryView":1016 * * result.from_slice = memviewslice * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<< @@ -21869,14 +23059,14 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1); - /* "View.MemoryView":1013 + /* "View.MemoryView":1018 * __PYX_INC_MEMVIEW(&memviewslice, 1) * * result.from_object = ( memviewslice.memview).base # <<<<<<<<<<<<<< * result.typeinfo = memviewslice.memview.typeinfo * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1018, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_result->from_object); @@ -21884,7 +23074,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_v_result->from_object = __pyx_t_2; __pyx_t_2 = 0; - /* "View.MemoryView":1014 + /* "View.MemoryView":1019 * * result.from_object = ( memviewslice.memview).base * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<< @@ -21894,7 +23084,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo; __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4; - /* "View.MemoryView":1016 + /* "View.MemoryView":1021 * result.typeinfo = memviewslice.memview.typeinfo * * result.view = memviewslice.memview.view # <<<<<<<<<<<<<< @@ -21904,7 +23094,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_5 = __pyx_v_memviewslice.memview->view; __pyx_v_result->__pyx_base.view = __pyx_t_5; - /* "View.MemoryView":1017 + /* "View.MemoryView":1022 * * result.view = memviewslice.memview.view * result.view.buf = memviewslice.data # <<<<<<<<<<<<<< @@ -21913,7 +23103,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data); - /* "View.MemoryView":1018 + /* "View.MemoryView":1023 * result.view = memviewslice.memview.view * result.view.buf = memviewslice.data * result.view.ndim = ndim # <<<<<<<<<<<<<< @@ -21922,7 +23112,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim; - /* "View.MemoryView":1019 + /* "View.MemoryView":1024 * result.view.buf = memviewslice.data * result.view.ndim = ndim * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<< @@ -21931,7 +23121,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None; - /* "View.MemoryView":1020 + /* "View.MemoryView":1025 * result.view.ndim = ndim * (<__pyx_buffer *> &result.view).obj = Py_None * Py_INCREF(Py_None) # <<<<<<<<<<<<<< @@ -21940,7 +23130,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ Py_INCREF(Py_None); - /* "View.MemoryView":1022 + /* "View.MemoryView":1027 * Py_INCREF(Py_None) * * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< @@ -21950,7 +23140,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1023 + /* "View.MemoryView":1028 * * if (memviewslice.memview).flags & PyBUF_WRITABLE: * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<< @@ -21959,7 +23149,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS; - /* "View.MemoryView":1022 + /* "View.MemoryView":1027 * Py_INCREF(Py_None) * * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<< @@ -21969,7 +23159,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl goto __pyx_L4; } - /* "View.MemoryView":1025 + /* "View.MemoryView":1030 * result.flags = PyBUF_RECORDS * else: * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<< @@ -21981,7 +23171,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl } __pyx_L4:; - /* "View.MemoryView":1027 + /* "View.MemoryView":1032 * result.flags = PyBUF_RECORDS_RO * * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<< @@ -21990,7 +23180,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape); - /* "View.MemoryView":1028 + /* "View.MemoryView":1033 * * result.view.shape = result.from_slice.shape * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<< @@ -21999,7 +23189,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides); - /* "View.MemoryView":1031 + /* "View.MemoryView":1036 * * * result.view.suboffsets = NULL # <<<<<<<<<<<<<< @@ -22008,7 +23198,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.suboffsets = NULL; - /* "View.MemoryView":1032 + /* "View.MemoryView":1037 * * result.view.suboffsets = NULL * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<< @@ -22020,7 +23210,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_6 = __pyx_t_8; __pyx_v_suboffset = (__pyx_t_6[0]); - /* "View.MemoryView":1033 + /* "View.MemoryView":1038 * result.view.suboffsets = NULL * for suboffset in result.from_slice.suboffsets[:ndim]: * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -22030,7 +23220,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1034 + /* "View.MemoryView":1039 * for suboffset in result.from_slice.suboffsets[:ndim]: * if suboffset >= 0: * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<< @@ -22039,7 +23229,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets); - /* "View.MemoryView":1035 + /* "View.MemoryView":1040 * if suboffset >= 0: * result.view.suboffsets = result.from_slice.suboffsets * break # <<<<<<<<<<<<<< @@ -22048,7 +23238,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ goto __pyx_L6_break; - /* "View.MemoryView":1033 + /* "View.MemoryView":1038 * result.view.suboffsets = NULL * for suboffset in result.from_slice.suboffsets[:ndim]: * if suboffset >= 0: # <<<<<<<<<<<<<< @@ -22059,7 +23249,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl } __pyx_L6_break:; - /* "View.MemoryView":1037 + /* "View.MemoryView":1042 * break * * result.view.len = result.view.itemsize # <<<<<<<<<<<<<< @@ -22069,7 +23259,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize; __pyx_v_result->__pyx_base.view.len = __pyx_t_9; - /* "View.MemoryView":1038 + /* "View.MemoryView":1043 * * result.view.len = result.view.itemsize * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<< @@ -22079,29 +23269,29 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim); for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) { __pyx_t_6 = __pyx_t_8; - __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1038, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1043, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2); __pyx_t_2 = 0; - /* "View.MemoryView":1039 + /* "View.MemoryView":1044 * result.view.len = result.view.itemsize * for length in result.view.shape[:ndim]: * result.view.len *= length # <<<<<<<<<<<<<< * * result.to_object_func = to_object_func */ - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1039, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1044, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1039, __pyx_L1_error) + __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1044, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1039, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1044, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_result->__pyx_base.view.len = __pyx_t_9; } - /* "View.MemoryView":1041 + /* "View.MemoryView":1046 * result.view.len *= length * * result.to_object_func = to_object_func # <<<<<<<<<<<<<< @@ -22110,7 +23300,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->to_object_func = __pyx_v_to_object_func; - /* "View.MemoryView":1042 + /* "View.MemoryView":1047 * * result.to_object_func = to_object_func * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<< @@ -22119,7 +23309,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl */ __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func; - /* "View.MemoryView":1044 + /* "View.MemoryView":1049 * result.to_dtype_func = to_dtype_func * * return result # <<<<<<<<<<<<<< @@ -22131,7 +23321,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; - /* "View.MemoryView":994 + /* "View.MemoryView":999 * * @cname('__pyx_memoryview_fromslice') * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<< @@ -22153,7 +23343,7 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl return __pyx_r; } -/* "View.MemoryView":1047 +/* "View.MemoryView":1052 * * @cname('__pyx_memoryview_get_slice_from_memoryview') * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< @@ -22170,7 +23360,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("get_slice_from_memview", 0); - /* "View.MemoryView":1050 + /* "View.MemoryView":1055 * __Pyx_memviewslice *mslice): * cdef _memoryviewslice obj * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -22181,20 +23371,20 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":1051 + /* "View.MemoryView":1056 * cdef _memoryviewslice obj * if isinstance(memview, _memoryviewslice): * obj = memview # <<<<<<<<<<<<<< * return &obj.from_slice * else: */ - if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1051, __pyx_L1_error) + if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1056, __pyx_L1_error) __pyx_t_3 = ((PyObject *)__pyx_v_memview); __Pyx_INCREF(__pyx_t_3); __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3); __pyx_t_3 = 0; - /* "View.MemoryView":1052 + /* "View.MemoryView":1057 * if isinstance(memview, _memoryviewslice): * obj = memview * return &obj.from_slice # <<<<<<<<<<<<<< @@ -22204,7 +23394,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p __pyx_r = (&__pyx_v_obj->from_slice); goto __pyx_L0; - /* "View.MemoryView":1050 + /* "View.MemoryView":1055 * __Pyx_memviewslice *mslice): * cdef _memoryviewslice obj * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -22213,7 +23403,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p */ } - /* "View.MemoryView":1054 + /* "View.MemoryView":1059 * return &obj.from_slice * else: * slice_copy(memview, mslice) # <<<<<<<<<<<<<< @@ -22223,7 +23413,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p /*else*/ { __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice); - /* "View.MemoryView":1055 + /* "View.MemoryView":1060 * else: * slice_copy(memview, mslice) * return mslice # <<<<<<<<<<<<<< @@ -22234,7 +23424,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p goto __pyx_L0; } - /* "View.MemoryView":1047 + /* "View.MemoryView":1052 * * @cname('__pyx_memoryview_get_slice_from_memoryview') * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<< @@ -22253,7 +23443,7 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p return __pyx_r; } -/* "View.MemoryView":1058 +/* "View.MemoryView":1063 * * @cname('__pyx_memoryview_slice_copy') * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< @@ -22274,7 +23464,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem Py_ssize_t __pyx_t_5; __Pyx_RefNannySetupContext("slice_copy", 0); - /* "View.MemoryView":1062 + /* "View.MemoryView":1067 * cdef (Py_ssize_t*) shape, strides, suboffsets * * shape = memview.view.shape # <<<<<<<<<<<<<< @@ -22284,7 +23474,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem __pyx_t_1 = __pyx_v_memview->view.shape; __pyx_v_shape = __pyx_t_1; - /* "View.MemoryView":1063 + /* "View.MemoryView":1068 * * shape = memview.view.shape * strides = memview.view.strides # <<<<<<<<<<<<<< @@ -22294,7 +23484,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem __pyx_t_1 = __pyx_v_memview->view.strides; __pyx_v_strides = __pyx_t_1; - /* "View.MemoryView":1064 + /* "View.MemoryView":1069 * shape = memview.view.shape * strides = memview.view.strides * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<< @@ -22304,7 +23494,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem __pyx_t_1 = __pyx_v_memview->view.suboffsets; __pyx_v_suboffsets = __pyx_t_1; - /* "View.MemoryView":1066 + /* "View.MemoryView":1071 * suboffsets = memview.view.suboffsets * * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<< @@ -22313,7 +23503,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem */ __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview); - /* "View.MemoryView":1067 + /* "View.MemoryView":1072 * * dst.memview = <__pyx_memoryview *> memview * dst.data = memview.view.buf # <<<<<<<<<<<<<< @@ -22322,7 +23512,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem */ __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf); - /* "View.MemoryView":1069 + /* "View.MemoryView":1074 * dst.data = memview.view.buf * * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<< @@ -22334,7 +23524,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_dim = __pyx_t_4; - /* "View.MemoryView":1070 + /* "View.MemoryView":1075 * * for dim in range(memview.view.ndim): * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<< @@ -22343,7 +23533,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem */ (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]); - /* "View.MemoryView":1071 + /* "View.MemoryView":1076 * for dim in range(memview.view.ndim): * dst.shape[dim] = shape[dim] * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<< @@ -22352,7 +23542,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem */ (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]); - /* "View.MemoryView":1072 + /* "View.MemoryView":1077 * dst.shape[dim] = shape[dim] * dst.strides[dim] = strides[dim] * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<< @@ -22367,7 +23557,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5; } - /* "View.MemoryView":1058 + /* "View.MemoryView":1063 * * @cname('__pyx_memoryview_slice_copy') * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<< @@ -22379,7 +23569,7 @@ static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_mem __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":1075 +/* "View.MemoryView":1080 * * @cname('__pyx_memoryview_copy_object') * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< @@ -22394,7 +23584,7 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("memoryview_copy", 0); - /* "View.MemoryView":1078 + /* "View.MemoryView":1083 * "Create a new memoryview object" * cdef __Pyx_memviewslice memviewslice * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<< @@ -22403,7 +23593,7 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx */ __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice)); - /* "View.MemoryView":1079 + /* "View.MemoryView":1084 * cdef __Pyx_memviewslice memviewslice * slice_copy(memview, &memviewslice) * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<< @@ -22411,13 +23601,13 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx * @cname('__pyx_memoryview_copy_object_from_slice') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1079, __pyx_L1_error) + __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1084, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "View.MemoryView":1075 + /* "View.MemoryView":1080 * * @cname('__pyx_memoryview_copy_object') * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<< @@ -22436,7 +23626,7 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx return __pyx_r; } -/* "View.MemoryView":1082 +/* "View.MemoryView":1087 * * @cname('__pyx_memoryview_copy_object_from_slice') * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< @@ -22456,7 +23646,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); - /* "View.MemoryView":1089 + /* "View.MemoryView":1094 * cdef int (*to_dtype_func)(char *, object) except 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -22467,7 +23657,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "View.MemoryView":1090 + /* "View.MemoryView":1095 * * if isinstance(memview, _memoryviewslice): * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<< @@ -22477,7 +23667,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func; __pyx_v_to_object_func = __pyx_t_3; - /* "View.MemoryView":1091 + /* "View.MemoryView":1096 * if isinstance(memview, _memoryviewslice): * to_object_func = (<_memoryviewslice> memview).to_object_func * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<< @@ -22487,7 +23677,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func; __pyx_v_to_dtype_func = __pyx_t_4; - /* "View.MemoryView":1089 + /* "View.MemoryView":1094 * cdef int (*to_dtype_func)(char *, object) except 0 * * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<< @@ -22497,7 +23687,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview goto __pyx_L3; } - /* "View.MemoryView":1093 + /* "View.MemoryView":1098 * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func * else: * to_object_func = NULL # <<<<<<<<<<<<<< @@ -22507,7 +23697,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview /*else*/ { __pyx_v_to_object_func = NULL; - /* "View.MemoryView":1094 + /* "View.MemoryView":1099 * else: * to_object_func = NULL * to_dtype_func = NULL # <<<<<<<<<<<<<< @@ -22518,7 +23708,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview } __pyx_L3:; - /* "View.MemoryView":1096 + /* "View.MemoryView":1101 * to_dtype_func = NULL * * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<< @@ -22527,20 +23717,20 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview */ __Pyx_XDECREF(__pyx_r); - /* "View.MemoryView":1098 + /* "View.MemoryView":1103 * return memoryview_fromslice(memviewslice[0], memview.view.ndim, * to_object_func, to_dtype_func, * memview.dtype_is_object) # <<<<<<<<<<<<<< * * */ - __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1096, __pyx_L1_error) + __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1101, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; - /* "View.MemoryView":1082 + /* "View.MemoryView":1087 * * @cname('__pyx_memoryview_copy_object_from_slice') * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<< @@ -22559,7 +23749,7 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview return __pyx_r; } -/* "View.MemoryView":1104 +/* "View.MemoryView":1109 * * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< @@ -22571,7 +23761,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { Py_ssize_t __pyx_r; int __pyx_t_1; - /* "View.MemoryView":1105 + /* "View.MemoryView":1110 * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: * if arg < 0: # <<<<<<<<<<<<<< @@ -22581,7 +23771,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { __pyx_t_1 = ((__pyx_v_arg < 0) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1106 + /* "View.MemoryView":1111 * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: * if arg < 0: * return -arg # <<<<<<<<<<<<<< @@ -22591,7 +23781,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { __pyx_r = (-__pyx_v_arg); goto __pyx_L0; - /* "View.MemoryView":1105 + /* "View.MemoryView":1110 * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: * if arg < 0: # <<<<<<<<<<<<<< @@ -22600,7 +23790,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { */ } - /* "View.MemoryView":1108 + /* "View.MemoryView":1113 * return -arg * else: * return arg # <<<<<<<<<<<<<< @@ -22612,7 +23802,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { goto __pyx_L0; } - /* "View.MemoryView":1104 + /* "View.MemoryView":1109 * * * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<< @@ -22625,7 +23815,7 @@ static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) { return __pyx_r; } -/* "View.MemoryView":1111 +/* "View.MemoryView":1116 * * @cname('__pyx_get_best_slice_order') * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< @@ -22643,7 +23833,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ int __pyx_t_3; int __pyx_t_4; - /* "View.MemoryView":1116 + /* "View.MemoryView":1121 * """ * cdef int i * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<< @@ -22652,7 +23842,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_v_c_stride = 0; - /* "View.MemoryView":1117 + /* "View.MemoryView":1122 * cdef int i * cdef Py_ssize_t c_stride = 0 * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<< @@ -22661,7 +23851,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_v_f_stride = 0; - /* "View.MemoryView":1119 + /* "View.MemoryView":1124 * cdef Py_ssize_t f_stride = 0 * * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< @@ -22671,7 +23861,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":1120 + /* "View.MemoryView":1125 * * for i in range(ndim - 1, -1, -1): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< @@ -22681,7 +23871,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1121 + /* "View.MemoryView":1126 * for i in range(ndim - 1, -1, -1): * if mslice.shape[i] > 1: * c_stride = mslice.strides[i] # <<<<<<<<<<<<<< @@ -22690,7 +23880,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":1122 + /* "View.MemoryView":1127 * if mslice.shape[i] > 1: * c_stride = mslice.strides[i] * break # <<<<<<<<<<<<<< @@ -22699,7 +23889,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ goto __pyx_L4_break; - /* "View.MemoryView":1120 + /* "View.MemoryView":1125 * * for i in range(ndim - 1, -1, -1): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< @@ -22710,7 +23900,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ } __pyx_L4_break:; - /* "View.MemoryView":1124 + /* "View.MemoryView":1129 * break * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -22722,7 +23912,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1125 + /* "View.MemoryView":1130 * * for i in range(ndim): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< @@ -22732,7 +23922,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1126 + /* "View.MemoryView":1131 * for i in range(ndim): * if mslice.shape[i] > 1: * f_stride = mslice.strides[i] # <<<<<<<<<<<<<< @@ -22741,7 +23931,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":1127 + /* "View.MemoryView":1132 * if mslice.shape[i] > 1: * f_stride = mslice.strides[i] * break # <<<<<<<<<<<<<< @@ -22750,7 +23940,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ goto __pyx_L7_break; - /* "View.MemoryView":1125 + /* "View.MemoryView":1130 * * for i in range(ndim): * if mslice.shape[i] > 1: # <<<<<<<<<<<<<< @@ -22761,7 +23951,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ } __pyx_L7_break:; - /* "View.MemoryView":1129 + /* "View.MemoryView":1134 * break * * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< @@ -22771,7 +23961,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1130 + /* "View.MemoryView":1135 * * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): * return 'C' # <<<<<<<<<<<<<< @@ -22781,7 +23971,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ __pyx_r = 'C'; goto __pyx_L0; - /* "View.MemoryView":1129 + /* "View.MemoryView":1134 * break * * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<< @@ -22790,7 +23980,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ */ } - /* "View.MemoryView":1132 + /* "View.MemoryView":1137 * return 'C' * else: * return 'F' # <<<<<<<<<<<<<< @@ -22802,7 +23992,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ goto __pyx_L0; } - /* "View.MemoryView":1111 + /* "View.MemoryView":1116 * * @cname('__pyx_get_best_slice_order') * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<< @@ -22815,7 +24005,7 @@ static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int _ return __pyx_r; } -/* "View.MemoryView":1135 +/* "View.MemoryView":1140 * * @cython.cdivision(True) * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< @@ -22836,7 +24026,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v Py_ssize_t __pyx_t_5; Py_ssize_t __pyx_t_6; - /* "View.MemoryView":1142 + /* "View.MemoryView":1147 * * cdef Py_ssize_t i * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<< @@ -22845,7 +24035,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_src_extent = (__pyx_v_src_shape[0]); - /* "View.MemoryView":1143 + /* "View.MemoryView":1148 * cdef Py_ssize_t i * cdef Py_ssize_t src_extent = src_shape[0] * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<< @@ -22854,7 +24044,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_dst_extent = (__pyx_v_dst_shape[0]); - /* "View.MemoryView":1144 + /* "View.MemoryView":1149 * cdef Py_ssize_t src_extent = src_shape[0] * cdef Py_ssize_t dst_extent = dst_shape[0] * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<< @@ -22863,7 +24053,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_src_stride = (__pyx_v_src_strides[0]); - /* "View.MemoryView":1145 + /* "View.MemoryView":1150 * cdef Py_ssize_t dst_extent = dst_shape[0] * cdef Py_ssize_t src_stride = src_strides[0] * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<< @@ -22872,7 +24062,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_dst_stride = (__pyx_v_dst_strides[0]); - /* "View.MemoryView":1147 + /* "View.MemoryView":1152 * cdef Py_ssize_t dst_stride = dst_strides[0] * * if ndim == 1: # <<<<<<<<<<<<<< @@ -22882,7 +24072,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1148 + /* "View.MemoryView":1153 * * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< @@ -22902,7 +24092,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v goto __pyx_L5_bool_binop_done; } - /* "View.MemoryView":1149 + /* "View.MemoryView":1154 * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<< @@ -22917,7 +24107,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v __pyx_t_1 = __pyx_t_3; __pyx_L5_bool_binop_done:; - /* "View.MemoryView":1148 + /* "View.MemoryView":1153 * * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< @@ -22926,7 +24116,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ if (__pyx_t_1) { - /* "View.MemoryView":1150 + /* "View.MemoryView":1155 * if (src_stride > 0 and dst_stride > 0 and * src_stride == itemsize == dst_stride): * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<< @@ -22935,7 +24125,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent))); - /* "View.MemoryView":1148 + /* "View.MemoryView":1153 * * if ndim == 1: * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<< @@ -22945,7 +24135,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v goto __pyx_L4; } - /* "View.MemoryView":1152 + /* "View.MemoryView":1157 * memcpy(dst_data, src_data, itemsize * dst_extent) * else: * for i in range(dst_extent): # <<<<<<<<<<<<<< @@ -22958,7 +24148,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":1153 + /* "View.MemoryView":1158 * else: * for i in range(dst_extent): * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<< @@ -22967,7 +24157,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize)); - /* "View.MemoryView":1154 + /* "View.MemoryView":1159 * for i in range(dst_extent): * memcpy(dst_data, src_data, itemsize) * src_data += src_stride # <<<<<<<<<<<<<< @@ -22976,7 +24166,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "View.MemoryView":1155 + /* "View.MemoryView":1160 * memcpy(dst_data, src_data, itemsize) * src_data += src_stride * dst_data += dst_stride # <<<<<<<<<<<<<< @@ -22988,7 +24178,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v } __pyx_L4:; - /* "View.MemoryView":1147 + /* "View.MemoryView":1152 * cdef Py_ssize_t dst_stride = dst_strides[0] * * if ndim == 1: # <<<<<<<<<<<<<< @@ -22998,7 +24188,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v goto __pyx_L3; } - /* "View.MemoryView":1157 + /* "View.MemoryView":1162 * dst_data += dst_stride * else: * for i in range(dst_extent): # <<<<<<<<<<<<<< @@ -23011,7 +24201,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":1158 + /* "View.MemoryView":1163 * else: * for i in range(dst_extent): * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<< @@ -23020,7 +24210,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize); - /* "View.MemoryView":1162 + /* "View.MemoryView":1167 * src_shape + 1, dst_shape + 1, * ndim - 1, itemsize) * src_data += src_stride # <<<<<<<<<<<<<< @@ -23029,7 +24219,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v */ __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride); - /* "View.MemoryView":1163 + /* "View.MemoryView":1168 * ndim - 1, itemsize) * src_data += src_stride * dst_data += dst_stride # <<<<<<<<<<<<<< @@ -23041,7 +24231,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v } __pyx_L3:; - /* "View.MemoryView":1135 + /* "View.MemoryView":1140 * * @cython.cdivision(True) * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<< @@ -23052,7 +24242,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v /* function exit code */ } -/* "View.MemoryView":1165 +/* "View.MemoryView":1170 * dst_data += dst_stride * * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< @@ -23062,7 +24252,7 @@ static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) { - /* "View.MemoryView":1168 + /* "View.MemoryView":1173 * __Pyx_memviewslice *dst, * int ndim, size_t itemsize) nogil: * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<< @@ -23071,7 +24261,7 @@ static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memvi */ _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize); - /* "View.MemoryView":1165 + /* "View.MemoryView":1170 * dst_data += dst_stride * * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< @@ -23082,7 +24272,7 @@ static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memvi /* function exit code */ } -/* "View.MemoryView":1172 +/* "View.MemoryView":1177 * * @cname('__pyx_memoryview_slice_get_size') * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< @@ -23099,7 +24289,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr int __pyx_t_3; int __pyx_t_4; - /* "View.MemoryView":1175 + /* "View.MemoryView":1180 * "Return the size of the memory occupied by the slice in number of bytes" * cdef int i * cdef Py_ssize_t size = src.memview.view.itemsize # <<<<<<<<<<<<<< @@ -23109,7 +24299,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr __pyx_t_1 = __pyx_v_src->memview->view.itemsize; __pyx_v_size = __pyx_t_1; - /* "View.MemoryView":1177 + /* "View.MemoryView":1182 * cdef Py_ssize_t size = src.memview.view.itemsize * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -23121,7 +24311,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1178 + /* "View.MemoryView":1183 * * for i in range(ndim): * size *= src.shape[i] # <<<<<<<<<<<<<< @@ -23131,7 +24321,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr __pyx_v_size = (__pyx_v_size * (__pyx_v_src->shape[__pyx_v_i])); } - /* "View.MemoryView":1180 + /* "View.MemoryView":1185 * size *= src.shape[i] * * return size # <<<<<<<<<<<<<< @@ -23141,7 +24331,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr __pyx_r = __pyx_v_size; goto __pyx_L0; - /* "View.MemoryView":1172 + /* "View.MemoryView":1177 * * @cname('__pyx_memoryview_slice_get_size') * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<< @@ -23154,7 +24344,7 @@ static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_sr return __pyx_r; } -/* "View.MemoryView":1183 +/* "View.MemoryView":1188 * * @cname('__pyx_fill_contig_strides_array') * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< @@ -23170,7 +24360,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ int __pyx_t_3; int __pyx_t_4; - /* "View.MemoryView":1192 + /* "View.MemoryView":1197 * cdef int idx * * if order == 'F': # <<<<<<<<<<<<<< @@ -23180,7 +24370,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ __pyx_t_1 = ((__pyx_v_order == 'F') != 0); if (__pyx_t_1) { - /* "View.MemoryView":1193 + /* "View.MemoryView":1198 * * if order == 'F': * for idx in range(ndim): # <<<<<<<<<<<<<< @@ -23192,7 +24382,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_idx = __pyx_t_4; - /* "View.MemoryView":1194 + /* "View.MemoryView":1199 * if order == 'F': * for idx in range(ndim): * strides[idx] = stride # <<<<<<<<<<<<<< @@ -23201,7 +24391,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ */ (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - /* "View.MemoryView":1195 + /* "View.MemoryView":1200 * for idx in range(ndim): * strides[idx] = stride * stride = stride * shape[idx] # <<<<<<<<<<<<<< @@ -23211,7 +24401,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx])); } - /* "View.MemoryView":1192 + /* "View.MemoryView":1197 * cdef int idx * * if order == 'F': # <<<<<<<<<<<<<< @@ -23221,7 +24411,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ goto __pyx_L3; } - /* "View.MemoryView":1197 + /* "View.MemoryView":1202 * stride = stride * shape[idx] * else: * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< @@ -23232,7 +24422,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) { __pyx_v_idx = __pyx_t_2; - /* "View.MemoryView":1198 + /* "View.MemoryView":1203 * else: * for idx in range(ndim - 1, -1, -1): * strides[idx] = stride # <<<<<<<<<<<<<< @@ -23241,7 +24431,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ */ (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride; - /* "View.MemoryView":1199 + /* "View.MemoryView":1204 * for idx in range(ndim - 1, -1, -1): * strides[idx] = stride * stride = stride * shape[idx] # <<<<<<<<<<<<<< @@ -23253,7 +24443,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ } __pyx_L3:; - /* "View.MemoryView":1201 + /* "View.MemoryView":1206 * stride = stride * shape[idx] * * return stride # <<<<<<<<<<<<<< @@ -23263,7 +24453,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ __pyx_r = __pyx_v_stride; goto __pyx_L0; - /* "View.MemoryView":1183 + /* "View.MemoryView":1188 * * @cname('__pyx_fill_contig_strides_array') * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<< @@ -23276,7 +24466,7 @@ static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ return __pyx_r; } -/* "View.MemoryView":1204 +/* "View.MemoryView":1209 * * @cname('__pyx_memoryview_copy_data_to_temp') * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< @@ -23297,7 +24487,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, int __pyx_t_5; int __pyx_t_6; - /* "View.MemoryView":1215 + /* "View.MemoryView":1220 * cdef void *result * * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< @@ -23307,7 +24497,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_1 = __pyx_v_src->memview->view.itemsize; __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":1216 + /* "View.MemoryView":1221 * * cdef size_t itemsize = src.memview.view.itemsize * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<< @@ -23316,7 +24506,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim); - /* "View.MemoryView":1218 + /* "View.MemoryView":1223 * cdef size_t size = slice_get_size(src, ndim) * * result = malloc(size) # <<<<<<<<<<<<<< @@ -23325,7 +24515,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ __pyx_v_result = malloc(__pyx_v_size); - /* "View.MemoryView":1219 + /* "View.MemoryView":1224 * * result = malloc(size) * if not result: # <<<<<<<<<<<<<< @@ -23335,16 +24525,16 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1220 + /* "View.MemoryView":1225 * result = malloc(size) * if not result: * _err(MemoryError, NULL) # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1220, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1225, __pyx_L1_error) - /* "View.MemoryView":1219 + /* "View.MemoryView":1224 * * result = malloc(size) * if not result: # <<<<<<<<<<<<<< @@ -23353,7 +24543,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ } - /* "View.MemoryView":1223 + /* "View.MemoryView":1228 * * * tmpslice.data = result # <<<<<<<<<<<<<< @@ -23362,7 +24552,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ __pyx_v_tmpslice->data = ((char *)__pyx_v_result); - /* "View.MemoryView":1224 + /* "View.MemoryView":1229 * * tmpslice.data = result * tmpslice.memview = src.memview # <<<<<<<<<<<<<< @@ -23372,7 +24562,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_4 = __pyx_v_src->memview; __pyx_v_tmpslice->memview = __pyx_t_4; - /* "View.MemoryView":1225 + /* "View.MemoryView":1230 * tmpslice.data = result * tmpslice.memview = src.memview * for i in range(ndim): # <<<<<<<<<<<<<< @@ -23384,7 +24574,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":1226 + /* "View.MemoryView":1231 * tmpslice.memview = src.memview * for i in range(ndim): * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<< @@ -23393,7 +24583,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]); - /* "View.MemoryView":1227 + /* "View.MemoryView":1232 * for i in range(ndim): * tmpslice.shape[i] = src.shape[i] * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< @@ -23403,7 +24593,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L; } - /* "View.MemoryView":1229 + /* "View.MemoryView":1234 * tmpslice.suboffsets[i] = -1 * * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<< @@ -23412,7 +24602,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order)); - /* "View.MemoryView":1233 + /* "View.MemoryView":1238 * * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -23424,7 +24614,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "View.MemoryView":1234 + /* "View.MemoryView":1239 * * for i in range(ndim): * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< @@ -23434,7 +24624,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1235 + /* "View.MemoryView":1240 * for i in range(ndim): * if tmpslice.shape[i] == 1: * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<< @@ -23443,7 +24633,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0; - /* "View.MemoryView":1234 + /* "View.MemoryView":1239 * * for i in range(ndim): * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<< @@ -23453,7 +24643,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, } } - /* "View.MemoryView":1237 + /* "View.MemoryView":1242 * tmpslice.strides[i] = 0 * * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< @@ -23463,7 +24653,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1238 + /* "View.MemoryView":1243 * * if slice_is_contig(src[0], order, ndim): * memcpy(result, src.data, size) # <<<<<<<<<<<<<< @@ -23472,7 +24662,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, */ (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size)); - /* "View.MemoryView":1237 + /* "View.MemoryView":1242 * tmpslice.strides[i] = 0 * * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<< @@ -23482,7 +24672,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, goto __pyx_L9; } - /* "View.MemoryView":1240 + /* "View.MemoryView":1245 * memcpy(result, src.data, size) * else: * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<< @@ -23494,7 +24684,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, } __pyx_L9:; - /* "View.MemoryView":1242 + /* "View.MemoryView":1247 * copy_strided_to_strided(src, tmpslice, ndim, itemsize) * * return result # <<<<<<<<<<<<<< @@ -23504,7 +24694,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "View.MemoryView":1204 + /* "View.MemoryView":1209 * * @cname('__pyx_memoryview_copy_data_to_temp') * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<< @@ -23528,7 +24718,7 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, return __pyx_r; } -/* "View.MemoryView":1247 +/* "View.MemoryView":1252 * * @cname('__pyx_memoryview_err_extents') * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< @@ -23548,20 +24738,20 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent #endif __Pyx_RefNannySetupContext("_err_extents", 0); - /* "View.MemoryView":1250 + /* "View.MemoryView":1255 * Py_ssize_t extent2) except -1 with gil: * raise ValueError("got differing extents in dimension %d (got %d and %d)" % * (i, extent1, extent2)) # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_err_dim') */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1250, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1250, __pyx_L1_error) + __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1250, __pyx_L1_error) + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1250, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); @@ -23573,24 +24763,24 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent __pyx_t_2 = 0; __pyx_t_3 = 0; - /* "View.MemoryView":1249 + /* "View.MemoryView":1254 * cdef int _err_extents(int i, Py_ssize_t extent1, * Py_ssize_t extent2) except -1 with gil: * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<< * (i, extent1, extent2)) * */ - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1249, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1249, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(2, 1249, __pyx_L1_error) + __PYX_ERR(2, 1254, __pyx_L1_error) - /* "View.MemoryView":1247 + /* "View.MemoryView":1252 * * @cname('__pyx_memoryview_err_extents') * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<< @@ -23613,7 +24803,7 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent return __pyx_r; } -/* "View.MemoryView":1253 +/* "View.MemoryView":1258 * * @cname('__pyx_memoryview_err_dim') * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< @@ -23628,25 +24818,24 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("_err_dim", 0); __Pyx_INCREF(__pyx_v_error); - /* "View.MemoryView":1254 + /* "View.MemoryView":1259 * @cname('__pyx_memoryview_err_dim') * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<< * * @cname('__pyx_memoryview_err') */ - __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1254, __pyx_L1_error) + __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1254, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1254, __pyx_L1_error) + __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -23661,47 +24850,17 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, __Pyx_DECREF_SET(__pyx_t_3, function); } } - if (!__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1259, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(2, 1254, __pyx_L1_error) + __PYX_ERR(2, 1259, __pyx_L1_error) - /* "View.MemoryView":1253 + /* "View.MemoryView":1258 * * @cname('__pyx_memoryview_err_dim') * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<< @@ -23715,7 +24874,6 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __Pyx_XDECREF(__pyx_v_error); @@ -23726,7 +24884,7 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, return __pyx_r; } -/* "View.MemoryView":1257 +/* "View.MemoryView":1262 * * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< @@ -23742,14 +24900,13 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannySetupContext("_err", 0); __Pyx_INCREF(__pyx_v_error); - /* "View.MemoryView":1258 + /* "View.MemoryView":1263 * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: * if msg != NULL: # <<<<<<<<<<<<<< @@ -23759,14 +24916,14 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { __pyx_t_1 = ((__pyx_v_msg != NULL) != 0); if (unlikely(__pyx_t_1)) { - /* "View.MemoryView":1259 + /* "View.MemoryView":1264 * cdef int _err(object error, char *msg) except -1 with gil: * if msg != NULL: * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<< * else: * raise error */ - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1259, __pyx_L1_error) + __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_error); __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL; @@ -23779,47 +24936,17 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { __Pyx_DECREF_SET(__pyx_t_4, function); } } - if (!__pyx_t_5) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1259, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1259, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_3}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1259, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 1259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } + __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1264, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(2, 1259, __pyx_L1_error) + __PYX_ERR(2, 1264, __pyx_L1_error) - /* "View.MemoryView":1258 + /* "View.MemoryView":1263 * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: * if msg != NULL: # <<<<<<<<<<<<<< @@ -23828,7 +24955,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { */ } - /* "View.MemoryView":1261 + /* "View.MemoryView":1266 * raise error(msg.decode('ascii')) * else: * raise error # <<<<<<<<<<<<<< @@ -23837,10 +24964,10 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { */ /*else*/ { __Pyx_Raise(__pyx_v_error, 0, 0, 0); - __PYX_ERR(2, 1261, __pyx_L1_error) + __PYX_ERR(2, 1266, __pyx_L1_error) } - /* "View.MemoryView":1257 + /* "View.MemoryView":1262 * * @cname('__pyx_memoryview_err') * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<< @@ -23854,7 +24981,6 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __Pyx_XDECREF(__pyx_v_error); @@ -23865,7 +24991,7 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { return __pyx_r; } -/* "View.MemoryView":1264 +/* "View.MemoryView":1269 * * @cname('__pyx_memoryview_copy_contents') * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< @@ -23892,7 +25018,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ void *__pyx_t_7; int __pyx_t_8; - /* "View.MemoryView":1272 + /* "View.MemoryView":1277 * Check for overlapping memory and verify the shapes. * """ * cdef void *tmpdata = NULL # <<<<<<<<<<<<<< @@ -23901,7 +25027,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_tmpdata = NULL; - /* "View.MemoryView":1273 + /* "View.MemoryView":1278 * """ * cdef void *tmpdata = NULL * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<< @@ -23911,7 +25037,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_1 = __pyx_v_src.memview->view.itemsize; __pyx_v_itemsize = __pyx_t_1; - /* "View.MemoryView":1275 + /* "View.MemoryView":1280 * cdef size_t itemsize = src.memview.view.itemsize * cdef int i * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<< @@ -23920,7 +25046,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim); - /* "View.MemoryView":1276 + /* "View.MemoryView":1281 * cdef int i * cdef char order = get_best_order(&src, src_ndim) * cdef bint broadcasting = False # <<<<<<<<<<<<<< @@ -23929,7 +25055,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_broadcasting = 0; - /* "View.MemoryView":1277 + /* "View.MemoryView":1282 * cdef char order = get_best_order(&src, src_ndim) * cdef bint broadcasting = False * cdef bint direct_copy = False # <<<<<<<<<<<<<< @@ -23938,7 +25064,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_direct_copy = 0; - /* "View.MemoryView":1280 + /* "View.MemoryView":1285 * cdef __Pyx_memviewslice tmp * * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< @@ -23948,7 +25074,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1281 + /* "View.MemoryView":1286 * * if src_ndim < dst_ndim: * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<< @@ -23957,7 +25083,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim); - /* "View.MemoryView":1280 + /* "View.MemoryView":1285 * cdef __Pyx_memviewslice tmp * * if src_ndim < dst_ndim: # <<<<<<<<<<<<<< @@ -23967,7 +25093,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ goto __pyx_L3; } - /* "View.MemoryView":1282 + /* "View.MemoryView":1287 * if src_ndim < dst_ndim: * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< @@ -23977,7 +25103,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1283 + /* "View.MemoryView":1288 * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<< @@ -23986,7 +25112,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim); - /* "View.MemoryView":1282 + /* "View.MemoryView":1287 * if src_ndim < dst_ndim: * broadcast_leading(&src, src_ndim, dst_ndim) * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<< @@ -23996,7 +25122,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_L3:; - /* "View.MemoryView":1285 + /* "View.MemoryView":1290 * broadcast_leading(&dst, dst_ndim, src_ndim) * * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<< @@ -24012,7 +25138,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_v_ndim = __pyx_t_5; - /* "View.MemoryView":1287 + /* "View.MemoryView":1292 * cdef int ndim = max(src_ndim, dst_ndim) * * for i in range(ndim): # <<<<<<<<<<<<<< @@ -24024,7 +25150,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1288 + /* "View.MemoryView":1293 * * for i in range(ndim): * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< @@ -24034,7 +25160,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1289 + /* "View.MemoryView":1294 * for i in range(ndim): * if src.shape[i] != dst.shape[i]: * if src.shape[i] == 1: # <<<<<<<<<<<<<< @@ -24044,7 +25170,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1290 + /* "View.MemoryView":1295 * if src.shape[i] != dst.shape[i]: * if src.shape[i] == 1: * broadcasting = True # <<<<<<<<<<<<<< @@ -24053,7 +25179,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_broadcasting = 1; - /* "View.MemoryView":1291 + /* "View.MemoryView":1296 * if src.shape[i] == 1: * broadcasting = True * src.strides[i] = 0 # <<<<<<<<<<<<<< @@ -24062,7 +25188,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ (__pyx_v_src.strides[__pyx_v_i]) = 0; - /* "View.MemoryView":1289 + /* "View.MemoryView":1294 * for i in range(ndim): * if src.shape[i] != dst.shape[i]: * if src.shape[i] == 1: # <<<<<<<<<<<<<< @@ -24072,7 +25198,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ goto __pyx_L7; } - /* "View.MemoryView":1293 + /* "View.MemoryView":1298 * src.strides[i] = 0 * else: * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<< @@ -24080,11 +25206,11 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ * if src.suboffsets[i] >= 0: */ /*else*/ { - __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1293, __pyx_L1_error) + __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1298, __pyx_L1_error) } __pyx_L7:; - /* "View.MemoryView":1288 + /* "View.MemoryView":1293 * * for i in range(ndim): * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<< @@ -24093,7 +25219,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ } - /* "View.MemoryView":1295 + /* "View.MemoryView":1300 * _err_extents(i, dst.shape[i], src.shape[i]) * * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< @@ -24103,16 +25229,16 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1296 + /* "View.MemoryView":1301 * * if src.suboffsets[i] >= 0: * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<< * * if slices_overlap(&src, &dst, ndim, itemsize): */ - __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1296, __pyx_L1_error) + __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(2, 1301, __pyx_L1_error) - /* "View.MemoryView":1295 + /* "View.MemoryView":1300 * _err_extents(i, dst.shape[i], src.shape[i]) * * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<< @@ -24122,7 +25248,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } } - /* "View.MemoryView":1298 + /* "View.MemoryView":1303 * _err_dim(ValueError, "Dimension %d is not direct", i) * * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< @@ -24132,7 +25258,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1300 + /* "View.MemoryView":1305 * if slices_overlap(&src, &dst, ndim, itemsize): * * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< @@ -24142,7 +25268,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1301 + /* "View.MemoryView":1306 * * if not slice_is_contig(src, order, ndim): * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<< @@ -24151,7 +25277,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim); - /* "View.MemoryView":1300 + /* "View.MemoryView":1305 * if slices_overlap(&src, &dst, ndim, itemsize): * * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<< @@ -24160,17 +25286,17 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ } - /* "View.MemoryView":1303 + /* "View.MemoryView":1308 * order = get_best_order(&dst, ndim) * * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<< * src = tmp * */ - __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1303, __pyx_L1_error) + __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(2, 1308, __pyx_L1_error) __pyx_v_tmpdata = __pyx_t_7; - /* "View.MemoryView":1304 + /* "View.MemoryView":1309 * * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) * src = tmp # <<<<<<<<<<<<<< @@ -24179,7 +25305,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_src = __pyx_v_tmp; - /* "View.MemoryView":1298 + /* "View.MemoryView":1303 * _err_dim(ValueError, "Dimension %d is not direct", i) * * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<< @@ -24188,7 +25314,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ } - /* "View.MemoryView":1306 + /* "View.MemoryView":1311 * src = tmp * * if not broadcasting: # <<<<<<<<<<<<<< @@ -24198,7 +25324,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1309 + /* "View.MemoryView":1314 * * * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< @@ -24208,7 +25334,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1310 + /* "View.MemoryView":1315 * * if slice_is_contig(src, 'C', ndim): * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<< @@ -24217,7 +25343,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim); - /* "View.MemoryView":1309 + /* "View.MemoryView":1314 * * * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<< @@ -24227,7 +25353,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ goto __pyx_L12; } - /* "View.MemoryView":1311 + /* "View.MemoryView":1316 * if slice_is_contig(src, 'C', ndim): * direct_copy = slice_is_contig(dst, 'C', ndim) * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< @@ -24237,7 +25363,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0); if (__pyx_t_2) { - /* "View.MemoryView":1312 + /* "View.MemoryView":1317 * direct_copy = slice_is_contig(dst, 'C', ndim) * elif slice_is_contig(src, 'F', ndim): * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<< @@ -24246,7 +25372,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim); - /* "View.MemoryView":1311 + /* "View.MemoryView":1316 * if slice_is_contig(src, 'C', ndim): * direct_copy = slice_is_contig(dst, 'C', ndim) * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<< @@ -24256,7 +25382,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ } __pyx_L12:; - /* "View.MemoryView":1314 + /* "View.MemoryView":1319 * direct_copy = slice_is_contig(dst, 'F', ndim) * * if direct_copy: # <<<<<<<<<<<<<< @@ -24266,7 +25392,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_2 = (__pyx_v_direct_copy != 0); if (__pyx_t_2) { - /* "View.MemoryView":1316 + /* "View.MemoryView":1321 * if direct_copy: * * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< @@ -24275,7 +25401,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":1317 + /* "View.MemoryView":1322 * * refcount_copying(&dst, dtype_is_object, ndim, False) * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<< @@ -24284,7 +25410,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim))); - /* "View.MemoryView":1318 + /* "View.MemoryView":1323 * refcount_copying(&dst, dtype_is_object, ndim, False) * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< @@ -24293,7 +25419,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":1319 + /* "View.MemoryView":1324 * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) * refcount_copying(&dst, dtype_is_object, ndim, True) * free(tmpdata) # <<<<<<<<<<<<<< @@ -24302,7 +25428,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ free(__pyx_v_tmpdata); - /* "View.MemoryView":1320 + /* "View.MemoryView":1325 * refcount_copying(&dst, dtype_is_object, ndim, True) * free(tmpdata) * return 0 # <<<<<<<<<<<<<< @@ -24312,7 +25438,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_r = 0; goto __pyx_L0; - /* "View.MemoryView":1314 + /* "View.MemoryView":1319 * direct_copy = slice_is_contig(dst, 'F', ndim) * * if direct_copy: # <<<<<<<<<<<<<< @@ -24321,7 +25447,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ } - /* "View.MemoryView":1306 + /* "View.MemoryView":1311 * src = tmp * * if not broadcasting: # <<<<<<<<<<<<<< @@ -24330,7 +25456,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ } - /* "View.MemoryView":1322 + /* "View.MemoryView":1327 * return 0 * * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< @@ -24344,25 +25470,25 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_t_8 = (__pyx_t_2 != 0); if (__pyx_t_8) { - /* "View.MemoryView":1325 + /* "View.MemoryView":1330 * * * transpose_memslice(&src) # <<<<<<<<<<<<<< * transpose_memslice(&dst) * */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1325, __pyx_L1_error) + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1330, __pyx_L1_error) - /* "View.MemoryView":1326 + /* "View.MemoryView":1331 * * transpose_memslice(&src) * transpose_memslice(&dst) # <<<<<<<<<<<<<< * * refcount_copying(&dst, dtype_is_object, ndim, False) */ - __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1326, __pyx_L1_error) + __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1331, __pyx_L1_error) - /* "View.MemoryView":1322 + /* "View.MemoryView":1327 * return 0 * * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<< @@ -24371,7 +25497,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ } - /* "View.MemoryView":1328 + /* "View.MemoryView":1333 * transpose_memslice(&dst) * * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< @@ -24380,7 +25506,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":1329 + /* "View.MemoryView":1334 * * refcount_copying(&dst, dtype_is_object, ndim, False) * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<< @@ -24389,7 +25515,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize); - /* "View.MemoryView":1330 + /* "View.MemoryView":1335 * refcount_copying(&dst, dtype_is_object, ndim, False) * copy_strided_to_strided(&src, &dst, ndim, itemsize) * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< @@ -24398,7 +25524,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":1332 + /* "View.MemoryView":1337 * refcount_copying(&dst, dtype_is_object, ndim, True) * * free(tmpdata) # <<<<<<<<<<<<<< @@ -24407,7 +25533,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ */ free(__pyx_v_tmpdata); - /* "View.MemoryView":1333 + /* "View.MemoryView":1338 * * free(tmpdata) * return 0 # <<<<<<<<<<<<<< @@ -24417,7 +25543,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ __pyx_r = 0; goto __pyx_L0; - /* "View.MemoryView":1264 + /* "View.MemoryView":1269 * * @cname('__pyx_memoryview_copy_contents') * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<< @@ -24441,7 +25567,7 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ return __pyx_r; } -/* "View.MemoryView":1336 +/* "View.MemoryView":1341 * * @cname('__pyx_memoryview_broadcast_leading') * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< @@ -24456,7 +25582,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic int __pyx_t_2; int __pyx_t_3; - /* "View.MemoryView":1340 + /* "View.MemoryView":1345 * int ndim_other) nogil: * cdef int i * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<< @@ -24465,7 +25591,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic */ __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim); - /* "View.MemoryView":1342 + /* "View.MemoryView":1347 * cdef int offset = ndim_other - ndim * * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<< @@ -24475,7 +25601,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) { __pyx_v_i = __pyx_t_1; - /* "View.MemoryView":1343 + /* "View.MemoryView":1348 * * for i in range(ndim - 1, -1, -1): * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<< @@ -24484,7 +25610,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic */ (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]); - /* "View.MemoryView":1344 + /* "View.MemoryView":1349 * for i in range(ndim - 1, -1, -1): * mslice.shape[i + offset] = mslice.shape[i] * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<< @@ -24493,7 +25619,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic */ (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]); - /* "View.MemoryView":1345 + /* "View.MemoryView":1350 * mslice.shape[i + offset] = mslice.shape[i] * mslice.strides[i + offset] = mslice.strides[i] * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<< @@ -24503,7 +25629,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]); } - /* "View.MemoryView":1347 + /* "View.MemoryView":1352 * mslice.suboffsets[i + offset] = mslice.suboffsets[i] * * for i in range(offset): # <<<<<<<<<<<<<< @@ -24515,7 +25641,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1348 + /* "View.MemoryView":1353 * * for i in range(offset): * mslice.shape[i] = 1 # <<<<<<<<<<<<<< @@ -24524,7 +25650,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic */ (__pyx_v_mslice->shape[__pyx_v_i]) = 1; - /* "View.MemoryView":1349 + /* "View.MemoryView":1354 * for i in range(offset): * mslice.shape[i] = 1 * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<< @@ -24533,7 +25659,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic */ (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]); - /* "View.MemoryView":1350 + /* "View.MemoryView":1355 * mslice.shape[i] = 1 * mslice.strides[i] = mslice.strides[0] * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<< @@ -24543,7 +25669,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L; } - /* "View.MemoryView":1336 + /* "View.MemoryView":1341 * * @cname('__pyx_memoryview_broadcast_leading') * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<< @@ -24554,7 +25680,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic /* function exit code */ } -/* "View.MemoryView":1358 +/* "View.MemoryView":1363 * * @cname('__pyx_memoryview_refcount_copying') * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< @@ -24565,7 +25691,7 @@ static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslic static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) { int __pyx_t_1; - /* "View.MemoryView":1362 + /* "View.MemoryView":1367 * * * if dtype_is_object: # <<<<<<<<<<<<<< @@ -24575,7 +25701,7 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i __pyx_t_1 = (__pyx_v_dtype_is_object != 0); if (__pyx_t_1) { - /* "View.MemoryView":1363 + /* "View.MemoryView":1368 * * if dtype_is_object: * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<< @@ -24584,7 +25710,7 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i */ __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc); - /* "View.MemoryView":1362 + /* "View.MemoryView":1367 * * * if dtype_is_object: # <<<<<<<<<<<<<< @@ -24593,7 +25719,7 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i */ } - /* "View.MemoryView":1358 + /* "View.MemoryView":1363 * * @cname('__pyx_memoryview_refcount_copying') * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<< @@ -24604,7 +25730,7 @@ static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, i /* function exit code */ } -/* "View.MemoryView":1367 +/* "View.MemoryView":1372 * * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -24619,7 +25745,7 @@ static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_da #endif __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0); - /* "View.MemoryView":1370 + /* "View.MemoryView":1375 * Py_ssize_t *strides, int ndim, * bint inc) with gil: * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<< @@ -24628,7 +25754,7 @@ static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_da */ __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc); - /* "View.MemoryView":1367 + /* "View.MemoryView":1372 * * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil') * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -24643,7 +25769,7 @@ static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_da #endif } -/* "View.MemoryView":1373 +/* "View.MemoryView":1378 * * @cname('__pyx_memoryview_refcount_objects_in_slice') * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -24660,7 +25786,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss int __pyx_t_4; __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0); - /* "View.MemoryView":1377 + /* "View.MemoryView":1382 * cdef Py_ssize_t i * * for i in range(shape[0]): # <<<<<<<<<<<<<< @@ -24672,7 +25798,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "View.MemoryView":1378 + /* "View.MemoryView":1383 * * for i in range(shape[0]): * if ndim == 1: # <<<<<<<<<<<<<< @@ -24682,7 +25808,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss __pyx_t_4 = ((__pyx_v_ndim == 1) != 0); if (__pyx_t_4) { - /* "View.MemoryView":1379 + /* "View.MemoryView":1384 * for i in range(shape[0]): * if ndim == 1: * if inc: # <<<<<<<<<<<<<< @@ -24692,7 +25818,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss __pyx_t_4 = (__pyx_v_inc != 0); if (__pyx_t_4) { - /* "View.MemoryView":1380 + /* "View.MemoryView":1385 * if ndim == 1: * if inc: * Py_INCREF(( data)[0]) # <<<<<<<<<<<<<< @@ -24701,7 +25827,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss */ Py_INCREF((((PyObject **)__pyx_v_data)[0])); - /* "View.MemoryView":1379 + /* "View.MemoryView":1384 * for i in range(shape[0]): * if ndim == 1: * if inc: # <<<<<<<<<<<<<< @@ -24711,7 +25837,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss goto __pyx_L6; } - /* "View.MemoryView":1382 + /* "View.MemoryView":1387 * Py_INCREF(( data)[0]) * else: * Py_DECREF(( data)[0]) # <<<<<<<<<<<<<< @@ -24723,7 +25849,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss } __pyx_L6:; - /* "View.MemoryView":1378 + /* "View.MemoryView":1383 * * for i in range(shape[0]): * if ndim == 1: # <<<<<<<<<<<<<< @@ -24733,7 +25859,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss goto __pyx_L5; } - /* "View.MemoryView":1384 + /* "View.MemoryView":1389 * Py_DECREF(( data)[0]) * else: * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< @@ -24742,7 +25868,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss */ /*else*/ { - /* "View.MemoryView":1385 + /* "View.MemoryView":1390 * else: * refcount_objects_in_slice(data, shape + 1, strides + 1, * ndim - 1, inc) # <<<<<<<<<<<<<< @@ -24753,7 +25879,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss } __pyx_L5:; - /* "View.MemoryView":1387 + /* "View.MemoryView":1392 * ndim - 1, inc) * * data += strides[0] # <<<<<<<<<<<<<< @@ -24763,7 +25889,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0])); } - /* "View.MemoryView":1373 + /* "View.MemoryView":1378 * * @cname('__pyx_memoryview_refcount_objects_in_slice') * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -24775,7 +25901,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss __Pyx_RefNannyFinishContext(); } -/* "View.MemoryView":1393 +/* "View.MemoryView":1398 * * @cname('__pyx_memoryview_slice_assign_scalar') * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< @@ -24785,7 +25911,7 @@ static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ss static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) { - /* "View.MemoryView":1396 + /* "View.MemoryView":1401 * size_t itemsize, void *item, * bint dtype_is_object) nogil: * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<< @@ -24794,7 +25920,7 @@ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst */ __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0); - /* "View.MemoryView":1397 + /* "View.MemoryView":1402 * bint dtype_is_object) nogil: * refcount_copying(dst, dtype_is_object, ndim, False) * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<< @@ -24803,7 +25929,7 @@ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst */ __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item); - /* "View.MemoryView":1399 + /* "View.MemoryView":1404 * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, * itemsize, item) * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<< @@ -24812,7 +25938,7 @@ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst */ __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1); - /* "View.MemoryView":1393 + /* "View.MemoryView":1398 * * @cname('__pyx_memoryview_slice_assign_scalar') * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<< @@ -24823,7 +25949,7 @@ static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst /* function exit code */ } -/* "View.MemoryView":1403 +/* "View.MemoryView":1408 * * @cname('__pyx_memoryview__slice_assign_scalar') * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -24840,7 +25966,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t Py_ssize_t __pyx_t_3; Py_ssize_t __pyx_t_4; - /* "View.MemoryView":1407 + /* "View.MemoryView":1412 * size_t itemsize, void *item) nogil: * cdef Py_ssize_t i * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<< @@ -24849,7 +25975,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t */ __pyx_v_stride = (__pyx_v_strides[0]); - /* "View.MemoryView":1408 + /* "View.MemoryView":1413 * cdef Py_ssize_t i * cdef Py_ssize_t stride = strides[0] * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<< @@ -24858,7 +25984,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t */ __pyx_v_extent = (__pyx_v_shape[0]); - /* "View.MemoryView":1410 + /* "View.MemoryView":1415 * cdef Py_ssize_t extent = shape[0] * * if ndim == 1: # <<<<<<<<<<<<<< @@ -24868,7 +25994,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t __pyx_t_1 = ((__pyx_v_ndim == 1) != 0); if (__pyx_t_1) { - /* "View.MemoryView":1411 + /* "View.MemoryView":1416 * * if ndim == 1: * for i in range(extent): # <<<<<<<<<<<<<< @@ -24880,7 +26006,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1412 + /* "View.MemoryView":1417 * if ndim == 1: * for i in range(extent): * memcpy(data, item, itemsize) # <<<<<<<<<<<<<< @@ -24889,7 +26015,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t */ (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize)); - /* "View.MemoryView":1413 + /* "View.MemoryView":1418 * for i in range(extent): * memcpy(data, item, itemsize) * data += stride # <<<<<<<<<<<<<< @@ -24899,7 +26025,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t __pyx_v_data = (__pyx_v_data + __pyx_v_stride); } - /* "View.MemoryView":1410 + /* "View.MemoryView":1415 * cdef Py_ssize_t extent = shape[0] * * if ndim == 1: # <<<<<<<<<<<<<< @@ -24909,7 +26035,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t goto __pyx_L3; } - /* "View.MemoryView":1415 + /* "View.MemoryView":1420 * data += stride * else: * for i in range(extent): # <<<<<<<<<<<<<< @@ -24922,7 +26048,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "View.MemoryView":1416 + /* "View.MemoryView":1421 * else: * for i in range(extent): * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<< @@ -24931,7 +26057,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t */ __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item); - /* "View.MemoryView":1418 + /* "View.MemoryView":1423 * _slice_assign_scalar(data, shape + 1, strides + 1, * ndim - 1, itemsize, item) * data += stride # <<<<<<<<<<<<<< @@ -24943,7 +26069,7 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t } __pyx_L3:; - /* "View.MemoryView":1403 + /* "View.MemoryView":1408 * * @cname('__pyx_memoryview__slice_assign_scalar') * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<< @@ -24956,13 +26082,13 @@ static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t /* "(tree fragment)":1 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * if __pyx_checksum != 0xb068931: - * from pickle import PickleError as __pyx_PickleError + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* Python wrapper */ static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0}; +static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v___pyx_type = 0; long __pyx_v___pyx_checksum; @@ -25034,8 +26160,8 @@ static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *_ } static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { - PyObject *__pyx_v___pyx_PickleError = NULL; - PyObject *__pyx_v___pyx_result = NULL; + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -25043,12 +26169,12 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; + int __pyx_t_6; __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); - /* "(tree fragment)":2 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<< * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) @@ -25056,38 +26182,38 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0); if (__pyx_t_1) { - /* "(tree fragment)":3 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): + /* "(tree fragment)":5 + * cdef object __pyx_result * if __pyx_checksum != 0xb068931: * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) * __pyx_result = Enum.__new__(__pyx_type) */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error) + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_PickleError); __Pyx_GIVEREF(__pyx_n_s_PickleError); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError); - __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 3, __pyx_L1_error) + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 3, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __pyx_v___pyx_PickleError = __pyx_t_2; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "(tree fragment)":4 + /* "(tree fragment)":6 * if __pyx_checksum != 0xb068931: * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) # <<<<<<<<<<<<<< * __pyx_result = Enum.__new__(__pyx_type) * if __pyx_state is not None: */ - __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 4, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_v___pyx_PickleError); @@ -25101,110 +26227,53 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE __Pyx_DECREF_SET(__pyx_t_2, function); } } - if (!__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(2, 4, __pyx_L1_error) + __PYX_ERR(2, 6, __pyx_L1_error) - /* "(tree fragment)":2 - * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<< * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) */ } - /* "(tree fragment)":5 + /* "(tree fragment)":7 * from pickle import PickleError as __pyx_PickleError * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<< * if __pyx_state is not None: * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = NULL; + __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_6)) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } - if (!__pyx_t_6) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v___pyx_type}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_INCREF(__pyx_v___pyx_type); - __Pyx_GIVEREF(__pyx_v___pyx_type); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v___pyx_type); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } + __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v___pyx_result = __pyx_t_3; __pyx_t_3 = 0; - /* "(tree fragment)":6 + /* "(tree fragment)":8 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) * __pyx_result = Enum.__new__(__pyx_type) * if __pyx_state is not None: # <<<<<<<<<<<<<< @@ -25212,22 +26281,22 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE * return __pyx_result */ __pyx_t_1 = (__pyx_v___pyx_state != Py_None); - __pyx_t_7 = (__pyx_t_1 != 0); - if (__pyx_t_7) { + __pyx_t_6 = (__pyx_t_1 != 0); + if (__pyx_t_6) { - /* "(tree fragment)":7 + /* "(tree fragment)":9 * __pyx_result = Enum.__new__(__pyx_type) * if __pyx_state is not None: * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) # <<<<<<<<<<<<<< * return __pyx_result * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): */ - if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 7, __pyx_L1_error) - __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error) + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error) + __pyx_t_3 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "(tree fragment)":6 + /* "(tree fragment)":8 * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) * __pyx_result = Enum.__new__(__pyx_type) * if __pyx_state is not None: # <<<<<<<<<<<<<< @@ -25236,7 +26305,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE */ } - /* "(tree fragment)":8 + /* "(tree fragment)":10 * if __pyx_state is not None: * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) * return __pyx_result # <<<<<<<<<<<<<< @@ -25250,8 +26319,8 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE /* "(tree fragment)":1 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * if __pyx_checksum != 0xb068931: - * from pickle import PickleError as __pyx_PickleError + * cdef object __pyx_PickleError + * cdef object __pyx_result */ /* function exit code */ @@ -25260,7 +26329,6 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -25271,7 +26339,7 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE return __pyx_r; } -/* "(tree fragment)":9 +/* "(tree fragment)":11 * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) * return __pyx_result * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< @@ -25290,10 +26358,9 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); - /* "(tree fragment)":10 + /* "(tree fragment)":12 * return __pyx_result * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<< @@ -25302,9 +26369,9 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ */ if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 10, __pyx_L1_error) + __PYX_ERR(2, 12, __pyx_L1_error) } - __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 10, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v___pyx_result->name); @@ -25312,7 +26379,7 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ __pyx_v___pyx_result->name = __pyx_t_1; __pyx_t_1 = 0; - /* "(tree fragment)":11 + /* "(tree fragment)":13 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): * __pyx_result.name = __pyx_state[0] * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< @@ -25320,36 +26387,36 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ */ if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(2, 11, __pyx_L1_error) + __PYX_ERR(2, 13, __pyx_L1_error) } - __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 11, __pyx_L1_error) + __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error) __pyx_t_4 = ((__pyx_t_3 > 1) != 0); if (__pyx_t_4) { } else { __pyx_t_2 = __pyx_t_4; goto __pyx_L4_bool_binop_done; } - __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 11, __pyx_L1_error) + __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error) __pyx_t_5 = (__pyx_t_4 != 0); __pyx_t_2 = __pyx_t_5; __pyx_L4_bool_binop_done:; if (__pyx_t_2) { - /* "(tree fragment)":12 + /* "(tree fragment)":14 * __pyx_result.name = __pyx_state[0] * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<< */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 12, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 12, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(2, 12, __pyx_L1_error) + __PYX_ERR(2, 14, __pyx_L1_error) } - __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 12, __pyx_L1_error) + __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { @@ -25361,45 +26428,15 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ __Pyx_DECREF_SET(__pyx_t_7, function); } } - if (!__pyx_t_8) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - } + __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "(tree fragment)":11 + /* "(tree fragment)":13 * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): * __pyx_result.name = __pyx_state[0] * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< @@ -25407,7 +26444,7 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ */ } - /* "(tree fragment)":9 + /* "(tree fragment)":11 * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) * return __pyx_result * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< @@ -25423,7 +26460,6 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -25608,6 +26644,9 @@ static PyTypeObject __pyx_type___pyx_array = { #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ + #endif }; static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { @@ -25716,6 +26755,9 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ + #endif }; static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; @@ -25966,6 +27008,9 @@ static PyTypeObject __pyx_type___pyx_memoryview = { #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ + #endif }; static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; @@ -26101,10 +27146,13 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif + #if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ + #endif }; static PyMethodDef __pyx_methods[] = { - {"lower_to_symmetric", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric, METH_O, __pyx_doc_6Orange_8distance_9_distance_lower_to_symmetric}, + {"lower_to_symmetric", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_lower_to_symmetric}, {0, 0, 0, 0} }; @@ -26139,6 +27187,15 @@ static struct PyModuleDef __pyx_moduledef = { NULL /* m_free */ }; #endif +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1}, @@ -26176,11 +27233,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1}, + {&__pyx_n_s_callback, __pyx_k_callback, sizeof(__pyx_k_callback), 0, 0, 1, 1}, {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_col, __pyx_k_col, sizeof(__pyx_k_col), 0, 0, 1, 1}, {&__pyx_n_s_col1, __pyx_k_col1, sizeof(__pyx_k_col1), 0, 0, 1, 1}, {&__pyx_n_s_col2, __pyx_k_col2, sizeof(__pyx_k_col2), 0, 0, 1, 1}, + {&__pyx_n_s_col_start, __pyx_k_col_start, sizeof(__pyx_k_col_start), 0, 0, 1, 1}, {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0}, {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0}, {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1}, @@ -26220,6 +27279,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_ival2, __pyx_k_ival2, sizeof(__pyx_k_ival2), 0, 0, 1, 1}, {&__pyx_n_s_jaccard_cols, __pyx_k_jaccard_cols, sizeof(__pyx_k_jaccard_cols), 0, 0, 1, 1}, {&__pyx_n_s_jaccard_rows, __pyx_k_jaccard_rows, sizeof(__pyx_k_jaccard_rows), 0, 0, 1, 1}, + {&__pyx_n_s_jaccard_rows_locals_lambda, __pyx_k_jaccard_rows_locals_lambda, sizeof(__pyx_k_jaccard_rows_locals_lambda), 0, 0, 1, 1}, {&__pyx_n_s_mads, __pyx_k_mads, sizeof(__pyx_k_mads), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_manhattan_cols, __pyx_k_manhattan_cols, sizeof(__pyx_k_manhattan_cols), 0, 0, 1, 1}, @@ -26250,8 +27310,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_not1_unk2, __pyx_k_not1_unk2, sizeof(__pyx_k_not1_unk2), 0, 0, 1, 1}, {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, - {&__pyx_kp_u_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 1, 0, 0}, - {&__pyx_kp_u_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 1, 0, 0}, + {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0}, + {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0}, {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1}, {&__pyx_n_s_p_nonzero, __pyx_k_p_nonzero, sizeof(__pyx_k_p_nonzero), 0, 0, 1, 1}, {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, @@ -26272,6 +27332,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_row, __pyx_k_row, sizeof(__pyx_k_row), 0, 0, 1, 1}, {&__pyx_n_s_row1, __pyx_k_row1, sizeof(__pyx_k_row1), 0, 0, 1, 1}, {&__pyx_n_s_row2, __pyx_k_row2, sizeof(__pyx_k_row2), 0, 0, 1, 1}, + {&__pyx_n_s_row_start, __pyx_k_row_start, sizeof(__pyx_k_row_start), 0, 0, 1, 1}, {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1}, @@ -26305,188 +27366,157 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 20, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 229, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 810, __pyx_L1_error) - __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1000, __pyx_L1_error) - __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 147, __pyx_L1_error) - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 150, __pyx_L1_error) +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error) + __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1038, __pyx_L1_error) + __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 148, __pyx_L1_error) + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 151, __pyx_L1_error) __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error) - __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 399, __pyx_L1_error) - __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 608, __pyx_L1_error) - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 827, __pyx_L1_error) + __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 404, __pyx_L1_error) + __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 613, __pyx_L1_error) + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 832, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } -static int __Pyx_InitCachedConstants(void) { +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":229 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":272 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 229, __pyx_L1_error) + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 272, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":233 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":276 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) - * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 233, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":263 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":306 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 263, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 306, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":810 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":856 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 810, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 856, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":814 - * if ((child.byteorder == c'>' and little_endian) or - * (child.byteorder == c'<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply - */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 814, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":834 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":880 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 834, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 880, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1000 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1038 * _import_array() * except Exception: * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_umath() except -1: */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 1000, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 1038, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1006 + /* "../orange3env/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":1044 * _import_umath() * except Exception: * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< * * cdef inline int import_ufunc() except -1: */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 1006, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - - /* "../../virtual/orange3/lib/python3.5/site-packages/Cython/Includes/numpy/__init__.pxd":1012 - * _import_umath() - * except Exception: - * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<< - */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 1012, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 1044, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); - /* "View.MemoryView":132 + /* "View.MemoryView":133 * * if not self.ndim: * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<< * * if itemsize <= 0: */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); - /* "View.MemoryView":135 + /* "View.MemoryView":136 * * if itemsize <= 0: * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<< * * if not isinstance(format, bytes): */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 135, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - - /* "View.MemoryView":138 - * - * if not isinstance(format, bytes): - * format = format.encode('ASCII') # <<<<<<<<<<<<<< - * self._format = format # keep a reference to the byte string - * self.format = self._format - */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_ASCII); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); - /* "View.MemoryView":147 + /* "View.MemoryView":148 * * if not self._shape: * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<< * * */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); - /* "View.MemoryView":175 + /* "View.MemoryView":176 * self.data = malloc(self.len) * if not self.data: * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<< * * if self.dtype_is_object: */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 175, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); - /* "View.MemoryView":191 + /* "View.MemoryView":192 * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS * if not (flags & bufmode): * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<< * info.buf = self.data * info.len = self.len */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 191, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -26494,76 +27524,76 @@ static int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); - /* "View.MemoryView":413 + /* "View.MemoryView":418 * def __setitem__(memoryview self, object index, object value): * if self.view.readonly: * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<< * * have_slices, index = _unellipsify(index, self.view.ndim) */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); - /* "View.MemoryView":490 + /* "View.MemoryView":495 * result = struct.unpack(self.view.format, bytesitem) * except struct.error: * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<< * else: * if len(self.view.format) == 1: */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 495, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); - /* "View.MemoryView":515 + /* "View.MemoryView":520 * def __getbuffer__(self, Py_buffer *info, int flags): * if flags & PyBUF_WRITABLE and self.view.readonly: * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<< * - * if flags & PyBUF_STRIDES: + * if flags & PyBUF_ND: */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 515, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 520, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); - /* "View.MemoryView":565 + /* "View.MemoryView":570 * if self.view.strides == NULL: * * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<< * * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) */ - __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 565, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 570, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); - /* "View.MemoryView":572 + /* "View.MemoryView":577 * def suboffsets(self): * if self.view.suboffsets == NULL: * return (-1,) * self.view.ndim # <<<<<<<<<<<<<< * * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) */ - __pyx_tuple__22 = PyTuple_New(1); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 572, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); + __pyx_tuple__19 = PyTuple_New(1); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 577, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); __Pyx_INCREF(__pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); - PyTuple_SET_ITEM(__pyx_tuple__22, 0, __pyx_int_neg_1); - __Pyx_GIVEREF(__pyx_tuple__22); + PyTuple_SET_ITEM(__pyx_tuple__19, 0, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_tuple__19); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -26571,62 +27601,40 @@ static int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); - /* "View.MemoryView":677 + /* "View.MemoryView":682 * if item is Ellipsis: * if not seen_ellipsis: * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<< * seen_ellipsis = True * else: */ - __pyx_slice__25 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__25)) __PYX_ERR(2, 677, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__25); - __Pyx_GIVEREF(__pyx_slice__25); - - /* "View.MemoryView":680 - * seen_ellipsis = True - * else: - * result.append(slice(None)) # <<<<<<<<<<<<<< - * have_slices = True - * else: - */ - __pyx_slice__26 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__26)) __PYX_ERR(2, 680, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__26); - __Pyx_GIVEREF(__pyx_slice__26); - - /* "View.MemoryView":691 - * nslices = ndim - len(result) - * if nslices: - * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<< - * - * return have_slices or nslices, tuple(result) - */ - __pyx_slice__27 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__27)) __PYX_ERR(2, 691, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__27); - __Pyx_GIVEREF(__pyx_slice__27); + __pyx_slice__22 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__22)) __PYX_ERR(2, 682, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__22); + __Pyx_GIVEREF(__pyx_slice__22); - /* "View.MemoryView":698 + /* "View.MemoryView":703 * for suboffset in suboffsets[:ndim]: * if suboffset >= 0: * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<< * * */ - __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 698, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 703, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); /* "(tree fragment)":2 * def __reduce_cython__(self): @@ -26634,239 +27642,239 @@ static int __Pyx_InitCachedConstants(void) { * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") */ - __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); /* "(tree fragment)":4 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") * def __setstate_cython__(self, __pyx_state): * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< */ - __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(2, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); - /* "Orange/distance/_distance.pyx":25 + /* "Orange/distance/_distance.pyx":29 * * * def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_tuple__31 = PyTuple_Pack(17, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_dist_missing, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_ival1, __pyx_n_s_ival2); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(6, 0, 17, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_euclidean_rows_discrete, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_tuple__26 = PyTuple_Pack(20, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_dist_missing, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(7, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_euclidean_rows_discrete, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 29, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":57 + /* "Orange/distance/_distance.pyx":65 * * * def fix_euclidean_rows( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_tuple__33 = PyTuple_Pack(16, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(7, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_rows, 57, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(19, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(8, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_rows, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 65, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":92 + /* "Orange/distance/_distance.pyx":104 * * * def fix_euclidean_rows_normalized( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_tuple__35 = PyTuple_Pack(16, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(7, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_rows_normalized, 92, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_tuple__30 = PyTuple_Pack(19, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(8, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_rows_normalized, 104, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 104, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":127 + /* "Orange/distance/_distance.pyx":143 * * * def fix_euclidean_cols( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x, */ - __pyx_tuple__37 = PyTuple_Pack(12, __pyx_n_s_distances, __pyx_n_s_x, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_cols, 127, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_tuple__32 = PyTuple_Pack(15, __pyx_n_s_distances, __pyx_n_s_x, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_callback, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_col_start); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_cols, 143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 143, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":157 + /* "Orange/distance/_distance.pyx":177 * * * def fix_euclidean_cols_normalized( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x, */ - __pyx_tuple__39 = PyTuple_Pack(12, __pyx_n_s_distances, __pyx_n_s_x, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 157, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_cols_normalized, 157, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 157, __pyx_L1_error) + __pyx_tuple__34 = PyTuple_Pack(15, __pyx_n_s_distances, __pyx_n_s_x, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_callback, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_col_start); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); + __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_cols_normalized, 177, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 177, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":186 + /* "Orange/distance/_distance.pyx":210 * * * def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x2, * char two_tables): */ - __pyx_tuple__41 = PyTuple_Pack(13, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); - __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(3, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_manhattan_rows_cont, 186, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_tuple__36 = PyTuple_Pack(13, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); + __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(3, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_manhattan_rows_cont, 210, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 210, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":206 + /* "Orange/distance/_distance.pyx":230 * return distances * * def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_tuple__43 = PyTuple_Pack(16, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_medians, __pyx_n_s_mads, __pyx_n_s_dist_missing2_cont, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); - __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(7, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_manhattan_rows, 206, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_tuple__38 = PyTuple_Pack(16, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_medians, __pyx_n_s_mads, __pyx_n_s_dist_missing2_cont, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__38); + __Pyx_GIVEREF(__pyx_tuple__38); + __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(7, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_manhattan_rows, 230, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 230, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":239 + /* "Orange/distance/_distance.pyx":263 * * * def fix_manhattan_rows_normalized(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_tuple__45 = PyTuple_Pack(13, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 239, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); - __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_manhattan_rows_normalized, 239, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_tuple__40 = PyTuple_Pack(13, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 263, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); + __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_manhattan_rows_normalized, 263, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 263, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":269 + /* "Orange/distance/_distance.pyx":293 * * * def manhattan_cols(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1] medians, * np.ndarray[np.float64_t, ndim=1] mads, */ - __pyx_tuple__47 = PyTuple_Pack(13, __pyx_n_s_x, __pyx_n_s_medians, __pyx_n_s_mads, __pyx_n_s_normalize, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 269, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__47); - __Pyx_GIVEREF(__pyx_tuple__47); - __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_manhattan_cols, 269, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_tuple__42 = PyTuple_Pack(13, __pyx_n_s_x, __pyx_n_s_medians, __pyx_n_s_mads, __pyx_n_s_normalize, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_manhattan_cols, 293, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 293, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":310 + /* "Orange/distance/_distance.pyx":334 * * * def p_nonzero(np.ndarray[np.float64_t, ndim=1] x): # <<<<<<<<<<<<<< * cdef: * int row, nonzeros, nonnans */ - __pyx_tuple__49 = PyTuple_Pack(5, __pyx_n_s_x, __pyx_n_s_row, __pyx_n_s_nonzeros, __pyx_n_s_nonnans, __pyx_n_s_val); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 310, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__49); - __Pyx_GIVEREF(__pyx_tuple__49); - __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_p_nonzero, 310, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 310, __pyx_L1_error) + __pyx_tuple__44 = PyTuple_Pack(5, __pyx_n_s_x, __pyx_n_s_row, __pyx_n_s_nonzeros, __pyx_n_s_nonnans, __pyx_n_s_val); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 334, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_p_nonzero, 334, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 334, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":324 + /* "Orange/distance/_distance.pyx":348 * return float(nonzeros) / nonnans * * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< * cdef: * int row, n_cols, n_rows */ - __pyx_tuple__51 = PyTuple_Pack(6, __pyx_n_s_x, __pyx_n_s_row, __pyx_n_s_n_cols, __pyx_n_s_n_rows, __pyx_n_s_flags, __pyx_n_s_col); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 324, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__51); - __Pyx_GIVEREF(__pyx_tuple__51); - __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_any_nan_row, 324, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_tuple__46 = PyTuple_Pack(6, __pyx_n_s_x, __pyx_n_s_row, __pyx_n_s_n_cols, __pyx_n_s_n_rows, __pyx_n_s_flags, __pyx_n_s_col); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_any_nan_row, 348, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 348, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":340 + /* "Orange/distance/_distance.pyx":364 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< * np.ndarray[np.int8_t, ndim=2] nonzeros2, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_tuple__53 = PyTuple_Pack(21, __pyx_n_s_nonzeros1, __pyx_n_s_nonzeros2, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_nans1, __pyx_n_s_nans2, __pyx_n_s_ps, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 340, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__53); - __Pyx_GIVEREF(__pyx_tuple__53); - __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(8, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_rows, 340, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) __PYX_ERR(0, 340, __pyx_L1_error) + __pyx_tuple__48 = PyTuple_Pack(21, __pyx_n_s_nonzeros1, __pyx_n_s_nonzeros2, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_nans1, __pyx_n_s_nans2, __pyx_n_s_ps, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 364, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__48); + __Pyx_GIVEREF(__pyx_tuple__48); + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(8, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_rows, 364, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 364, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":416 + /* "Orange/distance/_distance.pyx":440 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x, * np.ndarray[np.int8_t, ndim=1] nans, */ - __pyx_tuple__55 = PyTuple_Pack(23, __pyx_n_s_nonzeros, __pyx_n_s_x, __pyx_n_s_nans, __pyx_n_s_ps, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_in_both, __pyx_n_s_in_any, __pyx_n_s_in1_unk2, __pyx_n_s_unk1_in2, __pyx_n_s_unk1_unk2, __pyx_n_s_unk1_not2, __pyx_n_s_not1_unk2, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(0, 416, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__55); - __Pyx_GIVEREF(__pyx_tuple__55); - __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(4, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_cols, 416, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_tuple__50 = PyTuple_Pack(23, __pyx_n_s_nonzeros, __pyx_n_s_x, __pyx_n_s_nans, __pyx_n_s_ps, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_in_both, __pyx_n_s_in_any, __pyx_n_s_in1_unk2, __pyx_n_s_unk1_in2, __pyx_n_s_unk1_unk2, __pyx_n_s_unk1_not2, __pyx_n_s_not1_unk2, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 440, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(4, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_cols, 440, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 440, __pyx_L1_error) - /* "View.MemoryView":285 + /* "View.MemoryView":286 * return self.name * * cdef generic = Enum("") # <<<<<<<<<<<<<< * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(2, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__57); - __Pyx_GIVEREF(__pyx_tuple__57); + __pyx_tuple__52 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(2, 286, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__52); + __Pyx_GIVEREF(__pyx_tuple__52); - /* "View.MemoryView":286 + /* "View.MemoryView":287 * * cdef generic = Enum("") * cdef strided = Enum("") # default # <<<<<<<<<<<<<< * cdef indirect = Enum("") * */ - __pyx_tuple__58 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(2, 286, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__58); - __Pyx_GIVEREF(__pyx_tuple__58); + __pyx_tuple__53 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(2, 287, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__53); + __Pyx_GIVEREF(__pyx_tuple__53); - /* "View.MemoryView":287 + /* "View.MemoryView":288 * cdef generic = Enum("") * cdef strided = Enum("") # default * cdef indirect = Enum("") # <<<<<<<<<<<<<< * * */ - __pyx_tuple__59 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__59); - __Pyx_GIVEREF(__pyx_tuple__59); + __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(2, 288, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__54); + __Pyx_GIVEREF(__pyx_tuple__54); - /* "View.MemoryView":290 + /* "View.MemoryView":291 * * * cdef contiguous = Enum("") # <<<<<<<<<<<<<< * cdef indirect_contiguous = Enum("") * */ - __pyx_tuple__60 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(2, 290, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__60); - __Pyx_GIVEREF(__pyx_tuple__60); + __pyx_tuple__55 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(2, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__55); + __Pyx_GIVEREF(__pyx_tuple__55); - /* "View.MemoryView":291 + /* "View.MemoryView":292 * * cdef contiguous = Enum("") * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< * * */ - __pyx_tuple__61 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(2, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__61); - __Pyx_GIVEREF(__pyx_tuple__61); + __pyx_tuple__56 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(2, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__56); + __Pyx_GIVEREF(__pyx_tuple__56); /* "(tree fragment)":1 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * if __pyx_checksum != 0xb068931: - * from pickle import PickleError as __pyx_PickleError + * cdef object __pyx_PickleError + * cdef object __pyx_result */ - __pyx_tuple__62 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__62); - __Pyx_GIVEREF(__pyx_tuple__62); - __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(2, 1, __pyx_L1_error) + __pyx_tuple__57 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(2, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__57); + __Pyx_GIVEREF(__pyx_tuple__57); + __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(2, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -26874,7 +27882,7 @@ static int __Pyx_InitCachedConstants(void) { return -1; } -static int __Pyx_InitGlobals(void) { +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -26885,13 +27893,13 @@ static int __Pyx_InitGlobals(void) { return -1; } -static int __Pyx_modinit_global_init_code(void); /*proto*/ -static int __Pyx_modinit_variable_export_code(void); /*proto*/ -static int __Pyx_modinit_function_export_code(void); /*proto*/ -static int __Pyx_modinit_type_init_code(void); /*proto*/ -static int __Pyx_modinit_type_import_code(void); /*proto*/ -static int __Pyx_modinit_variable_import_code(void); /*proto*/ -static int __Pyx_modinit_function_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ static int __Pyx_modinit_global_init_code(void) { __Pyx_RefNannyDeclarations @@ -26928,17 +27936,21 @@ static int __Pyx_modinit_type_init_code(void) { /*--- Type init code ---*/ __pyx_vtabptr_array = &__pyx_vtable_array; __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview; - if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 104, __pyx_L1_error) + if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type___pyx_array.tp_print = 0; - if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 104, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 104, __pyx_L1_error) + #endif + if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error) __pyx_array_type = &__pyx_type___pyx_array; - if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 278, __pyx_L1_error) + if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type___pyx_MemviewEnum.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 278, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error) __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum; __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview; __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer; @@ -26948,26 +27960,30 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed; __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object; __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object; - if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 329, __pyx_L1_error) + if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type___pyx_memoryview.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 329, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 329, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error) __pyx_memoryview_type = &__pyx_type___pyx_memoryview; __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice; __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview; __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object; __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object; __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type; - if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 960, __pyx_L1_error) + if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 __pyx_type___pyx_memoryviewslice.tp_print = 0; + #endif if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) { __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr; } - if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 960, __pyx_L1_error) - if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 960, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error) __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice; __Pyx_RefNannyFinishContext(); return 0; @@ -26978,23 +27994,37 @@ static int __Pyx_modinit_type_init_code(void) { static int __Pyx_modinit_type_import_code(void) { __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); /*--- Type import code ---*/ - __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type", #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000 sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif - 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(3, 9, __pyx_L1_error) - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(1, 164, __pyx_L1_error) - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 186, __pyx_L1_error) - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 190, __pyx_L1_error) - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 199, __pyx_L1_error) - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 872, __pyx_L1_error) + __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore); + if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 206, __pyx_L1_error) + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 229, __pyx_L1_error) + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 233, __pyx_L1_error) + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore); + if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 242, __pyx_L1_error) + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn); + if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 918, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_RefNannyFinishContext(); return -1; } @@ -27029,15 +28059,6 @@ static int __Pyx_modinit_function_import_code(void) { #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC #endif #endif -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4))) - #define CYTHON_SMALL_CODE __attribute__((optimize("Os"))) -#else - #define CYTHON_SMALL_CODE -#endif -#endif #if PY_MAJOR_VERSION < 3 @@ -27050,11 +28071,36 @@ __Pyx_PyMODINIT_FUNC PyInit__distance(void) { return PyModuleDef_Init(&__pyx_moduledef); } -static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) { +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + #if PY_VERSION_HEX >= 0x030700A1 + static PY_INT64_T main_interpreter_id = -1; + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return (unlikely(current_id == -1)) ? -1 : 0; + } else if (unlikely(main_interpreter_id != current_id)) + #else + static PyInterpreterState *main_interpreter = NULL; + PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; + if (!main_interpreter) { + main_interpreter = current_interpreter; + } else if (unlikely(main_interpreter != current_interpreter)) + #endif + { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { PyObject *value = PyObject_GetAttrString(spec, from_name); int result = 0; if (likely(value)) { - result = PyDict_SetItemString(moddict, to_name, value); + if (allow_none || value != Py_None) { + result = PyDict_SetItemString(moddict, to_name, value); + } Py_DECREF(value); } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); @@ -27063,8 +28109,10 @@ static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const ch } return result; } -static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { PyObject *module = NULL, *moddict, *modname; + if (__Pyx_check_single_interpreter()) + return NULL; if (__pyx_m) return __Pyx_NewRef(__pyx_m); modname = PyObject_GetAttrString(spec, "name"); @@ -27074,10 +28122,10 @@ static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *d if (unlikely(!module)) goto bad; moddict = PyModule_GetDict(module); if (unlikely(!moddict)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; return module; bad: Py_XDECREF(module); @@ -27085,7 +28133,7 @@ static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *d } -static int __pyx_pymod_exec__distance(PyObject *__pyx_pyinit_module) +static CYTHON_SMALL_CODE int __pyx_pymod_exec__distance(PyObject *__pyx_pyinit_module) #endif #endif { @@ -27093,7 +28141,11 @@ static int __pyx_pymod_exec__distance(PyObject *__pyx_pyinit_module) static PyThread_type_lock __pyx_t_2[8]; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0; + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module '_distance' has already been imported. Re-initialisation is not supported."); + return -1; + } #elif PY_MAJOR_VERSION >= 3 if (__pyx_m) return __Pyx_NewRef(__pyx_m); #endif @@ -27108,6 +28160,9 @@ if (!__Pyx_RefNanny) { #endif __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__distance(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pxy_PyFrame_Initialize_Offsets + __Pxy_PyFrame_Initialize_Offsets(); + #endif __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) @@ -27151,10 +28206,9 @@ if (!__Pyx_RefNanny) { __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); - #endif + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) @@ -27162,7 +28216,7 @@ if (!__Pyx_RefNanny) { if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_Orange__distance___distance) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { @@ -27173,9 +28227,9 @@ if (!__Pyx_RefNanny) { } #endif /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error; /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error; /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); @@ -27196,165 +28250,165 @@ if (!__Pyx_RefNanny) { * cimport numpy as np * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":25 + /* "Orange/distance/_distance.pyx":29 * * * def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_3euclidean_rows_discrete, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_3euclidean_rows_discrete, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_euclidean_rows_discrete, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_euclidean_rows_discrete, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":57 + /* "Orange/distance/_distance.pyx":65 * * * def fix_euclidean_rows( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_5fix_euclidean_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_5fix_euclidean_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_rows, __pyx_t_1) < 0) __PYX_ERR(0, 57, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_rows, __pyx_t_1) < 0) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":92 + /* "Orange/distance/_distance.pyx":104 * * * def fix_euclidean_rows_normalized( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_rows_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_rows_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":127 + /* "Orange/distance/_distance.pyx":143 * * * def fix_euclidean_cols( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_9fix_euclidean_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_9fix_euclidean_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_cols, __pyx_t_1) < 0) __PYX_ERR(0, 127, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_cols, __pyx_t_1) < 0) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":157 + /* "Orange/distance/_distance.pyx":177 * * * def fix_euclidean_cols_normalized( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_cols_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 157, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_cols_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 177, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":186 + /* "Orange/distance/_distance.pyx":210 * * * def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x2, * char two_tables): */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_13manhattan_rows_cont, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_13manhattan_rows_cont, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_manhattan_rows_cont, __pyx_t_1) < 0) __PYX_ERR(0, 186, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_manhattan_rows_cont, __pyx_t_1) < 0) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":206 + /* "Orange/distance/_distance.pyx":230 * return distances * * def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_15fix_manhattan_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_15fix_manhattan_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_manhattan_rows, __pyx_t_1) < 0) __PYX_ERR(0, 206, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_manhattan_rows, __pyx_t_1) < 0) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":239 + /* "Orange/distance/_distance.pyx":263 * * * def fix_manhattan_rows_normalized(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_manhattan_rows_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 239, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_manhattan_rows_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":269 + /* "Orange/distance/_distance.pyx":293 * * * def manhattan_cols(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1] medians, * np.ndarray[np.float64_t, ndim=1] mads, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_19manhattan_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_19manhattan_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_manhattan_cols, __pyx_t_1) < 0) __PYX_ERR(0, 269, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_manhattan_cols, __pyx_t_1) < 0) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":310 + /* "Orange/distance/_distance.pyx":334 * * * def p_nonzero(np.ndarray[np.float64_t, ndim=1] x): # <<<<<<<<<<<<<< * cdef: * int row, nonzeros, nonnans */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_21p_nonzero, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 310, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_21p_nonzero, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_p_nonzero, __pyx_t_1) < 0) __PYX_ERR(0, 310, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_p_nonzero, __pyx_t_1) < 0) __PYX_ERR(0, 334, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":324 + /* "Orange/distance/_distance.pyx":348 * return float(nonzeros) / nonnans * * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< * cdef: * int row, n_cols, n_rows */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_23any_nan_row, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 324, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_23any_nan_row, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_any_nan_row, __pyx_t_1) < 0) __PYX_ERR(0, 324, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_any_nan_row, __pyx_t_1) < 0) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":340 + /* "Orange/distance/_distance.pyx":364 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< * np.ndarray[np.int8_t, ndim=2] nonzeros2, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_25jaccard_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_25jaccard_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_rows, __pyx_t_1) < 0) __PYX_ERR(0, 340, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_rows, __pyx_t_1) < 0) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":416 + /* "Orange/distance/_distance.pyx":440 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x, * np.ndarray[np.int8_t, ndim=1] nans, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_27jaccard_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 416, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_27jaccard_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_cols, __pyx_t_1) < 0) __PYX_ERR(0, 416, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_cols, __pyx_t_1) < 0) __PYX_ERR(0, 440, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "Orange/distance/_distance.pyx":1 @@ -27367,90 +28421,90 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":208 + /* "View.MemoryView":209 * info.obj = self * * __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * * def __dealloc__(array self): */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 208, __pyx_L1_error) + __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 208, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 209, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_array_type); - /* "View.MemoryView":285 + /* "View.MemoryView":286 * return self.name * * cdef generic = Enum("") # <<<<<<<<<<<<<< * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 285, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(generic); __Pyx_DECREF_SET(generic, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":286 + /* "View.MemoryView":287 * * cdef generic = Enum("") * cdef strided = Enum("") # default # <<<<<<<<<<<<<< * cdef indirect = Enum("") * */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 286, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(strided); __Pyx_DECREF_SET(strided, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":287 + /* "View.MemoryView":288 * cdef generic = Enum("") * cdef strided = Enum("") # default * cdef indirect = Enum("") # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__59, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(indirect); __Pyx_DECREF_SET(indirect, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":290 + /* "View.MemoryView":291 * * * cdef contiguous = Enum("") # <<<<<<<<<<<<<< * cdef indirect_contiguous = Enum("") * */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__60, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 290, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(contiguous); __Pyx_DECREF_SET(contiguous, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":291 + /* "View.MemoryView":292 * * cdef contiguous = Enum("") * cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__61, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 291, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(indirect_contiguous); __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "View.MemoryView":315 + /* "View.MemoryView":316 * * DEF THREAD_LOCKS_PREALLOCATED = 8 * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<< @@ -27459,7 +28513,7 @@ if (!__Pyx_RefNanny) { */ __pyx_memoryview_thread_locks_used = 0; - /* "View.MemoryView":316 + /* "View.MemoryView":317 * DEF THREAD_LOCKS_PREALLOCATED = 8 * cdef int __pyx_memoryview_thread_locks_used = 0 * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<< @@ -27476,43 +28530,43 @@ if (!__Pyx_RefNanny) { __pyx_t_2[7] = PyThread_allocate_lock(); memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2, sizeof(__pyx_memoryview_thread_locks[0]) * (8)); - /* "View.MemoryView":544 + /* "View.MemoryView":549 * info.obj = self * * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 544, __pyx_L1_error) + __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 549, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 544, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 549, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_memoryview_type); - /* "View.MemoryView":990 + /* "View.MemoryView":995 * return self.from_object * * __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 990, __pyx_L1_error) + __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 995, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 990, __pyx_L1_error) + if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 995, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_memoryviewslice_type); /* "(tree fragment)":1 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< - * if __pyx_checksum != 0xb068931: - * from pickle import PickleError as __pyx_PickleError + * cdef object __pyx_PickleError + * cdef object __pyx_result */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "(tree fragment)":9 + /* "(tree fragment)":11 * __pyx_unpickle_Enum__set_state( __pyx_result, __pyx_state) * return __pyx_result * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< @@ -27527,9 +28581,9 @@ if (!__Pyx_RefNanny) { __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { if (__pyx_d) { - __Pyx_AddTraceback("init Orange.distance._distance", 0, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init Orange.distance._distance", __pyx_clineno, __pyx_lineno, __pyx_filename); } - Py_DECREF(__pyx_m); __pyx_m = 0; + Py_CLEAR(__pyx_m); } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init Orange.distance._distance"); } @@ -27550,9 +28604,9 @@ if (!__Pyx_RefNanny) { static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; - m = PyImport_ImportModule((char *)modname); + m = PyImport_ImportModule(modname); if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + p = PyObject_GetAttrString(m, "RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: @@ -27590,147 +28644,321 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { return result; } -/* None */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); -} - -/* MemviewSliceInit */ -static int -__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, - int ndim, - __Pyx_memviewslice *memviewslice, - int memview_is_new_reference) -{ - __Pyx_RefNannyDeclarations - int i, retval=-1; - Py_buffer *buf = &memview->view; - __Pyx_RefNannySetupContext("init_memviewslice", 0); - if (!buf) { - PyErr_SetString(PyExc_ValueError, - "buf is NULL."); - goto fail; - } else if (memviewslice->memview || memviewslice->data) { - PyErr_SetString(PyExc_ValueError, - "memviewslice is already initialized!"); - goto fail; +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = func->ob_type->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); } - if (buf->strides) { - for (i = 0; i < ndim; i++) { - memviewslice->strides[i] = buf->strides[i]; - } + return result; +} +#endif + +/* PyCFunctionFastCall */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { + PyCFunctionObject *func = (PyCFunctionObject*)func_obj; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + int flags = PyCFunction_GET_FLAGS(func); + assert(PyCFunction_Check(func)); + assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + /* _PyCFunction_FastCallDict() must not be called with an exception set, + because it may clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { + return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); } else { - Py_ssize_t stride = buf->itemsize; - for (i = ndim - 1; i >= 0; i--) { - memviewslice->strides[i] = stride; - stride *= buf->shape[i]; + return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); + } +} +#endif + +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; +} +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; +#endif + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + return NULL; + } + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && +#endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; } } - for (i = 0; i < ndim; i++) { - memviewslice->shape[i] = buf->shape[i]; - if (buf->suboffsets) { - memviewslice->suboffsets[i] = buf->suboffsets[i]; - } else { - memviewslice->suboffsets[i] = -1; + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; } - memviewslice->memview = memview; - memviewslice->data = (char *)buf->buf; - if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { - Py_INCREF(memview); + else { + kwtuple = NULL; + k = NULL; } - retval = 0; - goto no_fail; -fail: - memviewslice->memview = 0; - memviewslice->data = 0; - retval = -1; -no_fail: - __Pyx_RefNannyFinishContext(); - return retval; -} -#ifndef Py_NO_RETURN -#define Py_NO_RETURN + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); #endif -static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { - va_list vargs; - char msg[200]; -#ifdef HAVE_STDARG_PROTOTYPES - va_start(vargs, fmt); + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); #else - va_start(vargs); + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, closure); #endif - vsnprintf(msg, 200, fmt, vargs); - va_end(vargs); - Py_FatalError(msg); + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; } -static CYTHON_INLINE int -__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)++; - PyThread_release_lock(lock); +#endif +#endif + +/* PyObjectCall2Args */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args, *result = NULL; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyFunction_FastCall(function, args, 2); + } + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyCFunction_FastCall(function, args, 2); + } + #endif + args = PyTuple_New(2); + if (unlikely(!args)) goto done; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + Py_INCREF(function); + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); +done: return result; } -static CYTHON_INLINE int -__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count, - PyThread_type_lock lock) -{ - int result; - PyThread_acquire_lock(lock, 1); - result = (*acquisition_count)--; - PyThread_release_lock(lock); + +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallOneArg */ +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, &arg, 1); + } +#endif + if (likely(PyCFunction_Check(func))) { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#endif + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); return result; } -static CYTHON_INLINE void -__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) -{ - int first_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (!memview || (PyObject *) memview == Py_None) - return; - if (__pyx_get_slice_count(memview) < 0) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - first_time = __pyx_add_acquisition_count(memview) == 0; - if (first_time) { - if (have_gil) { - Py_INCREF((PyObject *) memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_INCREF((PyObject *) memview); - PyGILState_Release(_gilstate); - } - } +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); } -static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, - int have_gil, int lineno) { - int last_time; - struct __pyx_memoryview_obj *memview = memslice->memview; - if (!memview ) { - return; - } else if ((PyObject *) memview == Py_None) { - memslice->memview = NULL; - return; +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} +#endif + +/* WriteUnraisableException */ +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, + int full_traceback, CYTHON_UNUSED int nogil) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_PyThreadState_declare +#ifdef WITH_THREAD + PyGILState_STATE state; + if (nogil) + state = PyGILState_Ensure(); +#ifdef _MSC_VER + else state = (PyGILState_STATE)-1; +#endif +#endif + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + if (full_traceback) { + Py_XINCREF(old_exc); + Py_XINCREF(old_val); + Py_XINCREF(old_tb); + __Pyx_ErrRestore(old_exc, old_val, old_tb); + PyErr_PrintEx(1); } - if (__pyx_get_slice_count(memview) <= 0) - __pyx_fatalerror("Acquisition count is %d (line %d)", - __pyx_get_slice_count(memview), lineno); - last_time = __pyx_sub_acquisition_count(memview) == 1; - memslice->data = NULL; - if (last_time) { - if (have_gil) { - Py_CLEAR(memslice->memview); - } else { - PyGILState_STATE _gilstate = PyGILState_Ensure(); - Py_CLEAR(memslice->memview); - PyGILState_Release(_gilstate); - } + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); } else { - memslice->memview = NULL; + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); } +#ifdef WITH_THREAD + if (nogil) + PyGILState_Release(state); +#endif } /* RaiseArgTupleInvalid */ @@ -27851,28 +29079,167 @@ static int __Pyx_ParseOptionalKeywords( if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { - goto invalid_keyword; + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +/* None */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* MemviewSliceInit */ +static int +__Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, + int ndim, + __Pyx_memviewslice *memviewslice, + int memview_is_new_reference) +{ + __Pyx_RefNannyDeclarations + int i, retval=-1; + Py_buffer *buf = &memview->view; + __Pyx_RefNannySetupContext("init_memviewslice", 0); + if (memviewslice->memview || memviewslice->data) { + PyErr_SetString(PyExc_ValueError, + "memviewslice is already initialized!"); + goto fail; + } + if (buf->strides) { + for (i = 0; i < ndim; i++) { + memviewslice->strides[i] = buf->strides[i]; + } + } else { + Py_ssize_t stride = buf->itemsize; + for (i = ndim - 1; i >= 0; i--) { + memviewslice->strides[i] = stride; + stride *= buf->shape[i]; + } + } + for (i = 0; i < ndim; i++) { + memviewslice->shape[i] = buf->shape[i]; + if (buf->suboffsets) { + memviewslice->suboffsets[i] = buf->suboffsets[i]; + } else { + memviewslice->suboffsets[i] = -1; + } + } + memviewslice->memview = memview; + memviewslice->data = (char *)buf->buf; + if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) { + Py_INCREF(memview); + } + retval = 0; + goto no_fail; +fail: + memviewslice->memview = 0; + memviewslice->data = 0; + retval = -1; +no_fail: + __Pyx_RefNannyFinishContext(); + return retval; +} +#ifndef Py_NO_RETURN +#define Py_NO_RETURN +#endif +static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN { + va_list vargs; + char msg[200]; +#ifdef HAVE_STDARG_PROTOTYPES + va_start(vargs, fmt); +#else + va_start(vargs); +#endif + vsnprintf(msg, 200, fmt, vargs); + va_end(vargs); + Py_FatalError(msg); +} +static CYTHON_INLINE int +__pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)++; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE int +__pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count, + PyThread_type_lock lock) +{ + int result; + PyThread_acquire_lock(lock, 1); + result = (*acquisition_count)--; + PyThread_release_lock(lock); + return result; +} +static CYTHON_INLINE void +__Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) +{ + int first_time; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (!memview || (PyObject *) memview == Py_None) + return; + if (__pyx_get_slice_count(memview) < 0) + __pyx_fatalerror("Acquisition count is %d (line %d)", + __pyx_get_slice_count(memview), lineno); + first_time = __pyx_add_acquisition_count(memview) == 0; + if (first_time) { + if (have_gil) { + Py_INCREF((PyObject *) memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_INCREF((PyObject *) memview); + PyGILState_Release(_gilstate); + } + } +} +static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, + int have_gil, int lineno) { + int last_time; + struct __pyx_memoryview_obj *memview = memslice->memview; + if (!memview ) { + return; + } else if ((PyObject *) memview == Py_None) { + memslice->memview = NULL; + return; + } + if (__pyx_get_slice_count(memview) <= 0) + __pyx_fatalerror("Acquisition count is %d (line %d)", + __pyx_get_slice_count(memview), lineno); + last_time = __pyx_sub_acquisition_count(memview) == 1; + memslice->data = NULL; + if (last_time) { + if (have_gil) { + Py_CLEAR(memslice->memview); + } else { + PyGILState_STATE _gilstate = PyGILState_Ensure(); + Py_CLEAR(memslice->memview); + PyGILState_Release(_gilstate); } + } else { + memslice->memview = NULL; } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; } /* ArgTypeTest */ @@ -27942,7 +29309,7 @@ static int __Pyx_BufFmt_ParseNumber(const char** ts) { return -1; } else { count = *t++ - '0'; - while (*t >= '0' && *t < '9') { + while (*t >= '0' && *t <= '9') { count *= 10; count += *t++ - '0'; } @@ -28442,7 +29809,7 @@ static int __Pyx__GetBufferAndValidate( __Pyx_BufFmt_Init(&ctx, stack, dtype); if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } - if (unlikely((unsigned)buf->itemsize != dtype->size)) { + if (unlikely((size_t)buf->itemsize != dtype->size)) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", @@ -28456,98 +29823,726 @@ fail:; return -1; } -/* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); +/* PyDictVersioning */ + #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; } -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); } #endif /* GetModuleGlobalName */ - static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + #if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ PyObject *result; #if !CYTHON_AVOID_BORROWED_REFS #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) if (likely(result)) { - Py_INCREF(result); + return __Pyx_NewRef(result); } else if (unlikely(PyErr_Occurred())) { - result = NULL; + return NULL; + } +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* ExtTypeTest */ + static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(__Pyx_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +/* BufferFallbackError */ + static void __Pyx_RaiseBufferFallbackError(void) { + PyErr_SetString(PyExc_ValueError, + "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); +} + +/* FetchCommonType */ + static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* fake_module; + PyTypeObject* cached_type = NULL; + fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); + if (!fake_module) return NULL; + Py_INCREF(fake_module); + cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); + if (cached_type) { + if (!PyType_Check((PyObject*)cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", + type->tp_name); + goto bad; + } + if (cached_type->tp_basicsize != type->tp_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + type->tp_name); + goto bad; + } } else { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; + } +done: + Py_DECREF(fake_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} + +/* CythonFunction */ + #include +static PyObject * +__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) +{ + if (unlikely(op->func_doc == NULL)) { + if (op->func.m_ml->ml_doc) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); +#endif + if (unlikely(op->func_doc == NULL)) + return NULL; + } else { + Py_INCREF(Py_None); + return Py_None; + } + } + Py_INCREF(op->func_doc); + return op->func_doc; +} +static int +__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp = op->func_doc; + if (value == NULL) { + value = Py_None; + } + Py_INCREF(value); + op->func_doc = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + if (unlikely(op->func_name == NULL)) { +#if PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); +#else + op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); +#endif + if (unlikely(op->func_name == NULL)) + return NULL; + } + Py_INCREF(op->func_name); + return op->func_name; +} +static int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + tmp = op->func_name; + Py_INCREF(value); + op->func_name = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp; +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + tmp = op->func_qualname; + Py_INCREF(value); + op->func_qualname = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) +{ + PyObject *self; + self = m->func_closure; + if (self == NULL) + self = Py_None; + Py_INCREF(self); + return self; +} +static PyObject * +__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + if (unlikely(op->func_dict == NULL)) { + op->func_dict = PyDict_New(); + if (unlikely(op->func_dict == NULL)) + return NULL; + } + Py_INCREF(op->func_dict); + return op->func_dict; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) +{ + PyObject *tmp; + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + tmp = op->func_dict; + Py_INCREF(value); + op->func_dict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + Py_INCREF(op->func_globals); + return op->func_globals; +} +static PyObject * +__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + Py_INCREF(Py_None); + return Py_None; +} +static PyObject * +__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) +{ + PyObject* result = (op->func_code) ? op->func_code : Py_None; + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { + int result = 0; + PyObject *res = op->defaults_getter((PyObject *) op); + if (unlikely(!res)) + return -1; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + op->defaults_tuple = PyTuple_GET_ITEM(res, 0); + Py_INCREF(op->defaults_tuple); + op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); + Py_INCREF(op->defaults_kwdict); + #else + op->defaults_tuple = PySequence_ITEM(res, 0); + if (unlikely(!op->defaults_tuple)) result = -1; + else { + op->defaults_kwdict = PySequence_ITEM(res, 1); + if (unlikely(!op->defaults_kwdict)) result = -1; + } + #endif + Py_DECREF(res); + return result; +} +static int +__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyTuple_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__defaults__ must be set to a tuple object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_tuple; + op->defaults_tuple = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { + PyObject* result = op->defaults_tuple; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_tuple; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { + PyObject* tmp; + if (!value) { + value = Py_None; + } else if (value != Py_None && !PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__kwdefaults__ must be set to a dict object"); + return -1; + } + Py_INCREF(value); + tmp = op->defaults_kwdict; + op->defaults_kwdict = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { + PyObject* result = op->defaults_kwdict; + if (unlikely(!result)) { + if (op->defaults_getter) { + if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; + result = op->defaults_kwdict; + } else { + result = Py_None; + } + } + Py_INCREF(result); + return result; +} +static int +__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { + PyObject* tmp; + if (!value || value == Py_None) { + value = NULL; + } else if (!PyDict_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "__annotations__ must be set to a dict object"); + return -1; + } + Py_XINCREF(value); + tmp = op->func_annotations; + op->func_annotations = value; + Py_XDECREF(tmp); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { + PyObject* result = op->func_annotations; + if (unlikely(!result)) { + result = PyDict_New(); + if (unlikely(!result)) return NULL; + op->func_annotations = result; + } + Py_INCREF(result); + return result; +} +static PyGetSetDef __pyx_CyFunction_getsets[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {0, 0, 0, 0, 0} +}; +static PyMemberDef __pyx_CyFunction_members[] = { + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, + {0, 0, 0, 0, 0} +}; +static PyObject * +__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromString(m->func.m_ml->ml_name); +#else + return PyString_FromString(m->func.m_ml->ml_name); +#endif +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if PY_VERSION_HEX < 0x030500A0 +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) #else - result = PyDict_GetItem(__pyx_d, name); - if (likely(result)) { - Py_INCREF(result); - } else { +#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) #endif +static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); + if (op == NULL) + return NULL; + op->flags = flags; + __Pyx_CyFunction_weakreflist(op) = NULL; + op->func.m_ml = ml; + op->func.m_self = (PyObject *) op; + Py_XINCREF(closure); + op->func_closure = closure; + Py_XINCREF(module); + op->func.m_module = module; + op->func_dict = NULL; + op->func_name = NULL; + Py_INCREF(qualname); + op->func_qualname = qualname; + op->func_doc = NULL; + op->func_classobj = NULL; + op->func_globals = globals; + Py_INCREF(op->func_globals); + Py_XINCREF(code); + op->func_code = code; + op->defaults_pyobjects = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + PyObject_GC_Track(op); + return (PyObject *) op; +} +static int +__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) +{ + Py_CLEAR(m->func_closure); + Py_CLEAR(m->func.m_module); + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); + Py_CLEAR(m->func_classobj); + Py_CLEAR(m->defaults_tuple); + Py_CLEAR(m->defaults_kwdict); + Py_CLEAR(m->func_annotations); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyObject_Free(m->defaults); + m->defaults = NULL; + } + return 0; +} +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + PyObject_GC_Del(m); +} +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} +static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) +{ + Py_VISIT(m->func_closure); + Py_VISIT(m->func.m_module); + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + Py_VISIT(m->func_code); + Py_VISIT(m->func_classobj); + Py_VISIT(m->defaults_tuple); + Py_VISIT(m->defaults_kwdict); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); + } + return 0; +} +static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) +{ + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { + Py_INCREF(func); + return func; + } + if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { + if (type == NULL) + type = (PyObject *)(Py_TYPE(obj)); + return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); + } + if (obj == Py_None) + obj = NULL; + return __Pyx_PyMethod_New(func, obj, type); +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); #else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); #endif - result = __Pyx_GetBuiltinName(name); +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + Py_ssize_t size; + switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { + size = PyTuple_GET_SIZE(arg); + if (likely(size == 0)) + return (*meth)(self, NULL); + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { + size = PyTuple_GET_SIZE(arg); + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags in " + "__Pyx_CyFunction_Call. METH_OLDARGS is no " + "longer supported!"); + return NULL; } - return result; + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); + return NULL; } - -/* PyObjectCall */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; + argc = PyTuple_GET_SIZE(args); + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); } return result; } +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, + (destructor) __Pyx_CyFunction_dealloc, + 0, + 0, + 0, +#if PY_MAJOR_VERSION < 3 + 0, +#else + 0, #endif - -/* ExtTypeTest */ - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; + (reprfunc) __Pyx_CyFunction_repr, + 0, + 0, + 0, + 0, + __Pyx_CyFunction_CallAsMethod, + 0, + 0, + 0, + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, + 0, + (traverseproc) __Pyx_CyFunction_traverse, + (inquiry) __Pyx_CyFunction_clear, + 0, +#if PY_VERSION_HEX < 0x030500A0 + offsetof(__pyx_CyFunctionObject, func_weakreflist), +#else + offsetof(PyCFunctionObject, m_weakreflist), +#endif + 0, + 0, + __pyx_CyFunction_methods, + __pyx_CyFunction_members, + __pyx_CyFunction_getsets, + 0, + 0, + __Pyx_CyFunction_descr_get, + 0, + offsetof(__pyx_CyFunctionObject, func_dict), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 + 0, +#endif +}; +static int __pyx_CyFunction_init(void) { + __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); + if (unlikely(__pyx_CyFunctionType == NULL)) { + return -1; } - if (likely(__Pyx_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); return 0; } - -/* BufferFallbackError */ - static void __Pyx_RaiseBufferFallbackError(void) { - PyErr_SetString(PyExc_ValueError, - "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_Malloc(size); + if (unlikely(!m->defaults)) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); } /* RaiseException */ - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { __Pyx_PyThreadState_declare @@ -28625,300 +30620,102 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject if (instance_class != type) { int is_subclass = PyObject_IsSubclass(instance_class, type); if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -/* PyCFunctionFastCall */ - #if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs); - } -} -#endif - -/* PyFunctionFastCall */ - #if CYTHON_FAST_PYCALL -#include "frameobject.h" -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = f->f_localsplus; - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; } - else { - d = NULL; - nd = 0; + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); + PyErr_SetObject(type, value); + if (tb) { +#if CYTHON_COMPILING_IN_PYPY + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); #else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif -#endif - -/* PyObjectCallMethO */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); } +#endif } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; +bad: + Py_XDECREF(owned_instance); + return; } #endif /* DictGetItem */ - #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY + #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { PyObject *value; value = PyDict_GetItemWithError(d, key); if (unlikely(!value)) { if (!PyErr_Occurred()) { - PyObject* args = PyTuple_Pack(1, key); - if (likely(args)) - PyErr_SetObject(PyExc_KeyError, args); - Py_XDECREF(args); + if (unlikely(PyTuple_Check(key))) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) { + PyErr_SetObject(PyExc_KeyError, args); + Py_DECREF(args); + } + } else { + PyErr_SetObject(PyExc_KeyError, key); + } } return NULL; } @@ -28928,30 +30725,46 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { #endif /* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } /* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } /* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } +/* GetTopmostException */ + #if CYTHON_USE_EXC_INFO_STACK +static _PyErr_StackItem * +__Pyx_PyErr_GetTopmostException(PyThreadState *tstate) +{ + _PyErr_StackItem *exc_info = tstate->exc_info; + while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && + exc_info->previous_item != NULL) + { + exc_info = exc_info->previous_item; + } + return exc_info; +} +#endif + /* SaveResetException */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - #if PY_VERSION_HEX >= 0x030700A2 - *type = tstate->exc_state.exc_type; - *value = tstate->exc_state.exc_value; - *tb = tstate->exc_state.exc_traceback; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate); + *type = exc_info->exc_type; + *value = exc_info->exc_value; + *tb = exc_info->exc_traceback; #else *type = tstate->exc_type; *value = tstate->exc_value; @@ -28963,13 +30776,14 @@ static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject * } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; - #if PY_VERSION_HEX >= 0x030700A2 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = type; - tstate->exc_state.exc_value = value; - tstate->exc_state.exc_traceback = tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = type; + exc_info->exc_value = value; + exc_info->exc_traceback = tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; @@ -28985,7 +30799,7 @@ static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject #endif /* PyErrExceptionMatches */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { Py_ssize_t i, n; n = PyTuple_GET_SIZE(tuple); @@ -29010,11 +30824,12 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta #endif /* GetException */ - #if CYTHON_FAST_THREAD_STATE -static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + #if CYTHON_FAST_THREAD_STATE +static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) #else -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #endif +{ PyObject *local_type, *local_value, *local_tb; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; @@ -29047,13 +30862,16 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) *value = local_value; *tb = local_tb; #if CYTHON_FAST_THREAD_STATE - #if PY_VERSION_HEX >= 0x030700A2 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = local_type; - tstate->exc_state.exc_value = local_value; - tstate->exc_state.exc_traceback = local_tb; + #if CYTHON_USE_EXC_INFO_STACK + { + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = local_type; + exc_info->exc_value = local_value; + exc_info->exc_traceback = local_tb; + } #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; @@ -29080,7 +30898,7 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) } /* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { + static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else @@ -29127,7 +30945,7 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) } /* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { + static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else @@ -29206,6 +31024,9 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); @@ -29226,7 +31047,7 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) } /* GetAttr */ - static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { + static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { #if CYTHON_USE_TYPE_SLOTS #if PY_MAJOR_VERSION >= 3 if (likely(PyUnicode_Check(n))) @@ -29239,7 +31060,7 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) } /* GetItemInt */ - static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); @@ -29254,7 +31075,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_ if (wraparound & unlikely(i < 0)) { wrapped_i += PyList_GET_SIZE(o); } - if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) { + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; @@ -29272,7 +31093,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize if (wraparound & unlikely(i < 0)) { wrapped_i += PyTuple_GET_SIZE(o); } - if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) { + if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; @@ -29288,7 +31109,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { PyObject *r = PyList_GET_ITEM(o, n); Py_INCREF(r); return r; @@ -29296,7 +31117,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } else if (PyTuple_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, n); Py_INCREF(r); return r; @@ -29326,7 +31147,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } /* ObjectGetItem */ - #if CYTHON_USE_TYPE_SLOTS + #if CYTHON_USE_TYPE_SLOTS static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { PyObject *runerr; Py_ssize_t key_value; @@ -29355,7 +31176,7 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { #endif /* decode_c_string */ - static CYTHON_INLINE PyObject* __Pyx_decode_c_string( + static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { @@ -29388,7 +31209,7 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { } /* GetAttr3 */ - static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + static PyObject *__Pyx_GetAttr3Default(PyObject *d) { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) @@ -29403,16 +31224,17 @@ static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject } /* SwapException */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; - #if PY_VERSION_HEX >= 0x030700A2 - tmp_type = tstate->exc_state.exc_type; - tmp_value = tstate->exc_state.exc_value; - tmp_tb = tstate->exc_state.exc_traceback; - tstate->exc_state.exc_type = *type; - tstate->exc_state.exc_value = *value; - tstate->exc_state.exc_traceback = *tb; + #if CYTHON_USE_EXC_INFO_STACK + _PyErr_StackItem *exc_info = tstate->exc_info; + tmp_type = exc_info->exc_type; + tmp_value = exc_info->exc_value; + tmp_tb = exc_info->exc_traceback; + exc_info->exc_type = *type; + exc_info->exc_value = *value; + exc_info->exc_traceback = *tb; #else tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; @@ -29437,7 +31259,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, #endif /* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; @@ -29484,7 +31306,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); + name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( @@ -29502,7 +31324,7 @@ static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, } /* FastTypeChecks */ - #if CYTHON_COMPILING_IN_CPYTHON + #if CYTHON_COMPILING_IN_CPYTHON static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { while (a) { a = a->tp_base; @@ -29557,14 +31379,42 @@ static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, return res; } #endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 3 @@ -29810,7 +31620,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj #endif /* PyObject_GenericGetAttr */ - #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { return PyObject_GenericGetAttr(obj, attr_name); @@ -29820,7 +31630,7 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam #endif /* SetVTable */ - static int __Pyx_SetVtable(PyObject *dict, void *vtable) { + static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #if PY_VERSION_HEX >= 0x02070000 PyObject *ob = PyCapsule_New(vtable, 0, 0); #else @@ -29838,7 +31648,7 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam } /* SetupReduce */ - static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; PyObject *name_attr; name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2); @@ -29905,17 +31715,78 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { Py_XDECREF(object_reduce); Py_XDECREF(object_reduce_ex); #endif - Py_XDECREF(reduce); - Py_XDECREF(reduce_ex); - Py_XDECREF(reduce_cython); - Py_XDECREF(setstate); - Py_XDECREF(setstate_cython); - return ret; + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; +} + +/* TypeImport */ + #ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name, + size_t size, enum __Pyx_ImportType_CheckSize check_size) +{ + PyObject *result = 0; + char warning[200]; + Py_ssize_t basicsize; +#ifdef Py_LIMITED_API + PyObject *py_basicsize; +#endif + result = PyObject_GetAttrString(module, class_name); + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%.200s.%.200s is not a type object", + module_name, class_name); + goto bad; + } +#ifndef Py_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if ((size_t)basicsize < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + goto bad; + } + if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + goto bad; + } + else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(result); + return NULL; } +#endif /* CLineInTraceback */ - #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { + #ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON @@ -29928,7 +31799,9 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li #if CYTHON_COMPILING_IN_CPYTHON cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); if (likely(cython_runtime_dict)) { - use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback); + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, *cython_runtime_dict, + __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) } else #endif { @@ -29945,7 +31818,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li c_line = 0; PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } - else if (PyObject_Not(use_cline) != 0) { + else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; } __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); @@ -29954,7 +31827,7 @@ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_li #endif /* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -30034,7 +31907,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { } /* AddTraceback */ - #include "compile.h" + #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( @@ -30142,8 +32015,8 @@ static void __Pyx_ReleaseBuffer(Py_buffer *view) { #endif - /* MemviewSliceIsContig */ - static int + /* MemviewSliceIsContig */ + static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) { int i, index, step, start; @@ -30165,7 +32038,7 @@ __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim) } /* OverlappingSlices */ - static void + static void __pyx_get_array_memory_extents(__Pyx_memviewslice *slice, void **out_start, void **out_end, int ndim, size_t itemsize) @@ -30201,7 +32074,7 @@ __pyx_slices_overlap(__Pyx_memviewslice *slice1, } /* Capsule */ - static CYTHON_INLINE PyObject * + static CYTHON_INLINE PyObject * __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) { PyObject *cobj; @@ -30214,7 +32087,7 @@ __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) } /* TypeInfoCompare */ - static int + static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) { int i; @@ -30255,7 +32128,7 @@ __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b) } /* MemviewSliceValidateAndInit */ - static int + static int __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) { if (buf->shape[dim] <= 1) @@ -30320,7 +32193,7 @@ __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec } } if (spec & __Pyx_MEMVIEW_PTR) { - if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[dim] < 0)) { + if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) { PyErr_Format(PyExc_ValueError, "Buffer is not indirectly accessible " "in dimension %d.", dim); @@ -30437,7 +32310,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *obj, int writable_flag) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_double(PyObject *obj, int writable_flag) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) }; @@ -30460,7 +32333,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) @@ -30482,7 +32355,7 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *obj, int writable_flag) { + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *obj, int writable_flag) { __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_BufFmt_StackElem stack[1]; int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) }; @@ -30505,8 +32378,8 @@ static int __Pyx_ValidateAndInit_memviewslice( } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) -1, const_zero = (int) 0; + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(int) < sizeof(long)) { @@ -30535,8 +32408,39 @@ static int __Pyx_ValidateAndInit_memviewslice( } } +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); + } +} + /* MemviewDtypeToObject */ - static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp) { + static CYTHON_INLINE PyObject *__pyx_memview_get_double(const char *itemp) { return (PyObject *) PyFloat_FromDouble(*(double *) itemp); } static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *obj) { @@ -30548,8 +32452,8 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) { - const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0; + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) { + const Py_intptr_t neg_one = (Py_intptr_t) ((Py_intptr_t) 0 - (Py_intptr_t) 1), const_zero = (Py_intptr_t) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(Py_intptr_t) < sizeof(long)) { @@ -30579,7 +32483,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o } /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); @@ -30599,7 +32503,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -30631,13 +32535,13 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag); } else { float r = b.imag / b.real; - float s = 1.0 / (b.real + b.imag * r); + float s = (float)(1.0) / (b.real + b.imag * r); return __pyx_t_float_complex_from_parts( (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); } } else { float r = b.real / b.imag; - float s = 1.0 / (b.imag + b.real * r); + float s = (float)(1.0) / (b.imag + b.real * r); return __pyx_t_float_complex_from_parts( (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); } @@ -30717,7 +32621,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o theta = 0; } else { r = -a.real; - theta = atan2f(0, -1); + theta = atan2f(0.0, -1.0); } } else { r = __Pyx_c_abs_float(a); @@ -30734,7 +32638,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o #endif /* Declarations */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); @@ -30754,7 +32658,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o #endif /* Arithmetic */ - #if CYTHON_CCOMPLEX + #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); @@ -30786,13 +32690,13 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag); } else { double r = b.imag / b.real; - double s = 1.0 / (b.real + b.imag * r); + double s = (double)(1.0) / (b.real + b.imag * r); return __pyx_t_double_complex_from_parts( (a.real + a.imag * r) * s, (a.imag - a.real * r) * s); } } else { double r = b.real / b.imag; - double s = 1.0 / (b.imag + b.real * r); + double s = (double)(1.0) / (b.imag + b.real * r); return __pyx_t_double_complex_from_parts( (a.real * r + a.imag) * s, (a.imag * r - a.real) * s); } @@ -30872,7 +32776,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o theta = 0; } else { r = -a.real; - theta = atan2(0, -1); + theta = atan2(0.0, -1.0); } } else { r = __Pyx_c_abs_double(a); @@ -30889,8 +32793,8 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o #endif /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { - const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0; + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) { + const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(enum NPY_TYPES) < sizeof(long)) { @@ -30920,7 +32824,7 @@ static CYTHON_INLINE int __pyx_memview_set_double(const char *itemp, PyObject *o } /* MemviewSliceCopyTemplate */ - static __Pyx_memviewslice + static __Pyx_memviewslice __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, const char *mode, int ndim, size_t sizeof_dtype, int contig_flag, @@ -30987,8 +32891,8 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } /* CIntFromPy */ - static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { - const char neg_one = (char) -1, const_zero = (char) 0; + static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { + const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -31167,206 +33071,17 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to char"); - return (char) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to char"); - return (char) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; + "value too large to convert to char"); + return (char) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; + "can't convert negative value to char"); + return (char) -1; } /* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -31553,39 +33268,197 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return (long) -1; } -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; +/* CIntFromPy */ + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(int) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (int) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int) 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int) 0; + case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) + case -2: + if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + } +#endif + if (sizeof(int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif + } } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + int val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (int) -1; + } + } else { + int val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); + Py_DECREF(tmp); + return val; } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; } /* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { + static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); @@ -31600,91 +33473,8 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return 0; } -/* ModuleImport */ - #ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - py_name = __Pyx_PyIdentifier_FromString(name); - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; -} -#endif - -/* TypeImport */ - #ifndef __PYX_HAVE_RT_ImportType -#define __PYX_HAVE_RT_ImportType -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - size_t size, int strict) -{ - PyObject *py_module = 0; - PyObject *result = 0; - PyObject *py_name = 0; - char warning[200]; - Py_ssize_t basicsize; -#ifdef Py_LIMITED_API - PyObject *py_basicsize; -#endif - py_module = __Pyx_ImportModule(module_name); - if (!py_module) - goto bad; - py_name = __Pyx_PyIdentifier_FromString(class_name); - if (!py_name) - goto bad; - result = PyObject_GetAttr(py_module, py_name); - Py_DECREF(py_name); - py_name = 0; - Py_DECREF(py_module); - py_module = 0; - if (!result) - goto bad; - if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, - "%.200s.%.200s is not a type object", - module_name, class_name); - goto bad; - } -#ifndef Py_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; -#else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if (!strict && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - else if ((size_t)basicsize != size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", - module_name, class_name, basicsize, size); - goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(py_module); - Py_XDECREF(result); - return NULL; -} -#endif - /* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { @@ -31793,6 +33583,13 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { #if PY_MAJOR_VERSION >= 3 if (PyLong_Check(result)) { @@ -31870,7 +33667,7 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { if (sizeof(Py_ssize_t) >= sizeof(long)) return PyInt_AS_LONG(b); else - return PyInt_AsSsize_t(x); + return PyInt_AsSsize_t(b); } #endif if (likely(PyLong_CheckExact(b))) { diff --git a/Orange/distance/_distance.pyx b/Orange/distance/_distance.pyx index d06af54d1dd..2450c9a0556 100644 --- a/Orange/distance/_distance.pyx +++ b/Orange/distance/_distance.pyx @@ -15,11 +15,17 @@ cdef extern from "math.h": double sqrt(double x) nogil -cpdef void lower_to_symmetric(double [:, :] distances): - cdef int row1, row2 - for row1 in range(distances.shape[0]): - for row2 in range(row1): - distances[row2, row1] = distances[row1, row2] +def lower_to_symmetric(double [:, :] distances, callback): + cdef int row1, row2, step, n_rows1 + + n_rows1 = distances.shape[0] + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + with nogil: + for row1 in range(row_start, min(row_start + step, n_rows1)): + for row2 in range(row1): + distances[row2, row1] = distances[row1, row2] def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, @@ -27,31 +33,35 @@ def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, np.ndarray[np.float64_t, ndim=2] x2, double[:, :] dist_missing, np.ndarray[np.float64_t, ndim=1] dist_missing2, - char two_tables): + char two_tables, + callback): cdef: - int n_rows1, n_rows2, n_cols, row1, row2, col + int n_rows1, n_rows2, n_cols, row1, row2, col, step double val1, val2, d int ival1, ival2 n_rows1, n_cols = x1.shape[0], x1.shape[1] n_rows2 = x2.shape[0] - with nogil: - for row1 in range(n_rows1): - for row2 in range(n_rows2 if two_tables else row1): - d = 0 - for col in range(n_cols): - val1, val2 = x1[row1, col], x2[row2, col] - ival1, ival2 = int(val1), int(val2) - if npy_isnan(val1): - if npy_isnan(val2): - d += dist_missing2[col] - else: - d += dist_missing[col, ival2] - elif npy_isnan(val2): - d += dist_missing[col, ival1] - elif ival1 != ival2: - d += 1 - distances[row1, row2] += d + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + for row1 in range(row_start, min(row_start + step, n_rows1)): + with nogil: + for row2 in range(n_rows2 if two_tables else row1): + d = 0 + for col in range(n_cols): + val1, val2 = x1[row1, col], x2[row2, col] + ival1, ival2 = int(val1), int(val2) + if npy_isnan(val1): + if npy_isnan(val2): + d += dist_missing2[col] + else: + d += dist_missing[col, ival2] + elif npy_isnan(val2): + d += dist_missing[col, ival1] + elif ival1 != ival2: + d += 1 + distances[row1, row2] += d def fix_euclidean_rows( @@ -61,32 +71,36 @@ def fix_euclidean_rows( np.ndarray[np.float64_t, ndim=1] means, np.ndarray[np.float64_t, ndim=1] vars, np.ndarray[np.float64_t, ndim=1] dist_missing2, - char two_tables): + char two_tables, + callback): cdef: - int n_rows1, n_rows2, n_cols, row1, row2, col + int n_rows1, n_rows2, n_cols, row1, row2, col, step double val1, val2, d n_rows1, n_cols = x1.shape[0], x1.shape[1] n_rows2 = x2.shape[0] - with nogil: - for row1 in range(n_rows1): - for row2 in range(n_rows2 if two_tables else row1): - if npy_isnan(distances[row1, row2]): - d = 0 - for col in range(n_cols): - val1, val2 = x1[row1, col], x2[row2, col] - if npy_isnan(val1): - if npy_isnan(val2): - d += dist_missing2[col] + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + for row1 in range(row_start, min(row_start + step, n_rows1)): + with nogil: + for row2 in range(n_rows2 if two_tables else row1): + if npy_isnan(distances[row1, row2]): + d = 0 + for col in range(n_cols): + val1, val2 = x1[row1, col], x2[row2, col] + if npy_isnan(val1): + if npy_isnan(val2): + d += dist_missing2[col] + else: + d += (val2 - means[col]) ** 2 + vars[col] + elif npy_isnan(val2): + d += (val1 - means[col]) ** 2 + vars[col] else: - d += (val2 - means[col]) ** 2 + vars[col] - elif npy_isnan(val2): - d += (val1 - means[col]) ** 2 + vars[col] - else: - d += (val1 - val2) ** 2 - distances[row1, row2] = d - if not two_tables: - distances[row2, row1] = d + d += (val1 - val2) ** 2 + distances[row1, row2] = d + if not two_tables: + distances[row2, row1] = d def fix_euclidean_rows_normalized( @@ -96,91 +110,103 @@ def fix_euclidean_rows_normalized( np.ndarray[np.float64_t, ndim=1] means, np.ndarray[np.float64_t, ndim=1] vars, np.ndarray[np.float64_t, ndim=1] dist_missing2, - char two_tables): + char two_tables, + callback): cdef: - int n_rows1, n_rows2, n_cols, row1, row2, col + int n_rows1, n_rows2, n_cols, row1, row2, col, step double val1, val2, d n_rows1, n_cols = x1.shape[0], x1.shape[1] n_rows2 = x2.shape[0] - with nogil: - for row1 in range(n_rows1): - for row2 in range(n_rows2 if two_tables else row1): - if npy_isnan(distances[row1, row2]): - d = 0 - for col in range(n_cols): - val1, val2 = x1[row1, col], x2[row2, col] - if npy_isnan(val1): - if npy_isnan(val2): - d += dist_missing2[col] + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + for row1 in range(row_start, min(row_start + step, n_rows1)): + with nogil: + for row2 in range(n_rows2 if two_tables else row1): + if npy_isnan(distances[row1, row2]): + d = 0 + for col in range(n_cols): + val1, val2 = x1[row1, col], x2[row2, col] + if npy_isnan(val1): + if npy_isnan(val2): + d += dist_missing2[col] + else: + d += val2 ** 2 + 0.5 + elif npy_isnan(val2): + d += val1 ** 2 + 0.5 else: - d += val2 ** 2 + 0.5 - elif npy_isnan(val2): - d += val1 ** 2 + 0.5 - else: - d += (val1 - val2) ** 2 - distances[row1, row2] = d - if not two_tables: - distances[row2, row1] = d + d += (val1 - val2) ** 2 + distances[row1, row2] = d + if not two_tables: + distances[row2, row1] = d def fix_euclidean_cols( np.ndarray[np.float64_t, ndim=2] distances, np.ndarray[np.float64_t, ndim=2] x, double[:] means, - double[:] vars): + double[:] vars, + callback): cdef: - int n_rows, n_cols, col1, col2, row + int n_rows, n_cols, col1, col2, row, step double val1, val2, d n_rows, n_cols = x.shape[0], x.shape[1] - with nogil: - for col1 in range(n_cols): - for col2 in range(col1): - if npy_isnan(distances[col1, col2]): - d = 0 - for row in range(n_rows): - val1, val2 = x[row, col1], x[row, col2] - if npy_isnan(val1): - if npy_isnan(val2): - d += vars[col1] + vars[col2] \ - + (means[col1] - means[col2]) ** 2 + step = max(n_cols // 100, 100) + for col_start in range(0, n_cols, step): + callback(col_start * 100 / n_cols) + for col1 in range(col_start, min(col_start + step, n_cols)): + with nogil: + for col2 in range(col1): + if npy_isnan(distances[col1, col2]): + d = 0 + for row in range(n_rows): + val1, val2 = x[row, col1], x[row, col2] + if npy_isnan(val1): + if npy_isnan(val2): + d += vars[col1] + vars[col2] \ + + (means[col1] - means[col2]) ** 2 + else: + d += (val2 - means[col1]) ** 2 + vars[col1] + elif npy_isnan(val2): + d += (val1 - means[col2]) ** 2 + vars[col2] else: - d += (val2 - means[col1]) ** 2 + vars[col1] - elif npy_isnan(val2): - d += (val1 - means[col2]) ** 2 + vars[col2] - else: - d += (val1 - val2) ** 2 - distances[col1, col2] = distances[col2, col1] = d + d += (val1 - val2) ** 2 + distances[col1, col2] = distances[col2, col1] = d def fix_euclidean_cols_normalized( np.ndarray[np.float64_t, ndim=2] distances, np.ndarray[np.float64_t, ndim=2] x, double[:] means, - double[:] vars): + double[:] vars, + callback): cdef: - int n_rows, n_cols, col1, col2, row + int n_rows, n_cols, col1, col2, row, step double val1, val2, d n_rows, n_cols = x.shape[0], x.shape[1] - with nogil: - for col1 in range(n_cols): - for col2 in range(col1): - if npy_isnan(distances[col1, col2]): - d = 0 - for row in range(n_rows): - val1, val2 = x[row, col1], x[row, col2] - if npy_isnan(val1): - if npy_isnan(val2): - d += 1 + step = max(n_cols // 100, 100) + for col_start in range(0, n_cols, step): + callback(col_start * 100 / n_cols) + for col1 in range(col_start, min(col_start + step, n_cols)): + with nogil: + for col2 in range(col1): + if npy_isnan(distances[col1, col2]): + d = 0 + for row in range(n_rows): + val1, val2 = x[row, col1], x[row, col2] + if npy_isnan(val1): + if npy_isnan(val2): + d += 1 + else: + d += val2 ** 2 + 0.5 + elif npy_isnan(val2): + d += val1 ** 2 + 0.5 else: - d += val2 ** 2 + 0.5 - elif npy_isnan(val2): - d += val1 ** 2 + 0.5 - else: - d += (val1 - val2) ** 2 - distances[col1, col2] = distances[col2, col1] = d + d += (val1 - val2) ** 2 + distances[col1, col2] = distances[col2, col1] = d def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, @@ -409,7 +435,7 @@ def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, if union != 0: distances[row1, row2] = 1 - intersection / union if not two_tables: - lower_to_symmetric(distances) + lower_to_symmetric(distances, lambda x: x) return distances diff --git a/Orange/distance/distance.py b/Orange/distance/distance.py index 0f21ea16e6d..d73da53b947 100644 --- a/Orange/distance/distance.py +++ b/Orange/distance/distance.py @@ -1,3 +1,4 @@ +from typing import Callable import warnings from unittest.mock import patch @@ -16,6 +17,65 @@ SklDistance, _orange_to_numpy) +def _safe_sparse_dot(a: np.ndarray, b: np.ndarray, + dense_output: bool = False, step: int = 100, + callback: Callable = None) -> np.ndarray: + if sp.issparse(a) or sp.issparse(b): + return safe_sparse_dot(a, b, dense_output) + else: + return _interruptible_dot(a, b, step, callback) + + +def _interruptible_dot(a: np.ndarray, b: np.ndarray, step: int = 100, + callback: Callable = None) -> np.ndarray: + if callback is None: + callback = lambda x: x + + if not isinstance(a, np.ndarray): + a = np.array(a) + if not isinstance(b, np.ndarray): + b = np.array(b) + if a.ndim < 2 or b.ndim < 2: + return np.dot(a, b) + + c = np.zeros((a.shape[0], b.shape[1]), dtype=float) + n_cols = b.shape[1] + for col in range(0, n_cols, step): + callback(col * 100 / n_cols) + c[:, col: col + step] = np.dot(a, b[:, col: col + step]) + return c + + +def _interruptible_sqrt(a: np.ndarray, step: int = 100, + callback: Callable = None) -> np.ndarray: + if callback is None: + callback = lambda x: x + + if not isinstance(a, np.ndarray): + a = np.array(a) + if a.ndim < 2: + return np.sqrt(a) + new_a = np.zeros(a.shape, dtype=float) + n_rows = len(a) + for row in range(0, n_rows, step): + callback(row * 100 / n_rows) + new_a[row: row + step, :] = np.sqrt(a[row: row + step, :]) + return new_a + + +class StepwiseCallbacks: + def __init__(self, callback, weights): + self.step_counter = -1 + self.callback = callback + self.weights = weights + + def next(self): + self.step_counter += 1 + base = sum(self.weights[:self.step_counter]) + step = self.weights[self.step_counter] / sum(self.weights) + return lambda i: self.callback and self.callback(base + i * step) + + class EuclideanRowsModel(FittedDistanceModel): """ Model for computation of Euclidean distances between rows. @@ -48,6 +108,8 @@ def compute_distances(self, x1, x2=None): - calls a function in Cython that adds the contributions of discrete columns """ + callbacks = StepwiseCallbacks(self.callback, [20, 10, 50, 5, 15]) + if self.continuous.any(): data1, data2 = self.continuous_columns( x1, x2, self.means, np.sqrt(2 * self.vars)) @@ -58,7 +120,8 @@ def compute_distances(self, x1, x2=None): yy = row_norms(data2, squared=True)[np.newaxis, :] else: yy = xx.T - distances = safe_sparse_dot(data1, data2.T, dense_output=True) + distances = _safe_sparse_dot(data1, data2.T, dense_output=True, + callback=callbacks.next()) distances *= -2 distances += xx distances += yy @@ -70,7 +133,7 @@ def compute_distances(self, x1, x2=None): else _distance.fix_euclidean_rows fixer(distances, data1, data2, self.means, self.vars, self.dist_missing2_cont, - x2 is not None) + x2 is not None, callbacks.next()) else: distances = np.zeros((x1.shape[0], (x2 if x2 is not None else x1).shape[0])) @@ -79,11 +142,11 @@ def compute_distances(self, x1, x2=None): data1, data2 = self.discrete_columns(x1, x2) _distance.euclidean_rows_discrete( distances, data1, data2, self.dist_missing_disc, - self.dist_missing2_disc, x2 is not None) + self.dist_missing2_disc, x2 is not None, callbacks.next()) if x2 is None: - _distance.lower_to_symmetric(distances) - return np.sqrt(distances) + _distance.lower_to_symmetric(distances, callbacks.next()) + return _interruptible_sqrt(distances, callback=callbacks.next()) class EuclideanColumnsModel(FittedDistanceModel): @@ -109,13 +172,15 @@ def compute_distances(self, x1, x2=None): - calls a function in Cython that adds the contributions of discrete columns """ + callbacks = StepwiseCallbacks(self.callback, [40, 30, 30]) + if self.normalize: x1 = x1 - self.means x1 /= np.sqrt(2 * self.vars) - # adapted from sklearn.metric.euclidean_distances xx = row_norms(x1.T, squared=True)[:, np.newaxis] - distances = safe_sparse_dot(x1.T, x1, dense_output=True) + distances = _safe_sparse_dot(x1.T, x1, dense_output=True, + callback=callbacks.next()) distances *= -2 distances += xx distances += xx.T @@ -125,8 +190,8 @@ def compute_distances(self, x1, x2=None): fixer = _distance.fix_euclidean_cols_normalized if self.normalize \ else _distance.fix_euclidean_cols - fixer(distances, x1, self.means, self.vars) - return np.sqrt(distances) + fixer(distances, x1, self.means, self.vars, callbacks.next()) + return _interruptible_sqrt(distances, callback=callbacks.next()) class Euclidean(FittedDistance): @@ -239,10 +304,10 @@ def compute_distances(self, x1, x2): # For discrete attributes, Euclidean is same as Manhattan _distance.euclidean_rows_discrete( distances, data1, data2, self.dist_missing_disc, - self.dist_missing2_disc, x2 is not None) + self.dist_missing2_disc, x2 is not None, lambda x: x) if x2 is None: - _distance.lower_to_symmetric(distances) + _distance.lower_to_symmetric(distances, lambda x: x) return distances diff --git a/Orange/distance/tests/test_distance.py b/Orange/distance/tests/test_distance.py index d23d4ec0704..61c288c1a20 100644 --- a/Orange/distance/tests/test_distance.py +++ b/Orange/distance/tests/test_distance.py @@ -933,5 +933,51 @@ def test_hamming_row_secondary_data(self): [1, 2 / 3]]) +class TestHelperFunctions(unittest.TestCase): + # pylint: disable=protected-access, no-self-use + def test_interruptable_dot(self): + dot = distance.distance._interruptible_dot + k, m, n = 20, 30, 40 + a = np.random.randint(10, size=(m, n)) + b = np.random.randint(10, size=(n, k)) + + c = dot(a, b, step=10) + np.testing.assert_array_equal(c, np.dot(a, b)) + + def test_interruptable_dot_list(self): + dot = distance.distance._interruptible_dot + a = [[1, 2, 3], [1, 2, 3]] + b = [3, 2, 1] + c = dot(a, b, step=10) + np.testing.assert_array_equal(c, np.dot(a, b)) + + def test_interruptable_dot_scalar(self): + dot = distance.distance._interruptible_dot + a = 2 + b = 3 + c = dot(a, b, step=10) + np.testing.assert_array_equal(c, np.dot(a, b)) + + def test_interruptable_sqrt(self): + sqrt_ = distance.distance._interruptible_sqrt + n = 100 + a = np.random.randint(10, size=(n, n)) + + new_a = sqrt_(a, step=10) + np.testing.assert_array_equal(new_a, np.sqrt(a)) + + def test_interruptable_sqrt_list(self): + sqrt_ = distance.distance._interruptible_sqrt + l = [1, 2, 3] + new_l = sqrt_(l, step=10) + np.testing.assert_array_equal(new_l, np.sqrt(l)) + + def test_interruptable_sqrt_scalar(self): + sqrt_ = distance.distance._interruptible_sqrt + i = 9 + new_i = sqrt_(i, step=10) + np.testing.assert_array_equal(new_i, np.sqrt(i)) + + if __name__ == "__main__": unittest.main() From 201eacaab7bd586f5440deef73ab79c1af2b1670 Mon Sep 17 00:00:00 2001 From: Vesna Tanko Date: Thu, 28 Nov 2019 14:52:03 +0100 Subject: [PATCH 4/7] Bhattacharyya: Impute missing values --- Orange/widgets/unsupervised/tests/test_owdistances.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Orange/widgets/unsupervised/tests/test_owdistances.py b/Orange/widgets/unsupervised/tests/test_owdistances.py index be7f89c399b..d508d74167b 100644 --- a/Orange/widgets/unsupervised/tests/test_owdistances.py +++ b/Orange/widgets/unsupervised/tests/test_owdistances.py @@ -31,7 +31,7 @@ def test_run(self): state.is_interruption_requested = Mock(return_value=False) for name, metric in METRICS: data = self.iris - if not metric.supports_missing: + if not metric.supports_missing or name == "Bhattacharyya": data = distance.impute(data) elif name == "Jaccard": data = self.zoo From 8128e053a4a8c0a2b78d1227c67caf7cbf0ebebb Mon Sep 17 00:00:00 2001 From: Vesna Tanko Date: Mon, 9 Dec 2019 11:07:54 +0100 Subject: [PATCH 5/7] Distances: Interruptable Manhattan distance --- Orange/distance/_distance.c | 5107 +++++++++++++++++++-------------- Orange/distance/_distance.pyx | 158 +- Orange/distance/distance.py | 16 +- 3 files changed, 3004 insertions(+), 2277 deletions(-) diff --git a/Orange/distance/_distance.c b/Orange/distance/_distance.c index 31f5499c2f7..7d3a3d89637 100644 --- a/Orange/distance/_distance.c +++ b/Orange/distance/_distance.c @@ -837,6 +837,13 @@ static const char *__pyx_f[] = { "stringsource", "type.pxd", }; +/* NoFastGil.proto */ +#define __Pyx_PyGILState_Ensure PyGILState_Ensure +#define __Pyx_PyGILState_Release PyGILState_Release +#define __Pyx_FastGIL_Remember() +#define __Pyx_FastGIL_Forget() +#define __Pyx_FastGilFuncInit() + /* MemviewSliceStruct.proto */ struct __pyx_memoryview_obj; typedef struct { @@ -933,13 +940,6 @@ typedef struct { char is_valid_array; } __Pyx_BufFmt_Context; -/* NoFastGil.proto */ -#define __Pyx_PyGILState_Ensure PyGILState_Ensure -#define __Pyx_PyGILState_Release PyGILState_Release -#define __Pyx_FastGIL_Remember() -#define __Pyx_FastGIL_Forget() -#define __Pyx_FastGilFuncInit() - /* ForceInitThreads.proto */ #ifndef __PYX_FORCE_INIT_THREADS #define __PYX_FORCE_INIT_THREADS 0 @@ -1400,6 +1400,18 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ + const char* function_name); + /* PyObjectCall.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); @@ -1448,62 +1460,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject /* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* WriteUnraisableException.proto */ -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename, - int full_traceback, int nogil); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* None.proto */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); - /* MemviewSliceInit.proto */ #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d #define __Pyx_MEMVIEW_DIRECT 1 @@ -1559,6 +1515,42 @@ static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) @@ -1881,6 +1873,14 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif +/* None.proto */ +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); + +/* WriteUnraisableException.proto */ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename, + int full_traceback, int nogil); + /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); @@ -2186,7 +2186,6 @@ static PyObject *contiguous = 0; static PyObject *indirect_contiguous = 0; static int __pyx_memoryview_thread_locks_used; static PyThread_type_lock __pyx_memoryview_thread_locks[8]; -static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memviewslice, PyObject *, int __pyx_skip_dispatch); /*proto*/ static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/ static void *__pyx_align_pointer(void *, size_t); /*proto*/ static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/ @@ -2362,6 +2361,7 @@ static const char __pyx_k_dist_missing2_cont[] = "dist_missing2_cont"; static const char __pyx_k_fix_euclidean_cols[] = "fix_euclidean_cols"; static const char __pyx_k_fix_euclidean_rows[] = "fix_euclidean_rows"; static const char __pyx_k_fix_manhattan_rows[] = "fix_manhattan_rows"; +static const char __pyx_k_lower_to_symmetric[] = "lower_to_symmetric"; static const char __pyx_k_strided_and_direct[] = ""; static const char __pyx_k_manhattan_rows_cont[] = "manhattan_rows_cont"; static const char __pyx_k_strided_and_indirect[] = ""; @@ -2484,6 +2484,7 @@ static PyObject *__pyx_n_s_ival2; static PyObject *__pyx_n_s_jaccard_cols; static PyObject *__pyx_n_s_jaccard_rows; static PyObject *__pyx_n_s_jaccard_rows_locals_lambda; +static PyObject *__pyx_n_s_lower_to_symmetric; static PyObject *__pyx_n_s_mads; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_manhattan_cols; @@ -2574,10 +2575,10 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, CYTHON_UNUSED PyArrayObject *__pyx_v_means, CYTHON_UNUSED PyArrayObject *__pyx_v_vars, PyArrayObject *__pyx_v_dist_missing2, char __pyx_v_two_tables, PyObject *__pyx_v_callback); /* proto */ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, __Pyx_memviewslice __pyx_v_means, __Pyx_memviewslice __pyx_v_vars, PyObject *__pyx_v_callback); /* proto */ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_means, CYTHON_UNUSED __Pyx_memviewslice __pyx_v_vars, PyObject *__pyx_v_callback); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, PyArrayObject *__pyx_v_dist_missing2_cont, char __pyx_v_two_tables); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, char __pyx_v_normalize); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, PyArrayObject *__pyx_v_dist_missing2_cont, char __pyx_v_two_tables, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, char __pyx_v_normalize, PyObject *__pyx_v_callback); /* proto */ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x); /* proto */ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x); /* proto */ static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */ @@ -2674,11 +2675,12 @@ static PyObject *__pyx_tuple__46; static PyObject *__pyx_tuple__48; static PyObject *__pyx_tuple__50; static PyObject *__pyx_tuple__52; -static PyObject *__pyx_tuple__53; static PyObject *__pyx_tuple__54; static PyObject *__pyx_tuple__55; static PyObject *__pyx_tuple__56; static PyObject *__pyx_tuple__57; +static PyObject *__pyx_tuple__58; +static PyObject *__pyx_tuple__59; static PyObject *__pyx_codeobj__27; static PyObject *__pyx_codeobj__29; static PyObject *__pyx_codeobj__31; @@ -2692,24 +2694,88 @@ static PyObject *__pyx_codeobj__45; static PyObject *__pyx_codeobj__47; static PyObject *__pyx_codeobj__49; static PyObject *__pyx_codeobj__51; -static PyObject *__pyx_codeobj__58; +static PyObject *__pyx_codeobj__53; +static PyObject *__pyx_codeobj__60; /* Late includes */ /* "Orange/distance/_distance.pyx":18 * * - * cpdef void lower_to_symmetric(double [:, :] distances, callback): # <<<<<<<<<<<<<< + * def lower_to_symmetric(double [:, :] distances, callback): # <<<<<<<<<<<<<< * cdef int row1, row2, step, n_rows1 - * n_rows1 = distances.shape[0] + * */ +/* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memviewslice __pyx_v_distances, PyObject *__pyx_v_callback, CYTHON_UNUSED int __pyx_skip_dispatch) { +static char __pyx_doc_6Orange_8distance_9_distance_lower_to_symmetric[] = "lower_to_symmetric(double[:, :] distances, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_1lower_to_symmetric = {"lower_to_symmetric", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_lower_to_symmetric}; +static PyObject *__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("lower_to_symmetric (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_callback,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_distances)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("lower_to_symmetric", 1, 2, 2, 1); __PYX_ERR(0, 18, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lower_to_symmetric") < 0)) __PYX_ERR(0, 18, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_distances = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_distances.memview)) __PYX_ERR(0, 18, __pyx_L3_error) + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("lower_to_symmetric", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 18, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("Orange.distance._distance.lower_to_symmetric", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(__pyx_self, __pyx_v_distances, __pyx_v_callback); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distances, PyObject *__pyx_v_callback) { int __pyx_v_row1; int __pyx_v_row2; int __pyx_v_step; int __pyx_v_n_rows1; long __pyx_v_row_start; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations long __pyx_t_1; long __pyx_t_2; @@ -2731,17 +2797,17 @@ static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memvie Py_ssize_t __pyx_t_18; __Pyx_RefNannySetupContext("lower_to_symmetric", 0); - /* "Orange/distance/_distance.pyx":20 - * cpdef void lower_to_symmetric(double [:, :] distances, callback): + /* "Orange/distance/_distance.pyx":21 * cdef int row1, row2, step, n_rows1 + * * n_rows1 = distances.shape[0] # <<<<<<<<<<<<<< * step = max(n_rows1 // 100, 100) * for row_start in range(0, n_rows1, step): */ __pyx_v_n_rows1 = (__pyx_v_distances.shape[0]); - /* "Orange/distance/_distance.pyx":21 - * cdef int row1, row2, step, n_rows1 + /* "Orange/distance/_distance.pyx":22 + * * n_rows1 = distances.shape[0] * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< * for row_start in range(0, n_rows1, step): @@ -2756,18 +2822,18 @@ static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memvie } __pyx_v_step = __pyx_t_3; - /* "Orange/distance/_distance.pyx":22 + /* "Orange/distance/_distance.pyx":23 * n_rows1 = distances.shape[0] * step = max(n_rows1 // 100, 100) * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< * callback(row_start * 100 / n_rows1) - * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -2778,16 +2844,16 @@ static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memvie PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5); __pyx_t_4 = 0; __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) { __pyx_t_6 = __pyx_t_5; __Pyx_INCREF(__pyx_t_6); __pyx_t_7 = 0; __pyx_t_8 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_7 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_8 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 23, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; for (;;) { @@ -2795,17 +2861,17 @@ static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memvie if (likely(PyList_CheckExact(__pyx_t_6))) { if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_6)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 23, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } else { if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_6)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 23, __pyx_L1_error) #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_5 = PySequence_ITEM(__pyx_t_6, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); #endif } @@ -2815,24 +2881,24 @@ static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memvie PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 22, __pyx_L1_error) + else __PYX_ERR(0, 23, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_5); } - __pyx_t_3 = __Pyx_PyInt_As_long(__pyx_t_5); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_As_long(__pyx_t_5); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_row_start = __pyx_t_3; - /* "Orange/distance/_distance.pyx":23 + /* "Orange/distance/_distance.pyx":24 * step = max(n_rows1 // 100, 100) * for row_start in range(0, n_rows1, step): * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< - * for row1 in range(row_start, min(row_start + step, n_rows1)): - * for row2 in range(row1): + * with nogil: + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - __pyx_t_4 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_callback); __pyx_t_9 = __pyx_v_callback; __pyx_t_10 = NULL; @@ -2848,63 +2914,98 @@ static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memvie __pyx_t_5 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_9, __pyx_t_10, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_4); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 23, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "Orange/distance/_distance.pyx":24 + /* "Orange/distance/_distance.pyx":25 * for row_start in range(0, n_rows1, step): * callback(row_start * 100 / n_rows1) - * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< - * for row2 in range(row1): - * distances[row2, row1] = distances[row1, row2] + * with nogil: # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * for row2 in range(row1): */ - __pyx_t_11 = __pyx_v_n_rows1; - __pyx_t_3 = (__pyx_v_row_start + __pyx_v_step); - if (((__pyx_t_11 < __pyx_t_3) != 0)) { - __pyx_t_1 = __pyx_t_11; - } else { - __pyx_t_1 = __pyx_t_3; - } - __pyx_t_3 = __pyx_t_1; - __pyx_t_1 = __pyx_t_3; - for (__pyx_t_11 = __pyx_v_row_start; __pyx_t_11 < __pyx_t_1; __pyx_t_11+=1) { - __pyx_v_row1 = __pyx_t_11; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":25 + /* "Orange/distance/_distance.pyx":26 * callback(row_start * 100 / n_rows1) - * for row1 in range(row_start, min(row_start + step, n_rows1)): - * for row2 in range(row1): # <<<<<<<<<<<<<< - * distances[row2, row1] = distances[row1, row2] + * with nogil: + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * for row2 in range(row1): + * distances[row2, row1] = distances[row1, row2] + */ + __pyx_t_11 = __pyx_v_n_rows1; + __pyx_t_3 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_11 < __pyx_t_3) != 0)) { + __pyx_t_1 = __pyx_t_11; + } else { + __pyx_t_1 = __pyx_t_3; + } + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = __pyx_t_3; + for (__pyx_t_11 = __pyx_v_row_start; __pyx_t_11 < __pyx_t_1; __pyx_t_11+=1) { + __pyx_v_row1 = __pyx_t_11; + + /* "Orange/distance/_distance.pyx":27 + * with nogil: + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * for row2 in range(row1): # <<<<<<<<<<<<<< + * distances[row2, row1] = distances[row1, row2] * */ - __pyx_t_12 = __pyx_v_row1; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_row2 = __pyx_t_14; + __pyx_t_12 = __pyx_v_row1; + __pyx_t_13 = __pyx_t_12; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { + __pyx_v_row2 = __pyx_t_14; - /* "Orange/distance/_distance.pyx":26 - * for row1 in range(row_start, min(row_start + step, n_rows1)): - * for row2 in range(row1): - * distances[row2, row1] = distances[row1, row2] # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":28 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * for row2 in range(row1): + * distances[row2, row1] = distances[row1, row2] # <<<<<<<<<<<<<< * * */ - __pyx_t_15 = __pyx_v_row1; - __pyx_t_16 = __pyx_v_row2; - __pyx_t_17 = __pyx_v_row2; - __pyx_t_18 = __pyx_v_row1; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_17 * __pyx_v_distances.strides[0]) ) + __pyx_t_18 * __pyx_v_distances.strides[1]) )) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_15 * __pyx_v_distances.strides[0]) ) + __pyx_t_16 * __pyx_v_distances.strides[1]) ))); - } + __pyx_t_15 = __pyx_v_row1; + __pyx_t_16 = __pyx_v_row2; + __pyx_t_17 = __pyx_v_row2; + __pyx_t_18 = __pyx_v_row1; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_17 * __pyx_v_distances.strides[0]) ) + __pyx_t_18 * __pyx_v_distances.strides[1]) )) = (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_15 * __pyx_v_distances.strides[0]) ) + __pyx_t_16 * __pyx_v_distances.strides[1]) ))); + } + } + } + + /* "Orange/distance/_distance.pyx":25 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * with nogil: # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * for row2 in range(row1): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L9; + } + __pyx_L9:; + } } - /* "Orange/distance/_distance.pyx":22 + /* "Orange/distance/_distance.pyx":23 * n_rows1 = distances.shape[0] * step = max(n_rows1 // 100, 100) * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< * callback(row_start * 100 / n_rows1) - * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: */ } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -2912,12 +3013,13 @@ static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memvie /* "Orange/distance/_distance.pyx":18 * * - * cpdef void lower_to_symmetric(double [:, :] distances, callback): # <<<<<<<<<<<<<< + * def lower_to_symmetric(double [:, :] distances, callback): # <<<<<<<<<<<<<< * cdef int row1, row2, step, n_rows1 - * n_rows1 = distances.shape[0] + * */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); @@ -2925,121 +3027,38 @@ static void __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__Pyx_memvie __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); - __Pyx_WriteUnraisable("Orange.distance._distance.lower_to_symmetric", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); + __Pyx_AddTraceback("Orange.distance._distance.lower_to_symmetric", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __PYX_XDEC_MEMVIEW(&__pyx_v_distances, 1); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); + return __pyx_r; } +/* "Orange/distance/_distance.pyx":31 + * + * + * def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=2] x1, + * np.ndarray[np.float64_t, ndim=2] x2, + */ + /* Python wrapper */ -static PyObject *__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_lower_to_symmetric[] = "lower_to_symmetric(double[:, :] distances, callback) -> void"; -static PyObject *__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } }; +static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6Orange_8distance_9_distance_2euclidean_rows_discrete[] = "euclidean_rows_discrete(ndarray distances, ndarray x1, ndarray x2, double[:, :] dist_missing, ndarray dist_missing2, char two_tables, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_3euclidean_rows_discrete = {"euclidean_rows_discrete", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_2euclidean_rows_discrete}; +static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_distances = 0; + PyArrayObject *__pyx_v_x1 = 0; + PyArrayObject *__pyx_v_x2 = 0; + __Pyx_memviewslice __pyx_v_dist_missing = { 0, 0, { 0 }, { 0 }, { 0 } }; + PyArrayObject *__pyx_v_dist_missing2 = 0; + char __pyx_v_two_tables; PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lower_to_symmetric (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_callback,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_distances)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("lower_to_symmetric", 1, 2, 2, 1); __PYX_ERR(0, 18, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lower_to_symmetric") < 0)) __PYX_ERR(0, 18, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_distances = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_distances.memview)) __PYX_ERR(0, 18, __pyx_L3_error) - __pyx_v_callback = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("lower_to_symmetric", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 18, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("Orange.distance._distance.lower_to_symmetric", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(__pyx_self, __pyx_v_distances, __pyx_v_callback); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_6Orange_8distance_9_distance_lower_to_symmetric(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_memviewslice __pyx_v_distances, PyObject *__pyx_v_callback) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("lower_to_symmetric", 0); - __Pyx_XDECREF(__pyx_r); - if (unlikely(!__pyx_v_distances.memview)) { __Pyx_RaiseUnboundLocalError("distances"); __PYX_ERR(0, 18, __pyx_L1_error) } - __pyx_t_1 = __Pyx_void_to_None(__pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__pyx_v_distances, __pyx_v_callback, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("Orange.distance._distance.lower_to_symmetric", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __PYX_XDEC_MEMVIEW(&__pyx_v_distances, 1); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "Orange/distance/_distance.pyx":29 - * - * - * def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=2] x1, - * np.ndarray[np.float64_t, ndim=2] x2, - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_2euclidean_rows_discrete[] = "euclidean_rows_discrete(ndarray distances, ndarray x1, ndarray x2, double[:, :] dist_missing, ndarray dist_missing2, char two_tables, callback)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_3euclidean_rows_discrete = {"euclidean_rows_discrete", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_2euclidean_rows_discrete}; -static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_distances = 0; - PyArrayObject *__pyx_v_x1 = 0; - PyArrayObject *__pyx_v_x2 = 0; - __Pyx_memviewslice __pyx_v_dist_missing = { 0, 0, { 0 }, { 0 }, { 0 } }; - PyArrayObject *__pyx_v_dist_missing2 = 0; - char __pyx_v_two_tables; - PyObject *__pyx_v_callback = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("euclidean_rows_discrete (wrapper)", 0); + __Pyx_RefNannySetupContext("euclidean_rows_discrete (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_dist_missing,&__pyx_n_s_dist_missing2,&__pyx_n_s_two_tables,&__pyx_n_s_callback,0}; PyObject* values[7] = {0,0,0,0,0,0,0}; @@ -3073,41 +3092,41 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete( case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 1); __PYX_ERR(0, 29, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 1); __PYX_ERR(0, 31, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 2); __PYX_ERR(0, 29, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 2); __PYX_ERR(0, 31, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 3); __PYX_ERR(0, 29, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 3); __PYX_ERR(0, 31, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 4); __PYX_ERR(0, 29, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 4); __PYX_ERR(0, 31, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 5); __PYX_ERR(0, 29, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 5); __PYX_ERR(0, 31, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 6); __PYX_ERR(0, 29, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, 6); __PYX_ERR(0, 31, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "euclidean_rows_discrete") < 0)) __PYX_ERR(0, 29, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "euclidean_rows_discrete") < 0)) __PYX_ERR(0, 31, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; @@ -3123,23 +3142,23 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_3euclidean_rows_discrete( __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x1 = ((PyArrayObject *)values[1]); __pyx_v_x2 = ((PyArrayObject *)values[2]); - __pyx_v_dist_missing = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dist_missing.memview)) __PYX_ERR(0, 32, __pyx_L3_error) + __pyx_v_dist_missing = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_dist_missing.memview)) __PYX_ERR(0, 34, __pyx_L3_error) __pyx_v_dist_missing2 = ((PyArrayObject *)values[4]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[5]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 34, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[5]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error) __pyx_v_callback = values[6]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 29, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("euclidean_rows_discrete", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 31, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.euclidean_rows_discrete", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 29, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 30, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 31, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 33, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 31, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 32, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 33, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 35, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_dist_missing, __pyx_v_dist_missing2, __pyx_v_two_tables, __pyx_v_callback); /* function exit code */ @@ -3227,26 +3246,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_pybuffernd_dist_missing2.rcbuffer = &__pyx_pybuffer_dist_missing2; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 31, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 31, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 31, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 29, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 31, __pyx_L1_error) } __pyx_pybuffernd_dist_missing2.diminfo[0].strides = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dist_missing2.diminfo[0].shape = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":41 + /* "Orange/distance/_distance.pyx":43 * int ival1, ival2 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< @@ -3258,7 +3277,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":42 + /* "Orange/distance/_distance.pyx":44 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< @@ -3267,7 +3286,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":43 + /* "Orange/distance/_distance.pyx":45 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< @@ -3283,18 +3302,18 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( } __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":44 + /* "Orange/distance/_distance.pyx":46 * n_rows2 = x2.shape[0] * step = max(n_rows1 // 100, 100) * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< * callback(row_start * 100 / n_rows1) * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -3305,16 +3324,16 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); __pyx_t_6 = 0; __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; __pyx_t_10 = NULL; } else { - __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 46, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { @@ -3322,17 +3341,17 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( if (likely(PyList_CheckExact(__pyx_t_8))) { if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 46, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } else { if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 46, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -3342,24 +3361,24 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 44, __pyx_L1_error) + else __PYX_ERR(0, 46, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_7); } - __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_row_start = __pyx_t_5; - /* "Orange/distance/_distance.pyx":45 + /* "Orange/distance/_distance.pyx":47 * step = max(n_rows1 // 100, 100) * for row_start in range(0, n_rows1, step): * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< * for row1 in range(row_start, min(row_start + step, n_rows1)): * with nogil: */ - __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_callback); __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; @@ -3375,12 +3394,12 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 45, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":46 + /* "Orange/distance/_distance.pyx":48 * for row_start in range(0, n_rows1, step): * callback(row_start * 100 / n_rows1) * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< @@ -3399,7 +3418,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( for (__pyx_t_13 = __pyx_v_row_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { __pyx_v_row1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":47 + /* "Orange/distance/_distance.pyx":49 * callback(row_start * 100 / n_rows1) * for row1 in range(row_start, min(row_start + step, n_rows1)): * with nogil: # <<<<<<<<<<<<<< @@ -3414,7 +3433,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( #endif /*try:*/ { - /* "Orange/distance/_distance.pyx":48 + /* "Orange/distance/_distance.pyx":50 * for row1 in range(row_start, min(row_start + step, n_rows1)): * with nogil: * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< @@ -3430,7 +3449,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { __pyx_v_row2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":49 + /* "Orange/distance/_distance.pyx":51 * with nogil: * for row2 in range(n_rows2 if two_tables else row1): * d = 0 # <<<<<<<<<<<<<< @@ -3439,7 +3458,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( */ __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":50 + /* "Orange/distance/_distance.pyx":52 * for row2 in range(n_rows2 if two_tables else row1): * d = 0 * for col in range(n_cols): # <<<<<<<<<<<<<< @@ -3451,7 +3470,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { __pyx_v_col = __pyx_t_19; - /* "Orange/distance/_distance.pyx":51 + /* "Orange/distance/_distance.pyx":53 * d = 0 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< @@ -3467,7 +3486,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_v_val1 = __pyx_t_22; __pyx_v_val2 = __pyx_t_25; - /* "Orange/distance/_distance.pyx":52 + /* "Orange/distance/_distance.pyx":54 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] * ival1, ival2 = int(val1), int(val2) # <<<<<<<<<<<<<< @@ -3477,7 +3496,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_v_ival1 = ((int)__pyx_v_val1); __pyx_v_ival2 = ((int)__pyx_v_val2); - /* "Orange/distance/_distance.pyx":53 + /* "Orange/distance/_distance.pyx":55 * val1, val2 = x1[row1, col], x2[row2, col] * ival1, ival2 = int(val1), int(val2) * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -3487,7 +3506,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_t_26 = (npy_isnan(__pyx_v_val1) != 0); if (__pyx_t_26) { - /* "Orange/distance/_distance.pyx":54 + /* "Orange/distance/_distance.pyx":56 * ival1, ival2 = int(val1), int(val2) * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -3497,7 +3516,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_t_26 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_26) { - /* "Orange/distance/_distance.pyx":55 + /* "Orange/distance/_distance.pyx":57 * if npy_isnan(val1): * if npy_isnan(val2): * d += dist_missing2[col] # <<<<<<<<<<<<<< @@ -3507,7 +3526,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_t_27 = __pyx_v_col; __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_dist_missing2.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":54 + /* "Orange/distance/_distance.pyx":56 * ival1, ival2 = int(val1), int(val2) * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -3517,7 +3536,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":57 + /* "Orange/distance/_distance.pyx":59 * d += dist_missing2[col] * else: * d += dist_missing[col, ival2] # <<<<<<<<<<<<<< @@ -3531,7 +3550,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( } __pyx_L17:; - /* "Orange/distance/_distance.pyx":53 + /* "Orange/distance/_distance.pyx":55 * val1, val2 = x1[row1, col], x2[row2, col] * ival1, ival2 = int(val1), int(val2) * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -3541,7 +3560,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( goto __pyx_L16; } - /* "Orange/distance/_distance.pyx":58 + /* "Orange/distance/_distance.pyx":60 * else: * d += dist_missing[col, ival2] * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -3551,7 +3570,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_t_26 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_26) { - /* "Orange/distance/_distance.pyx":59 + /* "Orange/distance/_distance.pyx":61 * d += dist_missing[col, ival2] * elif npy_isnan(val2): * d += dist_missing[col, ival1] # <<<<<<<<<<<<<< @@ -3562,7 +3581,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_t_31 = __pyx_v_ival1; __pyx_v_d = (__pyx_v_d + (*((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_dist_missing.data + __pyx_t_30 * __pyx_v_dist_missing.strides[0]) ) + __pyx_t_31 * __pyx_v_dist_missing.strides[1]) )))); - /* "Orange/distance/_distance.pyx":58 + /* "Orange/distance/_distance.pyx":60 * else: * d += dist_missing[col, ival2] * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -3572,7 +3591,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( goto __pyx_L16; } - /* "Orange/distance/_distance.pyx":60 + /* "Orange/distance/_distance.pyx":62 * elif npy_isnan(val2): * d += dist_missing[col, ival1] * elif ival1 != ival2: # <<<<<<<<<<<<<< @@ -3582,7 +3601,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_t_26 = ((__pyx_v_ival1 != __pyx_v_ival2) != 0); if (__pyx_t_26) { - /* "Orange/distance/_distance.pyx":61 + /* "Orange/distance/_distance.pyx":63 * d += dist_missing[col, ival1] * elif ival1 != ival2: * d += 1 # <<<<<<<<<<<<<< @@ -3591,7 +3610,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( */ __pyx_v_d = (__pyx_v_d + 1.0); - /* "Orange/distance/_distance.pyx":60 + /* "Orange/distance/_distance.pyx":62 * elif npy_isnan(val2): * d += dist_missing[col, ival1] * elif ival1 != ival2: # <<<<<<<<<<<<<< @@ -3602,7 +3621,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( __pyx_L16:; } - /* "Orange/distance/_distance.pyx":62 + /* "Orange/distance/_distance.pyx":64 * elif ival1 != ival2: * d += 1 * distances[row1, row2] += d # <<<<<<<<<<<<<< @@ -3615,7 +3634,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( } } - /* "Orange/distance/_distance.pyx":47 + /* "Orange/distance/_distance.pyx":49 * callback(row_start * 100 / n_rows1) * for row1 in range(row_start, min(row_start + step, n_rows1)): * with nogil: # <<<<<<<<<<<<<< @@ -3635,7 +3654,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( } } - /* "Orange/distance/_distance.pyx":44 + /* "Orange/distance/_distance.pyx":46 * n_rows2 = x2.shape[0] * step = max(n_rows1 // 100, 100) * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< @@ -3645,7 +3664,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":29 + /* "Orange/distance/_distance.pyx":31 * * * def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -3686,7 +3705,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_2euclidean_rows_discrete( return __pyx_r; } -/* "Orange/distance/_distance.pyx":65 +/* "Orange/distance/_distance.pyx":67 * * * def fix_euclidean_rows( # <<<<<<<<<<<<<< @@ -3745,47 +3764,47 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObj case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 1); __PYX_ERR(0, 65, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 1); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 2); __PYX_ERR(0, 65, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 2); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_means)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 3); __PYX_ERR(0, 65, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 3); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vars)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 4); __PYX_ERR(0, 65, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 4); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 5); __PYX_ERR(0, 65, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 5); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 6); __PYX_ERR(0, 65, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 6); __PYX_ERR(0, 67, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 7); __PYX_ERR(0, 65, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, 7); __PYX_ERR(0, 67, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_rows") < 0)) __PYX_ERR(0, 65, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_rows") < 0)) __PYX_ERR(0, 67, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; @@ -3805,23 +3824,23 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_5fix_euclidean_rows(PyObj __pyx_v_means = ((PyArrayObject *)values[3]); __pyx_v_vars = ((PyArrayObject *)values[4]); __pyx_v_dist_missing2 = ((PyArrayObject *)values[5]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L3_error) __pyx_v_callback = values[7]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 65, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 67, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_euclidean_rows", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 66, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 67, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 68, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_means), __pyx_ptype_5numpy_ndarray, 1, "means", 0))) __PYX_ERR(0, 69, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vars), __pyx_ptype_5numpy_ndarray, 1, "vars", 0))) __PYX_ERR(0, 70, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 71, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 68, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 69, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 70, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_means), __pyx_ptype_5numpy_ndarray, 1, "means", 0))) __PYX_ERR(0, 71, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vars), __pyx_ptype_5numpy_ndarray, 1, "vars", 0))) __PYX_ERR(0, 72, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 73, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_means, __pyx_v_vars, __pyx_v_dist_missing2, __pyx_v_two_tables, __pyx_v_callback); /* function exit code */ @@ -3923,36 +3942,36 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_pybuffernd_dist_missing2.rcbuffer = &__pyx_pybuffer_dist_missing2; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 65, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 67, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 65, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 67, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 65, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 67, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_means.rcbuffer->pybuffer, (PyObject*)__pyx_v_means, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 65, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_means.rcbuffer->pybuffer, (PyObject*)__pyx_v_means, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 67, __pyx_L1_error) } __pyx_pybuffernd_means.diminfo[0].strides = __pyx_pybuffernd_means.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_means.diminfo[0].shape = __pyx_pybuffernd_means.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vars.rcbuffer->pybuffer, (PyObject*)__pyx_v_vars, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 65, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vars.rcbuffer->pybuffer, (PyObject*)__pyx_v_vars, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 67, __pyx_L1_error) } __pyx_pybuffernd_vars.diminfo[0].strides = __pyx_pybuffernd_vars.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vars.diminfo[0].shape = __pyx_pybuffernd_vars.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 65, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 67, __pyx_L1_error) } __pyx_pybuffernd_dist_missing2.diminfo[0].strides = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dist_missing2.diminfo[0].shape = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":78 + /* "Orange/distance/_distance.pyx":80 * double val1, val2, d * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< @@ -3964,7 +3983,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":79 + /* "Orange/distance/_distance.pyx":81 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< @@ -3973,7 +3992,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":80 + /* "Orange/distance/_distance.pyx":82 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< @@ -3989,18 +4008,18 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO } __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":81 + /* "Orange/distance/_distance.pyx":83 * n_rows2 = x2.shape[0] * step = max(n_rows1 // 100, 100) * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< * callback(row_start * 100 / n_rows1) * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -4011,16 +4030,16 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); __pyx_t_6 = 0; __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; __pyx_t_10 = NULL; } else { - __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 83, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { @@ -4028,17 +4047,17 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO if (likely(PyList_CheckExact(__pyx_t_8))) { if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 83, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } else { if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 83, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -4048,24 +4067,24 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 81, __pyx_L1_error) + else __PYX_ERR(0, 83, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_7); } - __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_row_start = __pyx_t_5; - /* "Orange/distance/_distance.pyx":82 + /* "Orange/distance/_distance.pyx":84 * step = max(n_rows1 // 100, 100) * for row_start in range(0, n_rows1, step): * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< * for row1 in range(row_start, min(row_start + step, n_rows1)): * with nogil: */ - __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_callback); __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; @@ -4081,12 +4100,12 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 82, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":83 + /* "Orange/distance/_distance.pyx":85 * for row_start in range(0, n_rows1, step): * callback(row_start * 100 / n_rows1) * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< @@ -4105,7 +4124,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO for (__pyx_t_13 = __pyx_v_row_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { __pyx_v_row1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":84 + /* "Orange/distance/_distance.pyx":86 * callback(row_start * 100 / n_rows1) * for row1 in range(row_start, min(row_start + step, n_rows1)): * with nogil: # <<<<<<<<<<<<<< @@ -4120,7 +4139,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO #endif /*try:*/ { - /* "Orange/distance/_distance.pyx":85 + /* "Orange/distance/_distance.pyx":87 * for row1 in range(row_start, min(row_start + step, n_rows1)): * with nogil: * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< @@ -4136,7 +4155,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { __pyx_v_row2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":86 + /* "Orange/distance/_distance.pyx":88 * with nogil: * for row2 in range(n_rows2 if two_tables else row1): * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< @@ -4148,7 +4167,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":87 + /* "Orange/distance/_distance.pyx":89 * for row2 in range(n_rows2 if two_tables else row1): * if npy_isnan(distances[row1, row2]): * d = 0 # <<<<<<<<<<<<<< @@ -4157,7 +4176,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO */ __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":88 + /* "Orange/distance/_distance.pyx":90 * if npy_isnan(distances[row1, row2]): * d = 0 * for col in range(n_cols): # <<<<<<<<<<<<<< @@ -4169,7 +4188,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { __pyx_v_col = __pyx_t_22; - /* "Orange/distance/_distance.pyx":89 + /* "Orange/distance/_distance.pyx":91 * d = 0 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< @@ -4185,7 +4204,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_v_val1 = __pyx_t_25; __pyx_v_val2 = __pyx_t_28; - /* "Orange/distance/_distance.pyx":90 + /* "Orange/distance/_distance.pyx":92 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -4195,7 +4214,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":91 + /* "Orange/distance/_distance.pyx":93 * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -4205,7 +4224,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":92 + /* "Orange/distance/_distance.pyx":94 * if npy_isnan(val1): * if npy_isnan(val2): * d += dist_missing2[col] # <<<<<<<<<<<<<< @@ -4215,7 +4234,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_t_29 = __pyx_v_col; __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_dist_missing2.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":91 + /* "Orange/distance/_distance.pyx":93 * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -4225,7 +4244,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO goto __pyx_L18; } - /* "Orange/distance/_distance.pyx":94 + /* "Orange/distance/_distance.pyx":96 * d += dist_missing2[col] * else: * d += (val2 - means[col]) ** 2 + vars[col] # <<<<<<<<<<<<<< @@ -4239,7 +4258,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO } __pyx_L18:; - /* "Orange/distance/_distance.pyx":90 + /* "Orange/distance/_distance.pyx":92 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -4249,7 +4268,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":95 + /* "Orange/distance/_distance.pyx":97 * else: * d += (val2 - means[col]) ** 2 + vars[col] * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -4259,7 +4278,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":96 + /* "Orange/distance/_distance.pyx":98 * d += (val2 - means[col]) ** 2 + vars[col] * elif npy_isnan(val2): * d += (val1 - means[col]) ** 2 + vars[col] # <<<<<<<<<<<<<< @@ -4270,7 +4289,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_t_33 = __pyx_v_col; __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val1 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_means.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_means.diminfo[0].strides))), 2.0) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_vars.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_vars.diminfo[0].strides)))); - /* "Orange/distance/_distance.pyx":95 + /* "Orange/distance/_distance.pyx":97 * else: * d += (val2 - means[col]) ** 2 + vars[col] * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -4280,7 +4299,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":98 + /* "Orange/distance/_distance.pyx":100 * d += (val1 - means[col]) ** 2 + vars[col] * else: * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< @@ -4293,7 +4312,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_L17:; } - /* "Orange/distance/_distance.pyx":99 + /* "Orange/distance/_distance.pyx":101 * else: * d += (val1 - val2) ** 2 * distances[row1, row2] = d # <<<<<<<<<<<<<< @@ -4304,7 +4323,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_t_35 = __pyx_v_row2; *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":100 + /* "Orange/distance/_distance.pyx":102 * d += (val1 - val2) ** 2 * distances[row1, row2] = d * if not two_tables: # <<<<<<<<<<<<<< @@ -4314,7 +4333,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_t_19 = ((!(__pyx_v_two_tables != 0)) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":101 + /* "Orange/distance/_distance.pyx":103 * distances[row1, row2] = d * if not two_tables: * distances[row2, row1] = d # <<<<<<<<<<<<<< @@ -4325,7 +4344,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO __pyx_t_37 = __pyx_v_row1; *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":100 + /* "Orange/distance/_distance.pyx":102 * d += (val1 - val2) ** 2 * distances[row1, row2] = d * if not two_tables: # <<<<<<<<<<<<<< @@ -4334,7 +4353,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO */ } - /* "Orange/distance/_distance.pyx":86 + /* "Orange/distance/_distance.pyx":88 * with nogil: * for row2 in range(n_rows2 if two_tables else row1): * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< @@ -4345,7 +4364,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO } } - /* "Orange/distance/_distance.pyx":84 + /* "Orange/distance/_distance.pyx":86 * callback(row_start * 100 / n_rows1) * for row1 in range(row_start, min(row_start + step, n_rows1)): * with nogil: # <<<<<<<<<<<<<< @@ -4365,7 +4384,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO } } - /* "Orange/distance/_distance.pyx":81 + /* "Orange/distance/_distance.pyx":83 * n_rows2 = x2.shape[0] * step = max(n_rows1 // 100, 100) * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< @@ -4375,7 +4394,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":65 + /* "Orange/distance/_distance.pyx":67 * * * def fix_euclidean_rows( # <<<<<<<<<<<<<< @@ -4419,7 +4438,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_4fix_euclidean_rows(CYTHO return __pyx_r; } -/* "Orange/distance/_distance.pyx":104 +/* "Orange/distance/_distance.pyx":106 * * * def fix_euclidean_rows_normalized( # <<<<<<<<<<<<<< @@ -4478,47 +4497,47 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_norma case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 1); __PYX_ERR(0, 104, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 1); __PYX_ERR(0, 106, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 2); __PYX_ERR(0, 104, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 2); __PYX_ERR(0, 106, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_means)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 3); __PYX_ERR(0, 104, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 3); __PYX_ERR(0, 106, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vars)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 4); __PYX_ERR(0, 104, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 4); __PYX_ERR(0, 106, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 5); __PYX_ERR(0, 104, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 5); __PYX_ERR(0, 106, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 6); __PYX_ERR(0, 104, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 6); __PYX_ERR(0, 106, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 7); __PYX_ERR(0, 104, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, 7); __PYX_ERR(0, 106, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_rows_normalized") < 0)) __PYX_ERR(0, 104, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_rows_normalized") < 0)) __PYX_ERR(0, 106, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; @@ -4538,23 +4557,23 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_7fix_euclidean_rows_norma __pyx_v_means = ((PyArrayObject *)values[3]); __pyx_v_vars = ((PyArrayObject *)values[4]); __pyx_v_dist_missing2 = ((PyArrayObject *)values[5]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L3_error) __pyx_v_callback = values[7]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 104, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_rows_normalized", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 106, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_euclidean_rows_normalized", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 105, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 106, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 107, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_means), __pyx_ptype_5numpy_ndarray, 1, "means", 0))) __PYX_ERR(0, 108, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vars), __pyx_ptype_5numpy_ndarray, 1, "vars", 0))) __PYX_ERR(0, 109, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 110, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 107, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 108, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 109, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_means), __pyx_ptype_5numpy_ndarray, 1, "means", 0))) __PYX_ERR(0, 110, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_vars), __pyx_ptype_5numpy_ndarray, 1, "vars", 0))) __PYX_ERR(0, 111, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2", 0))) __PYX_ERR(0, 112, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_normalized(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_means, __pyx_v_vars, __pyx_v_dist_missing2, __pyx_v_two_tables, __pyx_v_callback); /* function exit code */ @@ -4652,36 +4671,36 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_pybuffernd_dist_missing2.rcbuffer = &__pyx_pybuffer_dist_missing2; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 104, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 106, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 104, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 106, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 104, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 106, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_means.rcbuffer->pybuffer, (PyObject*)__pyx_v_means, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 104, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_means.rcbuffer->pybuffer, (PyObject*)__pyx_v_means, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 106, __pyx_L1_error) } __pyx_pybuffernd_means.diminfo[0].strides = __pyx_pybuffernd_means.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_means.diminfo[0].shape = __pyx_pybuffernd_means.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vars.rcbuffer->pybuffer, (PyObject*)__pyx_v_vars, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 104, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_vars.rcbuffer->pybuffer, (PyObject*)__pyx_v_vars, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 106, __pyx_L1_error) } __pyx_pybuffernd_vars.diminfo[0].strides = __pyx_pybuffernd_vars.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_vars.diminfo[0].shape = __pyx_pybuffernd_vars.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 104, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 106, __pyx_L1_error) } __pyx_pybuffernd_dist_missing2.diminfo[0].strides = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dist_missing2.diminfo[0].shape = __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":117 + /* "Orange/distance/_distance.pyx":119 * double val1, val2, d * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< @@ -4693,7 +4712,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":118 + /* "Orange/distance/_distance.pyx":120 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< @@ -4702,7 +4721,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":119 + /* "Orange/distance/_distance.pyx":121 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< @@ -4718,18 +4737,18 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma } __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":120 + /* "Orange/distance/_distance.pyx":122 * n_rows2 = x2.shape[0] * step = max(n_rows1 // 100, 100) * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< * callback(row_start * 100 / n_rows1) * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -4740,16 +4759,16 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); __pyx_t_6 = 0; __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; __pyx_t_10 = NULL; } else { - __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 122, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { @@ -4757,17 +4776,17 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma if (likely(PyList_CheckExact(__pyx_t_8))) { if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 122, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } else { if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 122, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -4777,24 +4796,24 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 120, __pyx_L1_error) + else __PYX_ERR(0, 122, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_7); } - __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_row_start = __pyx_t_5; - /* "Orange/distance/_distance.pyx":121 + /* "Orange/distance/_distance.pyx":123 * step = max(n_rows1 // 100, 100) * for row_start in range(0, n_rows1, step): * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< * for row1 in range(row_start, min(row_start + step, n_rows1)): * with nogil: */ - __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_callback); __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; @@ -4810,12 +4829,12 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 121, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":122 + /* "Orange/distance/_distance.pyx":124 * for row_start in range(0, n_rows1, step): * callback(row_start * 100 / n_rows1) * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< @@ -4834,7 +4853,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma for (__pyx_t_13 = __pyx_v_row_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { __pyx_v_row1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":123 + /* "Orange/distance/_distance.pyx":125 * callback(row_start * 100 / n_rows1) * for row1 in range(row_start, min(row_start + step, n_rows1)): * with nogil: # <<<<<<<<<<<<<< @@ -4849,7 +4868,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma #endif /*try:*/ { - /* "Orange/distance/_distance.pyx":124 + /* "Orange/distance/_distance.pyx":126 * for row1 in range(row_start, min(row_start + step, n_rows1)): * with nogil: * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< @@ -4865,7 +4884,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { __pyx_v_row2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":125 + /* "Orange/distance/_distance.pyx":127 * with nogil: * for row2 in range(n_rows2 if two_tables else row1): * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< @@ -4877,7 +4896,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":126 + /* "Orange/distance/_distance.pyx":128 * for row2 in range(n_rows2 if two_tables else row1): * if npy_isnan(distances[row1, row2]): * d = 0 # <<<<<<<<<<<<<< @@ -4886,7 +4905,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma */ __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":127 + /* "Orange/distance/_distance.pyx":129 * if npy_isnan(distances[row1, row2]): * d = 0 * for col in range(n_cols): # <<<<<<<<<<<<<< @@ -4898,7 +4917,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { __pyx_v_col = __pyx_t_22; - /* "Orange/distance/_distance.pyx":128 + /* "Orange/distance/_distance.pyx":130 * d = 0 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< @@ -4914,7 +4933,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_v_val1 = __pyx_t_25; __pyx_v_val2 = __pyx_t_28; - /* "Orange/distance/_distance.pyx":129 + /* "Orange/distance/_distance.pyx":131 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -4924,7 +4943,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":130 + /* "Orange/distance/_distance.pyx":132 * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -4934,7 +4953,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":131 + /* "Orange/distance/_distance.pyx":133 * if npy_isnan(val1): * if npy_isnan(val2): * d += dist_missing2[col] # <<<<<<<<<<<<<< @@ -4944,7 +4963,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_t_29 = __pyx_v_col; __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_dist_missing2.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":130 + /* "Orange/distance/_distance.pyx":132 * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -4954,7 +4973,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma goto __pyx_L18; } - /* "Orange/distance/_distance.pyx":133 + /* "Orange/distance/_distance.pyx":135 * d += dist_missing2[col] * else: * d += val2 ** 2 + 0.5 # <<<<<<<<<<<<<< @@ -4966,7 +4985,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma } __pyx_L18:; - /* "Orange/distance/_distance.pyx":129 + /* "Orange/distance/_distance.pyx":131 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -4976,7 +4995,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":134 + /* "Orange/distance/_distance.pyx":136 * else: * d += val2 ** 2 + 0.5 * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -4986,7 +5005,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":135 + /* "Orange/distance/_distance.pyx":137 * d += val2 ** 2 + 0.5 * elif npy_isnan(val2): * d += val1 ** 2 + 0.5 # <<<<<<<<<<<<<< @@ -4995,7 +5014,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma */ __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val1, 2.0) + 0.5)); - /* "Orange/distance/_distance.pyx":134 + /* "Orange/distance/_distance.pyx":136 * else: * d += val2 ** 2 + 0.5 * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -5005,7 +5024,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":137 + /* "Orange/distance/_distance.pyx":139 * d += val1 ** 2 + 0.5 * else: * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< @@ -5018,7 +5037,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_L17:; } - /* "Orange/distance/_distance.pyx":138 + /* "Orange/distance/_distance.pyx":140 * else: * d += (val1 - val2) ** 2 * distances[row1, row2] = d # <<<<<<<<<<<<<< @@ -5029,7 +5048,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_t_31 = __pyx_v_row2; *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_31, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":139 + /* "Orange/distance/_distance.pyx":141 * d += (val1 - val2) ** 2 * distances[row1, row2] = d * if not two_tables: # <<<<<<<<<<<<<< @@ -5039,7 +5058,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_t_19 = ((!(__pyx_v_two_tables != 0)) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":140 + /* "Orange/distance/_distance.pyx":142 * distances[row1, row2] = d * if not two_tables: * distances[row2, row1] = d # <<<<<<<<<<<<<< @@ -5050,7 +5069,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma __pyx_t_33 = __pyx_v_row1; *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_33, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":139 + /* "Orange/distance/_distance.pyx":141 * d += (val1 - val2) ** 2 * distances[row1, row2] = d * if not two_tables: # <<<<<<<<<<<<<< @@ -5059,7 +5078,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma */ } - /* "Orange/distance/_distance.pyx":125 + /* "Orange/distance/_distance.pyx":127 * with nogil: * for row2 in range(n_rows2 if two_tables else row1): * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< @@ -5070,7 +5089,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma } } - /* "Orange/distance/_distance.pyx":123 + /* "Orange/distance/_distance.pyx":125 * callback(row_start * 100 / n_rows1) * for row1 in range(row_start, min(row_start + step, n_rows1)): * with nogil: # <<<<<<<<<<<<<< @@ -5090,7 +5109,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma } } - /* "Orange/distance/_distance.pyx":120 + /* "Orange/distance/_distance.pyx":122 * n_rows2 = x2.shape[0] * step = max(n_rows1 // 100, 100) * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< @@ -5100,7 +5119,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":104 + /* "Orange/distance/_distance.pyx":106 * * * def fix_euclidean_rows_normalized( # <<<<<<<<<<<<<< @@ -5144,7 +5163,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_6fix_euclidean_rows_norma return __pyx_r; } -/* "Orange/distance/_distance.pyx":143 +/* "Orange/distance/_distance.pyx":145 * * * def fix_euclidean_cols( # <<<<<<<<<<<<<< @@ -5194,29 +5213,29 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_9fix_euclidean_cols(PyObj case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 1); __PYX_ERR(0, 143, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 1); __PYX_ERR(0, 145, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_means)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 2); __PYX_ERR(0, 143, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 2); __PYX_ERR(0, 145, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vars)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 3); __PYX_ERR(0, 143, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 3); __PYX_ERR(0, 145, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 4); __PYX_ERR(0, 143, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, 4); __PYX_ERR(0, 145, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_cols") < 0)) __PYX_ERR(0, 143, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_cols") < 0)) __PYX_ERR(0, 145, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -5229,20 +5248,20 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_9fix_euclidean_cols(PyObj } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x = ((PyArrayObject *)values[1]); - __pyx_v_means = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_means.memview)) __PYX_ERR(0, 146, __pyx_L3_error) - __pyx_v_vars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vars.memview)) __PYX_ERR(0, 147, __pyx_L3_error) + __pyx_v_means = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_means.memview)) __PYX_ERR(0, 148, __pyx_L3_error) + __pyx_v_vars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vars.memview)) __PYX_ERR(0, 149, __pyx_L3_error) __pyx_v_callback = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 143, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 145, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_euclidean_cols", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 144, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 145, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 146, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 147, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(__pyx_self, __pyx_v_distances, __pyx_v_x, __pyx_v_means, __pyx_v_vars, __pyx_v_callback); /* function exit code */ @@ -5322,16 +5341,16 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 143, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 145, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 143, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 145, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":153 + /* "Orange/distance/_distance.pyx":155 * double val1, val2, d * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< @@ -5343,7 +5362,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":154 + /* "Orange/distance/_distance.pyx":156 * * n_rows, n_cols = x.shape[0], x.shape[1] * step = max(n_cols // 100, 100) # <<<<<<<<<<<<<< @@ -5359,18 +5378,18 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO } __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":155 + /* "Orange/distance/_distance.pyx":157 * n_rows, n_cols = x.shape[0], x.shape[1] * step = max(n_cols // 100, 100) * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< * callback(col_start * 100 / n_cols) * for col1 in range(col_start, min(col_start + step, n_cols)): */ - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -5381,16 +5400,16 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); __pyx_t_6 = 0; __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; __pyx_t_10 = NULL; } else { - __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 157, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { @@ -5398,17 +5417,17 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO if (likely(PyList_CheckExact(__pyx_t_8))) { if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 157, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } else { if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 157, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -5418,24 +5437,24 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 155, __pyx_L1_error) + else __PYX_ERR(0, 157, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_7); } - __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_col_start = __pyx_t_5; - /* "Orange/distance/_distance.pyx":156 + /* "Orange/distance/_distance.pyx":158 * step = max(n_cols // 100, 100) * for col_start in range(0, n_cols, step): * callback(col_start * 100 / n_cols) # <<<<<<<<<<<<<< * for col1 in range(col_start, min(col_start + step, n_cols)): * with nogil: */ - __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_col_start * 0x64) / __pyx_v_n_cols)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_col_start * 0x64) / __pyx_v_n_cols)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_callback); __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; @@ -5451,12 +5470,12 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 156, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":157 + /* "Orange/distance/_distance.pyx":159 * for col_start in range(0, n_cols, step): * callback(col_start * 100 / n_cols) * for col1 in range(col_start, min(col_start + step, n_cols)): # <<<<<<<<<<<<<< @@ -5475,7 +5494,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO for (__pyx_t_13 = __pyx_v_col_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { __pyx_v_col1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":158 + /* "Orange/distance/_distance.pyx":160 * callback(col_start * 100 / n_cols) * for col1 in range(col_start, min(col_start + step, n_cols)): * with nogil: # <<<<<<<<<<<<<< @@ -5490,7 +5509,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO #endif /*try:*/ { - /* "Orange/distance/_distance.pyx":159 + /* "Orange/distance/_distance.pyx":161 * for col1 in range(col_start, min(col_start + step, n_cols)): * with nogil: * for col2 in range(col1): # <<<<<<<<<<<<<< @@ -5502,7 +5521,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { __pyx_v_col2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":160 + /* "Orange/distance/_distance.pyx":162 * with nogil: * for col2 in range(col1): * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< @@ -5514,7 +5533,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":161 + /* "Orange/distance/_distance.pyx":163 * for col2 in range(col1): * if npy_isnan(distances[col1, col2]): * d = 0 # <<<<<<<<<<<<<< @@ -5523,7 +5542,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO */ __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":162 + /* "Orange/distance/_distance.pyx":164 * if npy_isnan(distances[col1, col2]): * d = 0 * for row in range(n_rows): # <<<<<<<<<<<<<< @@ -5535,7 +5554,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { __pyx_v_row = __pyx_t_22; - /* "Orange/distance/_distance.pyx":163 + /* "Orange/distance/_distance.pyx":165 * d = 0 * for row in range(n_rows): * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< @@ -5551,7 +5570,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_v_val1 = __pyx_t_25; __pyx_v_val2 = __pyx_t_28; - /* "Orange/distance/_distance.pyx":164 + /* "Orange/distance/_distance.pyx":166 * for row in range(n_rows): * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -5561,7 +5580,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":165 + /* "Orange/distance/_distance.pyx":167 * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -5571,7 +5590,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":166 + /* "Orange/distance/_distance.pyx":168 * if npy_isnan(val1): * if npy_isnan(val2): * d += vars[col1] + vars[col2] \ # <<<<<<<<<<<<<< @@ -5581,7 +5600,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_t_29 = __pyx_v_col1; __pyx_t_30 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":167 + /* "Orange/distance/_distance.pyx":169 * if npy_isnan(val2): * d += vars[col1] + vars[col2] \ * + (means[col1] - means[col2]) ** 2 # <<<<<<<<<<<<<< @@ -5591,7 +5610,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_t_31 = __pyx_v_col1; __pyx_t_32 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":166 + /* "Orange/distance/_distance.pyx":168 * if npy_isnan(val1): * if npy_isnan(val2): * d += vars[col1] + vars[col2] \ # <<<<<<<<<<<<<< @@ -5600,7 +5619,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO */ __pyx_v_d = (__pyx_v_d + (((*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_29 * __pyx_v_vars.strides[0]) ))) + (*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_30 * __pyx_v_vars.strides[0]) )))) + pow(((*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_31 * __pyx_v_means.strides[0]) ))) - (*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_32 * __pyx_v_means.strides[0]) )))), 2.0))); - /* "Orange/distance/_distance.pyx":165 + /* "Orange/distance/_distance.pyx":167 * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -5610,7 +5629,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO goto __pyx_L18; } - /* "Orange/distance/_distance.pyx":169 + /* "Orange/distance/_distance.pyx":171 * + (means[col1] - means[col2]) ** 2 * else: * d += (val2 - means[col1]) ** 2 + vars[col1] # <<<<<<<<<<<<<< @@ -5624,7 +5643,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO } __pyx_L18:; - /* "Orange/distance/_distance.pyx":164 + /* "Orange/distance/_distance.pyx":166 * for row in range(n_rows): * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -5634,7 +5653,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":170 + /* "Orange/distance/_distance.pyx":172 * else: * d += (val2 - means[col1]) ** 2 + vars[col1] * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -5644,7 +5663,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":171 + /* "Orange/distance/_distance.pyx":173 * d += (val2 - means[col1]) ** 2 + vars[col1] * elif npy_isnan(val2): * d += (val1 - means[col2]) ** 2 + vars[col2] # <<<<<<<<<<<<<< @@ -5655,7 +5674,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_t_36 = __pyx_v_col2; __pyx_v_d = (__pyx_v_d + (pow((__pyx_v_val1 - (*((double *) ( /* dim=0 */ (__pyx_v_means.data + __pyx_t_35 * __pyx_v_means.strides[0]) )))), 2.0) + (*((double *) ( /* dim=0 */ (__pyx_v_vars.data + __pyx_t_36 * __pyx_v_vars.strides[0]) ))))); - /* "Orange/distance/_distance.pyx":170 + /* "Orange/distance/_distance.pyx":172 * else: * d += (val2 - means[col1]) ** 2 + vars[col1] * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -5665,7 +5684,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":173 + /* "Orange/distance/_distance.pyx":175 * d += (val1 - means[col2]) ** 2 + vars[col2] * else: * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< @@ -5678,7 +5697,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_L17:; } - /* "Orange/distance/_distance.pyx":174 + /* "Orange/distance/_distance.pyx":176 * else: * d += (val1 - val2) ** 2 * distances[col1, col2] = distances[col2, col1] = d # <<<<<<<<<<<<<< @@ -5692,7 +5711,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO __pyx_t_40 = __pyx_v_col1; *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":160 + /* "Orange/distance/_distance.pyx":162 * with nogil: * for col2 in range(col1): * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< @@ -5703,7 +5722,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO } } - /* "Orange/distance/_distance.pyx":158 + /* "Orange/distance/_distance.pyx":160 * callback(col_start * 100 / n_cols) * for col1 in range(col_start, min(col_start + step, n_cols)): * with nogil: # <<<<<<<<<<<<<< @@ -5723,7 +5742,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO } } - /* "Orange/distance/_distance.pyx":155 + /* "Orange/distance/_distance.pyx":157 * n_rows, n_cols = x.shape[0], x.shape[1] * step = max(n_cols // 100, 100) * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< @@ -5733,7 +5752,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":143 + /* "Orange/distance/_distance.pyx":145 * * * def fix_euclidean_cols( # <<<<<<<<<<<<<< @@ -5771,7 +5790,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_8fix_euclidean_cols(CYTHO return __pyx_r; } -/* "Orange/distance/_distance.pyx":177 +/* "Orange/distance/_distance.pyx":179 * * * def fix_euclidean_cols_normalized( # <<<<<<<<<<<<<< @@ -5821,29 +5840,29 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_11fix_euclidean_cols_norm case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 1); __PYX_ERR(0, 177, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 1); __PYX_ERR(0, 179, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_means)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 2); __PYX_ERR(0, 177, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 2); __PYX_ERR(0, 179, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_vars)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 3); __PYX_ERR(0, 177, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 3); __PYX_ERR(0, 179, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 4); __PYX_ERR(0, 177, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, 4); __PYX_ERR(0, 179, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_cols_normalized") < 0)) __PYX_ERR(0, 177, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_euclidean_cols_normalized") < 0)) __PYX_ERR(0, 179, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -5856,20 +5875,20 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_11fix_euclidean_cols_norm } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x = ((PyArrayObject *)values[1]); - __pyx_v_means = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_means.memview)) __PYX_ERR(0, 180, __pyx_L3_error) - __pyx_v_vars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vars.memview)) __PYX_ERR(0, 181, __pyx_L3_error) + __pyx_v_means = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_means.memview)) __PYX_ERR(0, 182, __pyx_L3_error) + __pyx_v_vars = __Pyx_PyObject_to_MemoryviewSlice_ds_double(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_vars.memview)) __PYX_ERR(0, 183, __pyx_L3_error) __pyx_v_callback = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 177, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_euclidean_cols_normalized", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 179, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_euclidean_cols_normalized", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 178, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 179, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 180, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 181, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_normalized(__pyx_self, __pyx_v_distances, __pyx_v_x, __pyx_v_means, __pyx_v_vars, __pyx_v_callback); /* function exit code */ @@ -5941,16 +5960,16 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 177, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 179, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 177, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 179, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":187 + /* "Orange/distance/_distance.pyx":189 * double val1, val2, d * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< @@ -5962,7 +5981,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":188 + /* "Orange/distance/_distance.pyx":190 * * n_rows, n_cols = x.shape[0], x.shape[1] * step = max(n_cols // 100, 100) # <<<<<<<<<<<<<< @@ -5978,18 +5997,18 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm } __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":189 + /* "Orange/distance/_distance.pyx":191 * n_rows, n_cols = x.shape[0], x.shape[1] * step = max(n_cols // 100, 100) * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< * callback(col_start * 100 / n_cols) * for col1 in range(col_start, min(col_start + step, n_cols)): */ - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -6000,16 +6019,16 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); __pyx_t_6 = 0; __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; __pyx_t_10 = NULL; } else { - __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 191, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { @@ -6017,17 +6036,17 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm if (likely(PyList_CheckExact(__pyx_t_8))) { if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 191, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } else { if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 191, __pyx_L1_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -6037,24 +6056,24 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 189, __pyx_L1_error) + else __PYX_ERR(0, 191, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_7); } - __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_col_start = __pyx_t_5; - /* "Orange/distance/_distance.pyx":190 + /* "Orange/distance/_distance.pyx":192 * step = max(n_cols // 100, 100) * for col_start in range(0, n_cols, step): * callback(col_start * 100 / n_cols) # <<<<<<<<<<<<<< * for col1 in range(col_start, min(col_start + step, n_cols)): * with nogil: */ - __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_col_start * 0x64) / __pyx_v_n_cols)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 190, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_col_start * 0x64) / __pyx_v_n_cols)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_callback); __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; @@ -6070,12 +6089,12 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 190, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":191 + /* "Orange/distance/_distance.pyx":193 * for col_start in range(0, n_cols, step): * callback(col_start * 100 / n_cols) * for col1 in range(col_start, min(col_start + step, n_cols)): # <<<<<<<<<<<<<< @@ -6094,7 +6113,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm for (__pyx_t_13 = __pyx_v_col_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { __pyx_v_col1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":192 + /* "Orange/distance/_distance.pyx":194 * callback(col_start * 100 / n_cols) * for col1 in range(col_start, min(col_start + step, n_cols)): * with nogil: # <<<<<<<<<<<<<< @@ -6109,7 +6128,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm #endif /*try:*/ { - /* "Orange/distance/_distance.pyx":193 + /* "Orange/distance/_distance.pyx":195 * for col1 in range(col_start, min(col_start + step, n_cols)): * with nogil: * for col2 in range(col1): # <<<<<<<<<<<<<< @@ -6121,7 +6140,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { __pyx_v_col2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":194 + /* "Orange/distance/_distance.pyx":196 * with nogil: * for col2 in range(col1): * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< @@ -6133,7 +6152,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":195 + /* "Orange/distance/_distance.pyx":197 * for col2 in range(col1): * if npy_isnan(distances[col1, col2]): * d = 0 # <<<<<<<<<<<<<< @@ -6142,7 +6161,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm */ __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":196 + /* "Orange/distance/_distance.pyx":198 * if npy_isnan(distances[col1, col2]): * d = 0 * for row in range(n_rows): # <<<<<<<<<<<<<< @@ -6154,7 +6173,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { __pyx_v_row = __pyx_t_22; - /* "Orange/distance/_distance.pyx":197 + /* "Orange/distance/_distance.pyx":199 * d = 0 * for row in range(n_rows): * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< @@ -6170,7 +6189,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __pyx_v_val1 = __pyx_t_25; __pyx_v_val2 = __pyx_t_28; - /* "Orange/distance/_distance.pyx":198 + /* "Orange/distance/_distance.pyx":200 * for row in range(n_rows): * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -6180,7 +6199,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":199 + /* "Orange/distance/_distance.pyx":201 * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -6190,7 +6209,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":200 + /* "Orange/distance/_distance.pyx":202 * if npy_isnan(val1): * if npy_isnan(val2): * d += 1 # <<<<<<<<<<<<<< @@ -6199,7 +6218,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm */ __pyx_v_d = (__pyx_v_d + 1.0); - /* "Orange/distance/_distance.pyx":199 + /* "Orange/distance/_distance.pyx":201 * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -6209,7 +6228,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm goto __pyx_L18; } - /* "Orange/distance/_distance.pyx":202 + /* "Orange/distance/_distance.pyx":204 * d += 1 * else: * d += val2 ** 2 + 0.5 # <<<<<<<<<<<<<< @@ -6221,7 +6240,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm } __pyx_L18:; - /* "Orange/distance/_distance.pyx":198 + /* "Orange/distance/_distance.pyx":200 * for row in range(n_rows): * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -6231,7 +6250,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":203 + /* "Orange/distance/_distance.pyx":205 * else: * d += val2 ** 2 + 0.5 * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -6241,7 +6260,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":204 + /* "Orange/distance/_distance.pyx":206 * d += val2 ** 2 + 0.5 * elif npy_isnan(val2): * d += val1 ** 2 + 0.5 # <<<<<<<<<<<<<< @@ -6250,7 +6269,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm */ __pyx_v_d = (__pyx_v_d + (pow(__pyx_v_val1, 2.0) + 0.5)); - /* "Orange/distance/_distance.pyx":203 + /* "Orange/distance/_distance.pyx":205 * else: * d += val2 ** 2 + 0.5 * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -6260,7 +6279,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":206 + /* "Orange/distance/_distance.pyx":208 * d += val1 ** 2 + 0.5 * else: * d += (val1 - val2) ** 2 # <<<<<<<<<<<<<< @@ -6273,7 +6292,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __pyx_L17:; } - /* "Orange/distance/_distance.pyx":207 + /* "Orange/distance/_distance.pyx":209 * else: * d += (val1 - val2) ** 2 * distances[col1, col2] = distances[col2, col1] = d # <<<<<<<<<<<<<< @@ -6287,7 +6306,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm __pyx_t_32 = __pyx_v_col1; *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":194 + /* "Orange/distance/_distance.pyx":196 * with nogil: * for col2 in range(col1): * if npy_isnan(distances[col1, col2]): # <<<<<<<<<<<<<< @@ -6298,7 +6317,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm } } - /* "Orange/distance/_distance.pyx":192 + /* "Orange/distance/_distance.pyx":194 * callback(col_start * 100 / n_cols) * for col1 in range(col_start, min(col_start + step, n_cols)): * with nogil: # <<<<<<<<<<<<<< @@ -6318,7 +6337,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm } } - /* "Orange/distance/_distance.pyx":189 + /* "Orange/distance/_distance.pyx":191 * n_rows, n_cols = x.shape[0], x.shape[1] * step = max(n_cols // 100, 100) * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< @@ -6328,7 +6347,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm } __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":177 + /* "Orange/distance/_distance.pyx":179 * * * def fix_euclidean_cols_normalized( # <<<<<<<<<<<<<< @@ -6366,32 +6385,35 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_10fix_euclidean_cols_norm return __pyx_r; } -/* "Orange/distance/_distance.pyx":210 +/* "Orange/distance/_distance.pyx":212 * * * def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x2, - * char two_tables): + * char two_tables, */ /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_12manhattan_rows_cont[] = "manhattan_rows_cont(ndarray x1, ndarray x2, char two_tables)"; +static char __pyx_doc_6Orange_8distance_9_distance_12manhattan_rows_cont[] = "manhattan_rows_cont(ndarray x1, ndarray x2, char two_tables, callback)"; static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_13manhattan_rows_cont = {"manhattan_rows_cont", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_12manhattan_rows_cont}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_x1 = 0; PyArrayObject *__pyx_v_x2 = 0; char __pyx_v_two_tables; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("manhattan_rows_cont (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_two_tables,0}; - PyObject* values[3] = {0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_two_tables,&__pyx_n_s_callback,0}; + PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); @@ -6410,40 +6432,48 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont(PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 3, 3, 1); __PYX_ERR(0, 210, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 4, 4, 1); __PYX_ERR(0, 212, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 3, 3, 2); __PYX_ERR(0, 210, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 4, 4, 2); __PYX_ERR(0, 212, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 4, 4, 3); __PYX_ERR(0, 212, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "manhattan_rows_cont") < 0)) __PYX_ERR(0, 210, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "manhattan_rows_cont") < 0)) __PYX_ERR(0, 212, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_x1 = ((PyArrayObject *)values[0]); __pyx_v_x2 = ((PyArrayObject *)values[1]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[2]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[2]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L3_error) + __pyx_v_callback = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 210, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_rows_cont", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 212, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.manhattan_rows_cont", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 210, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 211, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(__pyx_self, __pyx_v_x1, __pyx_v_x2, __pyx_v_two_tables); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 212, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 213, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(__pyx_self, __pyx_v_x1, __pyx_v_x2, __pyx_v_two_tables, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -6454,15 +6484,17 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_13manhattan_rows_cont(PyO return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables, PyObject *__pyx_v_callback) { int __pyx_v_n_rows1; int __pyx_v_n_rows2; int __pyx_v_n_cols; int __pyx_v_row1; int __pyx_v_row2; int __pyx_v_col; + int __pyx_v_step; double __pyx_v_d; PyArrayObject *__pyx_v_distances = 0; + long __pyx_v_row_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; __Pyx_Buffer __pyx_pybuffer_distances; __Pyx_LocalBuf_ND __pyx_pybuffernd_x1; @@ -6482,20 +6514,24 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; + long __pyx_t_12; + long __pyx_t_13; + long __pyx_t_14; + Py_ssize_t __pyx_t_15; + PyObject *(*__pyx_t_16)(PyObject *); + PyObject *__pyx_t_17 = NULL; int __pyx_t_18; int __pyx_t_19; - Py_ssize_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; Py_ssize_t __pyx_t_24; Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + Py_ssize_t __pyx_t_28; + Py_ssize_t __pyx_t_29; __Pyx_RefNannySetupContext("manhattan_rows_cont", 0); __pyx_pybuffer_distances.pybuffer.buf = NULL; __pyx_pybuffer_distances.refcount = 0; @@ -6511,16 +6547,16 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT __pyx_pybuffernd_x2.rcbuffer = &__pyx_pybuffer_x2; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 210, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 212, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 210, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 212, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":218 + /* "Orange/distance/_distance.pyx":221 * np.ndarray[np.float64_t, ndim=2] distances * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< @@ -6532,32 +6568,32 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":219 + /* "Orange/distance/_distance.pyx":222 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: + * step = max(n_rows1 // 100, 100) */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":220 + /* "Orange/distance/_distance.pyx":223 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) # <<<<<<<<<<<<<< - * with nogil: - * for row1 in range(n_rows1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_rows2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_rows2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); @@ -6565,20 +6601,20 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 220, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 220, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 223, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 220, __pyx_L1_error) + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 223, __pyx_L1_error) __pyx_t_7 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -6595,126 +6631,256 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT __pyx_t_9 = __pyx_t_10 = __pyx_t_11 = 0; } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; - if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 220, __pyx_L1_error) + if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 223, __pyx_L1_error) } __pyx_t_7 = 0; __pyx_v_distances = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "Orange/distance/_distance.pyx":221 + /* "Orange/distance/_distance.pyx":224 * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_12 = 0x64; + __pyx_t_13 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_12 > __pyx_t_13) != 0)) { + __pyx_t_14 = __pyx_t_12; + } else { + __pyx_t_14 = __pyx_t_13; + } + __pyx_v_step = __pyx_t_14; - /* "Orange/distance/_distance.pyx":222 + /* "Orange/distance/_distance.pyx":225 * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: - * for row1 in range(n_rows1): # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * d = 0 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - __pyx_t_8 = __pyx_v_n_rows1; - __pyx_t_12 = __pyx_t_8; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_row1 = __pyx_t_13; + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6); + __pyx_t_3 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { + __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5); __pyx_t_15 = 0; + __pyx_t_16 = NULL; + } else { + __pyx_t_15 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_16 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 225, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + for (;;) { + if (likely(!__pyx_t_16)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_15); __Pyx_INCREF(__pyx_t_6); __pyx_t_15++; if (unlikely(0 < 0)) __PYX_ERR(0, 225, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } else { + if (__pyx_t_15 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_15); __Pyx_INCREF(__pyx_t_6); __pyx_t_15++; if (unlikely(0 < 0)) __PYX_ERR(0, 225, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } + } else { + __pyx_t_6 = __pyx_t_16(__pyx_t_5); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 225, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_14 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_14 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_row_start = __pyx_t_14; - /* "Orange/distance/_distance.pyx":223 - * with nogil: - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":226 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: */ - if ((__pyx_v_two_tables != 0)) { - __pyx_t_14 = __pyx_v_n_rows2; - } else { - __pyx_t_14 = __pyx_v_row1; - } - __pyx_t_15 = __pyx_t_14; - for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { - __pyx_v_row2 = __pyx_t_16; + __pyx_t_3 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_4 = __pyx_v_callback; __pyx_t_17 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_17)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_17); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_6 = (__pyx_t_17) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_17, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "Orange/distance/_distance.pyx":224 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * d = 0 # <<<<<<<<<<<<<< - * for col in range(n_cols): - * d += fabs(x1[row1, col] - x2[row2, col]) - */ - __pyx_v_d = 0.0; - - /* "Orange/distance/_distance.pyx":225 - * for row2 in range(n_rows2 if two_tables else row1): - * d = 0 - * for col in range(n_cols): # <<<<<<<<<<<<<< - * d += fabs(x1[row1, col] - x2[row2, col]) - * distances[row1, row2] = d - */ - __pyx_t_17 = __pyx_v_n_cols; - __pyx_t_18 = __pyx_t_17; - for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { - __pyx_v_col = __pyx_t_19; - - /* "Orange/distance/_distance.pyx":226 - * d = 0 - * for col in range(n_cols): - * d += fabs(x1[row1, col] - x2[row2, col]) # <<<<<<<<<<<<<< - * distances[row1, row2] = d - * return distances + /* "Orange/distance/_distance.pyx":227 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + */ + __pyx_t_8 = __pyx_v_n_rows1; + __pyx_t_14 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_8 < __pyx_t_14) != 0)) { + __pyx_t_12 = __pyx_t_8; + } else { + __pyx_t_12 = __pyx_t_14; + } + __pyx_t_14 = __pyx_t_12; + __pyx_t_12 = __pyx_t_14; + for (__pyx_t_8 = __pyx_v_row_start; __pyx_t_8 < __pyx_t_12; __pyx_t_8+=1) { + __pyx_v_row1 = __pyx_t_8; + + /* "Orange/distance/_distance.pyx":228 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + + /* "Orange/distance/_distance.pyx":229 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ - __pyx_t_20 = __pyx_v_row1; - __pyx_t_21 = __pyx_v_col; - __pyx_t_22 = __pyx_v_row2; - __pyx_t_23 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + fabs(((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x1.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_x2.diminfo[1].strides))))); + if ((__pyx_v_two_tables != 0)) { + __pyx_t_18 = __pyx_v_n_rows2; + } else { + __pyx_t_18 = __pyx_v_row1; } + __pyx_t_19 = __pyx_t_18; + for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { + __pyx_v_row2 = __pyx_t_20; + + /* "Orange/distance/_distance.pyx":230 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 # <<<<<<<<<<<<<< + * for col in range(n_cols): + * d += fabs(x1[row1, col] - x2[row2, col]) + */ + __pyx_v_d = 0.0; + + /* "Orange/distance/_distance.pyx":231 + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 + * for col in range(n_cols): # <<<<<<<<<<<<<< + * d += fabs(x1[row1, col] - x2[row2, col]) + * distances[row1, row2] = d + */ + __pyx_t_21 = __pyx_v_n_cols; + __pyx_t_22 = __pyx_t_21; + for (__pyx_t_23 = 0; __pyx_t_23 < __pyx_t_22; __pyx_t_23+=1) { + __pyx_v_col = __pyx_t_23; - /* "Orange/distance/_distance.pyx":227 - * for col in range(n_cols): - * d += fabs(x1[row1, col] - x2[row2, col]) - * distances[row1, row2] = d # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":232 + * d = 0 + * for col in range(n_cols): + * d += fabs(x1[row1, col] - x2[row2, col]) # <<<<<<<<<<<<<< + * distances[row1, row2] = d + * return distances + */ + __pyx_t_24 = __pyx_v_row1; + __pyx_t_25 = __pyx_v_col; + __pyx_t_26 = __pyx_v_row2; + __pyx_t_27 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + fabs(((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_x1.diminfo[1].strides)) - (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x2.diminfo[1].strides))))); + } + + /* "Orange/distance/_distance.pyx":233 + * for col in range(n_cols): + * d += fabs(x1[row1, col] - x2[row2, col]) + * distances[row1, row2] = d # <<<<<<<<<<<<<< * return distances * */ - __pyx_t_24 = __pyx_v_row1; - __pyx_t_25 = __pyx_v_row2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_28 = __pyx_v_row1; + __pyx_t_29 = __pyx_v_row2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + } + } + + /* "Orange/distance/_distance.pyx":228 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * d = 0 + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; } - } } + } - /* "Orange/distance/_distance.pyx":221 - * n_rows2 = x2.shape[0] + /* "Orange/distance/_distance.pyx":225 * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "Orange/distance/_distance.pyx":228 - * d += fabs(x1[row1, col] - x2[row2, col]) - * distances[row1, row2] = d + /* "Orange/distance/_distance.pyx":234 + * d += fabs(x1[row1, col] - x2[row2, col]) + * distances[row1, row2] = d * return distances # <<<<<<<<<<<<<< * * def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, @@ -6724,12 +6890,12 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT __pyx_r = ((PyObject *)__pyx_v_distances); goto __pyx_L0; - /* "Orange/distance/_distance.pyx":210 + /* "Orange/distance/_distance.pyx":212 * * * def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x2, - * char two_tables): + * char two_tables, */ /* function exit code */ @@ -6738,6 +6904,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_17); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -6760,7 +6927,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT return __pyx_r; } -/* "Orange/distance/_distance.pyx":230 +/* "Orange/distance/_distance.pyx":236 * return distances * * def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -6770,7 +6937,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_12manhattan_rows_cont(CYT /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_14fix_manhattan_rows[] = "fix_manhattan_rows(ndarray distances, ndarray x1, ndarray x2, ndarray medians, ndarray mads, ndarray dist_missing2_cont, char two_tables)"; +static char __pyx_doc_6Orange_8distance_9_distance_14fix_manhattan_rows[] = "fix_manhattan_rows(ndarray distances, ndarray x1, ndarray x2, ndarray medians, ndarray mads, ndarray dist_missing2_cont, char two_tables, callback)"; static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_15fix_manhattan_rows = {"fix_manhattan_rows", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_14fix_manhattan_rows}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_distances = 0; @@ -6780,16 +6947,19 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyOb PyArrayObject *__pyx_v_mads = 0; PyArrayObject *__pyx_v_dist_missing2_cont = 0; char __pyx_v_two_tables; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fix_manhattan_rows (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_medians,&__pyx_n_s_mads,&__pyx_n_s_dist_missing2_cont,&__pyx_n_s_two_tables,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_medians,&__pyx_n_s_mads,&__pyx_n_s_dist_missing2_cont,&__pyx_n_s_two_tables,&__pyx_n_s_callback,0}; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -6816,43 +6986,49 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyOb case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 1); __PYX_ERR(0, 230, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, 1); __PYX_ERR(0, 236, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 2); __PYX_ERR(0, 230, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, 2); __PYX_ERR(0, 236, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_medians)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 3); __PYX_ERR(0, 230, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, 3); __PYX_ERR(0, 236, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 4); __PYX_ERR(0, 230, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, 4); __PYX_ERR(0, 236, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dist_missing2_cont)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 5); __PYX_ERR(0, 230, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, 5); __PYX_ERR(0, 236, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, 6); __PYX_ERR(0, 230, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, 6); __PYX_ERR(0, 236, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 7: + if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, 7); __PYX_ERR(0, 236, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_manhattan_rows") < 0)) __PYX_ERR(0, 230, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_manhattan_rows") < 0)) __PYX_ERR(0, 236, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -6862,6 +7038,7 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyOb values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + values[7] = PyTuple_GET_ITEM(__pyx_args, 7); } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x1 = ((PyArrayObject *)values[1]); @@ -6869,23 +7046,24 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyOb __pyx_v_medians = ((PyArrayObject *)values[3]); __pyx_v_mads = ((PyArrayObject *)values[4]); __pyx_v_dist_missing2_cont = ((PyArrayObject *)values[5]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[6]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error) + __pyx_v_callback = values[7]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 230, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 236, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_manhattan_rows", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 230, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 231, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 232, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_medians), __pyx_ptype_5numpy_ndarray, 1, "medians", 0))) __PYX_ERR(0, 233, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mads), __pyx_ptype_5numpy_ndarray, 1, "mads", 0))) __PYX_ERR(0, 234, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2_cont), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2_cont", 0))) __PYX_ERR(0, 235, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_medians, __pyx_v_mads, __pyx_v_dist_missing2_cont, __pyx_v_two_tables); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 236, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 237, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 238, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_medians), __pyx_ptype_5numpy_ndarray, 1, "medians", 0))) __PYX_ERR(0, 239, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mads), __pyx_ptype_5numpy_ndarray, 1, "mads", 0))) __PYX_ERR(0, 240, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dist_missing2_cont), __pyx_ptype_5numpy_ndarray, 1, "dist_missing2_cont", 0))) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_medians, __pyx_v_mads, __pyx_v_dist_missing2_cont, __pyx_v_two_tables, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -6896,16 +7074,18 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_15fix_manhattan_rows(PyOb return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, PyArrayObject *__pyx_v_dist_missing2_cont, char __pyx_v_two_tables) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, PyArrayObject *__pyx_v_dist_missing2_cont, char __pyx_v_two_tables, PyObject *__pyx_v_callback) { int __pyx_v_n_rows1; int __pyx_v_n_rows2; int __pyx_v_n_cols; int __pyx_v_row1; int __pyx_v_row2; int __pyx_v_col; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; + long __pyx_v_row_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_dist_missing2_cont; __Pyx_Buffer __pyx_pybuffer_dist_missing2_cont; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; @@ -6922,31 +7102,39 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - __pyx_t_5numpy_float64_t __pyx_t_17; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - __pyx_t_5numpy_float64_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; Py_ssize_t __pyx_t_23; Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; + __pyx_t_5numpy_float64_t __pyx_t_25; Py_ssize_t __pyx_t_26; Py_ssize_t __pyx_t_27; + __pyx_t_5numpy_float64_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; + Py_ssize_t __pyx_t_31; + Py_ssize_t __pyx_t_32; + Py_ssize_t __pyx_t_33; + Py_ssize_t __pyx_t_34; + Py_ssize_t __pyx_t_35; __Pyx_RefNannySetupContext("fix_manhattan_rows", 0); __pyx_pybuffer_distances.pybuffer.buf = NULL; __pyx_pybuffer_distances.refcount = 0; @@ -6974,53 +7162,53 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_pybuffernd_dist_missing2_cont.rcbuffer = &__pyx_pybuffer_dist_missing2_cont; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 230, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 230, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 230, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_medians.rcbuffer->pybuffer, (PyObject*)__pyx_v_medians, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 230, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_medians.rcbuffer->pybuffer, (PyObject*)__pyx_v_medians, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error) } __pyx_pybuffernd_medians.diminfo[0].strides = __pyx_pybuffernd_medians.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_medians.diminfo[0].shape = __pyx_pybuffernd_medians.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mads.rcbuffer->pybuffer, (PyObject*)__pyx_v_mads, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 230, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mads.rcbuffer->pybuffer, (PyObject*)__pyx_v_mads, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error) } __pyx_pybuffernd_mads.diminfo[0].strides = __pyx_pybuffernd_mads.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mads.diminfo[0].shape = __pyx_pybuffernd_mads.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2_cont, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 230, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer, (PyObject*)__pyx_v_dist_missing2_cont, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 236, __pyx_L1_error) } __pyx_pybuffernd_dist_missing2_cont.diminfo[0].strides = __pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dist_missing2_cont.diminfo[0].shape = __pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":241 + /* "Orange/distance/_distance.pyx":248 * double val1, val2, d * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: + * step = max(n_rows1 // 100, 100) */ __pyx_t_1 = (__pyx_v_x1->dimensions[0]); __pyx_t_2 = (__pyx_v_x1->dimensions[1]); __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":242 + /* "Orange/distance/_distance.pyx":249 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] if two_tables else 0 # <<<<<<<<<<<<<< - * with nogil: - * for row1 in range(n_rows1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): */ if ((__pyx_v_two_tables != 0)) { __pyx_t_2 = (__pyx_v_x2->dimensions[0]); @@ -7029,251 +7217,381 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH } __pyx_v_n_rows2 = __pyx_t_2; - /* "Orange/distance/_distance.pyx":243 + /* "Orange/distance/_distance.pyx":250 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":244 + /* "Orange/distance/_distance.pyx":251 * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: - * for row1 in range(n_rows1): # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): - */ - __pyx_t_3 = __pyx_v_n_rows1; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_row1 = __pyx_t_5; - - /* "Orange/distance/_distance.pyx":245 - * with nogil: - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * if npy_isnan(distances[row1, row2]): - * d = 0 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - if ((__pyx_v_two_tables != 0)) { - __pyx_t_6 = __pyx_v_n_rows2; - } else { - __pyx_t_6 = __pyx_v_row1; - } - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_row2 = __pyx_t_8; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 251, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 251, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 251, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_10(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 251, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_row_start = __pyx_t_5; - /* "Orange/distance/_distance.pyx":246 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":252 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: */ - __pyx_t_9 = __pyx_v_row1; - __pyx_t_10 = __pyx_v_row2; - __pyx_t_11 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); - if (__pyx_t_11) { + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 252, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 252, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":247 - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): - * d = 0 # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] + /* "Orange/distance/_distance.pyx":253 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): */ - __pyx_v_d = 0.0; + __pyx_t_13 = __pyx_v_n_rows1; + __pyx_t_5 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_13 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_13; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_13 = __pyx_v_row_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { + __pyx_v_row1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":248 - * if npy_isnan(distances[row1, row2]): - * d = 0 - * for col in range(n_cols): # <<<<<<<<<<<<<< - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): + /* "Orange/distance/_distance.pyx":254 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): */ - __pyx_t_12 = __pyx_v_n_cols; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_col = __pyx_t_14; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":249 - * d = 0 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":255 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * if npy_isnan(distances[row1, row2]): + * d = 0 */ - __pyx_t_15 = __pyx_v_row1; - __pyx_t_16 = __pyx_v_col; - __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x1.diminfo[1].strides)); - __pyx_t_18 = __pyx_v_row2; - __pyx_t_19 = __pyx_v_col; - __pyx_t_20 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x2.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_17; - __pyx_v_val2 = __pyx_t_20; + if ((__pyx_v_two_tables != 0)) { + __pyx_t_14 = __pyx_v_n_rows2; + } else { + __pyx_t_14 = __pyx_v_row1; + } + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_row2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":250 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2_cont[col] + /* "Orange/distance/_distance.pyx":256 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ - __pyx_t_11 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_11) { + __pyx_t_17 = __pyx_v_row1; + __pyx_t_18 = __pyx_v_row2; + __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":251 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2_cont[col] - * else: + /* "Orange/distance/_distance.pyx":257 + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): + * d = 0 # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":252 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += dist_missing2_cont[col] # <<<<<<<<<<<<<< - * else: - * d += fabs(val2 - medians[col]) + mads[col] + /* "Orange/distance/_distance.pyx":258 + * if npy_isnan(distances[row1, row2]): + * d = 0 + * for col in range(n_cols): # <<<<<<<<<<<<<< + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): */ - __pyx_t_21 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_dist_missing2_cont.diminfo[0].strides))); + __pyx_t_20 = __pyx_v_n_cols; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_col = __pyx_t_22; - /* "Orange/distance/_distance.pyx":251 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += dist_missing2_cont[col] - * else: + /* "Orange/distance/_distance.pyx":259 + * d = 0 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - goto __pyx_L14; - } + __pyx_t_23 = __pyx_v_row1; + __pyx_t_24 = __pyx_v_col; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x1.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row2; + __pyx_t_27 = __pyx_v_col; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x2.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; - /* "Orange/distance/_distance.pyx":254 - * d += dist_missing2_cont[col] - * else: - * d += fabs(val2 - medians[col]) + mads[col] # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * d += fabs(val1 - medians[col]) + mads[col] + /* "Orange/distance/_distance.pyx":260 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2_cont[col] */ - /*else*/ { - __pyx_t_22 = __pyx_v_col; - __pyx_t_23 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val2 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_mads.diminfo[0].strides)))); - } - __pyx_L14:; + __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":250 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += dist_missing2_cont[col] + /* "Orange/distance/_distance.pyx":261 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2_cont[col] + * else: */ - goto __pyx_L13; - } + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { + + /* "Orange/distance/_distance.pyx":262 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += dist_missing2_cont[col] # <<<<<<<<<<<<<< + * else: + * d += fabs(val2 - medians[col]) + mads[col] + */ + __pyx_t_29 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_dist_missing2_cont.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_dist_missing2_cont.diminfo[0].strides))); + + /* "Orange/distance/_distance.pyx":261 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += dist_missing2_cont[col] + * else: + */ + goto __pyx_L18; + } + + /* "Orange/distance/_distance.pyx":264 + * d += dist_missing2_cont[col] + * else: + * d += fabs(val2 - medians[col]) + mads[col] # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * d += fabs(val1 - medians[col]) + mads[col] + */ + /*else*/ { + __pyx_t_30 = __pyx_v_col; + __pyx_t_31 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val2 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_mads.diminfo[0].strides)))); + } + __pyx_L18:; + + /* "Orange/distance/_distance.pyx":260 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += dist_missing2_cont[col] + */ + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":255 + /* "Orange/distance/_distance.pyx":265 + * else: + * d += fabs(val2 - medians[col]) + mads[col] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += fabs(val1 - medians[col]) + mads[col] * else: - * d += fabs(val2 - medians[col]) + mads[col] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += fabs(val1 - medians[col]) + mads[col] - * else: */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":256 - * d += fabs(val2 - medians[col]) + mads[col] - * elif npy_isnan(val2): - * d += fabs(val1 - medians[col]) + mads[col] # <<<<<<<<<<<<<< - * else: - * d += fabs(val1 - val2) + /* "Orange/distance/_distance.pyx":266 + * d += fabs(val2 - medians[col]) + mads[col] + * elif npy_isnan(val2): + * d += fabs(val1 - medians[col]) + mads[col] # <<<<<<<<<<<<<< + * else: + * d += fabs(val1 - val2) */ - __pyx_t_24 = __pyx_v_col; - __pyx_t_25 = __pyx_v_col; - __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val1 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_mads.diminfo[0].strides)))); + __pyx_t_32 = __pyx_v_col; + __pyx_t_33 = __pyx_v_col; + __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val1 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_mads.diminfo[0].strides)))); - /* "Orange/distance/_distance.pyx":255 + /* "Orange/distance/_distance.pyx":265 + * else: + * d += fabs(val2 - medians[col]) + mads[col] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += fabs(val1 - medians[col]) + mads[col] * else: - * d += fabs(val2 - medians[col]) + mads[col] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += fabs(val1 - medians[col]) + mads[col] - * else: */ - goto __pyx_L13; - } + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":258 - * d += fabs(val1 - medians[col]) + mads[col] - * else: - * d += fabs(val1 - val2) # <<<<<<<<<<<<<< - * distances[row1, row2] = d + /* "Orange/distance/_distance.pyx":268 + * d += fabs(val1 - medians[col]) + mads[col] + * else: + * d += fabs(val1 - val2) # <<<<<<<<<<<<<< + * distances[row1, row2] = d * return distances */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + fabs((__pyx_v_val1 - __pyx_v_val2))); + /*else*/ { + __pyx_v_d = (__pyx_v_d + fabs((__pyx_v_val1 - __pyx_v_val2))); + } + __pyx_L17:; } - __pyx_L13:; - } - /* "Orange/distance/_distance.pyx":259 - * else: - * d += fabs(val1 - val2) - * distances[row1, row2] = d # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":269 + * else: + * d += fabs(val1 - val2) + * distances[row1, row2] = d # <<<<<<<<<<<<<< * return distances * */ - __pyx_t_26 = __pyx_v_row1; - __pyx_t_27 = __pyx_v_row2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + __pyx_t_34 = __pyx_v_row1; + __pyx_t_35 = __pyx_v_row2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":246 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":256 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ + } } } - } - } - /* "Orange/distance/_distance.pyx":243 - * n_rows1, n_cols = x1.shape[0], x1.shape[1] - * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + /* "Orange/distance/_distance.pyx":254 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; + } } + } + + /* "Orange/distance/_distance.pyx":251 + * n_rows2 = x2.shape[0] if two_tables else 0 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + */ } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":260 - * d += fabs(val1 - val2) - * distances[row1, row2] = d + /* "Orange/distance/_distance.pyx":270 + * d += fabs(val1 - val2) + * distances[row1, row2] = d * return distances # <<<<<<<<<<<<<< * * @@ -7283,7 +7601,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH __pyx_r = ((PyObject *)__pyx_v_distances); goto __pyx_L0; - /* "Orange/distance/_distance.pyx":230 + /* "Orange/distance/_distance.pyx":236 * return distances * * def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -7293,6 +7611,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -7320,7 +7643,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH return __pyx_r; } -/* "Orange/distance/_distance.pyx":263 +/* "Orange/distance/_distance.pyx":273 * * * def fix_manhattan_rows_normalized(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -7330,23 +7653,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized[] = "fix_manhattan_rows_normalized(ndarray distances, ndarray x1, ndarray x2, char two_tables)"; +static char __pyx_doc_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized[] = "fix_manhattan_rows_normalized(ndarray distances, ndarray x1, ndarray x2, char two_tables, callback)"; static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized = {"fix_manhattan_rows_normalized", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_distances = 0; PyArrayObject *__pyx_v_x1 = 0; PyArrayObject *__pyx_v_x2 = 0; char __pyx_v_two_tables; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fix_manhattan_rows_normalized (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_two_tables,0}; - PyObject* values[4] = {0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_distances,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_two_tables,&__pyx_n_s_callback,0}; + PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -7367,49 +7693,57 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_norm case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, 1); __PYX_ERR(0, 263, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 5, 5, 1); __PYX_ERR(0, 273, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, 2); __PYX_ERR(0, 263, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 5, 5, 2); __PYX_ERR(0, 273, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, 3); __PYX_ERR(0, 263, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 5, 5, 3); __PYX_ERR(0, 273, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 5, 5, 4); __PYX_ERR(0, 273, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_manhattan_rows_normalized") < 0)) __PYX_ERR(0, 263, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fix_manhattan_rows_normalized") < 0)) __PYX_ERR(0, 273, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_distances = ((PyArrayObject *)values[0]); __pyx_v_x1 = ((PyArrayObject *)values[1]); __pyx_v_x2 = ((PyArrayObject *)values[2]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[3]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 266, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[3]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error) + __pyx_v_callback = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 263, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fix_manhattan_rows_normalized", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 273, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.fix_manhattan_rows_normalized", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 263, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 264, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 265, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_two_tables); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_distances), __pyx_ptype_5numpy_ndarray, 1, "distances", 0))) __PYX_ERR(0, 273, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 274, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 275, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized(__pyx_self, __pyx_v_distances, __pyx_v_x1, __pyx_v_x2, __pyx_v_two_tables, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -7420,16 +7754,18 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_17fix_manhattan_rows_norm return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables, PyObject *__pyx_v_callback) { int __pyx_v_n_rows1; int __pyx_v_n_rows2; int __pyx_v_n_cols; int __pyx_v_row1; int __pyx_v_row2; int __pyx_v_col; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; + long __pyx_v_row_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_distances; __Pyx_Buffer __pyx_pybuffer_distances; __Pyx_LocalBuf_ND __pyx_pybuffernd_x1; @@ -7440,26 +7776,34 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; + PyObject *(*__pyx_t_10)(PyObject *); + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - __pyx_t_5numpy_float64_t __pyx_t_17; + int __pyx_t_15; + int __pyx_t_16; + Py_ssize_t __pyx_t_17; Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - __pyx_t_5numpy_float64_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; + Py_ssize_t __pyx_t_23; + Py_ssize_t __pyx_t_24; + __pyx_t_5numpy_float64_t __pyx_t_25; + Py_ssize_t __pyx_t_26; + Py_ssize_t __pyx_t_27; + __pyx_t_5numpy_float64_t __pyx_t_28; + Py_ssize_t __pyx_t_29; + Py_ssize_t __pyx_t_30; __Pyx_RefNannySetupContext("fix_manhattan_rows_normalized", 0); __pyx_pybuffer_distances.pybuffer.buf = NULL; __pyx_pybuffer_distances.refcount = 0; @@ -7475,38 +7819,38 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __pyx_pybuffernd_x2.rcbuffer = &__pyx_pybuffer_x2; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 263, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_distances.rcbuffer->pybuffer, (PyObject*)__pyx_v_distances, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 273, __pyx_L1_error) } __pyx_pybuffernd_distances.diminfo[0].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_distances.diminfo[0].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_distances.diminfo[1].strides = __pyx_pybuffernd_distances.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_distances.diminfo[1].shape = __pyx_pybuffernd_distances.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 263, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 273, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 263, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 273, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":271 + /* "Orange/distance/_distance.pyx":282 * double val1, val2, d * * n_rows1, n_cols = x1.shape[0], x1.shape[1] # <<<<<<<<<<<<<< * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: + * step = max(n_rows1 // 100, 100) */ __pyx_t_1 = (__pyx_v_x1->dimensions[0]); __pyx_t_2 = (__pyx_v_x1->dimensions[1]); __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":272 + /* "Orange/distance/_distance.pyx":283 * * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] if two_tables else 0 # <<<<<<<<<<<<<< - * with nogil: - * for row1 in range(n_rows1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): */ if ((__pyx_v_two_tables != 0)) { __pyx_t_2 = (__pyx_v_x2->dimensions[0]); @@ -7515,246 +7859,376 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm } __pyx_v_n_rows2 = __pyx_t_2; - /* "Orange/distance/_distance.pyx":273 + /* "Orange/distance/_distance.pyx":284 * n_rows1, n_cols = x1.shape[0], x1.shape[1] * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; - /* "Orange/distance/_distance.pyx":274 + /* "Orange/distance/_distance.pyx":285 * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: - * for row1 in range(n_rows1): # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - __pyx_t_3 = __pyx_v_n_rows1; - __pyx_t_4 = __pyx_t_3; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_row1 = __pyx_t_5; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7); + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { + __pyx_t_8 = __pyx_t_7; __Pyx_INCREF(__pyx_t_8); __pyx_t_9 = 0; + __pyx_t_10 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_10 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 285, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + for (;;) { + if (likely(!__pyx_t_10)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 285, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 285, __pyx_L1_error) + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_8, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + #endif + } + } else { + __pyx_t_7 = __pyx_t_10(__pyx_t_8); + if (unlikely(!__pyx_t_7)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 285, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_7); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_row_start = __pyx_t_5; - /* "Orange/distance/_distance.pyx":275 - * with nogil: - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * if npy_isnan(distances[row1, row2]): - * d = 0 + /* "Orange/distance/_distance.pyx":286 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: */ - if ((__pyx_v_two_tables != 0)) { - __pyx_t_6 = __pyx_v_n_rows2; - } else { - __pyx_t_6 = __pyx_v_row1; - } - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_row2 = __pyx_t_8; + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 286, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_11 = __pyx_v_callback; __pyx_t_12 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_11); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_11, function); + } + } + __pyx_t_7 = (__pyx_t_12) ? __Pyx_PyObject_Call2Args(__pyx_t_11, __pyx_t_12, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 286, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":276 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":287 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): */ - __pyx_t_9 = __pyx_v_row1; - __pyx_t_10 = __pyx_v_row2; - __pyx_t_11 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); - if (__pyx_t_11) { + __pyx_t_13 = __pyx_v_n_rows1; + __pyx_t_5 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_13 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_13; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_13 = __pyx_v_row_start; __pyx_t_13 < __pyx_t_3; __pyx_t_13+=1) { + __pyx_v_row1 = __pyx_t_13; - /* "Orange/distance/_distance.pyx":277 - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): - * d = 0 # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] + /* "Orange/distance/_distance.pyx":288 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): */ - __pyx_v_d = 0.0; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":278 - * if npy_isnan(distances[row1, row2]): - * d = 0 - * for col in range(n_cols): # <<<<<<<<<<<<<< - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): + /* "Orange/distance/_distance.pyx":289 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * if npy_isnan(distances[row1, row2]): + * d = 0 */ - __pyx_t_12 = __pyx_v_n_cols; - __pyx_t_13 = __pyx_t_12; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_col = __pyx_t_14; + if ((__pyx_v_two_tables != 0)) { + __pyx_t_14 = __pyx_v_n_rows2; + } else { + __pyx_t_14 = __pyx_v_row1; + } + __pyx_t_15 = __pyx_t_14; + for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_row2 = __pyx_t_16; - /* "Orange/distance/_distance.pyx":279 - * d = 0 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":290 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ - __pyx_t_15 = __pyx_v_row1; - __pyx_t_16 = __pyx_v_col; - __pyx_t_17 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_x1.diminfo[1].strides)); - __pyx_t_18 = __pyx_v_row2; - __pyx_t_19 = __pyx_v_col; - __pyx_t_20 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x2.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_17; - __pyx_v_val2 = __pyx_t_20; + __pyx_t_17 = __pyx_v_row1; + __pyx_t_18 = __pyx_v_row2; + __pyx_t_19 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_distances.diminfo[1].strides))) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":280 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += 1 + /* "Orange/distance/_distance.pyx":291 + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): + * d = 0 # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] */ - __pyx_t_11 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_11) { + __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":281 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += 1 + /* "Orange/distance/_distance.pyx":292 + * if npy_isnan(distances[row1, row2]): + * d = 0 + * for col in range(n_cols): # <<<<<<<<<<<<<< + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + */ + __pyx_t_20 = __pyx_v_n_cols; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_col = __pyx_t_22; + + /* "Orange/distance/_distance.pyx":293 + * d = 0 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): + */ + __pyx_t_23 = __pyx_v_row1; + __pyx_t_24 = __pyx_v_col; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x1.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row2; + __pyx_t_27 = __pyx_v_col; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x2.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; + + /* "Orange/distance/_distance.pyx":294 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += 1 + */ + __pyx_t_19 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_19) { + + /* "Orange/distance/_distance.pyx":295 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += 1 + * else: + */ + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { + + /* "Orange/distance/_distance.pyx":296 + * if npy_isnan(val1): + * if npy_isnan(val2): + * d += 1 # <<<<<<<<<<<<<< + * else: + * d += fabs(val2) + 0.5 + */ + __pyx_v_d = (__pyx_v_d + 1.0); + + /* "Orange/distance/_distance.pyx":295 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * d += 1 + * else: + */ + goto __pyx_L18; + } + + /* "Orange/distance/_distance.pyx":298 + * d += 1 + * else: + * d += fabs(val2) + 0.5 # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * d += fabs(val1) + 0.5 + */ + /*else*/ { + __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val2) + 0.5)); + } + __pyx_L18:; + + /* "Orange/distance/_distance.pyx":294 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * d += 1 + */ + goto __pyx_L17; + } + + /* "Orange/distance/_distance.pyx":299 + * else: + * d += fabs(val2) + 0.5 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += fabs(val1) + 0.5 * else: */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { + __pyx_t_19 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_19) { - /* "Orange/distance/_distance.pyx":282 - * if npy_isnan(val1): - * if npy_isnan(val2): - * d += 1 # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":300 + * d += fabs(val2) + 0.5 + * elif npy_isnan(val2): + * d += fabs(val1) + 0.5 # <<<<<<<<<<<<<< * else: - * d += fabs(val2) + 0.5 + * d += fabs(val1 - val2) */ - __pyx_v_d = (__pyx_v_d + 1.0); + __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val1) + 0.5)); - /* "Orange/distance/_distance.pyx":281 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * d += 1 + /* "Orange/distance/_distance.pyx":299 + * else: + * d += fabs(val2) + 0.5 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * d += fabs(val1) + 0.5 * else: */ - goto __pyx_L14; + goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":284 - * d += 1 + /* "Orange/distance/_distance.pyx":302 + * d += fabs(val1) + 0.5 * else: - * d += fabs(val2) + 0.5 # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * d += fabs(val1) + 0.5 + * d += fabs(val1 - val2) # <<<<<<<<<<<<<< + * distances[row1, row2] = d + * return distances */ /*else*/ { - __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val2) + 0.5)); + __pyx_v_d = (__pyx_v_d + fabs((__pyx_v_val1 - __pyx_v_val2))); } - __pyx_L14:; - - /* "Orange/distance/_distance.pyx":280 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * d += 1 - */ - goto __pyx_L13; + __pyx_L17:; } - /* "Orange/distance/_distance.pyx":285 - * else: - * d += fabs(val2) + 0.5 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += fabs(val1) + 0.5 - * else: - */ - __pyx_t_11 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_11) { - - /* "Orange/distance/_distance.pyx":286 - * d += fabs(val2) + 0.5 - * elif npy_isnan(val2): - * d += fabs(val1) + 0.5 # <<<<<<<<<<<<<< - * else: - * d += fabs(val1 - val2) - */ - __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val1) + 0.5)); - - /* "Orange/distance/_distance.pyx":285 + /* "Orange/distance/_distance.pyx":303 * else: - * d += fabs(val2) + 0.5 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * d += fabs(val1) + 0.5 - * else: - */ - goto __pyx_L13; - } - - /* "Orange/distance/_distance.pyx":288 - * d += fabs(val1) + 0.5 - * else: - * d += fabs(val1 - val2) # <<<<<<<<<<<<<< - * distances[row1, row2] = d + * d += fabs(val1 - val2) + * distances[row1, row2] = d # <<<<<<<<<<<<<< * return distances + * */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + fabs((__pyx_v_val1 - __pyx_v_val2))); - } - __pyx_L13:; - } + __pyx_t_29 = __pyx_v_row1; + __pyx_t_30 = __pyx_v_row2; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; - /* "Orange/distance/_distance.pyx":289 - * else: - * d += fabs(val1 - val2) - * distances[row1, row2] = d # <<<<<<<<<<<<<< - * return distances - * + /* "Orange/distance/_distance.pyx":290 + * with nogil: + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< + * d = 0 + * for col in range(n_cols): */ - __pyx_t_21 = __pyx_v_row1; - __pyx_t_22 = __pyx_v_row2; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_distances.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_distances.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_distances.diminfo[1].strides) = __pyx_v_d; + } + } + } - /* "Orange/distance/_distance.pyx":276 - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): - * if npy_isnan(distances[row1, row2]): # <<<<<<<<<<<<<< - * d = 0 - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":288 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * if npy_isnan(distances[row1, row2]): */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; } + __pyx_L11:; } - } } + } - /* "Orange/distance/_distance.pyx":273 - * n_rows1, n_cols = x1.shape[0], x1.shape[1] + /* "Orange/distance/_distance.pyx":285 * n_rows2 = x2.shape[0] if two_tables else 0 - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * for row2 in range(n_rows2 if two_tables else row1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":290 - * d += fabs(val1 - val2) - * distances[row1, row2] = d + /* "Orange/distance/_distance.pyx":304 + * d += fabs(val1 - val2) + * distances[row1, row2] = d * return distances # <<<<<<<<<<<<<< * * @@ -7764,7 +8238,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm __pyx_r = ((PyObject *)__pyx_v_distances); goto __pyx_L0; - /* "Orange/distance/_distance.pyx":263 + /* "Orange/distance/_distance.pyx":273 * * * def fix_manhattan_rows_normalized(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< @@ -7774,6 +8248,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -7795,7 +8274,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm return __pyx_r; } -/* "Orange/distance/_distance.pyx":293 +/* "Orange/distance/_distance.pyx":307 * * * def manhattan_cols(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< @@ -7805,23 +8284,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_norm /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_18manhattan_cols[] = "manhattan_cols(ndarray x, ndarray medians, ndarray mads, char normalize)"; +static char __pyx_doc_6Orange_8distance_9_distance_18manhattan_cols[] = "manhattan_cols(ndarray x, ndarray medians, ndarray mads, char normalize, callback)"; static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_19manhattan_cols = {"manhattan_cols", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_18manhattan_cols}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_x = 0; PyArrayObject *__pyx_v_medians = 0; PyArrayObject *__pyx_v_mads = 0; char __pyx_v_normalize; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("manhattan_cols (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_medians,&__pyx_n_s_mads,&__pyx_n_s_normalize,0}; - PyObject* values[4] = {0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_medians,&__pyx_n_s_mads,&__pyx_n_s_normalize,&__pyx_n_s_callback,0}; + PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -7842,49 +8324,57 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols(PyObject case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_medians)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, 1); __PYX_ERR(0, 293, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 5, 5, 1); __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, 2); __PYX_ERR(0, 293, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 5, 5, 2); __PYX_ERR(0, 307, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_normalize)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, 3); __PYX_ERR(0, 293, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 5, 5, 3); __PYX_ERR(0, 307, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 5, 5, 4); __PYX_ERR(0, 307, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "manhattan_cols") < 0)) __PYX_ERR(0, 293, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "manhattan_cols") < 0)) __PYX_ERR(0, 307, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_x = ((PyArrayObject *)values[0]); __pyx_v_medians = ((PyArrayObject *)values[1]); __pyx_v_mads = ((PyArrayObject *)values[2]); - __pyx_v_normalize = __Pyx_PyInt_As_char(values[3]); if (unlikely((__pyx_v_normalize == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L3_error) + __pyx_v_normalize = __Pyx_PyInt_As_char(values[3]); if (unlikely((__pyx_v_normalize == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 310, __pyx_L3_error) + __pyx_v_callback = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 293, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("manhattan_cols", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 307, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.manhattan_cols", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 293, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_medians), __pyx_ptype_5numpy_ndarray, 1, "medians", 0))) __PYX_ERR(0, 294, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mads), __pyx_ptype_5numpy_ndarray, 1, "mads", 0))) __PYX_ERR(0, 295, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(__pyx_self, __pyx_v_x, __pyx_v_medians, __pyx_v_mads, __pyx_v_normalize); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 307, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_medians), __pyx_ptype_5numpy_ndarray, 1, "medians", 0))) __PYX_ERR(0, 308, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mads), __pyx_ptype_5numpy_ndarray, 1, "mads", 0))) __PYX_ERR(0, 309, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(__pyx_self, __pyx_v_x, __pyx_v_medians, __pyx_v_mads, __pyx_v_normalize, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -7895,16 +8385,18 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_19manhattan_cols(PyObject return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, char __pyx_v_normalize) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, char __pyx_v_normalize, PyObject *__pyx_v_callback) { int __pyx_v_n_rows; int __pyx_v_n_cols; int __pyx_v_col1; int __pyx_v_col2; int __pyx_v_row; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_d; __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_v_col_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_mads; __Pyx_Buffer __pyx_pybuffer_mads; __Pyx_LocalBuf_ND __pyx_pybuffernd_medians; @@ -7915,31 +8407,31 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __Pyx_RefNannyDeclarations npy_intp __pyx_t_1; npy_intp __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + long __pyx_t_3; + long __pyx_t_4; + long __pyx_t_5; PyObject *__pyx_t_6 = NULL; - __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + __Pyx_memviewslice __pyx_t_10 = { 0, 0, { 0 }, { 0 }, { 0 } }; + Py_ssize_t __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *__pyx_t_13 = NULL; int __pyx_t_14; int __pyx_t_15; int __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - __pyx_t_5numpy_float64_t __pyx_t_19; - Py_ssize_t __pyx_t_20; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; Py_ssize_t __pyx_t_21; - __pyx_t_5numpy_float64_t __pyx_t_22; - int __pyx_t_23; + Py_ssize_t __pyx_t_22; + __pyx_t_5numpy_float64_t __pyx_t_23; Py_ssize_t __pyx_t_24; Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; + __pyx_t_5numpy_float64_t __pyx_t_26; + int __pyx_t_27; Py_ssize_t __pyx_t_28; Py_ssize_t __pyx_t_29; Py_ssize_t __pyx_t_30; @@ -7948,6 +8440,10 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U Py_ssize_t __pyx_t_33; Py_ssize_t __pyx_t_34; Py_ssize_t __pyx_t_35; + Py_ssize_t __pyx_t_36; + Py_ssize_t __pyx_t_37; + Py_ssize_t __pyx_t_38; + Py_ssize_t __pyx_t_39; __Pyx_RefNannySetupContext("manhattan_cols", 0); __pyx_pybuffer_x.pybuffer.buf = NULL; __pyx_pybuffer_x.refcount = 0; @@ -7963,428 +8459,558 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U __pyx_pybuffernd_mads.rcbuffer = &__pyx_pybuffer_mads; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 293, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 307, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_medians.rcbuffer->pybuffer, (PyObject*)__pyx_v_medians, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 293, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_medians.rcbuffer->pybuffer, (PyObject*)__pyx_v_medians, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 307, __pyx_L1_error) } __pyx_pybuffernd_medians.diminfo[0].strides = __pyx_pybuffernd_medians.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_medians.diminfo[0].shape = __pyx_pybuffernd_medians.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mads.rcbuffer->pybuffer, (PyObject*)__pyx_v_mads, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 293, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mads.rcbuffer->pybuffer, (PyObject*)__pyx_v_mads, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 307, __pyx_L1_error) } __pyx_pybuffernd_mads.diminfo[0].strides = __pyx_pybuffernd_mads.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mads.diminfo[0].shape = __pyx_pybuffernd_mads.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":302 - * double [:, :] distances - * - * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< - * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: + /* "Orange/distance/_distance.pyx":317 + * double [:, :] distances + * + * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< + * step = max(n_cols // 100, 100) + * distances = np.zeros((n_cols, n_cols), dtype=float) + */ + __pyx_t_1 = (__pyx_v_x->dimensions[0]); + __pyx_t_2 = (__pyx_v_x->dimensions[1]); + __pyx_v_n_rows = __pyx_t_1; + __pyx_v_n_cols = __pyx_t_2; + + /* "Orange/distance/_distance.pyx":318 + * + * n_rows, n_cols = x.shape[0], x.shape[1] + * step = max(n_cols // 100, 100) # <<<<<<<<<<<<<< + * distances = np.zeros((n_cols, n_cols), dtype=float) + * for col_start in range(0, n_cols, step): + */ + __pyx_t_3 = 0x64; + __pyx_t_4 = (__pyx_v_n_cols / 0x64); + if (((__pyx_t_3 > __pyx_t_4) != 0)) { + __pyx_t_5 = __pyx_t_3; + } else { + __pyx_t_5 = __pyx_t_4; + } + __pyx_v_step = __pyx_t_5; + + /* "Orange/distance/_distance.pyx":319 + * n_rows, n_cols = x.shape[0], x.shape[1] + * step = max(n_cols // 100, 100) + * distances = np.zeros((n_cols, n_cols), dtype=float) # <<<<<<<<<<<<<< + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_8); + __pyx_t_6 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 319, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_10.memview)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_distances = __pyx_t_10; + __pyx_t_10.memview = NULL; + __pyx_t_10.data = NULL; + + /* "Orange/distance/_distance.pyx":320 + * step = max(n_cols // 100, 100) + * distances = np.zeros((n_cols, n_cols), dtype=float) + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + */ + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_9); + __pyx_t_6 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) { + __pyx_t_8 = __pyx_t_9; __Pyx_INCREF(__pyx_t_8); __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_8 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_12 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 320, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_8))) { + if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_9); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 320, __pyx_L1_error) + #else + __pyx_t_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + #endif + } else { + if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_8)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_8, __pyx_t_11); __Pyx_INCREF(__pyx_t_9); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 320, __pyx_L1_error) + #else + __pyx_t_9 = PySequence_ITEM(__pyx_t_8, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + #endif + } + } else { + __pyx_t_9 = __pyx_t_12(__pyx_t_8); + if (unlikely(!__pyx_t_9)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 320, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_9); + } + __pyx_t_5 = __Pyx_PyInt_As_long(__pyx_t_9); if (unlikely((__pyx_t_5 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 320, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_col_start = __pyx_t_5; + + /* "Orange/distance/_distance.pyx":321 + * distances = np.zeros((n_cols, n_cols), dtype=float) + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) # <<<<<<<<<<<<<< + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: + */ + __pyx_t_6 = __Pyx_PyInt_From_long(((__pyx_v_col_start * 0x64) / __pyx_v_n_cols)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_7 = __pyx_v_callback; __pyx_t_13 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_9 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_13, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "Orange/distance/_distance.pyx":322 + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): # <<<<<<<<<<<<<< + * with nogil: + * for col2 in range(col1): */ - __pyx_t_1 = (__pyx_v_x->dimensions[0]); - __pyx_t_2 = (__pyx_v_x->dimensions[1]); - __pyx_v_n_rows = __pyx_t_1; - __pyx_v_n_cols = __pyx_t_2; + __pyx_t_14 = __pyx_v_n_cols; + __pyx_t_5 = (__pyx_v_col_start + __pyx_v_step); + if (((__pyx_t_14 < __pyx_t_5) != 0)) { + __pyx_t_3 = __pyx_t_14; + } else { + __pyx_t_3 = __pyx_t_5; + } + __pyx_t_5 = __pyx_t_3; + __pyx_t_3 = __pyx_t_5; + for (__pyx_t_14 = __pyx_v_col_start; __pyx_t_14 < __pyx_t_3; __pyx_t_14+=1) { + __pyx_v_col1 = __pyx_t_14; - /* "Orange/distance/_distance.pyx":303 - * - * n_rows, n_cols = x.shape[0], x.shape[1] - * distances = np.zeros((n_cols, n_cols), dtype=float) # <<<<<<<<<<<<<< - * with nogil: - * for col1 in range(n_cols): + /* "Orange/distance/_distance.pyx":323 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * for col2 in range(col1): + * d = 0 */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __pyx_t_3 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 303, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 303, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_distances = __pyx_t_7; - __pyx_t_7.memview = NULL; - __pyx_t_7.data = NULL; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":304 - * n_rows, n_cols = x.shape[0], x.shape[1] - * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * for col2 in range(col1): + /* "Orange/distance/_distance.pyx":324 + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: + * for col2 in range(col1): # <<<<<<<<<<<<<< + * d = 0 + * for row in range(n_rows): */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_15 = __pyx_v_col1; + __pyx_t_16 = __pyx_t_15; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_col2 = __pyx_t_17; - /* "Orange/distance/_distance.pyx":305 - * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: - * for col1 in range(n_cols): # <<<<<<<<<<<<<< - * for col2 in range(col1): - * d = 0 + /* "Orange/distance/_distance.pyx":325 + * with nogil: + * for col2 in range(col1): + * d = 0 # <<<<<<<<<<<<<< + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] */ - __pyx_t_8 = __pyx_v_n_cols; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_col1 = __pyx_t_10; + __pyx_v_d = 0.0; - /* "Orange/distance/_distance.pyx":306 - * with nogil: - * for col1 in range(n_cols): - * for col2 in range(col1): # <<<<<<<<<<<<<< - * d = 0 - * for row in range(n_rows): + /* "Orange/distance/_distance.pyx":326 + * for col2 in range(col1): + * d = 0 + * for row in range(n_rows): # <<<<<<<<<<<<<< + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): */ - __pyx_t_11 = __pyx_v_col1; - __pyx_t_12 = __pyx_t_11; - for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { - __pyx_v_col2 = __pyx_t_13; + __pyx_t_18 = __pyx_v_n_rows; + __pyx_t_19 = __pyx_t_18; + for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { + __pyx_v_row = __pyx_t_20; - /* "Orange/distance/_distance.pyx":307 - * for col1 in range(n_cols): - * for col2 in range(col1): - * d = 0 # <<<<<<<<<<<<<< - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] + /* "Orange/distance/_distance.pyx":327 + * d = 0 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - __pyx_v_d = 0.0; + __pyx_t_21 = __pyx_v_row; + __pyx_t_22 = __pyx_v_col1; + __pyx_t_23 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_t_24 = __pyx_v_row; + __pyx_t_25 = __pyx_v_col2; + __pyx_t_26 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_23; + __pyx_v_val2 = __pyx_t_26; - /* "Orange/distance/_distance.pyx":308 - * for col2 in range(col1): - * d = 0 - * for row in range(n_rows): # <<<<<<<<<<<<<< - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): + /* "Orange/distance/_distance.pyx":328 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * if normalize: */ - __pyx_t_14 = __pyx_v_n_rows; - __pyx_t_15 = __pyx_t_14; - for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { - __pyx_v_row = __pyx_t_16; - - /* "Orange/distance/_distance.pyx":309 - * d = 0 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): - */ - __pyx_t_17 = __pyx_v_row; - __pyx_t_18 = __pyx_v_col1; - __pyx_t_19 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_18, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_t_20 = __pyx_v_row; - __pyx_t_21 = __pyx_v_col2; - __pyx_t_22 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_19; - __pyx_v_val2 = __pyx_t_22; - - /* "Orange/distance/_distance.pyx":310 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * if normalize: - */ - __pyx_t_23 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_23) { - - /* "Orange/distance/_distance.pyx":311 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * if normalize: - * d += 1 - */ - __pyx_t_23 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_23) { - - /* "Orange/distance/_distance.pyx":312 - * if npy_isnan(val1): - * if npy_isnan(val2): - * if normalize: # <<<<<<<<<<<<<< - * d += 1 - * else: + __pyx_t_27 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_27) { + + /* "Orange/distance/_distance.pyx":329 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * if normalize: + * d += 1 */ - __pyx_t_23 = (__pyx_v_normalize != 0); - if (__pyx_t_23) { + __pyx_t_27 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_27) { - /* "Orange/distance/_distance.pyx":313 - * if npy_isnan(val2): - * if normalize: - * d += 1 # <<<<<<<<<<<<<< - * else: - * d += mads[col1] + mads[col2] \ + /* "Orange/distance/_distance.pyx":330 + * if npy_isnan(val1): + * if npy_isnan(val2): + * if normalize: # <<<<<<<<<<<<<< + * d += 1 + * else: */ - __pyx_v_d = (__pyx_v_d + 1.0); + __pyx_t_27 = (__pyx_v_normalize != 0); + if (__pyx_t_27) { - /* "Orange/distance/_distance.pyx":312 - * if npy_isnan(val1): - * if npy_isnan(val2): - * if normalize: # <<<<<<<<<<<<<< - * d += 1 - * else: + /* "Orange/distance/_distance.pyx":331 + * if npy_isnan(val2): + * if normalize: + * d += 1 # <<<<<<<<<<<<<< + * else: + * d += mads[col1] + mads[col2] \ */ - goto __pyx_L14; - } + __pyx_v_d = (__pyx_v_d + 1.0); + + /* "Orange/distance/_distance.pyx":330 + * if npy_isnan(val1): + * if npy_isnan(val2): + * if normalize: # <<<<<<<<<<<<<< + * d += 1 + * else: + */ + goto __pyx_L18; + } - /* "Orange/distance/_distance.pyx":315 - * d += 1 + /* "Orange/distance/_distance.pyx":333 + * d += 1 + * else: + * d += mads[col1] + mads[col2] \ # <<<<<<<<<<<<<< + * + fabs(medians[col1] - medians[col2]) * else: - * d += mads[col1] + mads[col2] \ # <<<<<<<<<<<<<< - * + fabs(medians[col1] - medians[col2]) - * else: */ - /*else*/ { - __pyx_t_24 = __pyx_v_col1; - __pyx_t_25 = __pyx_v_col2; + /*else*/ { + __pyx_t_28 = __pyx_v_col1; + __pyx_t_29 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":316 + /* "Orange/distance/_distance.pyx":334 + * else: + * d += mads[col1] + mads[col2] \ + * + fabs(medians[col1] - medians[col2]) # <<<<<<<<<<<<<< * else: - * d += mads[col1] + mads[col2] \ - * + fabs(medians[col1] - medians[col2]) # <<<<<<<<<<<<<< - * else: - * if normalize: + * if normalize: */ - __pyx_t_26 = __pyx_v_col1; - __pyx_t_27 = __pyx_v_col2; + __pyx_t_30 = __pyx_v_col1; + __pyx_t_31 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":315 - * d += 1 + /* "Orange/distance/_distance.pyx":333 + * d += 1 + * else: + * d += mads[col1] + mads[col2] \ # <<<<<<<<<<<<<< + * + fabs(medians[col1] - medians[col2]) * else: - * d += mads[col1] + mads[col2] \ # <<<<<<<<<<<<<< - * + fabs(medians[col1] - medians[col2]) - * else: */ - __pyx_v_d = (__pyx_v_d + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_mads.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_mads.diminfo[0].strides))) + fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_medians.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_medians.diminfo[0].strides)))))); + __pyx_v_d = (__pyx_v_d + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_mads.diminfo[0].strides)) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_mads.diminfo[0].strides))) + fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_medians.diminfo[0].strides)) - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_medians.diminfo[0].strides)))))); + } + __pyx_L18:; + + /* "Orange/distance/_distance.pyx":329 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * if normalize: + * d += 1 + */ + goto __pyx_L17; } - __pyx_L14:; - /* "Orange/distance/_distance.pyx":311 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * if normalize: - * d += 1 + /* "Orange/distance/_distance.pyx":336 + * + fabs(medians[col1] - medians[col2]) + * else: + * if normalize: # <<<<<<<<<<<<<< + * d += fabs(val2) + 0.5 + * else: */ - goto __pyx_L13; - } + /*else*/ { + __pyx_t_27 = (__pyx_v_normalize != 0); + if (__pyx_t_27) { - /* "Orange/distance/_distance.pyx":318 - * + fabs(medians[col1] - medians[col2]) - * else: - * if normalize: # <<<<<<<<<<<<<< - * d += fabs(val2) + 0.5 + /* "Orange/distance/_distance.pyx":337 * else: + * if normalize: + * d += fabs(val2) + 0.5 # <<<<<<<<<<<<<< + * else: + * d += fabs(val2 - medians[col1]) + mads[col1] */ - /*else*/ { - __pyx_t_23 = (__pyx_v_normalize != 0); - if (__pyx_t_23) { + __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val2) + 0.5)); - /* "Orange/distance/_distance.pyx":319 - * else: - * if normalize: - * d += fabs(val2) + 0.5 # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":336 + * + fabs(medians[col1] - medians[col2]) * else: - * d += fabs(val2 - medians[col1]) + mads[col1] + * if normalize: # <<<<<<<<<<<<<< + * d += fabs(val2) + 0.5 + * else: */ - __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val2) + 0.5)); + goto __pyx_L19; + } - /* "Orange/distance/_distance.pyx":318 - * + fabs(medians[col1] - medians[col2]) + /* "Orange/distance/_distance.pyx":339 + * d += fabs(val2) + 0.5 + * else: + * d += fabs(val2 - medians[col1]) + mads[col1] # <<<<<<<<<<<<<< * else: - * if normalize: # <<<<<<<<<<<<<< - * d += fabs(val2) + 0.5 - * else: + * if npy_isnan(val2): */ - goto __pyx_L15; + /*else*/ { + __pyx_t_32 = __pyx_v_col1; + __pyx_t_33 = __pyx_v_col1; + __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val2 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_mads.diminfo[0].strides)))); + } + __pyx_L19:; } + __pyx_L17:; - /* "Orange/distance/_distance.pyx":321 - * d += fabs(val2) + 0.5 - * else: - * d += fabs(val2 - medians[col1]) + mads[col1] # <<<<<<<<<<<<<< - * else: - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":328 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * if normalize: */ - /*else*/ { - __pyx_t_28 = __pyx_v_col1; - __pyx_t_29 = __pyx_v_col1; - __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val2 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_mads.diminfo[0].strides)))); - } - __pyx_L15:; + goto __pyx_L16; } - __pyx_L13:; - /* "Orange/distance/_distance.pyx":310 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * if normalize: + /* "Orange/distance/_distance.pyx":341 + * d += fabs(val2 - medians[col1]) + mads[col1] + * else: + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * if normalize: + * d += fabs(val1) + 0.5 */ - goto __pyx_L12; - } + /*else*/ { + __pyx_t_27 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_27) { - /* "Orange/distance/_distance.pyx":323 - * d += fabs(val2 - medians[col1]) + mads[col1] - * else: - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * if normalize: - * d += fabs(val1) + 0.5 + /* "Orange/distance/_distance.pyx":342 + * else: + * if npy_isnan(val2): + * if normalize: # <<<<<<<<<<<<<< + * d += fabs(val1) + 0.5 + * else: */ - /*else*/ { - __pyx_t_23 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_23) { + __pyx_t_27 = (__pyx_v_normalize != 0); + if (__pyx_t_27) { - /* "Orange/distance/_distance.pyx":324 - * else: - * if npy_isnan(val2): - * if normalize: # <<<<<<<<<<<<<< - * d += fabs(val1) + 0.5 - * else: + /* "Orange/distance/_distance.pyx":343 + * if npy_isnan(val2): + * if normalize: + * d += fabs(val1) + 0.5 # <<<<<<<<<<<<<< + * else: + * d += fabs(val1 - medians[col2]) + mads[col2] */ - __pyx_t_23 = (__pyx_v_normalize != 0); - if (__pyx_t_23) { + __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val1) + 0.5)); - /* "Orange/distance/_distance.pyx":325 - * if npy_isnan(val2): - * if normalize: - * d += fabs(val1) + 0.5 # <<<<<<<<<<<<<< - * else: - * d += fabs(val1 - medians[col2]) + mads[col2] + /* "Orange/distance/_distance.pyx":342 + * else: + * if npy_isnan(val2): + * if normalize: # <<<<<<<<<<<<<< + * d += fabs(val1) + 0.5 + * else: */ - __pyx_v_d = (__pyx_v_d + (fabs(__pyx_v_val1) + 0.5)); + goto __pyx_L21; + } - /* "Orange/distance/_distance.pyx":324 - * else: - * if npy_isnan(val2): - * if normalize: # <<<<<<<<<<<<<< - * d += fabs(val1) + 0.5 + /* "Orange/distance/_distance.pyx":345 + * d += fabs(val1) + 0.5 + * else: + * d += fabs(val1 - medians[col2]) + mads[col2] # <<<<<<<<<<<<<< * else: + * d += fabs(val1 - val2) */ - goto __pyx_L17; - } + /*else*/ { + __pyx_t_34 = __pyx_v_col2; + __pyx_t_35 = __pyx_v_col2; + __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val1 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_mads.diminfo[0].strides)))); + } + __pyx_L21:; - /* "Orange/distance/_distance.pyx":327 - * d += fabs(val1) + 0.5 - * else: - * d += fabs(val1 - medians[col2]) + mads[col2] # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":341 + * d += fabs(val2 - medians[col1]) + mads[col1] * else: - * d += fabs(val1 - val2) + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * if normalize: + * d += fabs(val1) + 0.5 */ - /*else*/ { - __pyx_t_30 = __pyx_v_col2; - __pyx_t_31 = __pyx_v_col2; - __pyx_v_d = (__pyx_v_d + (fabs((__pyx_v_val1 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_medians.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_medians.diminfo[0].strides)))) + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_mads.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_mads.diminfo[0].strides)))); + goto __pyx_L20; } - __pyx_L17:; - - /* "Orange/distance/_distance.pyx":323 - * d += fabs(val2 - medians[col1]) + mads[col1] - * else: - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * if normalize: - * d += fabs(val1) + 0.5 - */ - goto __pyx_L16; - } - /* "Orange/distance/_distance.pyx":329 - * d += fabs(val1 - medians[col2]) + mads[col2] - * else: - * d += fabs(val1 - val2) # <<<<<<<<<<<<<< - * distances[col1, col2] = distances[col2, col1] = d + /* "Orange/distance/_distance.pyx":347 + * d += fabs(val1 - medians[col2]) + mads[col2] + * else: + * d += fabs(val1 - val2) # <<<<<<<<<<<<<< + * distances[col1, col2] = distances[col2, col1] = d * return distances */ - /*else*/ { - __pyx_v_d = (__pyx_v_d + fabs((__pyx_v_val1 - __pyx_v_val2))); + /*else*/ { + __pyx_v_d = (__pyx_v_d + fabs((__pyx_v_val1 - __pyx_v_val2))); + } + __pyx_L20:; } __pyx_L16:; } - __pyx_L12:; + + /* "Orange/distance/_distance.pyx":348 + * else: + * d += fabs(val1 - val2) + * distances[col1, col2] = distances[col2, col1] = d # <<<<<<<<<<<<<< + * return distances + * + */ + __pyx_t_36 = __pyx_v_col1; + __pyx_t_37 = __pyx_v_col2; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_36 * __pyx_v_distances.strides[0]) ) + __pyx_t_37 * __pyx_v_distances.strides[1]) )) = __pyx_v_d; + __pyx_t_38 = __pyx_v_col2; + __pyx_t_39 = __pyx_v_col1; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_38 * __pyx_v_distances.strides[0]) ) + __pyx_t_39 * __pyx_v_distances.strides[1]) )) = __pyx_v_d; + } + } + + /* "Orange/distance/_distance.pyx":323 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * for col2 in range(col1): + * d = 0 + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; } - - /* "Orange/distance/_distance.pyx":330 - * else: - * d += fabs(val1 - val2) - * distances[col1, col2] = distances[col2, col1] = d # <<<<<<<<<<<<<< - * return distances - * - */ - __pyx_t_32 = __pyx_v_col1; - __pyx_t_33 = __pyx_v_col2; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_32 * __pyx_v_distances.strides[0]) ) + __pyx_t_33 * __pyx_v_distances.strides[1]) )) = __pyx_v_d; - __pyx_t_34 = __pyx_v_col2; - __pyx_t_35 = __pyx_v_col1; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_34 * __pyx_v_distances.strides[0]) ) + __pyx_t_35 * __pyx_v_distances.strides[1]) )) = __pyx_v_d; + __pyx_L11:; } - } } + } - /* "Orange/distance/_distance.pyx":304 - * n_rows, n_cols = x.shape[0], x.shape[1] + /* "Orange/distance/_distance.pyx":320 + * step = max(n_cols // 100, 100) * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * for col2 in range(col1): + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "Orange/distance/_distance.pyx":331 - * d += fabs(val1 - val2) - * distances[col1, col2] = distances[col2, col1] = d + /* "Orange/distance/_distance.pyx":349 + * d += fabs(val1 - val2) + * distances[col1, col2] = distances[col2, col1] = d * return distances # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 349, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_r = __pyx_t_8; + __pyx_t_8 = 0; goto __pyx_L0; - /* "Orange/distance/_distance.pyx":293 + /* "Orange/distance/_distance.pyx":307 * * * def manhattan_cols(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< @@ -8394,11 +9020,12 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __PYX_XDEC_MEMVIEW(&__pyx_t_10, 1); + __Pyx_XDECREF(__pyx_t_13); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -8421,7 +9048,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_U return __pyx_r; } -/* "Orange/distance/_distance.pyx":334 +/* "Orange/distance/_distance.pyx":352 * * * def p_nonzero(np.ndarray[np.float64_t, ndim=1] x): # <<<<<<<<<<<<<< @@ -8437,7 +9064,7 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_21p_nonzero(PyObject *__p PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("p_nonzero (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 334, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 352, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_20p_nonzero(__pyx_self, ((PyArrayObject *)__pyx_v_x)); /* function exit code */ @@ -8471,11 +9098,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 334, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 352, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":339 + /* "Orange/distance/_distance.pyx":357 * double val * * nonzeros = nonnans = 0 # <<<<<<<<<<<<<< @@ -8485,19 +9112,19 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED __pyx_v_nonzeros = 0; __pyx_v_nonnans = 0; - /* "Orange/distance/_distance.pyx":340 + /* "Orange/distance/_distance.pyx":358 * * nonzeros = nonnans = 0 * for row in range(len(x)): # <<<<<<<<<<<<<< * val = x[row] * if not npy_isnan(val): */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_x)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 340, __pyx_L1_error) + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_x)); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 358, __pyx_L1_error) __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_row = __pyx_t_3; - /* "Orange/distance/_distance.pyx":341 + /* "Orange/distance/_distance.pyx":359 * nonzeros = nonnans = 0 * for row in range(len(x)): * val = x[row] # <<<<<<<<<<<<<< @@ -8507,7 +9134,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED __pyx_t_4 = __pyx_v_row; __pyx_v_val = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_x.diminfo[0].strides)); - /* "Orange/distance/_distance.pyx":342 + /* "Orange/distance/_distance.pyx":360 * for row in range(len(x)): * val = x[row] * if not npy_isnan(val): # <<<<<<<<<<<<<< @@ -8517,7 +9144,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED __pyx_t_5 = ((!(npy_isnan(__pyx_v_val) != 0)) != 0); if (__pyx_t_5) { - /* "Orange/distance/_distance.pyx":343 + /* "Orange/distance/_distance.pyx":361 * val = x[row] * if not npy_isnan(val): * nonnans += 1 # <<<<<<<<<<<<<< @@ -8526,7 +9153,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED */ __pyx_v_nonnans = (__pyx_v_nonnans + 1); - /* "Orange/distance/_distance.pyx":344 + /* "Orange/distance/_distance.pyx":362 * if not npy_isnan(val): * nonnans += 1 * if val != 0: # <<<<<<<<<<<<<< @@ -8536,7 +9163,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED __pyx_t_5 = ((__pyx_v_val != 0.0) != 0); if (__pyx_t_5) { - /* "Orange/distance/_distance.pyx":345 + /* "Orange/distance/_distance.pyx":363 * nonnans += 1 * if val != 0: * nonzeros += 1 # <<<<<<<<<<<<<< @@ -8545,7 +9172,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED */ __pyx_v_nonzeros = (__pyx_v_nonzeros + 1); - /* "Orange/distance/_distance.pyx":344 + /* "Orange/distance/_distance.pyx":362 * if not npy_isnan(val): * nonnans += 1 * if val != 0: # <<<<<<<<<<<<<< @@ -8554,7 +9181,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED */ } - /* "Orange/distance/_distance.pyx":342 + /* "Orange/distance/_distance.pyx":360 * for row in range(len(x)): * val = x[row] * if not npy_isnan(val): # <<<<<<<<<<<<<< @@ -8564,7 +9191,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED } } - /* "Orange/distance/_distance.pyx":346 + /* "Orange/distance/_distance.pyx":364 * if val != 0: * nonzeros += 1 * return float(nonzeros) / nonnans # <<<<<<<<<<<<<< @@ -8572,13 +9199,13 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = PyFloat_FromDouble((((double)__pyx_v_nonzeros) / __pyx_v_nonnans)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 346, __pyx_L1_error) + __pyx_t_6 = PyFloat_FromDouble((((double)__pyx_v_nonzeros) / __pyx_v_nonnans)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 364, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; - /* "Orange/distance/_distance.pyx":334 + /* "Orange/distance/_distance.pyx":352 * * * def p_nonzero(np.ndarray[np.float64_t, ndim=1] x): # <<<<<<<<<<<<<< @@ -8606,7 +9233,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED return __pyx_r; } -/* "Orange/distance/_distance.pyx":348 +/* "Orange/distance/_distance.pyx":366 * return float(nonzeros) / nonnans * * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< @@ -8622,7 +9249,7 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_23any_nan_row(PyObject *_ PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("any_nan_row (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 348, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 366, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_22any_nan_row(__pyx_self, ((PyArrayObject *)__pyx_v_x)); /* function exit code */ @@ -8678,11 +9305,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_pybuffernd_x.rcbuffer = &__pyx_pybuffer_x; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 348, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 366, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":353 + /* "Orange/distance/_distance.pyx":371 * np.ndarray[np.int8_t, ndim=1] flags * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< @@ -8694,40 +9321,40 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":354 + /* "Orange/distance/_distance.pyx":372 * * n_rows, n_cols = x.shape[0], x.shape[1] * flags = np.zeros(x.shape[0], dtype=np.int8) # <<<<<<<<<<<<<< * with nogil: * for row in range(n_rows): */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 354, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 354, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 354, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 354, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 354, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 354, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 354, __pyx_L1_error) + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 372, __pyx_L1_error) __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -8744,13 +9371,13 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0; } __pyx_pybuffernd_flags.diminfo[0].strides = __pyx_pybuffernd_flags.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_flags.diminfo[0].shape = __pyx_pybuffernd_flags.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 354, __pyx_L1_error) + if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 372, __pyx_L1_error) } __pyx_t_8 = 0; __pyx_v_flags = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":355 + /* "Orange/distance/_distance.pyx":373 * n_rows, n_cols = x.shape[0], x.shape[1] * flags = np.zeros(x.shape[0], dtype=np.int8) * with nogil: # <<<<<<<<<<<<<< @@ -8765,7 +9392,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS #endif /*try:*/ { - /* "Orange/distance/_distance.pyx":356 + /* "Orange/distance/_distance.pyx":374 * flags = np.zeros(x.shape[0], dtype=np.int8) * with nogil: * for row in range(n_rows): # <<<<<<<<<<<<<< @@ -8777,7 +9404,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { __pyx_v_row = __pyx_t_14; - /* "Orange/distance/_distance.pyx":357 + /* "Orange/distance/_distance.pyx":375 * with nogil: * for row in range(n_rows): * for col in range(n_cols): # <<<<<<<<<<<<<< @@ -8789,7 +9416,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_col = __pyx_t_17; - /* "Orange/distance/_distance.pyx":358 + /* "Orange/distance/_distance.pyx":376 * for row in range(n_rows): * for col in range(n_cols): * if npy_isnan(x[row, col]): # <<<<<<<<<<<<<< @@ -8801,7 +9428,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_t_20 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[1].strides))) != 0); if (__pyx_t_20) { - /* "Orange/distance/_distance.pyx":359 + /* "Orange/distance/_distance.pyx":377 * for col in range(n_cols): * if npy_isnan(x[row, col]): * flags[row] = 1 # <<<<<<<<<<<<<< @@ -8811,7 +9438,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_t_21 = __pyx_v_row; *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_flags.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_flags.diminfo[0].strides) = 1; - /* "Orange/distance/_distance.pyx":360 + /* "Orange/distance/_distance.pyx":378 * if npy_isnan(x[row, col]): * flags[row] = 1 * break # <<<<<<<<<<<<<< @@ -8820,7 +9447,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS */ goto __pyx_L9_break; - /* "Orange/distance/_distance.pyx":358 + /* "Orange/distance/_distance.pyx":376 * for row in range(n_rows): * for col in range(n_cols): * if npy_isnan(x[row, col]): # <<<<<<<<<<<<<< @@ -8833,7 +9460,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS } } - /* "Orange/distance/_distance.pyx":355 + /* "Orange/distance/_distance.pyx":373 * n_rows, n_cols = x.shape[0], x.shape[1] * flags = np.zeros(x.shape[0], dtype=np.int8) * with nogil: # <<<<<<<<<<<<<< @@ -8852,7 +9479,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS } } - /* "Orange/distance/_distance.pyx":361 + /* "Orange/distance/_distance.pyx":379 * flags[row] = 1 * break * return flags # <<<<<<<<<<<<<< @@ -8864,7 +9491,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_r = ((PyObject *)__pyx_v_flags); goto __pyx_L0; - /* "Orange/distance/_distance.pyx":348 + /* "Orange/distance/_distance.pyx":366 * return float(nonzeros) / nonnans * * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< @@ -8899,7 +9526,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS return __pyx_r; } -/* "Orange/distance/_distance.pyx":364 +/* "Orange/distance/_distance.pyx":382 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< @@ -8958,47 +9585,47 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nonzeros2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 1); __PYX_ERR(0, 364, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 1); __PYX_ERR(0, 382, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 2); __PYX_ERR(0, 364, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 2); __PYX_ERR(0, 382, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 3); __PYX_ERR(0, 364, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 3); __PYX_ERR(0, 382, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nans1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 4); __PYX_ERR(0, 364, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 4); __PYX_ERR(0, 382, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nans2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 5); __PYX_ERR(0, 364, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 5); __PYX_ERR(0, 382, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ps)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 6); __PYX_ERR(0, 364, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 6); __PYX_ERR(0, 382, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 7); __PYX_ERR(0, 364, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 7); __PYX_ERR(0, 382, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_rows") < 0)) __PYX_ERR(0, 364, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_rows") < 0)) __PYX_ERR(0, 382, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { goto __pyx_L5_argtuple_error; @@ -9019,23 +9646,23 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * __pyx_v_nans1 = ((PyArrayObject *)values[4]); __pyx_v_nans2 = ((PyArrayObject *)values[5]); __pyx_v_ps = ((PyArrayObject *)values[6]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[7]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 371, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[7]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 389, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 364, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 382, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.jaccard_rows", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros1), __pyx_ptype_5numpy_ndarray, 1, "nonzeros1", 0))) __PYX_ERR(0, 364, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros2), __pyx_ptype_5numpy_ndarray, 1, "nonzeros2", 0))) __PYX_ERR(0, 365, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 366, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 367, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans1), __pyx_ptype_5numpy_ndarray, 1, "nans1", 0))) __PYX_ERR(0, 368, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans2), __pyx_ptype_5numpy_ndarray, 1, "nans2", 0))) __PYX_ERR(0, 369, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 370, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros1), __pyx_ptype_5numpy_ndarray, 1, "nonzeros1", 0))) __PYX_ERR(0, 382, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros2), __pyx_ptype_5numpy_ndarray, 1, "nonzeros2", 0))) __PYX_ERR(0, 383, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 384, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 385, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans1), __pyx_ptype_5numpy_ndarray, 1, "nans1", 0))) __PYX_ERR(0, 386, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans2), __pyx_ptype_5numpy_ndarray, 1, "nans2", 0))) __PYX_ERR(0, 387, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 388, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(__pyx_self, __pyx_v_nonzeros1, __pyx_v_nonzeros2, __pyx_v_x1, __pyx_v_x2, __pyx_v_nans1, __pyx_v_nans2, __pyx_v_ps, __pyx_v_two_tables); /* function exit code */ @@ -9047,7 +9674,7 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * return __pyx_r; } -/* "Orange/distance/_distance.pyx":436 +/* "Orange/distance/_distance.pyx":454 * distances[row1, row2] = 1 - intersection / union * if not two_tables: * lower_to_symmetric(distances, lambda x: x) # <<<<<<<<<<<<<< @@ -9085,7 +9712,7 @@ static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, return __pyx_r; } -/* "Orange/distance/_distance.pyx":364 +/* "Orange/distance/_distance.pyx":382 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< @@ -9172,6 +9799,8 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU Py_ssize_t __pyx_t_47; Py_ssize_t __pyx_t_48; Py_ssize_t __pyx_t_49; + PyObject *__pyx_t_50 = NULL; + PyObject *__pyx_t_51 = NULL; __Pyx_RefNannySetupContext("jaccard_rows", 0); __pyx_pybuffer_nonzeros1.pybuffer.buf = NULL; __pyx_pybuffer_nonzeros1.refcount = 0; @@ -9203,41 +9832,41 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_pybuffernd_ps.rcbuffer = &__pyx_pybuffer_ps; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 364, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 382, __pyx_L1_error) } __pyx_pybuffernd_nonzeros1.diminfo[0].strides = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nonzeros1.diminfo[0].shape = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nonzeros1.diminfo[1].strides = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nonzeros1.diminfo[1].shape = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 364, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 382, __pyx_L1_error) } __pyx_pybuffernd_nonzeros2.diminfo[0].strides = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nonzeros2.diminfo[0].shape = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nonzeros2.diminfo[1].strides = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nonzeros2.diminfo[1].shape = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 364, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 382, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 364, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 382, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 364, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 382, __pyx_L1_error) } __pyx_pybuffernd_nans1.diminfo[0].strides = __pyx_pybuffernd_nans1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nans1.diminfo[0].shape = __pyx_pybuffernd_nans1.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 364, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 382, __pyx_L1_error) } __pyx_pybuffernd_nans2.diminfo[0].strides = __pyx_pybuffernd_nans2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nans2.diminfo[0].shape = __pyx_pybuffernd_nans2.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 364, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 382, __pyx_L1_error) } __pyx_pybuffernd_ps.diminfo[0].strides = __pyx_pybuffernd_ps.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ps.diminfo[0].shape = __pyx_pybuffernd_ps.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":378 + /* "Orange/distance/_distance.pyx":396 * double [:, :] distances * * n_rows1, n_cols = x1.shape[0], x2.shape[1] # <<<<<<<<<<<<<< @@ -9249,7 +9878,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":379 + /* "Orange/distance/_distance.pyx":397 * * n_rows1, n_cols = x1.shape[0], x2.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< @@ -9258,23 +9887,23 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":380 + /* "Orange/distance/_distance.pyx":398 * n_rows1, n_cols = x1.shape[0], x2.shape[1] * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) # <<<<<<<<<<<<<< * with nogil: * for row1 in range(n_rows1): */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 380, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_rows2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 380, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_rows2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 380, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); @@ -9282,26 +9911,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 380, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 380, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 380, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 398, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 380, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_distances = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "Orange/distance/_distance.pyx":381 + /* "Orange/distance/_distance.pyx":399 * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) * with nogil: # <<<<<<<<<<<<<< @@ -9316,7 +9945,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU #endif /*try:*/ { - /* "Orange/distance/_distance.pyx":382 + /* "Orange/distance/_distance.pyx":400 * distances = np.zeros((n_rows1, n_rows2), dtype=float) * with nogil: * for row1 in range(n_rows1): # <<<<<<<<<<<<<< @@ -9328,7 +9957,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_row1 = __pyx_t_10; - /* "Orange/distance/_distance.pyx":383 + /* "Orange/distance/_distance.pyx":401 * with nogil: * for row1 in range(n_rows1): * if nans1[row1]: # <<<<<<<<<<<<<< @@ -9339,7 +9968,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans1.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_nans1.diminfo[0].strides)) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":384 + /* "Orange/distance/_distance.pyx":402 * for row1 in range(n_rows1): * if nans1[row1]: * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< @@ -9355,7 +9984,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_row2 = __pyx_t_15; - /* "Orange/distance/_distance.pyx":385 + /* "Orange/distance/_distance.pyx":403 * if nans1[row1]: * for row2 in range(n_rows2 if two_tables else row1): * union = intersection = 0 # <<<<<<<<<<<<<< @@ -9365,7 +9994,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_v_union = 0.0; __pyx_v_intersection = 0.0; - /* "Orange/distance/_distance.pyx":386 + /* "Orange/distance/_distance.pyx":404 * for row2 in range(n_rows2 if two_tables else row1): * union = intersection = 0 * for col in range(n_cols): # <<<<<<<<<<<<<< @@ -9377,7 +10006,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_col = __pyx_t_18; - /* "Orange/distance/_distance.pyx":387 + /* "Orange/distance/_distance.pyx":405 * union = intersection = 0 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< @@ -9393,7 +10022,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_v_val1 = __pyx_t_21; __pyx_v_val2 = __pyx_t_24; - /* "Orange/distance/_distance.pyx":388 + /* "Orange/distance/_distance.pyx":406 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -9403,7 +10032,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val1) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":389 + /* "Orange/distance/_distance.pyx":407 * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -9413,7 +10042,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":390 + /* "Orange/distance/_distance.pyx":408 * if npy_isnan(val1): * if npy_isnan(val2): * intersection += ps[col] ** 2 # <<<<<<<<<<<<<< @@ -9423,7 +10052,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_25 = __pyx_v_col; __pyx_v_intersection = (__pyx_v_intersection + pow((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_ps.diminfo[0].strides)), 2.0)); - /* "Orange/distance/_distance.pyx":391 + /* "Orange/distance/_distance.pyx":409 * if npy_isnan(val2): * intersection += ps[col] ** 2 * union += 1 - (1 - ps[col]) ** 2 # <<<<<<<<<<<<<< @@ -9433,7 +10062,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_26 = __pyx_v_col; __pyx_v_union = (__pyx_v_union + (1.0 - pow((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_ps.diminfo[0].strides))), 2.0))); - /* "Orange/distance/_distance.pyx":389 + /* "Orange/distance/_distance.pyx":407 * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -9443,7 +10072,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L14; } - /* "Orange/distance/_distance.pyx":392 + /* "Orange/distance/_distance.pyx":410 * intersection += ps[col] ** 2 * union += 1 - (1 - ps[col]) ** 2 * elif val2 != 0: # <<<<<<<<<<<<<< @@ -9453,7 +10082,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":393 + /* "Orange/distance/_distance.pyx":411 * union += 1 - (1 - ps[col]) ** 2 * elif val2 != 0: * intersection += ps[col] # <<<<<<<<<<<<<< @@ -9463,7 +10092,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_27 = __pyx_v_col; __pyx_v_intersection = (__pyx_v_intersection + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_ps.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":394 + /* "Orange/distance/_distance.pyx":412 * elif val2 != 0: * intersection += ps[col] * union += 1 # <<<<<<<<<<<<<< @@ -9472,7 +10101,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_union = (__pyx_v_union + 1.0); - /* "Orange/distance/_distance.pyx":392 + /* "Orange/distance/_distance.pyx":410 * intersection += ps[col] ** 2 * union += 1 - (1 - ps[col]) ** 2 * elif val2 != 0: # <<<<<<<<<<<<<< @@ -9482,7 +10111,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L14; } - /* "Orange/distance/_distance.pyx":396 + /* "Orange/distance/_distance.pyx":414 * union += 1 * else: * union += ps[col] # <<<<<<<<<<<<<< @@ -9495,7 +10124,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU } __pyx_L14:; - /* "Orange/distance/_distance.pyx":388 + /* "Orange/distance/_distance.pyx":406 * for col in range(n_cols): * val1, val2 = x1[row1, col], x2[row2, col] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -9505,7 +10134,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L13; } - /* "Orange/distance/_distance.pyx":397 + /* "Orange/distance/_distance.pyx":415 * else: * union += ps[col] * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -9515,7 +10144,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":398 + /* "Orange/distance/_distance.pyx":416 * union += ps[col] * elif npy_isnan(val2): * if val1 != 0: # <<<<<<<<<<<<<< @@ -9525,7 +10154,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((__pyx_v_val1 != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":399 + /* "Orange/distance/_distance.pyx":417 * elif npy_isnan(val2): * if val1 != 0: * intersection += val1 * ps[col] # <<<<<<<<<<<<<< @@ -9535,7 +10164,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_29 = __pyx_v_col; __pyx_v_intersection = (__pyx_v_intersection + (__pyx_v_val1 * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_ps.diminfo[0].strides)))); - /* "Orange/distance/_distance.pyx":400 + /* "Orange/distance/_distance.pyx":418 * if val1 != 0: * intersection += val1 * ps[col] * union += 1 # <<<<<<<<<<<<<< @@ -9544,7 +10173,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_union = (__pyx_v_union + 1.0); - /* "Orange/distance/_distance.pyx":398 + /* "Orange/distance/_distance.pyx":416 * union += ps[col] * elif npy_isnan(val2): * if val1 != 0: # <<<<<<<<<<<<<< @@ -9554,7 +10183,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L15; } - /* "Orange/distance/_distance.pyx":402 + /* "Orange/distance/_distance.pyx":420 * union += 1 * else: * union += ps[col] # <<<<<<<<<<<<<< @@ -9567,7 +10196,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU } __pyx_L15:; - /* "Orange/distance/_distance.pyx":397 + /* "Orange/distance/_distance.pyx":415 * else: * union += ps[col] * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -9577,7 +10206,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L13; } - /* "Orange/distance/_distance.pyx":404 + /* "Orange/distance/_distance.pyx":422 * union += ps[col] * else: * ival1 = nonzeros1[row1, col] # <<<<<<<<<<<<<< @@ -9589,7 +10218,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_32 = __pyx_v_col; __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":405 + /* "Orange/distance/_distance.pyx":423 * else: * ival1 = nonzeros1[row1, col] * ival2 = nonzeros2[row2, col] # <<<<<<<<<<<<<< @@ -9600,7 +10229,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_34 = __pyx_v_col; __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_nonzeros2.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_nonzeros2.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":406 + /* "Orange/distance/_distance.pyx":424 * ival1 = nonzeros1[row1, col] * ival2 = nonzeros2[row2, col] * union += ival1 | ival2 # <<<<<<<<<<<<<< @@ -9609,7 +10238,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_union = (__pyx_v_union + (__pyx_v_ival1 | __pyx_v_ival2)); - /* "Orange/distance/_distance.pyx":407 + /* "Orange/distance/_distance.pyx":425 * ival2 = nonzeros2[row2, col] * union += ival1 | ival2 * intersection += ival1 & ival2 # <<<<<<<<<<<<<< @@ -9621,7 +10250,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_L13:; } - /* "Orange/distance/_distance.pyx":408 + /* "Orange/distance/_distance.pyx":426 * union += ival1 | ival2 * intersection += ival1 & ival2 * if union != 0: # <<<<<<<<<<<<<< @@ -9631,7 +10260,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((__pyx_v_union != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":409 + /* "Orange/distance/_distance.pyx":427 * intersection += ival1 & ival2 * if union != 0: * distances[row1, row2] = 1 - intersection / union # <<<<<<<<<<<<<< @@ -9642,7 +10271,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_36 = __pyx_v_row2; *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_35 * __pyx_v_distances.strides[0]) ) + __pyx_t_36 * __pyx_v_distances.strides[1]) )) = (1.0 - (__pyx_v_intersection / __pyx_v_union)); - /* "Orange/distance/_distance.pyx":408 + /* "Orange/distance/_distance.pyx":426 * union += ival1 | ival2 * intersection += ival1 & ival2 * if union != 0: # <<<<<<<<<<<<<< @@ -9652,7 +10281,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU } } - /* "Orange/distance/_distance.pyx":383 + /* "Orange/distance/_distance.pyx":401 * with nogil: * for row1 in range(n_rows1): * if nans1[row1]: # <<<<<<<<<<<<<< @@ -9662,7 +10291,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L8; } - /* "Orange/distance/_distance.pyx":411 + /* "Orange/distance/_distance.pyx":429 * distances[row1, row2] = 1 - intersection / union * else: * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< @@ -9679,7 +10308,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_row2 = __pyx_t_15; - /* "Orange/distance/_distance.pyx":412 + /* "Orange/distance/_distance.pyx":430 * else: * for row2 in range(n_rows2 if two_tables else row1): * union = intersection = 0 # <<<<<<<<<<<<<< @@ -9689,7 +10318,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_v_union = 0.0; __pyx_v_intersection = 0.0; - /* "Orange/distance/_distance.pyx":414 + /* "Orange/distance/_distance.pyx":432 * union = intersection = 0 * # This case is slightly different since val1 can't be nan * if nans2[row2]: # <<<<<<<<<<<<<< @@ -9700,7 +10329,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans2.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_nans2.diminfo[0].strides)) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":415 + /* "Orange/distance/_distance.pyx":433 * # This case is slightly different since val1 can't be nan * if nans2[row2]: * for col in range(n_cols): # <<<<<<<<<<<<<< @@ -9712,7 +10341,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_col = __pyx_t_18; - /* "Orange/distance/_distance.pyx":416 + /* "Orange/distance/_distance.pyx":434 * if nans2[row2]: * for col in range(n_cols): * val2 = x2[row2, col] # <<<<<<<<<<<<<< @@ -9723,7 +10352,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_39 = __pyx_v_col; __pyx_v_val2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_x2.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":417 + /* "Orange/distance/_distance.pyx":435 * for col in range(n_cols): * val2 = x2[row2, col] * if nonzeros1[row1, col] != 0: # <<<<<<<<<<<<<< @@ -9735,7 +10364,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = (((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)) != 0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":418 + /* "Orange/distance/_distance.pyx":436 * val2 = x2[row2, col] * if nonzeros1[row1, col] != 0: * union += 1 # <<<<<<<<<<<<<< @@ -9744,7 +10373,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_union = (__pyx_v_union + 1.0); - /* "Orange/distance/_distance.pyx":419 + /* "Orange/distance/_distance.pyx":437 * if nonzeros1[row1, col] != 0: * union += 1 * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -9754,7 +10383,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":420 + /* "Orange/distance/_distance.pyx":438 * union += 1 * if npy_isnan(val2): * intersection += ps[col] # <<<<<<<<<<<<<< @@ -9764,7 +10393,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_42 = __pyx_v_col; __pyx_v_intersection = (__pyx_v_intersection + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_ps.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":419 + /* "Orange/distance/_distance.pyx":437 * if nonzeros1[row1, col] != 0: * union += 1 * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -9774,7 +10403,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L23; } - /* "Orange/distance/_distance.pyx":421 + /* "Orange/distance/_distance.pyx":439 * if npy_isnan(val2): * intersection += ps[col] * elif val2 != 0: # <<<<<<<<<<<<<< @@ -9784,7 +10413,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":422 + /* "Orange/distance/_distance.pyx":440 * intersection += ps[col] * elif val2 != 0: * intersection += 1 # <<<<<<<<<<<<<< @@ -9793,7 +10422,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_intersection = (__pyx_v_intersection + 1.0); - /* "Orange/distance/_distance.pyx":421 + /* "Orange/distance/_distance.pyx":439 * if npy_isnan(val2): * intersection += ps[col] * elif val2 != 0: # <<<<<<<<<<<<<< @@ -9803,7 +10432,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU } __pyx_L23:; - /* "Orange/distance/_distance.pyx":417 + /* "Orange/distance/_distance.pyx":435 * for col in range(n_cols): * val2 = x2[row2, col] * if nonzeros1[row1, col] != 0: # <<<<<<<<<<<<<< @@ -9813,7 +10442,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L22; } - /* "Orange/distance/_distance.pyx":423 + /* "Orange/distance/_distance.pyx":441 * elif val2 != 0: * intersection += 1 * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -9823,7 +10452,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":424 + /* "Orange/distance/_distance.pyx":442 * intersection += 1 * elif npy_isnan(val2): * union += ps[col] # <<<<<<<<<<<<<< @@ -9833,7 +10462,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_43 = __pyx_v_col; __pyx_v_union = (__pyx_v_union + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_ps.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":423 + /* "Orange/distance/_distance.pyx":441 * elif val2 != 0: * intersection += 1 * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -9843,7 +10472,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L22; } - /* "Orange/distance/_distance.pyx":425 + /* "Orange/distance/_distance.pyx":443 * elif npy_isnan(val2): * union += ps[col] * elif val2 != 0: # <<<<<<<<<<<<<< @@ -9853,7 +10482,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":426 + /* "Orange/distance/_distance.pyx":444 * union += ps[col] * elif val2 != 0: * union += 1 # <<<<<<<<<<<<<< @@ -9862,7 +10491,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_union = (__pyx_v_union + 1.0); - /* "Orange/distance/_distance.pyx":425 + /* "Orange/distance/_distance.pyx":443 * elif npy_isnan(val2): * union += ps[col] * elif val2 != 0: # <<<<<<<<<<<<<< @@ -9873,7 +10502,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_L22:; } - /* "Orange/distance/_distance.pyx":414 + /* "Orange/distance/_distance.pyx":432 * union = intersection = 0 * # This case is slightly different since val1 can't be nan * if nans2[row2]: # <<<<<<<<<<<<<< @@ -9883,7 +10512,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU goto __pyx_L19; } - /* "Orange/distance/_distance.pyx":428 + /* "Orange/distance/_distance.pyx":446 * union += 1 * else: * for col in range(n_cols): # <<<<<<<<<<<<<< @@ -9896,7 +10525,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_col = __pyx_t_18; - /* "Orange/distance/_distance.pyx":429 + /* "Orange/distance/_distance.pyx":447 * else: * for col in range(n_cols): * ival1 = nonzeros1[row1, col] # <<<<<<<<<<<<<< @@ -9907,7 +10536,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_45 = __pyx_v_col; __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":430 + /* "Orange/distance/_distance.pyx":448 * for col in range(n_cols): * ival1 = nonzeros1[row1, col] * ival2 = nonzeros2[row2, col] # <<<<<<<<<<<<<< @@ -9918,7 +10547,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_47 = __pyx_v_col; __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_nonzeros2.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_nonzeros2.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":431 + /* "Orange/distance/_distance.pyx":449 * ival1 = nonzeros1[row1, col] * ival2 = nonzeros2[row2, col] * union += ival1 | ival2 # <<<<<<<<<<<<<< @@ -9927,7 +10556,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ __pyx_v_union = (__pyx_v_union + (__pyx_v_ival1 | __pyx_v_ival2)); - /* "Orange/distance/_distance.pyx":432 + /* "Orange/distance/_distance.pyx":450 * ival2 = nonzeros2[row2, col] * union += ival1 | ival2 * intersection += ival1 & ival2 # <<<<<<<<<<<<<< @@ -9939,7 +10568,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU } __pyx_L19:; - /* "Orange/distance/_distance.pyx":433 + /* "Orange/distance/_distance.pyx":451 * union += ival1 | ival2 * intersection += ival1 & ival2 * if union != 0: # <<<<<<<<<<<<<< @@ -9949,7 +10578,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((__pyx_v_union != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":434 + /* "Orange/distance/_distance.pyx":452 * intersection += ival1 & ival2 * if union != 0: * distances[row1, row2] = 1 - intersection / union # <<<<<<<<<<<<<< @@ -9960,7 +10589,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_49 = __pyx_v_row2; *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_48 * __pyx_v_distances.strides[0]) ) + __pyx_t_49 * __pyx_v_distances.strides[1]) )) = (1.0 - (__pyx_v_intersection / __pyx_v_union)); - /* "Orange/distance/_distance.pyx":433 + /* "Orange/distance/_distance.pyx":451 * union += ival1 | ival2 * intersection += ival1 & ival2 * if union != 0: # <<<<<<<<<<<<<< @@ -9974,7 +10603,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU } } - /* "Orange/distance/_distance.pyx":381 + /* "Orange/distance/_distance.pyx":399 * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) * with nogil: # <<<<<<<<<<<<<< @@ -9993,7 +10622,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU } } - /* "Orange/distance/_distance.pyx":435 + /* "Orange/distance/_distance.pyx":453 * if union != 0: * distances[row1, row2] = 1 - intersection / union * if not two_tables: # <<<<<<<<<<<<<< @@ -10003,19 +10632,71 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_t_12 = ((!(__pyx_v_two_tables != 0)) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":436 + /* "Orange/distance/_distance.pyx":454 * distances[row1, row2] = 1 - intersection / union * if not two_tables: * lower_to_symmetric(distances, lambda x: x) # <<<<<<<<<<<<<< * return distances * */ - __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_12jaccard_rows_lambda, 0, __pyx_n_s_jaccard_rows_locals_lambda, NULL, __pyx_n_s_Orange_distance__distance, __pyx_d, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 436, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_f_6Orange_8distance_9_distance_lower_to_symmetric(__pyx_v_distances, __pyx_t_3, 0); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_lower_to_symmetric); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_12jaccard_rows_lambda, 0, __pyx_n_s_jaccard_rows_locals_lambda, NULL, __pyx_n_s_Orange_distance__distance, __pyx_d, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_50 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_50 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_50)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_50); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + __pyx_t_8 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_50, __pyx_t_5, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_50); __pyx_t_50 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[3] = {__pyx_t_50, __pyx_t_5, __pyx_t_4}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_50); __pyx_t_50 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_51 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_51)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_51); + if (__pyx_t_50) { + __Pyx_GIVEREF(__pyx_t_50); PyTuple_SET_ITEM(__pyx_t_51, 0, __pyx_t_50); __pyx_t_50 = NULL; + } + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_51, 0+__pyx_t_8, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_51, 1+__pyx_t_8, __pyx_t_4); + __pyx_t_5 = 0; + __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_51, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_51); __pyx_t_51 = 0; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "Orange/distance/_distance.pyx":435 + /* "Orange/distance/_distance.pyx":453 * if union != 0: * distances[row1, row2] = 1 - intersection / union * if not two_tables: # <<<<<<<<<<<<<< @@ -10024,7 +10705,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU */ } - /* "Orange/distance/_distance.pyx":437 + /* "Orange/distance/_distance.pyx":455 * if not two_tables: * lower_to_symmetric(distances, lambda x: x) * return distances # <<<<<<<<<<<<<< @@ -10032,13 +10713,13 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "Orange/distance/_distance.pyx":364 + /* "Orange/distance/_distance.pyx":382 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< @@ -10053,6 +10734,8 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1); + __Pyx_XDECREF(__pyx_t_50); + __Pyx_XDECREF(__pyx_t_51); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -10083,7 +10766,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU return __pyx_r; } -/* "Orange/distance/_distance.pyx":440 +/* "Orange/distance/_distance.pyx":458 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< @@ -10130,23 +10813,23 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols(PyObject * case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 1); __PYX_ERR(0, 440, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 1); __PYX_ERR(0, 458, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nans)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 2); __PYX_ERR(0, 440, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 2); __PYX_ERR(0, 458, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ps)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 3); __PYX_ERR(0, 440, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 3); __PYX_ERR(0, 458, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_cols") < 0)) __PYX_ERR(0, 440, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_cols") < 0)) __PYX_ERR(0, 458, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -10163,16 +10846,16 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols(PyObject * } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 440, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 458, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.jaccard_cols", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros), __pyx_ptype_5numpy_ndarray, 1, "nonzeros", 0))) __PYX_ERR(0, 440, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 441, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans), __pyx_ptype_5numpy_ndarray, 1, "nans", 0))) __PYX_ERR(0, 442, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 443, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros), __pyx_ptype_5numpy_ndarray, 1, "nonzeros", 0))) __PYX_ERR(0, 458, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 459, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans), __pyx_ptype_5numpy_ndarray, 1, "nans", 0))) __PYX_ERR(0, 460, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 461, __pyx_L1_error) __pyx_r = __pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(__pyx_self, __pyx_v_nonzeros, __pyx_v_x, __pyx_v_nans, __pyx_v_ps); /* function exit code */ @@ -10301,26 +10984,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_pybuffernd_ps.rcbuffer = &__pyx_pybuffer_ps; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 440, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 458, __pyx_L1_error) } __pyx_pybuffernd_nonzeros.diminfo[0].strides = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nonzeros.diminfo[0].shape = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nonzeros.diminfo[1].strides = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nonzeros.diminfo[1].shape = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 440, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 458, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 440, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 458, __pyx_L1_error) } __pyx_pybuffernd_nans.diminfo[0].strides = __pyx_pybuffernd_nans.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nans.diminfo[0].shape = __pyx_pybuffernd_nans.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 440, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 458, __pyx_L1_error) } __pyx_pybuffernd_ps.diminfo[0].strides = __pyx_pybuffernd_ps.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ps.diminfo[0].shape = __pyx_pybuffernd_ps.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":451 + /* "Orange/distance/_distance.pyx":469 * double [:, :] distances * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< @@ -10332,23 +11015,23 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":452 + /* "Orange/distance/_distance.pyx":470 * * n_rows, n_cols = x.shape[0], x.shape[1] * distances = np.zeros((n_cols, n_cols), dtype=float) # <<<<<<<<<<<<<< * with nogil: * for col1 in range(n_cols): */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 452, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 452, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 452, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); @@ -10356,26 +11039,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 452, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 452, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 452, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 452, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 452, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 470, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_distances = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "Orange/distance/_distance.pyx":453 + /* "Orange/distance/_distance.pyx":471 * n_rows, n_cols = x.shape[0], x.shape[1] * distances = np.zeros((n_cols, n_cols), dtype=float) * with nogil: # <<<<<<<<<<<<<< @@ -10390,7 +11073,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU #endif /*try:*/ { - /* "Orange/distance/_distance.pyx":454 + /* "Orange/distance/_distance.pyx":472 * distances = np.zeros((n_cols, n_cols), dtype=float) * with nogil: * for col1 in range(n_cols): # <<<<<<<<<<<<<< @@ -10402,7 +11085,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_col1 = __pyx_t_10; - /* "Orange/distance/_distance.pyx":455 + /* "Orange/distance/_distance.pyx":473 * with nogil: * for col1 in range(n_cols): * if nans[col1]: # <<<<<<<<<<<<<< @@ -10413,7 +11096,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_nans.diminfo[0].strides)) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":456 + /* "Orange/distance/_distance.pyx":474 * for col1 in range(n_cols): * if nans[col1]: * for col2 in range(col1): # <<<<<<<<<<<<<< @@ -10425,7 +11108,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_col2 = __pyx_t_15; - /* "Orange/distance/_distance.pyx":457 + /* "Orange/distance/_distance.pyx":475 * if nans[col1]: * for col2 in range(col1): * in_both = in_any = 0 # <<<<<<<<<<<<<< @@ -10435,7 +11118,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_in_both = 0; __pyx_v_in_any = 0; - /* "Orange/distance/_distance.pyx":458 + /* "Orange/distance/_distance.pyx":476 * for col2 in range(col1): * in_both = in_any = 0 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 # <<<<<<<<<<<<<< @@ -10448,7 +11131,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_unk1_not2 = 0; __pyx_v_not1_unk2 = 0; - /* "Orange/distance/_distance.pyx":459 + /* "Orange/distance/_distance.pyx":477 * in_both = in_any = 0 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 * for row in range(n_rows): # <<<<<<<<<<<<<< @@ -10460,7 +11143,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_row = __pyx_t_18; - /* "Orange/distance/_distance.pyx":460 + /* "Orange/distance/_distance.pyx":478 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 * for row in range(n_rows): * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< @@ -10476,7 +11159,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_val1 = __pyx_t_21; __pyx_v_val2 = __pyx_t_24; - /* "Orange/distance/_distance.pyx":461 + /* "Orange/distance/_distance.pyx":479 * for row in range(n_rows): * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -10486,7 +11169,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val1) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":462 + /* "Orange/distance/_distance.pyx":480 * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -10496,7 +11179,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":463 + /* "Orange/distance/_distance.pyx":481 * if npy_isnan(val1): * if npy_isnan(val2): * unk1_unk2 += 1 # <<<<<<<<<<<<<< @@ -10505,7 +11188,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_unk1_unk2 = (__pyx_v_unk1_unk2 + 1); - /* "Orange/distance/_distance.pyx":462 + /* "Orange/distance/_distance.pyx":480 * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -10515,7 +11198,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L14; } - /* "Orange/distance/_distance.pyx":464 + /* "Orange/distance/_distance.pyx":482 * if npy_isnan(val2): * unk1_unk2 += 1 * elif val2 != 0: # <<<<<<<<<<<<<< @@ -10525,7 +11208,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":465 + /* "Orange/distance/_distance.pyx":483 * unk1_unk2 += 1 * elif val2 != 0: * unk1_in2 += 1 # <<<<<<<<<<<<<< @@ -10534,7 +11217,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_unk1_in2 = (__pyx_v_unk1_in2 + 1); - /* "Orange/distance/_distance.pyx":464 + /* "Orange/distance/_distance.pyx":482 * if npy_isnan(val2): * unk1_unk2 += 1 * elif val2 != 0: # <<<<<<<<<<<<<< @@ -10544,7 +11227,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L14; } - /* "Orange/distance/_distance.pyx":467 + /* "Orange/distance/_distance.pyx":485 * unk1_in2 += 1 * else: * unk1_not2 += 1 # <<<<<<<<<<<<<< @@ -10556,7 +11239,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU } __pyx_L14:; - /* "Orange/distance/_distance.pyx":461 + /* "Orange/distance/_distance.pyx":479 * for row in range(n_rows): * val1, val2 = x[row, col1], x[row, col2] * if npy_isnan(val1): # <<<<<<<<<<<<<< @@ -10566,7 +11249,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L13; } - /* "Orange/distance/_distance.pyx":468 + /* "Orange/distance/_distance.pyx":486 * else: * unk1_not2 += 1 * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -10576,7 +11259,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":469 + /* "Orange/distance/_distance.pyx":487 * unk1_not2 += 1 * elif npy_isnan(val2): * if val1 != 0: # <<<<<<<<<<<<<< @@ -10586,7 +11269,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = ((__pyx_v_val1 != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":470 + /* "Orange/distance/_distance.pyx":488 * elif npy_isnan(val2): * if val1 != 0: * in1_unk2 += 1 # <<<<<<<<<<<<<< @@ -10595,7 +11278,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_in1_unk2 = (__pyx_v_in1_unk2 + 1); - /* "Orange/distance/_distance.pyx":469 + /* "Orange/distance/_distance.pyx":487 * unk1_not2 += 1 * elif npy_isnan(val2): * if val1 != 0: # <<<<<<<<<<<<<< @@ -10605,7 +11288,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L15; } - /* "Orange/distance/_distance.pyx":472 + /* "Orange/distance/_distance.pyx":490 * in1_unk2 += 1 * else: * not1_unk2 += 1 # <<<<<<<<<<<<<< @@ -10617,7 +11300,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU } __pyx_L15:; - /* "Orange/distance/_distance.pyx":468 + /* "Orange/distance/_distance.pyx":486 * else: * unk1_not2 += 1 * elif npy_isnan(val2): # <<<<<<<<<<<<<< @@ -10627,7 +11310,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L13; } - /* "Orange/distance/_distance.pyx":474 + /* "Orange/distance/_distance.pyx":492 * not1_unk2 += 1 * else: * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< @@ -10639,7 +11322,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_26 = __pyx_v_col1; __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":475 + /* "Orange/distance/_distance.pyx":493 * else: * ival1 = nonzeros[row, col1] * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< @@ -10650,7 +11333,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_28 = __pyx_v_col2; __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":476 + /* "Orange/distance/_distance.pyx":494 * ival1 = nonzeros[row, col1] * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 # <<<<<<<<<<<<<< @@ -10659,7 +11342,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); - /* "Orange/distance/_distance.pyx":477 + /* "Orange/distance/_distance.pyx":495 * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 * in_any += ival1 | ival2 # <<<<<<<<<<<<<< @@ -10671,7 +11354,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_L13:; } - /* "Orange/distance/_distance.pyx":479 + /* "Orange/distance/_distance.pyx":497 * in_any += ival1 | ival2 * union = (in_any + unk1_in2 + in1_unk2 * + ps[col1] * unk1_not2 # <<<<<<<<<<<<<< @@ -10680,7 +11363,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_29 = __pyx_v_col1; - /* "Orange/distance/_distance.pyx":480 + /* "Orange/distance/_distance.pyx":498 * union = (in_any + unk1_in2 + in1_unk2 * + ps[col1] * unk1_not2 * + ps[col2] * not1_unk2 # <<<<<<<<<<<<<< @@ -10689,7 +11372,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_30 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":481 + /* "Orange/distance/_distance.pyx":499 * + ps[col1] * unk1_not2 * + ps[col2] * not1_unk2 * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) # <<<<<<<<<<<<<< @@ -10700,7 +11383,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_32 = __pyx_v_col2; __pyx_v_union = (((((__pyx_v_in_any + __pyx_v_unk1_in2) + __pyx_v_in1_unk2) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_not2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_not1_unk2)) + ((1.0 - ((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_ps.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_ps.diminfo[0].strides))))) * __pyx_v_unk1_unk2)); - /* "Orange/distance/_distance.pyx":482 + /* "Orange/distance/_distance.pyx":500 * + ps[col2] * not1_unk2 * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) * if union != 0: # <<<<<<<<<<<<<< @@ -10710,7 +11393,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = ((__pyx_v_union != 0.0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":484 + /* "Orange/distance/_distance.pyx":502 * if union != 0: * intersection = (in_both * + ps[col1] * unk1_in2 + # <<<<<<<<<<<<<< @@ -10719,7 +11402,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_33 = __pyx_v_col1; - /* "Orange/distance/_distance.pyx":485 + /* "Orange/distance/_distance.pyx":503 * intersection = (in_both * + ps[col1] * unk1_in2 + * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< @@ -10728,7 +11411,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_34 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":486 + /* "Orange/distance/_distance.pyx":504 * + ps[col1] * unk1_in2 + * + ps[col2] * in1_unk2 + * + ps[col1] * ps[col2] * unk1_unk2) # <<<<<<<<<<<<<< @@ -10738,7 +11421,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_35 = __pyx_v_col1; __pyx_t_36 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":485 + /* "Orange/distance/_distance.pyx":503 * intersection = (in_both * + ps[col1] * unk1_in2 + * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< @@ -10747,7 +11430,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_intersection = (((__pyx_v_in_both + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_in2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_in1_unk2)) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_ps.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_ps.diminfo[0].strides))) * __pyx_v_unk1_unk2)); - /* "Orange/distance/_distance.pyx":488 + /* "Orange/distance/_distance.pyx":506 * + ps[col1] * ps[col2] * unk1_unk2) * distances[col1, col2] = distances[col2, col1] = \ * 1 - intersection / union # <<<<<<<<<<<<<< @@ -10756,7 +11439,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_37 = (1.0 - (__pyx_v_intersection / __pyx_v_union)); - /* "Orange/distance/_distance.pyx":487 + /* "Orange/distance/_distance.pyx":505 * + ps[col2] * in1_unk2 + * + ps[col1] * ps[col2] * unk1_unk2) * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< @@ -10770,7 +11453,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_41 = __pyx_v_col1; *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_40 * __pyx_v_distances.strides[0]) ) + __pyx_t_41 * __pyx_v_distances.strides[1]) )) = __pyx_t_37; - /* "Orange/distance/_distance.pyx":482 + /* "Orange/distance/_distance.pyx":500 * + ps[col2] * not1_unk2 * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) * if union != 0: # <<<<<<<<<<<<<< @@ -10780,7 +11463,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU } } - /* "Orange/distance/_distance.pyx":455 + /* "Orange/distance/_distance.pyx":473 * with nogil: * for col1 in range(n_cols): * if nans[col1]: # <<<<<<<<<<<<<< @@ -10790,7 +11473,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L8; } - /* "Orange/distance/_distance.pyx":490 + /* "Orange/distance/_distance.pyx":508 * 1 - intersection / union * else: * for col2 in range(col1): # <<<<<<<<<<<<<< @@ -10803,7 +11486,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_col2 = __pyx_t_15; - /* "Orange/distance/_distance.pyx":491 + /* "Orange/distance/_distance.pyx":509 * else: * for col2 in range(col1): * if nans[col2]: # <<<<<<<<<<<<<< @@ -10814,7 +11497,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_nans.diminfo[0].strides)) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":492 + /* "Orange/distance/_distance.pyx":510 * for col2 in range(col1): * if nans[col2]: * in_both = in_any = 0 # <<<<<<<<<<<<<< @@ -10824,7 +11507,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_in_both = 0; __pyx_v_in_any = 0; - /* "Orange/distance/_distance.pyx":493 + /* "Orange/distance/_distance.pyx":511 * if nans[col2]: * in_both = in_any = 0 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 # <<<<<<<<<<<<<< @@ -10837,7 +11520,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_unk1_not2 = 0; __pyx_v_not1_unk2 = 0; - /* "Orange/distance/_distance.pyx":494 + /* "Orange/distance/_distance.pyx":512 * in_both = in_any = 0 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 * for row in range(n_rows): # <<<<<<<<<<<<<< @@ -10849,7 +11532,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_row = __pyx_t_18; - /* "Orange/distance/_distance.pyx":495 + /* "Orange/distance/_distance.pyx":513 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 * for row in range(n_rows): * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< @@ -10860,7 +11543,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_44 = __pyx_v_col1; __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":496 + /* "Orange/distance/_distance.pyx":514 * for row in range(n_rows): * ival1 = nonzeros[row, col1] * val2 = x[row, col2] # <<<<<<<<<<<<<< @@ -10871,7 +11554,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_46 = __pyx_v_col2; __pyx_v_val2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_x.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":497 + /* "Orange/distance/_distance.pyx":515 * ival1 = nonzeros[row, col1] * val2 = x[row, col2] * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -10881,7 +11564,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":498 + /* "Orange/distance/_distance.pyx":516 * val2 = x[row, col2] * if npy_isnan(val2): * if ival1: # <<<<<<<<<<<<<< @@ -10891,7 +11574,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = (__pyx_v_ival1 != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":499 + /* "Orange/distance/_distance.pyx":517 * if npy_isnan(val2): * if ival1: * in1_unk2 += 1 # <<<<<<<<<<<<<< @@ -10900,7 +11583,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_in1_unk2 = (__pyx_v_in1_unk2 + 1); - /* "Orange/distance/_distance.pyx":498 + /* "Orange/distance/_distance.pyx":516 * val2 = x[row, col2] * if npy_isnan(val2): * if ival1: # <<<<<<<<<<<<<< @@ -10910,7 +11593,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L23; } - /* "Orange/distance/_distance.pyx":501 + /* "Orange/distance/_distance.pyx":519 * in1_unk2 += 1 * else: * not1_unk2 += 1 # <<<<<<<<<<<<<< @@ -10922,7 +11605,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU } __pyx_L23:; - /* "Orange/distance/_distance.pyx":497 + /* "Orange/distance/_distance.pyx":515 * ival1 = nonzeros[row, col1] * val2 = x[row, col2] * if npy_isnan(val2): # <<<<<<<<<<<<<< @@ -10932,7 +11615,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L22; } - /* "Orange/distance/_distance.pyx":503 + /* "Orange/distance/_distance.pyx":521 * not1_unk2 += 1 * else: * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< @@ -10944,7 +11627,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_48 = __pyx_v_col2; __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":504 + /* "Orange/distance/_distance.pyx":522 * else: * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 # <<<<<<<<<<<<<< @@ -10953,7 +11636,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); - /* "Orange/distance/_distance.pyx":505 + /* "Orange/distance/_distance.pyx":523 * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 * in_any += ival1 | ival2 # <<<<<<<<<<<<<< @@ -10965,7 +11648,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_L22:; } - /* "Orange/distance/_distance.pyx":508 + /* "Orange/distance/_distance.pyx":526 * distances[col1, col2] = distances[col2, col1] = \ * 1 - float(in_both * + ps[col1] * unk1_in2 + # <<<<<<<<<<<<<< @@ -10974,7 +11657,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_49 = __pyx_v_col1; - /* "Orange/distance/_distance.pyx":509 + /* "Orange/distance/_distance.pyx":527 * 1 - float(in_both * + ps[col1] * unk1_in2 + * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< @@ -10983,7 +11666,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_50 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":510 + /* "Orange/distance/_distance.pyx":528 * + ps[col1] * unk1_in2 + * + ps[col2] * in1_unk2 + * + ps[col1] * ps[col2] * unk1_unk2) / \ # <<<<<<<<<<<<<< @@ -10993,7 +11676,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_51 = __pyx_v_col1; __pyx_t_52 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":512 + /* "Orange/distance/_distance.pyx":530 * + ps[col1] * ps[col2] * unk1_unk2) / \ * (in_any + unk1_in2 + in1_unk2 + * + ps[col1] * unk1_not2 # <<<<<<<<<<<<<< @@ -11002,7 +11685,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_53 = __pyx_v_col1; - /* "Orange/distance/_distance.pyx":513 + /* "Orange/distance/_distance.pyx":531 * (in_any + unk1_in2 + in1_unk2 + * + ps[col1] * unk1_not2 * + ps[col2] * not1_unk2 # <<<<<<<<<<<<<< @@ -11011,7 +11694,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_54 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":514 + /* "Orange/distance/_distance.pyx":532 * + ps[col1] * unk1_not2 * + ps[col2] * not1_unk2 * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) # <<<<<<<<<<<<<< @@ -11021,7 +11704,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_55 = __pyx_v_col1; __pyx_t_56 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":507 + /* "Orange/distance/_distance.pyx":525 * in_any += ival1 | ival2 * distances[col1, col2] = distances[col2, col1] = \ * 1 - float(in_both # <<<<<<<<<<<<<< @@ -11030,7 +11713,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_24 = (1.0 - (((double)(((__pyx_v_in_both + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_in2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_in1_unk2)) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_ps.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_ps.diminfo[0].strides))) * __pyx_v_unk1_unk2))) / (((((__pyx_v_in_any + __pyx_v_unk1_in2) + __pyx_v_in1_unk2) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_not2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_not1_unk2)) + ((1.0 - ((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_ps.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_ps.diminfo[0].strides))))) * __pyx_v_unk1_unk2)))); - /* "Orange/distance/_distance.pyx":506 + /* "Orange/distance/_distance.pyx":524 * in_both += ival1 & ival2 * in_any += ival1 | ival2 * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< @@ -11044,7 +11727,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_60 = __pyx_v_col1; *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_59 * __pyx_v_distances.strides[0]) ) + __pyx_t_60 * __pyx_v_distances.strides[1]) )) = __pyx_t_24; - /* "Orange/distance/_distance.pyx":491 + /* "Orange/distance/_distance.pyx":509 * else: * for col2 in range(col1): * if nans[col2]: # <<<<<<<<<<<<<< @@ -11054,7 +11737,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU goto __pyx_L19; } - /* "Orange/distance/_distance.pyx":516 + /* "Orange/distance/_distance.pyx":534 * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) * else: * in_both = in_any = 0 # <<<<<<<<<<<<<< @@ -11065,7 +11748,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_in_both = 0; __pyx_v_in_any = 0; - /* "Orange/distance/_distance.pyx":517 + /* "Orange/distance/_distance.pyx":535 * else: * in_both = in_any = 0 * for row in range(n_rows): # <<<<<<<<<<<<<< @@ -11077,7 +11760,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_row = __pyx_t_18; - /* "Orange/distance/_distance.pyx":518 + /* "Orange/distance/_distance.pyx":536 * in_both = in_any = 0 * for row in range(n_rows): * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< @@ -11088,7 +11771,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_62 = __pyx_v_col1; __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_62, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":519 + /* "Orange/distance/_distance.pyx":537 * for row in range(n_rows): * ival1 = nonzeros[row, col1] * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< @@ -11099,7 +11782,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_64 = __pyx_v_col2; __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":520 + /* "Orange/distance/_distance.pyx":538 * ival1 = nonzeros[row, col1] * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 # <<<<<<<<<<<<<< @@ -11108,7 +11791,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); - /* "Orange/distance/_distance.pyx":521 + /* "Orange/distance/_distance.pyx":539 * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 * in_any += ival1 | ival2 # <<<<<<<<<<<<<< @@ -11118,7 +11801,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_in_any = (__pyx_v_in_any + (__pyx_v_ival1 | __pyx_v_ival2)); } - /* "Orange/distance/_distance.pyx":522 + /* "Orange/distance/_distance.pyx":540 * in_both += ival1 & ival2 * in_any += ival1 | ival2 * if in_any != 0: # <<<<<<<<<<<<<< @@ -11128,7 +11811,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_12 = ((__pyx_v_in_any != 0) != 0); if (__pyx_t_12) { - /* "Orange/distance/_distance.pyx":524 + /* "Orange/distance/_distance.pyx":542 * if in_any != 0: * distances[col1, col2] = distances[col2, col1] = \ * 1 - float(in_both) / in_any # <<<<<<<<<<<<<< @@ -11137,7 +11820,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU */ __pyx_t_37 = (1.0 - (((double)__pyx_v_in_both) / __pyx_v_in_any)); - /* "Orange/distance/_distance.pyx":523 + /* "Orange/distance/_distance.pyx":541 * in_any += ival1 | ival2 * if in_any != 0: * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< @@ -11151,7 +11834,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_t_68 = __pyx_v_col1; *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_67 * __pyx_v_distances.strides[0]) ) + __pyx_t_68 * __pyx_v_distances.strides[1]) )) = __pyx_t_37; - /* "Orange/distance/_distance.pyx":522 + /* "Orange/distance/_distance.pyx":540 * in_both += ival1 & ival2 * in_any += ival1 | ival2 * if in_any != 0: # <<<<<<<<<<<<<< @@ -11167,7 +11850,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU } } - /* "Orange/distance/_distance.pyx":453 + /* "Orange/distance/_distance.pyx":471 * n_rows, n_cols = x.shape[0], x.shape[1] * distances = np.zeros((n_cols, n_cols), dtype=float) * with nogil: # <<<<<<<<<<<<<< @@ -11186,19 +11869,19 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU } } - /* "Orange/distance/_distance.pyx":526 + /* "Orange/distance/_distance.pyx":544 * 1 - float(in_both) / in_any * * return distances # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 526, __pyx_L1_error) + __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; - /* "Orange/distance/_distance.pyx":440 + /* "Orange/distance/_distance.pyx":458 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< @@ -27152,7 +27835,6 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { }; static PyMethodDef __pyx_methods[] = { - {"lower_to_symmetric", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_1lower_to_symmetric, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_lower_to_symmetric}, {0, 0, 0, 0} }; @@ -27280,6 +27962,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_jaccard_cols, __pyx_k_jaccard_cols, sizeof(__pyx_k_jaccard_cols), 0, 0, 1, 1}, {&__pyx_n_s_jaccard_rows, __pyx_k_jaccard_rows, sizeof(__pyx_k_jaccard_rows), 0, 0, 1, 1}, {&__pyx_n_s_jaccard_rows_locals_lambda, __pyx_k_jaccard_rows_locals_lambda, sizeof(__pyx_k_jaccard_rows_locals_lambda), 0, 0, 1, 1}, + {&__pyx_n_s_lower_to_symmetric, __pyx_k_lower_to_symmetric, sizeof(__pyx_k_lower_to_symmetric), 0, 0, 1, 1}, {&__pyx_n_s_mads, __pyx_k_mads, sizeof(__pyx_k_mads), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_manhattan_cols, __pyx_k_manhattan_cols, sizeof(__pyx_k_manhattan_cols), 0, 0, 1, 1}, @@ -27367,7 +28050,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 23, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error) __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error) __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1038, __pyx_L1_error) @@ -27655,161 +28338,173 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25); - /* "Orange/distance/_distance.pyx":29 + /* "Orange/distance/_distance.pyx":18 * * - * def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=2] x1, - * np.ndarray[np.float64_t, ndim=2] x2, + * def lower_to_symmetric(double [:, :] distances, callback): # <<<<<<<<<<<<<< + * cdef int row1, row2, step, n_rows1 + * */ - __pyx_tuple__26 = PyTuple_Pack(20, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_dist_missing, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 29, __pyx_L1_error) + __pyx_tuple__26 = PyTuple_Pack(7, __pyx_n_s_distances, __pyx_n_s_callback, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_step, __pyx_n_s_n_rows1, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__26); __Pyx_GIVEREF(__pyx_tuple__26); - __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(7, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_euclidean_rows_discrete, 29, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 29, __pyx_L1_error) + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_lower_to_symmetric, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 18, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":65 + /* "Orange/distance/_distance.pyx":31 * * - * def fix_euclidean_rows( # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=2] distances, - * np.ndarray[np.float64_t, ndim=2] x1, + * def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=2] x1, + * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_tuple__28 = PyTuple_Pack(19, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(20, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_dist_missing, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__28); __Pyx_GIVEREF(__pyx_tuple__28); - __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(8, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_rows, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(7, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_euclidean_rows_discrete, 31, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 31, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":104 + /* "Orange/distance/_distance.pyx":67 * * - * def fix_euclidean_rows_normalized( # <<<<<<<<<<<<<< + * def fix_euclidean_rows( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_tuple__30 = PyTuple_Pack(19, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_tuple__30 = PyTuple_Pack(19, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__30); __Pyx_GIVEREF(__pyx_tuple__30); - __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(8, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_rows_normalized, 104, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(8, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_rows, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 67, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":143 + /* "Orange/distance/_distance.pyx":106 * * - * def fix_euclidean_cols( # <<<<<<<<<<<<<< + * def fix_euclidean_rows_normalized( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, - * np.ndarray[np.float64_t, ndim=2] x, + * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_tuple__32 = PyTuple_Pack(15, __pyx_n_s_distances, __pyx_n_s_x, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_callback, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_col_start); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_tuple__32 = PyTuple_Pack(19, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_dist_missing2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__32); __Pyx_GIVEREF(__pyx_tuple__32); - __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_cols, 143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(8, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_rows_normalized, 106, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 106, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":177 + /* "Orange/distance/_distance.pyx":145 * * - * def fix_euclidean_cols_normalized( # <<<<<<<<<<<<<< + * def fix_euclidean_cols( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x, */ - __pyx_tuple__34 = PyTuple_Pack(15, __pyx_n_s_distances, __pyx_n_s_x, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_callback, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_col_start); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_tuple__34 = PyTuple_Pack(15, __pyx_n_s_distances, __pyx_n_s_x, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_callback, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_col_start); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34); - __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_cols_normalized, 177, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_cols, 145, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 145, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":210 + /* "Orange/distance/_distance.pyx":179 * * - * def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, # <<<<<<<<<<<<<< - * np.ndarray[np.float64_t, ndim=2] x2, - * char two_tables): + * def fix_euclidean_cols_normalized( # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=2] distances, + * np.ndarray[np.float64_t, ndim=2] x, */ - __pyx_tuple__36 = PyTuple_Pack(13, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_tuple__36 = PyTuple_Pack(15, __pyx_n_s_distances, __pyx_n_s_x, __pyx_n_s_means, __pyx_n_s_vars, __pyx_n_s_callback, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_col_start); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__36); __Pyx_GIVEREF(__pyx_tuple__36); - __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(3, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_manhattan_rows_cont, 210, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_euclidean_cols_normalized, 179, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 179, __pyx_L1_error) + + /* "Orange/distance/_distance.pyx":212 + * + * + * def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, # <<<<<<<<<<<<<< + * np.ndarray[np.float64_t, ndim=2] x2, + * char two_tables, + */ + __pyx_tuple__38 = PyTuple_Pack(16, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_distances, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__38); + __Pyx_GIVEREF(__pyx_tuple__38); + __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(4, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_manhattan_rows_cont, 212, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 212, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":230 + /* "Orange/distance/_distance.pyx":236 * return distances * * def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_tuple__38 = PyTuple_Pack(16, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_medians, __pyx_n_s_mads, __pyx_n_s_dist_missing2_cont, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 230, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__38); - __Pyx_GIVEREF(__pyx_tuple__38); - __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(7, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_manhattan_rows, 230, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 230, __pyx_L1_error) + __pyx_tuple__40 = PyTuple_Pack(19, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_medians, __pyx_n_s_mads, __pyx_n_s_dist_missing2_cont, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); + __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(8, 0, 19, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_manhattan_rows, 236, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 236, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":263 + /* "Orange/distance/_distance.pyx":273 * * * def fix_manhattan_rows_normalized(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_tuple__40 = PyTuple_Pack(13, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 263, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__40); - __Pyx_GIVEREF(__pyx_tuple__40); - __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_manhattan_rows_normalized, 263, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_tuple__42 = PyTuple_Pack(16, __pyx_n_s_distances, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(5, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_fix_manhattan_rows_normalized, 273, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 273, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":293 + /* "Orange/distance/_distance.pyx":307 * * * def manhattan_cols(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1] medians, * np.ndarray[np.float64_t, ndim=1] mads, */ - __pyx_tuple__42 = PyTuple_Pack(13, __pyx_n_s_x, __pyx_n_s_medians, __pyx_n_s_mads, __pyx_n_s_normalize, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 293, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__42); - __Pyx_GIVEREF(__pyx_tuple__42); - __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(4, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_manhattan_cols, 293, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 293, __pyx_L1_error) + __pyx_tuple__44 = PyTuple_Pack(16, __pyx_n_s_x, __pyx_n_s_medians, __pyx_n_s_mads, __pyx_n_s_normalize, __pyx_n_s_callback, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_d, __pyx_n_s_distances, __pyx_n_s_col_start); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 307, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(5, 0, 16, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_manhattan_cols, 307, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 307, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":334 + /* "Orange/distance/_distance.pyx":352 * * * def p_nonzero(np.ndarray[np.float64_t, ndim=1] x): # <<<<<<<<<<<<<< * cdef: * int row, nonzeros, nonnans */ - __pyx_tuple__44 = PyTuple_Pack(5, __pyx_n_s_x, __pyx_n_s_row, __pyx_n_s_nonzeros, __pyx_n_s_nonnans, __pyx_n_s_val); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 334, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); - __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_p_nonzero, 334, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 334, __pyx_L1_error) + __pyx_tuple__46 = PyTuple_Pack(5, __pyx_n_s_x, __pyx_n_s_row, __pyx_n_s_nonzeros, __pyx_n_s_nonnans, __pyx_n_s_val); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 352, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_p_nonzero, 352, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 352, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":348 + /* "Orange/distance/_distance.pyx":366 * return float(nonzeros) / nonnans * * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< * cdef: * int row, n_cols, n_rows */ - __pyx_tuple__46 = PyTuple_Pack(6, __pyx_n_s_x, __pyx_n_s_row, __pyx_n_s_n_cols, __pyx_n_s_n_rows, __pyx_n_s_flags, __pyx_n_s_col); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 348, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_any_nan_row, 348, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 348, __pyx_L1_error) + __pyx_tuple__48 = PyTuple_Pack(6, __pyx_n_s_x, __pyx_n_s_row, __pyx_n_s_n_cols, __pyx_n_s_n_rows, __pyx_n_s_flags, __pyx_n_s_col); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 366, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__48); + __Pyx_GIVEREF(__pyx_tuple__48); + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_any_nan_row, 366, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 366, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":364 + /* "Orange/distance/_distance.pyx":382 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< * np.ndarray[np.int8_t, ndim=2] nonzeros2, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_tuple__48 = PyTuple_Pack(21, __pyx_n_s_nonzeros1, __pyx_n_s_nonzeros2, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_nans1, __pyx_n_s_nans2, __pyx_n_s_ps, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__48); - __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(8, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_rows, 364, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 364, __pyx_L1_error) + __pyx_tuple__50 = PyTuple_Pack(21, __pyx_n_s_nonzeros1, __pyx_n_s_nonzeros2, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_nans1, __pyx_n_s_nans2, __pyx_n_s_ps, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 382, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(8, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_rows, 382, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 382, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":440 + /* "Orange/distance/_distance.pyx":458 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x, * np.ndarray[np.int8_t, ndim=1] nans, */ - __pyx_tuple__50 = PyTuple_Pack(23, __pyx_n_s_nonzeros, __pyx_n_s_x, __pyx_n_s_nans, __pyx_n_s_ps, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_in_both, __pyx_n_s_in_any, __pyx_n_s_in1_unk2, __pyx_n_s_unk1_in2, __pyx_n_s_unk1_unk2, __pyx_n_s_unk1_not2, __pyx_n_s_not1_unk2, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__50); - __Pyx_GIVEREF(__pyx_tuple__50); - __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(4, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_cols, 440, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 440, __pyx_L1_error) + __pyx_tuple__52 = PyTuple_Pack(23, __pyx_n_s_nonzeros, __pyx_n_s_x, __pyx_n_s_nans, __pyx_n_s_ps, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_in_both, __pyx_n_s_in_any, __pyx_n_s_in1_unk2, __pyx_n_s_unk1_in2, __pyx_n_s_unk1_unk2, __pyx_n_s_unk1_not2, __pyx_n_s_not1_unk2, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 458, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__52); + __Pyx_GIVEREF(__pyx_tuple__52); + __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(4, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_cols, 458, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 458, __pyx_L1_error) /* "View.MemoryView":286 * return self.name @@ -27818,9 +28513,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_tuple__52 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(2, 286, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__52); - __Pyx_GIVEREF(__pyx_tuple__52); + __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(2, 286, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__54); + __Pyx_GIVEREF(__pyx_tuple__54); /* "View.MemoryView":287 * @@ -27829,9 +28524,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * cdef indirect = Enum("") * */ - __pyx_tuple__53 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(2, 287, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__53); - __Pyx_GIVEREF(__pyx_tuple__53); + __pyx_tuple__55 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(2, 287, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__55); + __Pyx_GIVEREF(__pyx_tuple__55); /* "View.MemoryView":288 * cdef generic = Enum("") @@ -27840,9 +28535,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * * */ - __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(2, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__54); - __Pyx_GIVEREF(__pyx_tuple__54); + __pyx_tuple__56 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(2, 288, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__56); + __Pyx_GIVEREF(__pyx_tuple__56); /* "View.MemoryView":291 * @@ -27851,9 +28546,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * cdef indirect_contiguous = Enum("") * */ - __pyx_tuple__55 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(2, 291, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__55); - __Pyx_GIVEREF(__pyx_tuple__55); + __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(2, 291, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__57); + __Pyx_GIVEREF(__pyx_tuple__57); /* "View.MemoryView":292 * @@ -27862,19 +28557,19 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * * */ - __pyx_tuple__56 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(2, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__56); - __Pyx_GIVEREF(__pyx_tuple__56); + __pyx_tuple__58 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(2, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__58); + __Pyx_GIVEREF(__pyx_tuple__58); /* "(tree fragment)":1 * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< * cdef object __pyx_PickleError * cdef object __pyx_result */ - __pyx_tuple__57 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(2, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__57); - __Pyx_GIVEREF(__pyx_tuple__57); - __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(2, 1, __pyx_L1_error) + __pyx_tuple__59 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(2, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__59); + __Pyx_GIVEREF(__pyx_tuple__59); + __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(2, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -28255,160 +28950,172 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":29 + /* "Orange/distance/_distance.pyx":18 + * + * + * def lower_to_symmetric(double [:, :] distances, callback): # <<<<<<<<<<<<<< + * cdef int row1, row2, step, n_rows1 + * + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_1lower_to_symmetric, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_lower_to_symmetric, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "Orange/distance/_distance.pyx":31 * * * def euclidean_rows_discrete(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_3euclidean_rows_discrete, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_3euclidean_rows_discrete, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_euclidean_rows_discrete, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_euclidean_rows_discrete, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":65 + /* "Orange/distance/_distance.pyx":67 * * * def fix_euclidean_rows( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_5fix_euclidean_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_5fix_euclidean_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_rows, __pyx_t_1) < 0) __PYX_ERR(0, 65, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_rows, __pyx_t_1) < 0) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":104 + /* "Orange/distance/_distance.pyx":106 * * * def fix_euclidean_rows_normalized( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_7fix_euclidean_rows_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_rows_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 104, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_rows_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":143 + /* "Orange/distance/_distance.pyx":145 * * * def fix_euclidean_cols( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_9fix_euclidean_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_9fix_euclidean_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_cols, __pyx_t_1) < 0) __PYX_ERR(0, 143, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_cols, __pyx_t_1) < 0) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":177 + /* "Orange/distance/_distance.pyx":179 * * * def fix_euclidean_cols_normalized( # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] distances, * np.ndarray[np.float64_t, ndim=2] x, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_11fix_euclidean_cols_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_cols_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 177, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_euclidean_cols_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":210 + /* "Orange/distance/_distance.pyx":212 * * * def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x2, - * char two_tables): + * char two_tables, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_13manhattan_rows_cont, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_13manhattan_rows_cont, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_manhattan_rows_cont, __pyx_t_1) < 0) __PYX_ERR(0, 210, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_manhattan_rows_cont, __pyx_t_1) < 0) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":230 + /* "Orange/distance/_distance.pyx":236 * return distances * * def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_15fix_manhattan_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_15fix_manhattan_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_manhattan_rows, __pyx_t_1) < 0) __PYX_ERR(0, 230, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_manhattan_rows, __pyx_t_1) < 0) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":263 + /* "Orange/distance/_distance.pyx":273 * * * def fix_manhattan_rows_normalized(np.ndarray[np.float64_t, ndim=2] distances, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x1, * np.ndarray[np.float64_t, ndim=2] x2, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_17fix_manhattan_rows_normalized, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_manhattan_rows_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 263, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fix_manhattan_rows_normalized, __pyx_t_1) < 0) __PYX_ERR(0, 273, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":293 + /* "Orange/distance/_distance.pyx":307 * * * def manhattan_cols(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=1] medians, * np.ndarray[np.float64_t, ndim=1] mads, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_19manhattan_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_19manhattan_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_manhattan_cols, __pyx_t_1) < 0) __PYX_ERR(0, 293, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_manhattan_cols, __pyx_t_1) < 0) __PYX_ERR(0, 307, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":334 + /* "Orange/distance/_distance.pyx":352 * * * def p_nonzero(np.ndarray[np.float64_t, ndim=1] x): # <<<<<<<<<<<<<< * cdef: * int row, nonzeros, nonnans */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_21p_nonzero, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_21p_nonzero, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_p_nonzero, __pyx_t_1) < 0) __PYX_ERR(0, 334, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_p_nonzero, __pyx_t_1) < 0) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":348 + /* "Orange/distance/_distance.pyx":366 * return float(nonzeros) / nonnans * * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< * cdef: * int row, n_cols, n_rows */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_23any_nan_row, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 348, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_23any_nan_row, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_any_nan_row, __pyx_t_1) < 0) __PYX_ERR(0, 348, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_any_nan_row, __pyx_t_1) < 0) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":364 + /* "Orange/distance/_distance.pyx":382 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< * np.ndarray[np.int8_t, ndim=2] nonzeros2, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_25jaccard_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_25jaccard_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_rows, __pyx_t_1) < 0) __PYX_ERR(0, 364, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_rows, __pyx_t_1) < 0) __PYX_ERR(0, 382, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":440 + /* "Orange/distance/_distance.pyx":458 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x, * np.ndarray[np.int8_t, ndim=1] nans, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_27jaccard_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 440, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_27jaccard_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_cols, __pyx_t_1) < 0) __PYX_ERR(0, 440, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_cols, __pyx_t_1) < 0) __PYX_ERR(0, 458, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "Orange/distance/_distance.pyx":1 @@ -28441,7 +29148,7 @@ if (!__Pyx_RefNanny) { * cdef strided = Enum("") # default * cdef indirect = Enum("") */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__52, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 286, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 286, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(generic); __Pyx_DECREF_SET(generic, __pyx_t_1); @@ -28455,7 +29162,7 @@ if (!__Pyx_RefNanny) { * cdef indirect = Enum("") * */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(strided); __Pyx_DECREF_SET(strided, __pyx_t_1); @@ -28469,7 +29176,7 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(indirect); __Pyx_DECREF_SET(indirect, __pyx_t_1); @@ -28483,7 +29190,7 @@ if (!__Pyx_RefNanny) { * cdef indirect_contiguous = Enum("") * */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__55, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 291, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(contiguous); __Pyx_DECREF_SET(contiguous, __pyx_t_1); @@ -28497,7 +29204,7 @@ if (!__Pyx_RefNanny) { * * */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__56, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__58, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(indirect_contiguous); __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1); @@ -28641,7 +29348,149 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { "name '%.200s' is not defined", PyString_AS_STRING(name)); #endif } - return result; + return result; +} + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* RaiseDoubleKeywords */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; } /* PyObjectCall */ @@ -28815,298 +29664,85 @@ static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyOb return __Pyx_PyFunction_FastCall(function, args, 2); } #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} - -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* WriteUnraisableException */ -static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, - int full_traceback, CYTHON_UNUSED int nogil) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_PyThreadState_declare -#ifdef WITH_THREAD - PyGILState_STATE state; - if (nogil) - state = PyGILState_Ensure(); -#ifdef _MSC_VER - else state = (PyGILState_STATE)-1; -#endif -#endif - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - if (full_traceback) { - Py_XINCREF(old_exc); - Py_XINCREF(old_val); - Py_XINCREF(old_tb); - __Pyx_ErrRestore(old_exc, old_val, old_tb); - PyErr_PrintEx(1); - } - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); - } -#ifdef WITH_THREAD - if (nogil) - PyGILState_Release(state); -#endif -} - -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyCFunction_FastCall(function, args, 2); } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); + #endif + args = PyTuple_New(2); + if (unlikely(!args)) goto done; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + Py_INCREF(function); + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); +done: + return result; } -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; } +#endif -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; +/* PyObjectCallOneArg */ +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, &arg, 1); + } +#endif + if (likely(PyCFunction_Check(func))) { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#endif } } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; + return __Pyx__PyObject_CallOneArg(func, arg); } - -/* None */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; } +#endif /* MemviewSliceInit */ static int @@ -29823,6 +30459,30 @@ fail:; return -1; } +/* PyErrFetchRestore */ + #if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} +#endif + /* PyDictVersioning */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { @@ -31547,6 +32207,53 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED } #endif +/* None */ + static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +/* WriteUnraisableException */ + static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename, + int full_traceback, CYTHON_UNUSED int nogil) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_PyThreadState_declare +#ifdef WITH_THREAD + PyGILState_STATE state; + if (nogil) + state = PyGILState_Ensure(); +#ifdef _MSC_VER + else state = (PyGILState_STATE)-1; +#endif +#endif + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + if (full_traceback) { + Py_XINCREF(old_exc); + Py_XINCREF(old_val); + Py_XINCREF(old_tb); + __Pyx_ErrRestore(old_exc, old_val, old_tb); + PyErr_PrintEx(1); + } + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +#ifdef WITH_THREAD + if (nogil) + PyGILState_Release(state); +#endif +} + /* ImportFrom */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); diff --git a/Orange/distance/_distance.pyx b/Orange/distance/_distance.pyx index 2450c9a0556..d37587726f6 100644 --- a/Orange/distance/_distance.pyx +++ b/Orange/distance/_distance.pyx @@ -211,22 +211,26 @@ def fix_euclidean_cols_normalized( def manhattan_rows_cont(np.ndarray[np.float64_t, ndim=2] x1, np.ndarray[np.float64_t, ndim=2] x2, - char two_tables): + char two_tables, + callback): cdef: - int n_rows1, n_rows2, n_cols, row1, row2, col + int n_rows1, n_rows2, n_cols, row1, row2, col, step double val1, val2, d np.ndarray[np.float64_t, ndim=2] distances n_rows1, n_cols = x1.shape[0], x1.shape[1] n_rows2 = x2.shape[0] distances = np.zeros((n_rows1, n_rows2), dtype=float) - with nogil: - for row1 in range(n_rows1): - for row2 in range(n_rows2 if two_tables else row1): - d = 0 - for col in range(n_cols): - d += fabs(x1[row1, col] - x2[row2, col]) - distances[row1, row2] = d + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + for row1 in range(row_start, min(row_start + step, n_rows1)): + with nogil: + for row2 in range(n_rows2 if two_tables else row1): + d = 0 + for col in range(n_cols): + d += fabs(x1[row1, col] - x2[row2, col]) + distances[row1, row2] = d return distances def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, @@ -235,101 +239,113 @@ def fix_manhattan_rows(np.ndarray[np.float64_t, ndim=2] distances, np.ndarray[np.float64_t, ndim=1] medians, np.ndarray[np.float64_t, ndim=1] mads, np.ndarray[np.float64_t, ndim=1] dist_missing2_cont, - char two_tables): + char two_tables, + callback): cdef: - int n_rows1, n_rows2, n_cols, row1, row2, col + int n_rows1, n_rows2, n_cols, row1, row2, col, step double val1, val2, d n_rows1, n_cols = x1.shape[0], x1.shape[1] n_rows2 = x2.shape[0] if two_tables else 0 - with nogil: - for row1 in range(n_rows1): - for row2 in range(n_rows2 if two_tables else row1): - if npy_isnan(distances[row1, row2]): - d = 0 - for col in range(n_cols): - val1, val2 = x1[row1, col], x2[row2, col] - if npy_isnan(val1): - if npy_isnan(val2): - d += dist_missing2_cont[col] + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + for row1 in range(row_start, min(row_start + step, n_rows1)): + with nogil: + for row2 in range(n_rows2 if two_tables else row1): + if npy_isnan(distances[row1, row2]): + d = 0 + for col in range(n_cols): + val1, val2 = x1[row1, col], x2[row2, col] + if npy_isnan(val1): + if npy_isnan(val2): + d += dist_missing2_cont[col] + else: + d += fabs(val2 - medians[col]) + mads[col] + elif npy_isnan(val2): + d += fabs(val1 - medians[col]) + mads[col] else: - d += fabs(val2 - medians[col]) + mads[col] - elif npy_isnan(val2): - d += fabs(val1 - medians[col]) + mads[col] - else: - d += fabs(val1 - val2) - distances[row1, row2] = d + d += fabs(val1 - val2) + distances[row1, row2] = d return distances def fix_manhattan_rows_normalized(np.ndarray[np.float64_t, ndim=2] distances, np.ndarray[np.float64_t, ndim=2] x1, np.ndarray[np.float64_t, ndim=2] x2, - char two_tables): + char two_tables, + callback): cdef: - int n_rows1, n_rows2, n_cols, row1, row2, col + int n_rows1, n_rows2, n_cols, row1, row2, col, step double val1, val2, d n_rows1, n_cols = x1.shape[0], x1.shape[1] n_rows2 = x2.shape[0] if two_tables else 0 - with nogil: - for row1 in range(n_rows1): - for row2 in range(n_rows2 if two_tables else row1): - if npy_isnan(distances[row1, row2]): - d = 0 - for col in range(n_cols): - val1, val2 = x1[row1, col], x2[row2, col] - if npy_isnan(val1): - if npy_isnan(val2): - d += 1 + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + for row1 in range(row_start, min(row_start + step, n_rows1)): + with nogil: + for row2 in range(n_rows2 if two_tables else row1): + if npy_isnan(distances[row1, row2]): + d = 0 + for col in range(n_cols): + val1, val2 = x1[row1, col], x2[row2, col] + if npy_isnan(val1): + if npy_isnan(val2): + d += 1 + else: + d += fabs(val2) + 0.5 + elif npy_isnan(val2): + d += fabs(val1) + 0.5 else: - d += fabs(val2) + 0.5 - elif npy_isnan(val2): - d += fabs(val1) + 0.5 - else: - d += fabs(val1 - val2) - distances[row1, row2] = d + d += fabs(val1 - val2) + distances[row1, row2] = d return distances def manhattan_cols(np.ndarray[np.float64_t, ndim=2] x, np.ndarray[np.float64_t, ndim=1] medians, np.ndarray[np.float64_t, ndim=1] mads, - char normalize): + char normalize, + callback): cdef: - int n_rows, n_cols, col1, col2, row + int n_rows, n_cols, col1, col2, row, step double val1, val2, d double [:, :] distances n_rows, n_cols = x.shape[0], x.shape[1] + step = max(n_cols // 100, 100) distances = np.zeros((n_cols, n_cols), dtype=float) - with nogil: - for col1 in range(n_cols): - for col2 in range(col1): - d = 0 - for row in range(n_rows): - val1, val2 = x[row, col1], x[row, col2] - if npy_isnan(val1): - if npy_isnan(val2): - if normalize: - d += 1 + for col_start in range(0, n_cols, step): + callback(col_start * 100 / n_cols) + for col1 in range(col_start, min(col_start + step, n_cols)): + with nogil: + for col2 in range(col1): + d = 0 + for row in range(n_rows): + val1, val2 = x[row, col1], x[row, col2] + if npy_isnan(val1): + if npy_isnan(val2): + if normalize: + d += 1 + else: + d += mads[col1] + mads[col2] \ + + fabs(medians[col1] - medians[col2]) else: - d += mads[col1] + mads[col2] \ - + fabs(medians[col1] - medians[col2]) + if normalize: + d += fabs(val2) + 0.5 + else: + d += fabs(val2 - medians[col1]) + mads[col1] else: - if normalize: - d += fabs(val2) + 0.5 - else: - d += fabs(val2 - medians[col1]) + mads[col1] - else: - if npy_isnan(val2): - if normalize: - d += fabs(val1) + 0.5 + if npy_isnan(val2): + if normalize: + d += fabs(val1) + 0.5 + else: + d += fabs(val1 - medians[col2]) + mads[col2] else: - d += fabs(val1 - medians[col2]) + mads[col2] - else: - d += fabs(val1 - val2) - distances[col1, col2] = distances[col2, col1] = d + d += fabs(val1 - val2) + distances[col1, col2] = distances[col2, col1] = d return distances diff --git a/Orange/distance/distance.py b/Orange/distance/distance.py index d73da53b947..6b21a064df7 100644 --- a/Orange/distance/distance.py +++ b/Orange/distance/distance.py @@ -282,19 +282,21 @@ def compute_distances(self, x1, x2): - adds the contributions of discrete columns using the same function as the Euclidean distance """ + callbacks = StepwiseCallbacks(self.callback, [5, 5, 60, 30]) + if self.continuous.any(): data1, data2 = self.continuous_columns( x1, x2, self.medians, 2 * self.mads) distances = _distance.manhattan_rows_cont( - data1, data2, x2 is not None) + data1, data2, x2 is not None, callbacks.next()) if self.normalize: _distance.fix_manhattan_rows_normalized( - distances, data1, data2, x2 is not None) + distances, data1, data2, x2 is not None, callbacks.next()) else: _distance.fix_manhattan_rows( distances, data1, data2, self.medians, self.mads, self.dist_missing2_cont, - x2 is not None) + x2 is not None, callbacks.next()) else: distances = np.zeros((x1.shape[0], (x2 if x2 is not None else x1).shape[0])) @@ -304,10 +306,10 @@ def compute_distances(self, x1, x2): # For discrete attributes, Euclidean is same as Manhattan _distance.euclidean_rows_discrete( distances, data1, data2, self.dist_missing_disc, - self.dist_missing2_disc, x2 is not None, lambda x: x) + self.dist_missing2_disc, x2 is not None, callbacks.next()) if x2 is None: - _distance.lower_to_symmetric(distances, lambda x: x) + _distance.lower_to_symmetric(distances, callbacks.next()) return distances @@ -331,7 +333,9 @@ def compute_distances(self, x1, x2=None): x1 = x1 - self.medians x1 /= 2 x1 /= self.mads - return _distance.manhattan_cols(x1, self.medians, self.mads, self.normalize) + callback = self.callback or (lambda x: x) + return _distance.manhattan_cols(x1, self.medians, self.mads, + self.normalize, callback) class Manhattan(FittedDistance): From 4375d8ff783b1672bebfee4a6ed5476ee3cb70cb Mon Sep 17 00:00:00 2001 From: Vesna Tanko Date: Mon, 9 Dec 2019 12:15:13 +0100 Subject: [PATCH 6/7] Distances: Interruptible Cosine distance --- Orange/distance/distance.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Orange/distance/distance.py b/Orange/distance/distance.py index 6b21a064df7..ec29b445718 100644 --- a/Orange/distance/distance.py +++ b/Orange/distance/distance.py @@ -413,7 +413,7 @@ def fit_rows(self, attributes, x, n_vals): means = util.nanmean(x, axis=0) means = np.nan_to_num(means) return self.CosineModel(attributes, self.axis, self.impute, - discrete, means) + discrete, means, self.callback) fit_cols = fit_rows @@ -424,8 +424,8 @@ def get_continuous_stats(self, column): class CosineModel(FittedDistanceModel): """Model for computation of cosine distances across rows and columns. All non-zero discrete values are treated as 1.""" - def __init__(self, attributes, axis, impute, discrete, means): - super().__init__(attributes, axis, impute) + def __init__(self, attributes, axis, impute, discrete, means, callback): + super().__init__(attributes, axis, impute, callback) self.discrete = discrete self.means = means @@ -452,7 +452,7 @@ def prepare_data(x): data1 = prepare_data(x1) data2 = data1 if x2 is None else prepare_data(x2) - dist = safe_sparse_dot(data1, data2.T) + dist = _safe_sparse_dot(data1, data2.T, callback=self.callback) np.clip(dist, -1, 1, out=dist) if x2 is None: diag = np.diag_indices_from(dist) From c10ce621a0d38224bad91dc1a2d3ebb5da2542a4 Mon Sep 17 00:00:00 2001 From: Vesna Tanko Date: Tue, 10 Dec 2019 11:57:49 +0100 Subject: [PATCH 7/7] Distances: Interruptible Jaccard distance --- Orange/distance/_distance.c | 4334 ++++++++++++++++----------------- Orange/distance/_distance.pyx | 261 +- Orange/distance/distance.py | 29 +- 3 files changed, 2192 insertions(+), 2432 deletions(-) diff --git a/Orange/distance/_distance.c b/Orange/distance/_distance.c index 7d3a3d89637..9660c26e414 100644 --- a/Orange/distance/_distance.c +++ b/Orange/distance/_distance.c @@ -1604,63 +1604,6 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /* BufferFallbackError.proto */ static void __Pyx_RaiseBufferFallbackError(void); -/* FetchCommonType.proto */ -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); - -/* CythonFunction.proto */ -#define __Pyx_CyFunction_USED 1 -#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 -#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 -#define __Pyx_CYFUNCTION_CCLASS 0x04 -#define __Pyx_CyFunction_GetClosure(f)\ - (((__pyx_CyFunctionObject *) (f))->func_closure) -#define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) -#define __Pyx_CyFunction_Defaults(type, f)\ - ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) -#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ - ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) -typedef struct { - PyCFunctionObject func; -#if PY_VERSION_HEX < 0x030500A0 - PyObject *func_weakreflist; -#endif - PyObject *func_dict; - PyObject *func_name; - PyObject *func_qualname; - PyObject *func_doc; - PyObject *func_globals; - PyObject *func_code; - PyObject *func_closure; - PyObject *func_classobj; - void *defaults; - int defaults_pyobjects; - int flags; - PyObject *defaults_tuple; - PyObject *defaults_kwdict; - PyObject *(*defaults_getter)(PyObject *); - PyObject *func_annotations; -} __pyx_CyFunctionObject; -static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType)) -#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ - __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) -static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *self, - PyObject *module, PyObject *globals, - PyObject* code); -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, - size_t size, - int pyobjects); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, - PyObject *tuple); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, - PyObject *dict); -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, - PyObject *dict); -static int __pyx_CyFunction_init(void); - /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); @@ -2347,6 +2290,7 @@ static const char __pyx_k_jaccard_rows[] = "jaccard_rows"; static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; static const char __pyx_k_stringsource[] = "stringsource"; static const char __pyx_k_dist_missing2[] = "dist_missing2"; +static const char __pyx_k_next_callback[] = "next_callback"; static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer"; static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; static const char __pyx_k_manhattan_cols[] = "manhattan_cols"; @@ -2373,7 +2317,6 @@ static const char __pyx_k_euclidean_rows_discrete[] = "euclidean_rows_discrete"; static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'"; static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d."; static const char __pyx_k_Orange_distance__distance[] = "Orange.distance._distance"; -static const char __pyx_k_jaccard_rows_locals_lambda[] = "jaccard_rows.."; static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array"; static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous"; static const char __pyx_k_Orange_distance__distance_pyx[] = "Orange/distance/_distance.pyx"; @@ -2483,7 +2426,6 @@ static PyObject *__pyx_n_s_ival1; static PyObject *__pyx_n_s_ival2; static PyObject *__pyx_n_s_jaccard_cols; static PyObject *__pyx_n_s_jaccard_rows; -static PyObject *__pyx_n_s_jaccard_rows_locals_lambda; static PyObject *__pyx_n_s_lower_to_symmetric; static PyObject *__pyx_n_s_mads; static PyObject *__pyx_n_s_main; @@ -2506,6 +2448,7 @@ static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous; static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; static PyObject *__pyx_n_s_ndim; static PyObject *__pyx_n_s_new; +static PyObject *__pyx_n_s_next_callback; static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; static PyObject *__pyx_n_s_nonnans; static PyObject *__pyx_n_s_nonzeros; @@ -2580,10 +2523,9 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_14fix_manhattan_rows(CYTH static PyObject *__pyx_pf_6Orange_8distance_9_distance_16fix_manhattan_rows_normalized(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_distances, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, char __pyx_v_two_tables, PyObject *__pyx_v_callback); /* proto */ static PyObject *__pyx_pf_6Orange_8distance_9_distance_18manhattan_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_medians, PyArrayObject *__pyx_v_mads, char __pyx_v_normalize, PyObject *__pyx_v_callback); /* proto */ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x); /* proto */ -static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros1, PyArrayObject *__pyx_v_nonzeros2, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_nans1, PyArrayObject *__pyx_v_nans2, PyArrayObject *__pyx_v_ps, char __pyx_v_two_tables); /* proto */ -static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_nans, PyArrayObject *__pyx_v_ps); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyObject *__pyx_v_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros1, PyArrayObject *__pyx_v_nonzeros2, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_nans1, PyArrayObject *__pyx_v_nans2, PyArrayObject *__pyx_v_ps, char __pyx_v_two_tables, PyObject *__pyx_v_callback, PyObject *__pyx_v_next_callback); /* proto */ +static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_nans, PyArrayObject *__pyx_v_ps, PyObject *__pyx_v_callback); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */ @@ -9196,7 +9138,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED * nonzeros += 1 * return float(nonzeros) / nonnans # <<<<<<<<<<<<<< * - * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): + * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x, */ __Pyx_XDECREF(__pyx_r); __pyx_t_6 = PyFloat_FromDouble((((double)__pyx_v_nonzeros) / __pyx_v_nonnans)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 364, __pyx_L1_error) @@ -9236,21 +9178,69 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_20p_nonzero(CYTHON_UNUSED /* "Orange/distance/_distance.pyx":366 * return float(nonzeros) / nonnans * - * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< + * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< + * callback): * cdef: - * int row, n_cols, n_rows */ /* Python wrapper */ -static PyObject *__pyx_pw_6Orange_8distance_9_distance_23any_nan_row(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_22any_nan_row[] = "any_nan_row(ndarray x)"; -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_23any_nan_row = {"any_nan_row", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_23any_nan_row, METH_O, __pyx_doc_6Orange_8distance_9_distance_22any_nan_row}; -static PyObject *__pyx_pw_6Orange_8distance_9_distance_23any_nan_row(PyObject *__pyx_self, PyObject *__pyx_v_x) { +static PyObject *__pyx_pw_6Orange_8distance_9_distance_23any_nan_row(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6Orange_8distance_9_distance_22any_nan_row[] = "any_nan_row(ndarray x, callback)"; +static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_23any_nan_row = {"any_nan_row", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_23any_nan_row, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_22any_nan_row}; +static PyObject *__pyx_pw_6Orange_8distance_9_distance_23any_nan_row(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_x = 0; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("any_nan_row (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_callback,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("any_nan_row", 1, 2, 2, 1); __PYX_ERR(0, 366, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "any_nan_row") < 0)) __PYX_ERR(0, 366, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_x = ((PyArrayObject *)values[0]); + __pyx_v_callback = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("any_nan_row", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 366, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("Orange.distance._distance.any_nan_row", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 366, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_22any_nan_row(__pyx_self, ((PyArrayObject *)__pyx_v_x)); + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_22any_nan_row(__pyx_self, __pyx_v_x, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -9261,11 +9251,13 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_23any_nan_row(PyObject *_ return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, PyObject *__pyx_v_callback) { int __pyx_v_row; int __pyx_v_n_cols; int __pyx_v_n_rows; + int __pyx_v_step; PyArrayObject *__pyx_v_flags = 0; + long __pyx_v_row_start; int __pyx_v_col; __Pyx_LocalBuf_ND __pyx_pybuffernd_flags; __Pyx_Buffer __pyx_pybuffer_flags; @@ -9285,15 +9277,18 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; - int __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; + long __pyx_t_13; + long __pyx_t_14; + long __pyx_t_15; + Py_ssize_t __pyx_t_16; + PyObject *(*__pyx_t_17)(PyObject *); + int __pyx_t_18; + int __pyx_t_19; int __pyx_t_20; Py_ssize_t __pyx_t_21; + Py_ssize_t __pyx_t_22; + int __pyx_t_23; + Py_ssize_t __pyx_t_24; __Pyx_RefNannySetupContext("any_nan_row", 0); __pyx_pybuffer_flags.pybuffer.buf = NULL; __pyx_pybuffer_flags.refcount = 0; @@ -9309,52 +9304,52 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; - /* "Orange/distance/_distance.pyx":371 + /* "Orange/distance/_distance.pyx":372 * np.ndarray[np.int8_t, ndim=1] flags * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< * flags = np.zeros(x.shape[0], dtype=np.int8) - * with nogil: + * step = max(n_cols // 100, 100) */ __pyx_t_1 = (__pyx_v_x->dimensions[0]); __pyx_t_2 = (__pyx_v_x->dimensions[1]); __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":372 + /* "Orange/distance/_distance.pyx":373 * * n_rows, n_cols = x.shape[0], x.shape[1] * flags = np.zeros(x.shape[0], dtype=np.int8) # <<<<<<<<<<<<<< - * with nogil: - * for row in range(n_rows): + * step = max(n_cols // 100, 100) + * for row_start in range(0, n_rows, step): */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_Py_intptr_t((__pyx_v_x->dimensions[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 372, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_int8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 372, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 372, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 373, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 372, __pyx_L1_error) + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 373, __pyx_L1_error) __pyx_t_8 = ((PyArrayObject *)__pyx_t_7); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -9371,117 +9366,247 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS __pyx_t_10 = __pyx_t_11 = __pyx_t_12 = 0; } __pyx_pybuffernd_flags.diminfo[0].strides = __pyx_pybuffernd_flags.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_flags.diminfo[0].shape = __pyx_pybuffernd_flags.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 372, __pyx_L1_error) + if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 373, __pyx_L1_error) } __pyx_t_8 = 0; __pyx_v_flags = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; - /* "Orange/distance/_distance.pyx":373 + /* "Orange/distance/_distance.pyx":374 * n_rows, n_cols = x.shape[0], x.shape[1] * flags = np.zeros(x.shape[0], dtype=np.int8) - * with nogil: # <<<<<<<<<<<<<< - * for row in range(n_rows): - * for col in range(n_cols): + * step = max(n_cols // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows, step): + * callback(row_start * 100 / n_rows) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_13 = 0x64; + __pyx_t_14 = (__pyx_v_n_cols / 0x64); + if (((__pyx_t_13 > __pyx_t_14) != 0)) { + __pyx_t_15 = __pyx_t_13; + } else { + __pyx_t_15 = __pyx_t_14; + } + __pyx_v_step = __pyx_t_15; - /* "Orange/distance/_distance.pyx":374 + /* "Orange/distance/_distance.pyx":375 * flags = np.zeros(x.shape[0], dtype=np.int8) - * with nogil: - * for row in range(n_rows): # <<<<<<<<<<<<<< - * for col in range(n_cols): - * if npy_isnan(x[row, col]): - */ - __pyx_t_9 = __pyx_v_n_rows; - __pyx_t_13 = __pyx_t_9; - for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { - __pyx_v_row = __pyx_t_14; - - /* "Orange/distance/_distance.pyx":375 - * with nogil: - * for row in range(n_rows): - * for col in range(n_cols): # <<<<<<<<<<<<<< - * if npy_isnan(x[row, col]): - * flags[row] = 1 - */ - __pyx_t_15 = __pyx_v_n_cols; - __pyx_t_16 = __pyx_t_15; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_col = __pyx_t_17; - - /* "Orange/distance/_distance.pyx":376 - * for row in range(n_rows): - * for col in range(n_cols): - * if npy_isnan(x[row, col]): # <<<<<<<<<<<<<< - * flags[row] = 1 - * break + * step = max(n_cols // 100, 100) + * for row_start in range(0, n_rows, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows) + * for row in range(row_start, min(row_start + step, n_rows)): */ - __pyx_t_18 = __pyx_v_row; - __pyx_t_19 = __pyx_v_col; - __pyx_t_20 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_x.diminfo[1].strides))) != 0); - if (__pyx_t_20) { + __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_n_rows); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); + __pyx_t_7 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5); __pyx_t_16 = 0; + __pyx_t_17 = NULL; + } else { + __pyx_t_16 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_17 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 375, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_17)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_16); __Pyx_INCREF(__pyx_t_3); __pyx_t_16++; if (unlikely(0 < 0)) __PYX_ERR(0, 375, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } else { + if (__pyx_t_16 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_16); __Pyx_INCREF(__pyx_t_3); __pyx_t_16++; if (unlikely(0 < 0)) __PYX_ERR(0, 375, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } + } else { + __pyx_t_3 = __pyx_t_17(__pyx_t_5); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 375, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __pyx_t_15 = __Pyx_PyInt_As_long(__pyx_t_3); if (unlikely((__pyx_t_15 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 375, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_row_start = __pyx_t_15; - /* "Orange/distance/_distance.pyx":377 - * for col in range(n_cols): - * if npy_isnan(x[row, col]): - * flags[row] = 1 # <<<<<<<<<<<<<< - * break - * return flags + /* "Orange/distance/_distance.pyx":376 + * step = max(n_cols // 100, 100) + * for row_start in range(0, n_rows, step): + * callback(row_start * 100 / n_rows) # <<<<<<<<<<<<<< + * for row in range(row_start, min(row_start + step, n_rows)): + * with nogil: + */ + __pyx_t_7 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_4 = __pyx_v_callback; __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 376, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "Orange/distance/_distance.pyx":377 + * for row_start in range(0, n_rows, step): + * callback(row_start * 100 / n_rows) + * for row in range(row_start, min(row_start + step, n_rows)): # <<<<<<<<<<<<<< + * with nogil: + * for col in range(n_cols): + */ + __pyx_t_9 = __pyx_v_n_rows; + __pyx_t_15 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_9 < __pyx_t_15) != 0)) { + __pyx_t_13 = __pyx_t_9; + } else { + __pyx_t_13 = __pyx_t_15; + } + __pyx_t_15 = __pyx_t_13; + __pyx_t_13 = __pyx_t_15; + for (__pyx_t_9 = __pyx_v_row_start; __pyx_t_9 < __pyx_t_13; __pyx_t_9+=1) { + __pyx_v_row = __pyx_t_9; + + /* "Orange/distance/_distance.pyx":378 + * callback(row_start * 100 / n_rows) + * for row in range(row_start, min(row_start + step, n_rows)): + * with nogil: # <<<<<<<<<<<<<< + * for col in range(n_cols): + * if npy_isnan(x[row, col]): + */ + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { + + /* "Orange/distance/_distance.pyx":379 + * for row in range(row_start, min(row_start + step, n_rows)): + * with nogil: + * for col in range(n_cols): # <<<<<<<<<<<<<< + * if npy_isnan(x[row, col]): + * flags[row] = 1 + */ + __pyx_t_18 = __pyx_v_n_cols; + __pyx_t_19 = __pyx_t_18; + for (__pyx_t_20 = 0; __pyx_t_20 < __pyx_t_19; __pyx_t_20+=1) { + __pyx_v_col = __pyx_t_20; + + /* "Orange/distance/_distance.pyx":380 + * with nogil: + * for col in range(n_cols): + * if npy_isnan(x[row, col]): # <<<<<<<<<<<<<< + * flags[row] = 1 + * break */ __pyx_t_21 = __pyx_v_row; - *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_flags.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_flags.diminfo[0].strides) = 1; + __pyx_t_22 = __pyx_v_col; + __pyx_t_23 = (npy_isnan((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_x.diminfo[1].strides))) != 0); + if (__pyx_t_23) { + + /* "Orange/distance/_distance.pyx":381 + * for col in range(n_cols): + * if npy_isnan(x[row, col]): + * flags[row] = 1 # <<<<<<<<<<<<<< + * break + * return flags + */ + __pyx_t_24 = __pyx_v_row; + *__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_flags.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_flags.diminfo[0].strides) = 1; - /* "Orange/distance/_distance.pyx":378 - * if npy_isnan(x[row, col]): - * flags[row] = 1 - * break # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":382 + * if npy_isnan(x[row, col]): + * flags[row] = 1 + * break # <<<<<<<<<<<<<< * return flags * */ - goto __pyx_L9_break; + goto __pyx_L13_break; - /* "Orange/distance/_distance.pyx":376 - * for row in range(n_rows): - * for col in range(n_cols): - * if npy_isnan(x[row, col]): # <<<<<<<<<<<<<< - * flags[row] = 1 - * break + /* "Orange/distance/_distance.pyx":380 + * with nogil: + * for col in range(n_cols): + * if npy_isnan(x[row, col]): # <<<<<<<<<<<<<< + * flags[row] = 1 + * break */ + } } + __pyx_L13_break:; + } + + /* "Orange/distance/_distance.pyx":378 + * callback(row_start * 100 / n_rows) + * for row in range(row_start, min(row_start + step, n_rows)): + * with nogil: # <<<<<<<<<<<<<< + * for col in range(n_cols): + * if npy_isnan(x[row, col]): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; } - __pyx_L9_break:; - } } + } - /* "Orange/distance/_distance.pyx":373 - * n_rows, n_cols = x.shape[0], x.shape[1] + /* "Orange/distance/_distance.pyx":375 * flags = np.zeros(x.shape[0], dtype=np.int8) - * with nogil: # <<<<<<<<<<<<<< - * for row in range(n_rows): - * for col in range(n_cols): + * step = max(n_cols // 100, 100) + * for row_start in range(0, n_rows, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows) + * for row in range(row_start, min(row_start + step, n_rows)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "Orange/distance/_distance.pyx":379 - * flags[row] = 1 - * break + /* "Orange/distance/_distance.pyx":383 + * flags[row] = 1 + * break * return flags # <<<<<<<<<<<<<< * * @@ -9494,9 +9619,9 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS /* "Orange/distance/_distance.pyx":366 * return float(nonzeros) / nonnans * - * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< + * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< + * callback): * cdef: - * int row, n_cols, n_rows */ /* function exit code */ @@ -9526,7 +9651,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS return __pyx_r; } -/* "Orange/distance/_distance.pyx":382 +/* "Orange/distance/_distance.pyx":386 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< @@ -9536,7 +9661,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_22any_nan_row(CYTHON_UNUS /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_24jaccard_rows[] = "jaccard_rows(ndarray nonzeros1, ndarray nonzeros2, ndarray x1, ndarray x2, ndarray nans1, ndarray nans2, ndarray ps, char two_tables)"; +static char __pyx_doc_6Orange_8distance_9_distance_24jaccard_rows[] = "jaccard_rows(ndarray nonzeros1, ndarray nonzeros2, ndarray x1, ndarray x2, ndarray nans1, ndarray nans2, ndarray ps, char two_tables, callback, next_callback)"; static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_25jaccard_rows = {"jaccard_rows", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_24jaccard_rows}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_nonzeros1 = 0; @@ -9547,16 +9672,22 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * PyArrayObject *__pyx_v_nans2 = 0; PyArrayObject *__pyx_v_ps = 0; char __pyx_v_two_tables; + PyObject *__pyx_v_callback = 0; + PyObject *__pyx_v_next_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("jaccard_rows (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nonzeros1,&__pyx_n_s_nonzeros2,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_nans1,&__pyx_n_s_nans2,&__pyx_n_s_ps,&__pyx_n_s_two_tables,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nonzeros1,&__pyx_n_s_nonzeros2,&__pyx_n_s_x1,&__pyx_n_s_x2,&__pyx_n_s_nans1,&__pyx_n_s_nans2,&__pyx_n_s_ps,&__pyx_n_s_two_tables,&__pyx_n_s_callback,&__pyx_n_s_next_callback,0}; + PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + CYTHON_FALLTHROUGH; + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + CYTHON_FALLTHROUGH; case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); @@ -9585,49 +9716,61 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nonzeros2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 1); __PYX_ERR(0, 382, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 1); __PYX_ERR(0, 386, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 2); __PYX_ERR(0, 382, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 2); __PYX_ERR(0, 386, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 3); __PYX_ERR(0, 382, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 3); __PYX_ERR(0, 386, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nans1)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 4); __PYX_ERR(0, 382, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 4); __PYX_ERR(0, 386, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nans2)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 5); __PYX_ERR(0, 382, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 5); __PYX_ERR(0, 386, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ps)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 6); __PYX_ERR(0, 382, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 6); __PYX_ERR(0, 386, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_two_tables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, 7); __PYX_ERR(0, 382, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 7); __PYX_ERR(0, 386, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 8: + if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 8); __PYX_ERR(0, 386, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 9: + if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_next_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, 9); __PYX_ERR(0, 386, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_rows") < 0)) __PYX_ERR(0, 382, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_rows") < 0)) __PYX_ERR(0, 386, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 8) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 10) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -9638,6 +9781,8 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + values[9] = PyTuple_GET_ITEM(__pyx_args, 9); } __pyx_v_nonzeros1 = ((PyArrayObject *)values[0]); __pyx_v_nonzeros2 = ((PyArrayObject *)values[1]); @@ -9646,24 +9791,26 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * __pyx_v_nans1 = ((PyArrayObject *)values[4]); __pyx_v_nans2 = ((PyArrayObject *)values[5]); __pyx_v_ps = ((PyArrayObject *)values[6]); - __pyx_v_two_tables = __Pyx_PyInt_As_char(values[7]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 389, __pyx_L3_error) + __pyx_v_two_tables = __Pyx_PyInt_As_char(values[7]); if (unlikely((__pyx_v_two_tables == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 393, __pyx_L3_error) + __pyx_v_callback = values[8]; + __pyx_v_next_callback = values[9]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 382, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_rows", 1, 10, 10, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 386, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.jaccard_rows", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros1), __pyx_ptype_5numpy_ndarray, 1, "nonzeros1", 0))) __PYX_ERR(0, 382, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros2), __pyx_ptype_5numpy_ndarray, 1, "nonzeros2", 0))) __PYX_ERR(0, 383, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 384, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 385, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans1), __pyx_ptype_5numpy_ndarray, 1, "nans1", 0))) __PYX_ERR(0, 386, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans2), __pyx_ptype_5numpy_ndarray, 1, "nans2", 0))) __PYX_ERR(0, 387, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 388, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(__pyx_self, __pyx_v_nonzeros1, __pyx_v_nonzeros2, __pyx_v_x1, __pyx_v_x2, __pyx_v_nans1, __pyx_v_nans2, __pyx_v_ps, __pyx_v_two_tables); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros1), __pyx_ptype_5numpy_ndarray, 1, "nonzeros1", 0))) __PYX_ERR(0, 386, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros2), __pyx_ptype_5numpy_ndarray, 1, "nonzeros2", 0))) __PYX_ERR(0, 387, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x1), __pyx_ptype_5numpy_ndarray, 1, "x1", 0))) __PYX_ERR(0, 388, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x2), __pyx_ptype_5numpy_ndarray, 1, "x2", 0))) __PYX_ERR(0, 389, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans1), __pyx_ptype_5numpy_ndarray, 1, "nans1", 0))) __PYX_ERR(0, 390, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans2), __pyx_ptype_5numpy_ndarray, 1, "nans2", 0))) __PYX_ERR(0, 391, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 392, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(__pyx_self, __pyx_v_nonzeros1, __pyx_v_nonzeros2, __pyx_v_x1, __pyx_v_x2, __pyx_v_nans1, __pyx_v_nans2, __pyx_v_ps, __pyx_v_two_tables, __pyx_v_callback, __pyx_v_next_callback); /* function exit code */ goto __pyx_L0; @@ -9674,59 +9821,14 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_25jaccard_rows(PyObject * return __pyx_r; } -/* "Orange/distance/_distance.pyx":454 - * distances[row1, row2] = 1 - intersection / union - * if not two_tables: - * lower_to_symmetric(distances, lambda x: x) # <<<<<<<<<<<<<< - * return distances - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_6Orange_8distance_9_distance_12jaccard_rows_lambda(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ -static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_12jaccard_rows_lambda = {"lambda", (PyCFunction)__pyx_pw_6Orange_8distance_9_distance_12jaccard_rows_lambda, METH_O, 0}; -static PyObject *__pyx_pw_6Orange_8distance_9_distance_12jaccard_rows_lambda(PyObject *__pyx_self, PyObject *__pyx_v_x) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda (wrapper)", 0); - __pyx_r = __pyx_lambda_funcdef_lambda(__pyx_self, ((PyObject *)__pyx_v_x)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lambda", 0); - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_x); - __pyx_r = __pyx_v_x; - goto __pyx_L0; - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "Orange/distance/_distance.pyx":382 - * - * - * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< - * np.ndarray[np.int8_t, ndim=2] nonzeros2, - * np.ndarray[np.float64_t, ndim=2] x1, - */ - -static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros1, PyArrayObject *__pyx_v_nonzeros2, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_nans1, PyArrayObject *__pyx_v_nans2, PyArrayObject *__pyx_v_ps, char __pyx_v_two_tables) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros1, PyArrayObject *__pyx_v_nonzeros2, PyArrayObject *__pyx_v_x1, PyArrayObject *__pyx_v_x2, PyArrayObject *__pyx_v_nans1, PyArrayObject *__pyx_v_nans2, PyArrayObject *__pyx_v_ps, char __pyx_v_two_tables, PyObject *__pyx_v_callback, PyObject *__pyx_v_next_callback) { int __pyx_v_n_rows1; int __pyx_v_n_rows2; int __pyx_v_n_cols; int __pyx_v_row1; int __pyx_v_row2; int __pyx_v_col; + int __pyx_v_step; __pyx_t_5numpy_float64_t __pyx_v_val1; __pyx_t_5numpy_float64_t __pyx_v_val2; __pyx_t_5numpy_float64_t __pyx_v_intersection; @@ -9734,6 +9836,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU int __pyx_v_ival1; int __pyx_v_ival2; __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_v_row_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_nans1; __Pyx_Buffer __pyx_pybuffer_nans1; __Pyx_LocalBuf_ND __pyx_pybuffernd_nans2; @@ -9757,27 +9860,27 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; + long __pyx_t_8; + long __pyx_t_9; + long __pyx_t_10; Py_ssize_t __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *__pyx_t_13 = NULL; int __pyx_t_14; - int __pyx_t_15; + Py_ssize_t __pyx_t_15; int __pyx_t_16; int __pyx_t_17; int __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - __pyx_t_5numpy_float64_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; Py_ssize_t __pyx_t_23; - __pyx_t_5numpy_float64_t __pyx_t_24; - Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_24; + __pyx_t_5numpy_float64_t __pyx_t_25; Py_ssize_t __pyx_t_26; Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; + __pyx_t_5numpy_float64_t __pyx_t_28; Py_ssize_t __pyx_t_29; Py_ssize_t __pyx_t_30; Py_ssize_t __pyx_t_31; @@ -9799,10 +9902,12 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU Py_ssize_t __pyx_t_47; Py_ssize_t __pyx_t_48; Py_ssize_t __pyx_t_49; - PyObject *__pyx_t_50 = NULL; - PyObject *__pyx_t_51 = NULL; - __Pyx_RefNannySetupContext("jaccard_rows", 0); - __pyx_pybuffer_nonzeros1.pybuffer.buf = NULL; + Py_ssize_t __pyx_t_50; + Py_ssize_t __pyx_t_51; + Py_ssize_t __pyx_t_52; + Py_ssize_t __pyx_t_53; + __Pyx_RefNannySetupContext("jaccard_rows", 0); + __pyx_pybuffer_nonzeros1.pybuffer.buf = NULL; __pyx_pybuffer_nonzeros1.refcount = 0; __pyx_pybuffernd_nonzeros1.data = NULL; __pyx_pybuffernd_nonzeros1.rcbuffer = &__pyx_pybuffer_nonzeros1; @@ -9832,41 +9937,41 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_pybuffernd_ps.rcbuffer = &__pyx_pybuffer_ps; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 382, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 386, __pyx_L1_error) } __pyx_pybuffernd_nonzeros1.diminfo[0].strides = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nonzeros1.diminfo[0].shape = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nonzeros1.diminfo[1].strides = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nonzeros1.diminfo[1].shape = __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 382, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 386, __pyx_L1_error) } __pyx_pybuffernd_nonzeros2.diminfo[0].strides = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nonzeros2.diminfo[0].shape = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nonzeros2.diminfo[1].strides = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nonzeros2.diminfo[1].shape = __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 382, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x1.rcbuffer->pybuffer, (PyObject*)__pyx_v_x1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 386, __pyx_L1_error) } __pyx_pybuffernd_x1.diminfo[0].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x1.diminfo[0].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x1.diminfo[1].strides = __pyx_pybuffernd_x1.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x1.diminfo[1].shape = __pyx_pybuffernd_x1.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 382, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x2.rcbuffer->pybuffer, (PyObject*)__pyx_v_x2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 386, __pyx_L1_error) } __pyx_pybuffernd_x2.diminfo[0].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x2.diminfo[0].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x2.diminfo[1].strides = __pyx_pybuffernd_x2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x2.diminfo[1].shape = __pyx_pybuffernd_x2.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 382, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans1.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans1, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 386, __pyx_L1_error) } __pyx_pybuffernd_nans1.diminfo[0].strides = __pyx_pybuffernd_nans1.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nans1.diminfo[0].shape = __pyx_pybuffernd_nans1.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 382, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans2.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 386, __pyx_L1_error) } __pyx_pybuffernd_nans2.diminfo[0].strides = __pyx_pybuffernd_nans2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nans2.diminfo[0].shape = __pyx_pybuffernd_nans2.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 382, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 386, __pyx_L1_error) } __pyx_pybuffernd_ps.diminfo[0].strides = __pyx_pybuffernd_ps.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ps.diminfo[0].shape = __pyx_pybuffernd_ps.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":396 + /* "Orange/distance/_distance.pyx":402 * double [:, :] distances * * n_rows1, n_cols = x1.shape[0], x2.shape[1] # <<<<<<<<<<<<<< @@ -9878,32 +9983,32 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __pyx_v_n_rows1 = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":397 + /* "Orange/distance/_distance.pyx":403 * * n_rows1, n_cols = x1.shape[0], x2.shape[1] * n_rows2 = x2.shape[0] # <<<<<<<<<<<<<< * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: + * step = max(n_rows1 // 100, 100) */ __pyx_v_n_rows2 = (__pyx_v_x2->dimensions[0]); - /* "Orange/distance/_distance.pyx":398 + /* "Orange/distance/_distance.pyx":404 * n_rows1, n_cols = x1.shape[0], x2.shape[1] * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) # <<<<<<<<<<<<<< - * with nogil: - * for row1 in range(n_rows1): + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 398, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_rows2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 398, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_rows2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 398, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); @@ -9911,815 +10016,941 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 398, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 398, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 398, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 398, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 404, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 398, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 404, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_distances = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "Orange/distance/_distance.pyx":399 + /* "Orange/distance/_distance.pyx":405 * n_rows2 = x2.shape[0] * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * if nans1[row1]: + * step = max(n_rows1 // 100, 100) # <<<<<<<<<<<<<< + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_8 = 0x64; + __pyx_t_9 = (__pyx_v_n_rows1 / 0x64); + if (((__pyx_t_8 > __pyx_t_9) != 0)) { + __pyx_t_10 = __pyx_t_8; + } else { + __pyx_t_10 = __pyx_t_9; + } + __pyx_v_step = __pyx_t_10; - /* "Orange/distance/_distance.pyx":400 + /* "Orange/distance/_distance.pyx":406 * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: - * for row1 in range(n_rows1): # <<<<<<<<<<<<<< - * if nans1[row1]: - * for row2 in range(n_rows2 if two_tables else row1): - */ - __pyx_t_8 = __pyx_v_n_rows1; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_row1 = __pyx_t_10; - - /* "Orange/distance/_distance.pyx":401 - * with nogil: - * for row1 in range(n_rows1): - * if nans1[row1]: # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * union = intersection = 0 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - __pyx_t_11 = __pyx_v_row1; - __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans1.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_nans1.diminfo[0].strides)) != 0); - if (__pyx_t_12) { + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_rows1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6); + __pyx_t_3 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { + __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5); __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_12 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 406, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 406, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } else { + if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 406, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } + } else { + __pyx_t_6 = __pyx_t_12(__pyx_t_5); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 406, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_row_start = __pyx_t_10; - /* "Orange/distance/_distance.pyx":402 - * for row1 in range(n_rows1): - * if nans1[row1]: - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * union = intersection = 0 - * for col in range(n_cols): + /* "Orange/distance/_distance.pyx":407 + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) # <<<<<<<<<<<<<< + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: */ - if ((__pyx_v_two_tables != 0)) { - __pyx_t_13 = __pyx_v_n_rows2; - } else { - __pyx_t_13 = __pyx_v_row1; - } - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_row2 = __pyx_t_15; + __pyx_t_3 = __Pyx_PyInt_From_long(((__pyx_v_row_start * 0x64) / __pyx_v_n_rows1)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_4 = __pyx_v_callback; __pyx_t_13 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_6 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_13, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "Orange/distance/_distance.pyx":403 - * if nans1[row1]: - * for row2 in range(n_rows2 if two_tables else row1): - * union = intersection = 0 # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] + /* "Orange/distance/_distance.pyx":408 + * for row_start in range(0, n_rows1, step): + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): # <<<<<<<<<<<<<< + * with nogil: + * if nans1[row1]: */ - __pyx_v_union = 0.0; - __pyx_v_intersection = 0.0; + __pyx_t_14 = __pyx_v_n_rows1; + __pyx_t_10 = (__pyx_v_row_start + __pyx_v_step); + if (((__pyx_t_14 < __pyx_t_10) != 0)) { + __pyx_t_8 = __pyx_t_14; + } else { + __pyx_t_8 = __pyx_t_10; + } + __pyx_t_10 = __pyx_t_8; + __pyx_t_8 = __pyx_t_10; + for (__pyx_t_14 = __pyx_v_row_start; __pyx_t_14 < __pyx_t_8; __pyx_t_14+=1) { + __pyx_v_row1 = __pyx_t_14; - /* "Orange/distance/_distance.pyx":404 - * for row2 in range(n_rows2 if two_tables else row1): - * union = intersection = 0 - * for col in range(n_cols): # <<<<<<<<<<<<<< - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): + /* "Orange/distance/_distance.pyx":409 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * if nans1[row1]: + * for row2 in range(n_rows2 if two_tables else row1): */ - __pyx_t_16 = __pyx_v_n_cols; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_col = __pyx_t_18; + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":405 - * union = intersection = 0 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + /* "Orange/distance/_distance.pyx":410 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * if nans1[row1]: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * union = intersection = 0 */ - __pyx_t_19 = __pyx_v_row1; - __pyx_t_20 = __pyx_v_col; - __pyx_t_21 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_x1.diminfo[1].strides)); - __pyx_t_22 = __pyx_v_row2; - __pyx_t_23 = __pyx_v_col; - __pyx_t_24 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_x2.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_21; - __pyx_v_val2 = __pyx_t_24; + __pyx_t_15 = __pyx_v_row1; + __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans1.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_nans1.diminfo[0].strides)) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":406 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * intersection += ps[col] ** 2 + /* "Orange/distance/_distance.pyx":411 + * with nogil: + * if nans1[row1]: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * union = intersection = 0 + * for col in range(n_cols): */ - __pyx_t_12 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_12) { + if ((__pyx_v_two_tables != 0)) { + __pyx_t_17 = __pyx_v_n_rows2; + } else { + __pyx_t_17 = __pyx_v_row1; + } + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_row2 = __pyx_t_19; - /* "Orange/distance/_distance.pyx":407 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * intersection += ps[col] ** 2 - * union += 1 - (1 - ps[col]) ** 2 + /* "Orange/distance/_distance.pyx":412 + * if nans1[row1]: + * for row2 in range(n_rows2 if two_tables else row1): + * union = intersection = 0 # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] */ - __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_12) { + __pyx_v_union = 0.0; + __pyx_v_intersection = 0.0; - /* "Orange/distance/_distance.pyx":408 - * if npy_isnan(val1): - * if npy_isnan(val2): - * intersection += ps[col] ** 2 # <<<<<<<<<<<<<< - * union += 1 - (1 - ps[col]) ** 2 - * elif val2 != 0: + /* "Orange/distance/_distance.pyx":413 + * for row2 in range(n_rows2 if two_tables else row1): + * union = intersection = 0 + * for col in range(n_cols): # <<<<<<<<<<<<<< + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): */ - __pyx_t_25 = __pyx_v_col; - __pyx_v_intersection = (__pyx_v_intersection + pow((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_ps.diminfo[0].strides)), 2.0)); + __pyx_t_20 = __pyx_v_n_cols; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_col = __pyx_t_22; - /* "Orange/distance/_distance.pyx":409 - * if npy_isnan(val2): - * intersection += ps[col] ** 2 - * union += 1 - (1 - ps[col]) ** 2 # <<<<<<<<<<<<<< - * elif val2 != 0: - * intersection += ps[col] + /* "Orange/distance/_distance.pyx":414 + * union = intersection = 0 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - __pyx_t_26 = __pyx_v_col; - __pyx_v_union = (__pyx_v_union + (1.0 - pow((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_ps.diminfo[0].strides))), 2.0))); + __pyx_t_23 = __pyx_v_row1; + __pyx_t_24 = __pyx_v_col; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x1.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x1.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x1.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row2; + __pyx_t_27 = __pyx_v_col; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x2.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; - /* "Orange/distance/_distance.pyx":407 - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * intersection += ps[col] ** 2 - * union += 1 - (1 - ps[col]) ** 2 + /* "Orange/distance/_distance.pyx":415 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * intersection += ps[col] ** 2 */ - goto __pyx_L14; - } + __pyx_t_16 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":410 - * intersection += ps[col] ** 2 - * union += 1 - (1 - ps[col]) ** 2 - * elif val2 != 0: # <<<<<<<<<<<<<< - * intersection += ps[col] - * union += 1 - */ - __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); - if (__pyx_t_12) { - - /* "Orange/distance/_distance.pyx":411 - * union += 1 - (1 - ps[col]) ** 2 - * elif val2 != 0: - * intersection += ps[col] # <<<<<<<<<<<<<< - * union += 1 - * else: + /* "Orange/distance/_distance.pyx":416 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * intersection += ps[col] ** 2 + * union += 1 - (1 - ps[col]) ** 2 */ - __pyx_t_27 = __pyx_v_col; - __pyx_v_intersection = (__pyx_v_intersection + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_ps.diminfo[0].strides))); + __pyx_t_16 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":412 - * elif val2 != 0: - * intersection += ps[col] - * union += 1 # <<<<<<<<<<<<<< - * else: - * union += ps[col] + /* "Orange/distance/_distance.pyx":417 + * if npy_isnan(val1): + * if npy_isnan(val2): + * intersection += ps[col] ** 2 # <<<<<<<<<<<<<< + * union += 1 - (1 - ps[col]) ** 2 + * elif val2 != 0: */ - __pyx_v_union = (__pyx_v_union + 1.0); + __pyx_t_29 = __pyx_v_col; + __pyx_v_intersection = (__pyx_v_intersection + pow((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_ps.diminfo[0].strides)), 2.0)); - /* "Orange/distance/_distance.pyx":410 - * intersection += ps[col] ** 2 - * union += 1 - (1 - ps[col]) ** 2 - * elif val2 != 0: # <<<<<<<<<<<<<< - * intersection += ps[col] - * union += 1 + /* "Orange/distance/_distance.pyx":418 + * if npy_isnan(val2): + * intersection += ps[col] ** 2 + * union += 1 - (1 - ps[col]) ** 2 # <<<<<<<<<<<<<< + * elif val2 != 0: + * intersection += ps[col] */ - goto __pyx_L14; - } + __pyx_t_30 = __pyx_v_col; + __pyx_v_union = (__pyx_v_union + (1.0 - pow((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_ps.diminfo[0].strides))), 2.0))); - /* "Orange/distance/_distance.pyx":414 - * union += 1 - * else: - * union += ps[col] # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * if val1 != 0: + /* "Orange/distance/_distance.pyx":416 + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * intersection += ps[col] ** 2 + * union += 1 - (1 - ps[col]) ** 2 */ - /*else*/ { - __pyx_t_28 = __pyx_v_col; - __pyx_v_union = (__pyx_v_union + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_ps.diminfo[0].strides))); - } - __pyx_L14:; + goto __pyx_L18; + } - /* "Orange/distance/_distance.pyx":406 - * for col in range(n_cols): - * val1, val2 = x1[row1, col], x2[row2, col] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * intersection += ps[col] ** 2 + /* "Orange/distance/_distance.pyx":419 + * intersection += ps[col] ** 2 + * union += 1 - (1 - ps[col]) ** 2 + * elif val2 != 0: # <<<<<<<<<<<<<< + * intersection += ps[col] + * union += 1 */ - goto __pyx_L13; - } + __pyx_t_16 = ((__pyx_v_val2 != 0.0) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":415 - * else: - * union += ps[col] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * if val1 != 0: - * intersection += val1 * ps[col] + /* "Orange/distance/_distance.pyx":420 + * union += 1 - (1 - ps[col]) ** 2 + * elif val2 != 0: + * intersection += ps[col] # <<<<<<<<<<<<<< + * union += 1 + * else: */ - __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_12) { + __pyx_t_31 = __pyx_v_col; + __pyx_v_intersection = (__pyx_v_intersection + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_ps.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":416 - * union += ps[col] - * elif npy_isnan(val2): - * if val1 != 0: # <<<<<<<<<<<<<< - * intersection += val1 * ps[col] - * union += 1 + /* "Orange/distance/_distance.pyx":421 + * elif val2 != 0: + * intersection += ps[col] + * union += 1 # <<<<<<<<<<<<<< + * else: + * union += ps[col] */ - __pyx_t_12 = ((__pyx_v_val1 != 0.0) != 0); - if (__pyx_t_12) { + __pyx_v_union = (__pyx_v_union + 1.0); - /* "Orange/distance/_distance.pyx":417 - * elif npy_isnan(val2): - * if val1 != 0: - * intersection += val1 * ps[col] # <<<<<<<<<<<<<< - * union += 1 - * else: + /* "Orange/distance/_distance.pyx":419 + * intersection += ps[col] ** 2 + * union += 1 - (1 - ps[col]) ** 2 + * elif val2 != 0: # <<<<<<<<<<<<<< + * intersection += ps[col] + * union += 1 */ - __pyx_t_29 = __pyx_v_col; - __pyx_v_intersection = (__pyx_v_intersection + (__pyx_v_val1 * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_ps.diminfo[0].strides)))); + goto __pyx_L18; + } - /* "Orange/distance/_distance.pyx":418 - * if val1 != 0: - * intersection += val1 * ps[col] - * union += 1 # <<<<<<<<<<<<<< - * else: - * union += ps[col] + /* "Orange/distance/_distance.pyx":423 + * union += 1 + * else: + * union += ps[col] # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * if val1 != 0: */ - __pyx_v_union = (__pyx_v_union + 1.0); + /*else*/ { + __pyx_t_32 = __pyx_v_col; + __pyx_v_union = (__pyx_v_union + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_ps.diminfo[0].strides))); + } + __pyx_L18:; - /* "Orange/distance/_distance.pyx":416 - * union += ps[col] - * elif npy_isnan(val2): - * if val1 != 0: # <<<<<<<<<<<<<< - * intersection += val1 * ps[col] - * union += 1 + /* "Orange/distance/_distance.pyx":415 + * for col in range(n_cols): + * val1, val2 = x1[row1, col], x2[row2, col] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * intersection += ps[col] ** 2 */ - goto __pyx_L15; + goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":420 - * union += 1 - * else: - * union += ps[col] # <<<<<<<<<<<<<< - * else: - * ival1 = nonzeros1[row1, col] + /* "Orange/distance/_distance.pyx":424 + * else: + * union += ps[col] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * if val1 != 0: + * intersection += val1 * ps[col] */ - /*else*/ { - __pyx_t_30 = __pyx_v_col; - __pyx_v_union = (__pyx_v_union + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_ps.diminfo[0].strides))); - } - __pyx_L15:; + __pyx_t_16 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":415 - * else: - * union += ps[col] - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * if val1 != 0: - * intersection += val1 * ps[col] + /* "Orange/distance/_distance.pyx":425 + * union += ps[col] + * elif npy_isnan(val2): + * if val1 != 0: # <<<<<<<<<<<<<< + * intersection += val1 * ps[col] + * union += 1 */ - goto __pyx_L13; - } + __pyx_t_16 = ((__pyx_v_val1 != 0.0) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":422 - * union += ps[col] - * else: - * ival1 = nonzeros1[row1, col] # <<<<<<<<<<<<<< - * ival2 = nonzeros2[row2, col] - * union += ival1 | ival2 + /* "Orange/distance/_distance.pyx":426 + * elif npy_isnan(val2): + * if val1 != 0: + * intersection += val1 * ps[col] # <<<<<<<<<<<<<< + * union += 1 + * else: */ - /*else*/ { - __pyx_t_31 = __pyx_v_row1; - __pyx_t_32 = __pyx_v_col; - __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)); + __pyx_t_33 = __pyx_v_col; + __pyx_v_intersection = (__pyx_v_intersection + (__pyx_v_val1 * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_ps.diminfo[0].strides)))); - /* "Orange/distance/_distance.pyx":423 - * else: - * ival1 = nonzeros1[row1, col] - * ival2 = nonzeros2[row2, col] # <<<<<<<<<<<<<< - * union += ival1 | ival2 - * intersection += ival1 & ival2 + /* "Orange/distance/_distance.pyx":427 + * if val1 != 0: + * intersection += val1 * ps[col] + * union += 1 # <<<<<<<<<<<<<< + * else: + * union += ps[col] */ - __pyx_t_33 = __pyx_v_row2; - __pyx_t_34 = __pyx_v_col; - __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_nonzeros2.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_nonzeros2.diminfo[1].strides)); - - /* "Orange/distance/_distance.pyx":424 - * ival1 = nonzeros1[row1, col] - * ival2 = nonzeros2[row2, col] - * union += ival1 | ival2 # <<<<<<<<<<<<<< - * intersection += ival1 & ival2 - * if union != 0: - */ - __pyx_v_union = (__pyx_v_union + (__pyx_v_ival1 | __pyx_v_ival2)); - - /* "Orange/distance/_distance.pyx":425 - * ival2 = nonzeros2[row2, col] - * union += ival1 | ival2 - * intersection += ival1 & ival2 # <<<<<<<<<<<<<< - * if union != 0: - * distances[row1, row2] = 1 - intersection / union - */ - __pyx_v_intersection = (__pyx_v_intersection + (__pyx_v_ival1 & __pyx_v_ival2)); - } - __pyx_L13:; - } + __pyx_v_union = (__pyx_v_union + 1.0); - /* "Orange/distance/_distance.pyx":426 - * union += ival1 | ival2 - * intersection += ival1 & ival2 - * if union != 0: # <<<<<<<<<<<<<< - * distances[row1, row2] = 1 - intersection / union - * else: + /* "Orange/distance/_distance.pyx":425 + * union += ps[col] + * elif npy_isnan(val2): + * if val1 != 0: # <<<<<<<<<<<<<< + * intersection += val1 * ps[col] + * union += 1 */ - __pyx_t_12 = ((__pyx_v_union != 0.0) != 0); - if (__pyx_t_12) { + goto __pyx_L19; + } - /* "Orange/distance/_distance.pyx":427 - * intersection += ival1 & ival2 - * if union != 0: - * distances[row1, row2] = 1 - intersection / union # <<<<<<<<<<<<<< - * else: - * for row2 in range(n_rows2 if two_tables else row1): + /* "Orange/distance/_distance.pyx":429 + * union += 1 + * else: + * union += ps[col] # <<<<<<<<<<<<<< + * else: + * ival1 = nonzeros1[row1, col] */ - __pyx_t_35 = __pyx_v_row1; - __pyx_t_36 = __pyx_v_row2; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_35 * __pyx_v_distances.strides[0]) ) + __pyx_t_36 * __pyx_v_distances.strides[1]) )) = (1.0 - (__pyx_v_intersection / __pyx_v_union)); + /*else*/ { + __pyx_t_34 = __pyx_v_col; + __pyx_v_union = (__pyx_v_union + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_ps.diminfo[0].strides))); + } + __pyx_L19:; - /* "Orange/distance/_distance.pyx":426 - * union += ival1 | ival2 - * intersection += ival1 & ival2 - * if union != 0: # <<<<<<<<<<<<<< - * distances[row1, row2] = 1 - intersection / union - * else: + /* "Orange/distance/_distance.pyx":424 + * else: + * union += ps[col] + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * if val1 != 0: + * intersection += val1 * ps[col] */ - } - } + goto __pyx_L17; + } - /* "Orange/distance/_distance.pyx":401 - * with nogil: - * for row1 in range(n_rows1): - * if nans1[row1]: # <<<<<<<<<<<<<< - * for row2 in range(n_rows2 if two_tables else row1): - * union = intersection = 0 + /* "Orange/distance/_distance.pyx":431 + * union += ps[col] + * else: + * ival1 = nonzeros1[row1, col] # <<<<<<<<<<<<<< + * ival2 = nonzeros2[row2, col] + * union += ival1 | ival2 */ - goto __pyx_L8; - } + /*else*/ { + __pyx_t_35 = __pyx_v_row1; + __pyx_t_36 = __pyx_v_col; + __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_36, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":429 - * distances[row1, row2] = 1 - intersection / union - * else: - * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< - * union = intersection = 0 - * # This case is slightly different since val1 can't be nan - */ - /*else*/ { - if ((__pyx_v_two_tables != 0)) { - __pyx_t_13 = __pyx_v_n_rows2; - } else { - __pyx_t_13 = __pyx_v_row1; - } - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_row2 = __pyx_t_15; + /* "Orange/distance/_distance.pyx":432 + * else: + * ival1 = nonzeros1[row1, col] + * ival2 = nonzeros2[row2, col] # <<<<<<<<<<<<<< + * union += ival1 | ival2 + * intersection += ival1 & ival2 + */ + __pyx_t_37 = __pyx_v_row2; + __pyx_t_38 = __pyx_v_col; + __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_nonzeros2.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_nonzeros2.diminfo[1].strides)); + + /* "Orange/distance/_distance.pyx":433 + * ival1 = nonzeros1[row1, col] + * ival2 = nonzeros2[row2, col] + * union += ival1 | ival2 # <<<<<<<<<<<<<< + * intersection += ival1 & ival2 + * if union != 0: + */ + __pyx_v_union = (__pyx_v_union + (__pyx_v_ival1 | __pyx_v_ival2)); + + /* "Orange/distance/_distance.pyx":434 + * ival2 = nonzeros2[row2, col] + * union += ival1 | ival2 + * intersection += ival1 & ival2 # <<<<<<<<<<<<<< + * if union != 0: + * distances[row1, row2] = 1 - intersection / union + */ + __pyx_v_intersection = (__pyx_v_intersection + (__pyx_v_ival1 & __pyx_v_ival2)); + } + __pyx_L17:; + } - /* "Orange/distance/_distance.pyx":430 - * else: - * for row2 in range(n_rows2 if two_tables else row1): - * union = intersection = 0 # <<<<<<<<<<<<<< - * # This case is slightly different since val1 can't be nan - * if nans2[row2]: + /* "Orange/distance/_distance.pyx":435 + * union += ival1 | ival2 + * intersection += ival1 & ival2 + * if union != 0: # <<<<<<<<<<<<<< + * distances[row1, row2] = 1 - intersection / union + * else: */ - __pyx_v_union = 0.0; - __pyx_v_intersection = 0.0; + __pyx_t_16 = ((__pyx_v_union != 0.0) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":432 - * union = intersection = 0 - * # This case is slightly different since val1 can't be nan - * if nans2[row2]: # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val2 = x2[row2, col] + /* "Orange/distance/_distance.pyx":436 + * intersection += ival1 & ival2 + * if union != 0: + * distances[row1, row2] = 1 - intersection / union # <<<<<<<<<<<<<< + * else: + * for row2 in range(n_rows2 if two_tables else row1): */ - __pyx_t_37 = __pyx_v_row2; - __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans2.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_nans2.diminfo[0].strides)) != 0); - if (__pyx_t_12) { + __pyx_t_39 = __pyx_v_row1; + __pyx_t_40 = __pyx_v_row2; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_39 * __pyx_v_distances.strides[0]) ) + __pyx_t_40 * __pyx_v_distances.strides[1]) )) = (1.0 - (__pyx_v_intersection / __pyx_v_union)); - /* "Orange/distance/_distance.pyx":433 - * # This case is slightly different since val1 can't be nan - * if nans2[row2]: - * for col in range(n_cols): # <<<<<<<<<<<<<< - * val2 = x2[row2, col] - * if nonzeros1[row1, col] != 0: + /* "Orange/distance/_distance.pyx":435 + * union += ival1 | ival2 + * intersection += ival1 & ival2 + * if union != 0: # <<<<<<<<<<<<<< + * distances[row1, row2] = 1 - intersection / union + * else: */ - __pyx_t_16 = __pyx_v_n_cols; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_col = __pyx_t_18; + } + } - /* "Orange/distance/_distance.pyx":434 - * if nans2[row2]: - * for col in range(n_cols): - * val2 = x2[row2, col] # <<<<<<<<<<<<<< - * if nonzeros1[row1, col] != 0: - * union += 1 + /* "Orange/distance/_distance.pyx":410 + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: + * if nans1[row1]: # <<<<<<<<<<<<<< + * for row2 in range(n_rows2 if two_tables else row1): + * union = intersection = 0 */ - __pyx_t_38 = __pyx_v_row2; - __pyx_t_39 = __pyx_v_col; - __pyx_v_val2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_x2.diminfo[1].strides)); + goto __pyx_L12; + } - /* "Orange/distance/_distance.pyx":435 - * for col in range(n_cols): - * val2 = x2[row2, col] - * if nonzeros1[row1, col] != 0: # <<<<<<<<<<<<<< - * union += 1 - * if npy_isnan(val2): - */ - __pyx_t_40 = __pyx_v_row1; - __pyx_t_41 = __pyx_v_col; - __pyx_t_12 = (((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_41, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)) != 0) != 0); - if (__pyx_t_12) { + /* "Orange/distance/_distance.pyx":438 + * distances[row1, row2] = 1 - intersection / union + * else: + * for row2 in range(n_rows2 if two_tables else row1): # <<<<<<<<<<<<<< + * union = intersection = 0 + * # This case is slightly different since val1 can't be nan + */ + /*else*/ { + if ((__pyx_v_two_tables != 0)) { + __pyx_t_17 = __pyx_v_n_rows2; + } else { + __pyx_t_17 = __pyx_v_row1; + } + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_row2 = __pyx_t_19; - /* "Orange/distance/_distance.pyx":436 - * val2 = x2[row2, col] - * if nonzeros1[row1, col] != 0: - * union += 1 # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * intersection += ps[col] + /* "Orange/distance/_distance.pyx":439 + * else: + * for row2 in range(n_rows2 if two_tables else row1): + * union = intersection = 0 # <<<<<<<<<<<<<< + * # This case is slightly different since val1 can't be nan + * if nans2[row2]: + */ + __pyx_v_union = 0.0; + __pyx_v_intersection = 0.0; + + /* "Orange/distance/_distance.pyx":441 + * union = intersection = 0 + * # This case is slightly different since val1 can't be nan + * if nans2[row2]: # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val2 = x2[row2, col] + */ + __pyx_t_41 = __pyx_v_row2; + __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans2.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_nans2.diminfo[0].strides)) != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":442 + * # This case is slightly different since val1 can't be nan + * if nans2[row2]: + * for col in range(n_cols): # <<<<<<<<<<<<<< + * val2 = x2[row2, col] + * if nonzeros1[row1, col] != 0: + */ + __pyx_t_20 = __pyx_v_n_cols; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_col = __pyx_t_22; + + /* "Orange/distance/_distance.pyx":443 + * if nans2[row2]: + * for col in range(n_cols): + * val2 = x2[row2, col] # <<<<<<<<<<<<<< + * if nonzeros1[row1, col] != 0: + * union += 1 */ - __pyx_v_union = (__pyx_v_union + 1.0); + __pyx_t_42 = __pyx_v_row2; + __pyx_t_43 = __pyx_v_col; + __pyx_v_val2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x2.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_x2.diminfo[0].strides, __pyx_t_43, __pyx_pybuffernd_x2.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":437 - * if nonzeros1[row1, col] != 0: - * union += 1 - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * intersection += ps[col] + /* "Orange/distance/_distance.pyx":444 + * for col in range(n_cols): + * val2 = x2[row2, col] + * if nonzeros1[row1, col] != 0: # <<<<<<<<<<<<<< + * union += 1 + * if npy_isnan(val2): + */ + __pyx_t_44 = __pyx_v_row1; + __pyx_t_45 = __pyx_v_col; + __pyx_t_16 = (((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)) != 0) != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":445 + * val2 = x2[row2, col] + * if nonzeros1[row1, col] != 0: + * union += 1 # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * intersection += ps[col] + */ + __pyx_v_union = (__pyx_v_union + 1.0); + + /* "Orange/distance/_distance.pyx":446 + * if nonzeros1[row1, col] != 0: + * union += 1 + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * intersection += ps[col] + * elif val2 != 0: + */ + __pyx_t_16 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":447 + * union += 1 + * if npy_isnan(val2): + * intersection += ps[col] # <<<<<<<<<<<<<< + * elif val2 != 0: + * intersection += 1 + */ + __pyx_t_46 = __pyx_v_col; + __pyx_v_intersection = (__pyx_v_intersection + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_ps.diminfo[0].strides))); + + /* "Orange/distance/_distance.pyx":446 + * if nonzeros1[row1, col] != 0: + * union += 1 + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * intersection += ps[col] + * elif val2 != 0: + */ + goto __pyx_L27; + } + + /* "Orange/distance/_distance.pyx":448 + * if npy_isnan(val2): + * intersection += ps[col] + * elif val2 != 0: # <<<<<<<<<<<<<< + * intersection += 1 + * elif npy_isnan(val2): + */ + __pyx_t_16 = ((__pyx_v_val2 != 0.0) != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":449 + * intersection += ps[col] + * elif val2 != 0: + * intersection += 1 # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * union += ps[col] + */ + __pyx_v_intersection = (__pyx_v_intersection + 1.0); + + /* "Orange/distance/_distance.pyx":448 + * if npy_isnan(val2): + * intersection += ps[col] + * elif val2 != 0: # <<<<<<<<<<<<<< + * intersection += 1 + * elif npy_isnan(val2): + */ + } + __pyx_L27:; + + /* "Orange/distance/_distance.pyx":444 + * for col in range(n_cols): + * val2 = x2[row2, col] + * if nonzeros1[row1, col] != 0: # <<<<<<<<<<<<<< + * union += 1 + * if npy_isnan(val2): + */ + goto __pyx_L26; + } + + /* "Orange/distance/_distance.pyx":450 + * elif val2 != 0: + * intersection += 1 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * union += ps[col] * elif val2 != 0: */ - __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_12) { + __pyx_t_16 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":438 - * union += 1 - * if npy_isnan(val2): - * intersection += ps[col] # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":451 + * intersection += 1 + * elif npy_isnan(val2): + * union += ps[col] # <<<<<<<<<<<<<< * elif val2 != 0: - * intersection += 1 + * union += 1 */ - __pyx_t_42 = __pyx_v_col; - __pyx_v_intersection = (__pyx_v_intersection + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_ps.diminfo[0].strides))); + __pyx_t_47 = __pyx_v_col; + __pyx_v_union = (__pyx_v_union + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_ps.diminfo[0].strides))); - /* "Orange/distance/_distance.pyx":437 - * if nonzeros1[row1, col] != 0: - * union += 1 - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * intersection += ps[col] + /* "Orange/distance/_distance.pyx":450 + * elif val2 != 0: + * intersection += 1 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * union += ps[col] * elif val2 != 0: */ - goto __pyx_L23; + goto __pyx_L26; } - /* "Orange/distance/_distance.pyx":439 - * if npy_isnan(val2): - * intersection += ps[col] + /* "Orange/distance/_distance.pyx":452 + * elif npy_isnan(val2): + * union += ps[col] * elif val2 != 0: # <<<<<<<<<<<<<< - * intersection += 1 - * elif npy_isnan(val2): + * union += 1 + * else: */ - __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); - if (__pyx_t_12) { + __pyx_t_16 = ((__pyx_v_val2 != 0.0) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":440 - * intersection += ps[col] + /* "Orange/distance/_distance.pyx":453 + * union += ps[col] * elif val2 != 0: - * intersection += 1 # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * union += ps[col] + * union += 1 # <<<<<<<<<<<<<< + * else: + * for col in range(n_cols): */ - __pyx_v_intersection = (__pyx_v_intersection + 1.0); + __pyx_v_union = (__pyx_v_union + 1.0); - /* "Orange/distance/_distance.pyx":439 - * if npy_isnan(val2): - * intersection += ps[col] + /* "Orange/distance/_distance.pyx":452 + * elif npy_isnan(val2): + * union += ps[col] * elif val2 != 0: # <<<<<<<<<<<<<< - * intersection += 1 - * elif npy_isnan(val2): + * union += 1 + * else: */ } - __pyx_L23:; - - /* "Orange/distance/_distance.pyx":435 - * for col in range(n_cols): - * val2 = x2[row2, col] - * if nonzeros1[row1, col] != 0: # <<<<<<<<<<<<<< - * union += 1 - * if npy_isnan(val2): - */ - goto __pyx_L22; + __pyx_L26:; } /* "Orange/distance/_distance.pyx":441 - * elif val2 != 0: - * intersection += 1 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * union += ps[col] - * elif val2 != 0: - */ - __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_12) { - - /* "Orange/distance/_distance.pyx":442 - * intersection += 1 - * elif npy_isnan(val2): - * union += ps[col] # <<<<<<<<<<<<<< - * elif val2 != 0: - * union += 1 - */ - __pyx_t_43 = __pyx_v_col; - __pyx_v_union = (__pyx_v_union + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_ps.diminfo[0].strides))); - - /* "Orange/distance/_distance.pyx":441 - * elif val2 != 0: - * intersection += 1 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * union += ps[col] - * elif val2 != 0: - */ - goto __pyx_L22; - } - - /* "Orange/distance/_distance.pyx":443 - * elif npy_isnan(val2): - * union += ps[col] - * elif val2 != 0: # <<<<<<<<<<<<<< - * union += 1 - * else: + * union = intersection = 0 + * # This case is slightly different since val1 can't be nan + * if nans2[row2]: # <<<<<<<<<<<<<< + * for col in range(n_cols): + * val2 = x2[row2, col] */ - __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); - if (__pyx_t_12) { - - /* "Orange/distance/_distance.pyx":444 - * union += ps[col] - * elif val2 != 0: - * union += 1 # <<<<<<<<<<<<<< - * else: - * for col in range(n_cols): - */ - __pyx_v_union = (__pyx_v_union + 1.0); - - /* "Orange/distance/_distance.pyx":443 - * elif npy_isnan(val2): - * union += ps[col] - * elif val2 != 0: # <<<<<<<<<<<<<< - * union += 1 - * else: - */ - } - __pyx_L22:; + goto __pyx_L23; } - /* "Orange/distance/_distance.pyx":432 - * union = intersection = 0 - * # This case is slightly different since val1 can't be nan - * if nans2[row2]: # <<<<<<<<<<<<<< - * for col in range(n_cols): - * val2 = x2[row2, col] - */ - goto __pyx_L19; - } - - /* "Orange/distance/_distance.pyx":446 - * union += 1 - * else: - * for col in range(n_cols): # <<<<<<<<<<<<<< - * ival1 = nonzeros1[row1, col] - * ival2 = nonzeros2[row2, col] - */ - /*else*/ { - __pyx_t_16 = __pyx_v_n_cols; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_col = __pyx_t_18; - - /* "Orange/distance/_distance.pyx":447 - * else: - * for col in range(n_cols): - * ival1 = nonzeros1[row1, col] # <<<<<<<<<<<<<< - * ival2 = nonzeros2[row2, col] - * union += ival1 | ival2 + /* "Orange/distance/_distance.pyx":455 + * union += 1 + * else: + * for col in range(n_cols): # <<<<<<<<<<<<<< + * ival1 = nonzeros1[row1, col] + * ival2 = nonzeros2[row2, col] */ - __pyx_t_44 = __pyx_v_row1; - __pyx_t_45 = __pyx_v_col; - __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)); + /*else*/ { + __pyx_t_20 = __pyx_v_n_cols; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_col = __pyx_t_22; - /* "Orange/distance/_distance.pyx":448 - * for col in range(n_cols): - * ival1 = nonzeros1[row1, col] - * ival2 = nonzeros2[row2, col] # <<<<<<<<<<<<<< - * union += ival1 | ival2 - * intersection += ival1 & ival2 - */ - __pyx_t_46 = __pyx_v_row2; - __pyx_t_47 = __pyx_v_col; - __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_nonzeros2.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_nonzeros2.diminfo[1].strides)); - - /* "Orange/distance/_distance.pyx":449 - * ival1 = nonzeros1[row1, col] - * ival2 = nonzeros2[row2, col] - * union += ival1 | ival2 # <<<<<<<<<<<<<< - * intersection += ival1 & ival2 - * if union != 0: - */ - __pyx_v_union = (__pyx_v_union + (__pyx_v_ival1 | __pyx_v_ival2)); - - /* "Orange/distance/_distance.pyx":450 - * ival2 = nonzeros2[row2, col] - * union += ival1 | ival2 - * intersection += ival1 & ival2 # <<<<<<<<<<<<<< - * if union != 0: - * distances[row1, row2] = 1 - intersection / union - */ - __pyx_v_intersection = (__pyx_v_intersection + (__pyx_v_ival1 & __pyx_v_ival2)); + /* "Orange/distance/_distance.pyx":456 + * else: + * for col in range(n_cols): + * ival1 = nonzeros1[row1, col] # <<<<<<<<<<<<<< + * ival2 = nonzeros2[row2, col] + * union += ival1 | ival2 + */ + __pyx_t_48 = __pyx_v_row1; + __pyx_t_49 = __pyx_v_col; + __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros1.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_nonzeros1.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_nonzeros1.diminfo[1].strides)); + + /* "Orange/distance/_distance.pyx":457 + * for col in range(n_cols): + * ival1 = nonzeros1[row1, col] + * ival2 = nonzeros2[row2, col] # <<<<<<<<<<<<<< + * union += ival1 | ival2 + * intersection += ival1 & ival2 + */ + __pyx_t_50 = __pyx_v_row2; + __pyx_t_51 = __pyx_v_col; + __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros2.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_nonzeros2.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_nonzeros2.diminfo[1].strides)); + + /* "Orange/distance/_distance.pyx":458 + * ival1 = nonzeros1[row1, col] + * ival2 = nonzeros2[row2, col] + * union += ival1 | ival2 # <<<<<<<<<<<<<< + * intersection += ival1 & ival2 + * if union != 0: + */ + __pyx_v_union = (__pyx_v_union + (__pyx_v_ival1 | __pyx_v_ival2)); + + /* "Orange/distance/_distance.pyx":459 + * ival2 = nonzeros2[row2, col] + * union += ival1 | ival2 + * intersection += ival1 & ival2 # <<<<<<<<<<<<<< + * if union != 0: + * distances[row1, row2] = 1 - intersection / union + */ + __pyx_v_intersection = (__pyx_v_intersection + (__pyx_v_ival1 & __pyx_v_ival2)); + } } - } - __pyx_L19:; + __pyx_L23:; - /* "Orange/distance/_distance.pyx":451 - * union += ival1 | ival2 - * intersection += ival1 & ival2 - * if union != 0: # <<<<<<<<<<<<<< - * distances[row1, row2] = 1 - intersection / union + /* "Orange/distance/_distance.pyx":460 + * union += ival1 | ival2 + * intersection += ival1 & ival2 + * if union != 0: # <<<<<<<<<<<<<< + * distances[row1, row2] = 1 - intersection / union * if not two_tables: */ - __pyx_t_12 = ((__pyx_v_union != 0.0) != 0); - if (__pyx_t_12) { + __pyx_t_16 = ((__pyx_v_union != 0.0) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":452 - * intersection += ival1 & ival2 - * if union != 0: - * distances[row1, row2] = 1 - intersection / union # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":461 + * intersection += ival1 & ival2 + * if union != 0: + * distances[row1, row2] = 1 - intersection / union # <<<<<<<<<<<<<< * if not two_tables: - * lower_to_symmetric(distances, lambda x: x) + * lower_to_symmetric(distances, next_callback) */ - __pyx_t_48 = __pyx_v_row1; - __pyx_t_49 = __pyx_v_row2; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_48 * __pyx_v_distances.strides[0]) ) + __pyx_t_49 * __pyx_v_distances.strides[1]) )) = (1.0 - (__pyx_v_intersection / __pyx_v_union)); + __pyx_t_52 = __pyx_v_row1; + __pyx_t_53 = __pyx_v_row2; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_52 * __pyx_v_distances.strides[0]) ) + __pyx_t_53 * __pyx_v_distances.strides[1]) )) = (1.0 - (__pyx_v_intersection / __pyx_v_union)); - /* "Orange/distance/_distance.pyx":451 - * union += ival1 | ival2 - * intersection += ival1 & ival2 - * if union != 0: # <<<<<<<<<<<<<< - * distances[row1, row2] = 1 - intersection / union + /* "Orange/distance/_distance.pyx":460 + * union += ival1 | ival2 + * intersection += ival1 & ival2 + * if union != 0: # <<<<<<<<<<<<<< + * distances[row1, row2] = 1 - intersection / union * if not two_tables: */ + } } } + __pyx_L12:; + } + + /* "Orange/distance/_distance.pyx":409 + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): + * with nogil: # <<<<<<<<<<<<<< + * if nans1[row1]: + * for row2 in range(n_rows2 if two_tables else row1): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; } - __pyx_L8:; - } } + } - /* "Orange/distance/_distance.pyx":399 - * n_rows2 = x2.shape[0] + /* "Orange/distance/_distance.pyx":406 * distances = np.zeros((n_rows1, n_rows2), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for row1 in range(n_rows1): - * if nans1[row1]: + * step = max(n_rows1 // 100, 100) + * for row_start in range(0, n_rows1, step): # <<<<<<<<<<<<<< + * callback(row_start * 100 / n_rows1) + * for row1 in range(row_start, min(row_start + step, n_rows1)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "Orange/distance/_distance.pyx":453 - * if union != 0: - * distances[row1, row2] = 1 - intersection / union + /* "Orange/distance/_distance.pyx":462 + * if union != 0: + * distances[row1, row2] = 1 - intersection / union * if not two_tables: # <<<<<<<<<<<<<< - * lower_to_symmetric(distances, lambda x: x) + * lower_to_symmetric(distances, next_callback) * return distances */ - __pyx_t_12 = ((!(__pyx_v_two_tables != 0)) != 0); - if (__pyx_t_12) { + __pyx_t_16 = ((!(__pyx_v_two_tables != 0)) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":454 - * distances[row1, row2] = 1 - intersection / union + /* "Orange/distance/_distance.pyx":463 + * distances[row1, row2] = 1 - intersection / union * if not two_tables: - * lower_to_symmetric(distances, lambda x: x) # <<<<<<<<<<<<<< + * lower_to_symmetric(distances, next_callback) # <<<<<<<<<<<<<< * return distances * */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_lower_to_symmetric); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 454, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_lower_to_symmetric); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_CyFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_12jaccard_rows_lambda, 0, __pyx_n_s_jaccard_rows_locals_lambda, NULL, __pyx_n_s_Orange_distance__distance, __pyx_d, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 454, __pyx_L1_error) + __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 463, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_50 = NULL; - __pyx_t_8 = 0; + __pyx_t_3 = NULL; + __pyx_t_14 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_50 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_50)) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_50); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_8 = 1; + __pyx_t_14 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_50, __pyx_t_5, __pyx_t_4}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_50); __pyx_t_50 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_v_next_callback}; + __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[3] = {__pyx_t_50, __pyx_t_5, __pyx_t_4}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_50); __pyx_t_50 = 0; - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_4, __pyx_v_next_callback}; + __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_14, 2+__pyx_t_14); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { - __pyx_t_51 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_51)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_51); - if (__pyx_t_50) { - __Pyx_GIVEREF(__pyx_t_50); PyTuple_SET_ITEM(__pyx_t_51, 0, __pyx_t_50); __pyx_t_50 = NULL; + __pyx_t_13 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + if (__pyx_t_3) { + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_3); __pyx_t_3 = NULL; } - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_51, 0+__pyx_t_8, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_51, 1+__pyx_t_8, __pyx_t_4); - __pyx_t_5 = 0; + PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_14, __pyx_t_4); + __Pyx_INCREF(__pyx_v_next_callback); + __Pyx_GIVEREF(__pyx_v_next_callback); + PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_14, __pyx_v_next_callback); __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_51, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 454, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_51); __pyx_t_51 = 0; + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_13, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 463, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "Orange/distance/_distance.pyx":453 - * if union != 0: - * distances[row1, row2] = 1 - intersection / union + /* "Orange/distance/_distance.pyx":462 + * if union != 0: + * distances[row1, row2] = 1 - intersection / union * if not two_tables: # <<<<<<<<<<<<<< - * lower_to_symmetric(distances, lambda x: x) + * lower_to_symmetric(distances, next_callback) * return distances */ } - /* "Orange/distance/_distance.pyx":455 + /* "Orange/distance/_distance.pyx":464 * if not two_tables: - * lower_to_symmetric(distances, lambda x: x) + * lower_to_symmetric(distances, next_callback) * return distances # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 464, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; goto __pyx_L0; - /* "Orange/distance/_distance.pyx":382 + /* "Orange/distance/_distance.pyx":386 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< @@ -10734,8 +10965,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1); - __Pyx_XDECREF(__pyx_t_50); - __Pyx_XDECREF(__pyx_t_51); + __Pyx_XDECREF(__pyx_t_13); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -10766,7 +10996,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU return __pyx_r; } -/* "Orange/distance/_distance.pyx":458 +/* "Orange/distance/_distance.pyx":467 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< @@ -10776,23 +11006,26 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_24jaccard_rows(CYTHON_UNU /* Python wrapper */ static PyObject *__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6Orange_8distance_9_distance_26jaccard_cols[] = "jaccard_cols(ndarray nonzeros, ndarray x, ndarray nans, ndarray ps)"; +static char __pyx_doc_6Orange_8distance_9_distance_26jaccard_cols[] = "jaccard_cols(ndarray nonzeros, ndarray x, ndarray nans, ndarray ps, callback)"; static PyMethodDef __pyx_mdef_6Orange_8distance_9_distance_27jaccard_cols = {"jaccard_cols", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6Orange_8distance_9_distance_26jaccard_cols}; static PyObject *__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_nonzeros = 0; PyArrayObject *__pyx_v_x = 0; PyArrayObject *__pyx_v_nans = 0; PyArrayObject *__pyx_v_ps = 0; + PyObject *__pyx_v_callback = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("jaccard_cols (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nonzeros,&__pyx_n_s_x,&__pyx_n_s_nans,&__pyx_n_s_ps,0}; - PyObject* values[4] = {0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_nonzeros,&__pyx_n_s_x,&__pyx_n_s_nans,&__pyx_n_s_ps,&__pyx_n_s_callback,0}; + PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -10813,50 +11046,58 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols(PyObject * case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 1); __PYX_ERR(0, 458, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 5, 5, 1); __PYX_ERR(0, 467, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nans)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 2); __PYX_ERR(0, 458, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 5, 5, 2); __PYX_ERR(0, 467, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ps)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, 3); __PYX_ERR(0, 458, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 5, 5, 3); __PYX_ERR(0, 467, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_callback)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 5, 5, 4); __PYX_ERR(0, 467, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_cols") < 0)) __PYX_ERR(0, 458, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "jaccard_cols") < 0)) __PYX_ERR(0, 467, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_nonzeros = ((PyArrayObject *)values[0]); __pyx_v_x = ((PyArrayObject *)values[1]); __pyx_v_nans = ((PyArrayObject *)values[2]); __pyx_v_ps = ((PyArrayObject *)values[3]); + __pyx_v_callback = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 458, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("jaccard_cols", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 467, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("Orange.distance._distance.jaccard_cols", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros), __pyx_ptype_5numpy_ndarray, 1, "nonzeros", 0))) __PYX_ERR(0, 458, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 459, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans), __pyx_ptype_5numpy_ndarray, 1, "nans", 0))) __PYX_ERR(0, 460, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 461, __pyx_L1_error) - __pyx_r = __pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(__pyx_self, __pyx_v_nonzeros, __pyx_v_x, __pyx_v_nans, __pyx_v_ps); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nonzeros), __pyx_ptype_5numpy_ndarray, 1, "nonzeros", 0))) __PYX_ERR(0, 467, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) __PYX_ERR(0, 468, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_nans), __pyx_ptype_5numpy_ndarray, 1, "nans", 0))) __PYX_ERR(0, 469, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ps), __pyx_ptype_5numpy_ndarray, 1, "ps", 0))) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_r = __pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(__pyx_self, __pyx_v_nonzeros, __pyx_v_x, __pyx_v_nans, __pyx_v_ps, __pyx_v_callback); /* function exit code */ goto __pyx_L0; @@ -10867,12 +11108,13 @@ static PyObject *__pyx_pw_6Orange_8distance_9_distance_27jaccard_cols(PyObject * return __pyx_r; } -static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_nans, PyArrayObject *__pyx_v_ps) { +static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_nonzeros, PyArrayObject *__pyx_v_x, PyArrayObject *__pyx_v_nans, PyArrayObject *__pyx_v_ps, PyObject *__pyx_v_callback) { int __pyx_v_n_rows; int __pyx_v_n_cols; int __pyx_v_col1; int __pyx_v_col2; int __pyx_v_row; + int __pyx_v_step; double __pyx_v_val1; double __pyx_v_val2; double __pyx_v_intersection; @@ -10887,6 +11129,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU int __pyx_v_unk1_not2; int __pyx_v_not1_unk2; __Pyx_memviewslice __pyx_v_distances = { 0, 0, { 0 }, { 0 }, { 0 } }; + long __pyx_v_col_start; __Pyx_LocalBuf_ND __pyx_pybuffernd_nans; __Pyx_Buffer __pyx_pybuffer_nans; __Pyx_LocalBuf_ND __pyx_pybuffernd_nonzeros; @@ -10904,27 +11147,27 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } }; - int __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; + long __pyx_t_8; + long __pyx_t_9; + long __pyx_t_10; Py_ssize_t __pyx_t_11; - int __pyx_t_12; - int __pyx_t_13; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *__pyx_t_13 = NULL; int __pyx_t_14; - int __pyx_t_15; + Py_ssize_t __pyx_t_15; int __pyx_t_16; int __pyx_t_17; int __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - __pyx_t_5numpy_float64_t __pyx_t_21; - Py_ssize_t __pyx_t_22; + int __pyx_t_19; + int __pyx_t_20; + int __pyx_t_21; + int __pyx_t_22; Py_ssize_t __pyx_t_23; - __pyx_t_5numpy_float64_t __pyx_t_24; - Py_ssize_t __pyx_t_25; + Py_ssize_t __pyx_t_24; + __pyx_t_5numpy_float64_t __pyx_t_25; Py_ssize_t __pyx_t_26; Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; + __pyx_t_5numpy_float64_t __pyx_t_28; Py_ssize_t __pyx_t_29; Py_ssize_t __pyx_t_30; Py_ssize_t __pyx_t_31; @@ -10933,11 +11176,11 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU Py_ssize_t __pyx_t_34; Py_ssize_t __pyx_t_35; Py_ssize_t __pyx_t_36; - double __pyx_t_37; + Py_ssize_t __pyx_t_37; Py_ssize_t __pyx_t_38; Py_ssize_t __pyx_t_39; Py_ssize_t __pyx_t_40; - Py_ssize_t __pyx_t_41; + double __pyx_t_41; Py_ssize_t __pyx_t_42; Py_ssize_t __pyx_t_43; Py_ssize_t __pyx_t_44; @@ -10965,6 +11208,10 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU Py_ssize_t __pyx_t_66; Py_ssize_t __pyx_t_67; Py_ssize_t __pyx_t_68; + Py_ssize_t __pyx_t_69; + Py_ssize_t __pyx_t_70; + Py_ssize_t __pyx_t_71; + Py_ssize_t __pyx_t_72; __Pyx_RefNannySetupContext("jaccard_cols", 0); __pyx_pybuffer_nonzeros.pybuffer.buf = NULL; __pyx_pybuffer_nonzeros.refcount = 0; @@ -10984,54 +11231,54 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_pybuffernd_ps.rcbuffer = &__pyx_pybuffer_ps; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 458, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nonzeros.rcbuffer->pybuffer, (PyObject*)__pyx_v_nonzeros, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 467, __pyx_L1_error) } __pyx_pybuffernd_nonzeros.diminfo[0].strides = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nonzeros.diminfo[0].shape = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_nonzeros.diminfo[1].strides = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_nonzeros.diminfo[1].shape = __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 458, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_x.rcbuffer->pybuffer, (PyObject*)__pyx_v_x, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 467, __pyx_L1_error) } __pyx_pybuffernd_x.diminfo[0].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_x.diminfo[0].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_x.diminfo[1].strides = __pyx_pybuffernd_x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_x.diminfo[1].shape = __pyx_pybuffernd_x.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 458, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_nans.rcbuffer->pybuffer, (PyObject*)__pyx_v_nans, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 467, __pyx_L1_error) } __pyx_pybuffernd_nans.diminfo[0].strides = __pyx_pybuffernd_nans.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_nans.diminfo[0].shape = __pyx_pybuffernd_nans.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 458, __pyx_L1_error) + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_ps.rcbuffer->pybuffer, (PyObject*)__pyx_v_ps, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float64_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 467, __pyx_L1_error) } __pyx_pybuffernd_ps.diminfo[0].strides = __pyx_pybuffernd_ps.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_ps.diminfo[0].shape = __pyx_pybuffernd_ps.rcbuffer->pybuffer.shape[0]; - /* "Orange/distance/_distance.pyx":469 + /* "Orange/distance/_distance.pyx":479 * double [:, :] distances * * n_rows, n_cols = x.shape[0], x.shape[1] # <<<<<<<<<<<<<< * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: + * step = max(n_cols // 100, 100) */ __pyx_t_1 = (__pyx_v_x->dimensions[0]); __pyx_t_2 = (__pyx_v_x->dimensions[1]); __pyx_v_n_rows = __pyx_t_1; __pyx_v_n_cols = __pyx_t_2; - /* "Orange/distance/_distance.pyx":470 + /* "Orange/distance/_distance.pyx":480 * * n_rows, n_cols = x.shape[0], x.shape[1] * distances = np.zeros((n_cols, n_cols), dtype=float) # <<<<<<<<<<<<<< - * with nogil: - * for col1 in range(n_cols): + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); @@ -11039,467 +11286,198 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 470, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, ((PyObject *)(&PyFloat_Type))) < 0) __PYX_ERR(0, 480, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_double(__pyx_t_3, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_distances = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "Orange/distance/_distance.pyx":471 + /* "Orange/distance/_distance.pyx":481 * n_rows, n_cols = x.shape[0], x.shape[1] * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * if nans[col1]: + * step = max(n_cols // 100, 100) # <<<<<<<<<<<<<< + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - __Pyx_FastGIL_Remember(); - #endif - /*try:*/ { + __pyx_t_8 = 0x64; + __pyx_t_9 = (__pyx_v_n_cols / 0x64); + if (((__pyx_t_8 > __pyx_t_9) != 0)) { + __pyx_t_10 = __pyx_t_8; + } else { + __pyx_t_10 = __pyx_t_9; + } + __pyx_v_step = __pyx_t_10; - /* "Orange/distance/_distance.pyx":472 + /* "Orange/distance/_distance.pyx":482 * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: - * for col1 in range(n_cols): # <<<<<<<<<<<<<< - * if nans[col1]: - * for col2 in range(col1): - */ - __pyx_t_8 = __pyx_v_n_cols; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_col1 = __pyx_t_10; - - /* "Orange/distance/_distance.pyx":473 - * with nogil: - * for col1 in range(n_cols): - * if nans[col1]: # <<<<<<<<<<<<<< - * for col2 in range(col1): - * in_both = in_any = 0 - */ - __pyx_t_11 = __pyx_v_col1; - __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_nans.diminfo[0].strides)) != 0); - if (__pyx_t_12) { - - /* "Orange/distance/_distance.pyx":474 - * for col1 in range(n_cols): - * if nans[col1]: - * for col2 in range(col1): # <<<<<<<<<<<<<< - * in_both = in_any = 0 - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 - */ - __pyx_t_13 = __pyx_v_col1; - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_col2 = __pyx_t_15; - - /* "Orange/distance/_distance.pyx":475 - * if nans[col1]: - * for col2 in range(col1): - * in_both = in_any = 0 # <<<<<<<<<<<<<< - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 - * for row in range(n_rows): - */ - __pyx_v_in_both = 0; - __pyx_v_in_any = 0; - - /* "Orange/distance/_distance.pyx":476 - * for col2 in range(col1): - * in_both = in_any = 0 - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 # <<<<<<<<<<<<<< - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - */ - __pyx_v_in1_unk2 = 0; - __pyx_v_unk1_in2 = 0; - __pyx_v_unk1_unk2 = 0; - __pyx_v_unk1_not2 = 0; - __pyx_v_not1_unk2 = 0; - - /* "Orange/distance/_distance.pyx":477 - * in_both = in_any = 0 - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 - * for row in range(n_rows): # <<<<<<<<<<<<<< - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - */ - __pyx_t_16 = __pyx_v_n_rows; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_row = __pyx_t_18; - - /* "Orange/distance/_distance.pyx":478 - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< - * if npy_isnan(val1): - * if npy_isnan(val2): + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): */ - __pyx_t_19 = __pyx_v_row; - __pyx_t_20 = __pyx_v_col1; - __pyx_t_21 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_t_22 = __pyx_v_row; - __pyx_t_23 = __pyx_v_col2; - __pyx_t_24 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_x.diminfo[1].strides)); - __pyx_v_val1 = __pyx_t_21; - __pyx_v_val2 = __pyx_t_24; - - /* "Orange/distance/_distance.pyx":479 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * unk1_unk2 += 1 - */ - __pyx_t_12 = (npy_isnan(__pyx_v_val1) != 0); - if (__pyx_t_12) { - - /* "Orange/distance/_distance.pyx":480 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * unk1_unk2 += 1 - * elif val2 != 0: - */ - __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_12) { - - /* "Orange/distance/_distance.pyx":481 - * if npy_isnan(val1): - * if npy_isnan(val2): - * unk1_unk2 += 1 # <<<<<<<<<<<<<< - * elif val2 != 0: - * unk1_in2 += 1 - */ - __pyx_v_unk1_unk2 = (__pyx_v_unk1_unk2 + 1); - - /* "Orange/distance/_distance.pyx":480 - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * unk1_unk2 += 1 - * elif val2 != 0: - */ - goto __pyx_L14; - } - - /* "Orange/distance/_distance.pyx":482 - * if npy_isnan(val2): - * unk1_unk2 += 1 - * elif val2 != 0: # <<<<<<<<<<<<<< - * unk1_in2 += 1 - * else: - */ - __pyx_t_12 = ((__pyx_v_val2 != 0.0) != 0); - if (__pyx_t_12) { - - /* "Orange/distance/_distance.pyx":483 - * unk1_unk2 += 1 - * elif val2 != 0: - * unk1_in2 += 1 # <<<<<<<<<<<<<< - * else: - * unk1_not2 += 1 - */ - __pyx_v_unk1_in2 = (__pyx_v_unk1_in2 + 1); - - /* "Orange/distance/_distance.pyx":482 - * if npy_isnan(val2): - * unk1_unk2 += 1 - * elif val2 != 0: # <<<<<<<<<<<<<< - * unk1_in2 += 1 - * else: - */ - goto __pyx_L14; - } - - /* "Orange/distance/_distance.pyx":485 - * unk1_in2 += 1 - * else: - * unk1_not2 += 1 # <<<<<<<<<<<<<< - * elif npy_isnan(val2): - * if val1 != 0: - */ - /*else*/ { - __pyx_v_unk1_not2 = (__pyx_v_unk1_not2 + 1); - } - __pyx_L14:; - - /* "Orange/distance/_distance.pyx":479 - * for row in range(n_rows): - * val1, val2 = x[row, col1], x[row, col2] - * if npy_isnan(val1): # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * unk1_unk2 += 1 - */ - goto __pyx_L13; - } - - /* "Orange/distance/_distance.pyx":486 - * else: - * unk1_not2 += 1 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * if val1 != 0: - * in1_unk2 += 1 - */ - __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_12) { - - /* "Orange/distance/_distance.pyx":487 - * unk1_not2 += 1 - * elif npy_isnan(val2): - * if val1 != 0: # <<<<<<<<<<<<<< - * in1_unk2 += 1 - * else: - */ - __pyx_t_12 = ((__pyx_v_val1 != 0.0) != 0); - if (__pyx_t_12) { - - /* "Orange/distance/_distance.pyx":488 - * elif npy_isnan(val2): - * if val1 != 0: - * in1_unk2 += 1 # <<<<<<<<<<<<<< - * else: - * not1_unk2 += 1 - */ - __pyx_v_in1_unk2 = (__pyx_v_in1_unk2 + 1); - - /* "Orange/distance/_distance.pyx":487 - * unk1_not2 += 1 - * elif npy_isnan(val2): - * if val1 != 0: # <<<<<<<<<<<<<< - * in1_unk2 += 1 - * else: - */ - goto __pyx_L15; - } - - /* "Orange/distance/_distance.pyx":490 - * in1_unk2 += 1 - * else: - * not1_unk2 += 1 # <<<<<<<<<<<<<< - * else: - * ival1 = nonzeros[row, col1] - */ - /*else*/ { - __pyx_v_not1_unk2 = (__pyx_v_not1_unk2 + 1); - } - __pyx_L15:; - - /* "Orange/distance/_distance.pyx":486 - * else: - * unk1_not2 += 1 - * elif npy_isnan(val2): # <<<<<<<<<<<<<< - * if val1 != 0: - * in1_unk2 += 1 - */ - goto __pyx_L13; - } - - /* "Orange/distance/_distance.pyx":492 - * not1_unk2 += 1 - * else: - * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< - * ival2 = nonzeros[row, col2] - * in_both += ival1 & ival2 - */ - /*else*/ { - __pyx_t_25 = __pyx_v_row; - __pyx_t_26 = __pyx_v_col1; - __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - - /* "Orange/distance/_distance.pyx":493 - * else: - * ival1 = nonzeros[row, col1] - * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< - * in_both += ival1 & ival2 - * in_any += ival1 | ival2 - */ - __pyx_t_27 = __pyx_v_row; - __pyx_t_28 = __pyx_v_col2; - __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - - /* "Orange/distance/_distance.pyx":494 - * ival1 = nonzeros[row, col1] - * ival2 = nonzeros[row, col2] - * in_both += ival1 & ival2 # <<<<<<<<<<<<<< - * in_any += ival1 | ival2 - * union = (in_any + unk1_in2 + in1_unk2 - */ - __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); - - /* "Orange/distance/_distance.pyx":495 - * ival2 = nonzeros[row, col2] - * in_both += ival1 & ival2 - * in_any += ival1 | ival2 # <<<<<<<<<<<<<< - * union = (in_any + unk1_in2 + in1_unk2 - * + ps[col1] * unk1_not2 - */ - __pyx_v_in_any = (__pyx_v_in_any + (__pyx_v_ival1 | __pyx_v_ival2)); - } - __pyx_L13:; - } - - /* "Orange/distance/_distance.pyx":497 - * in_any += ival1 | ival2 - * union = (in_any + unk1_in2 + in1_unk2 - * + ps[col1] * unk1_not2 # <<<<<<<<<<<<<< - * + ps[col2] * not1_unk2 - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - */ - __pyx_t_29 = __pyx_v_col1; - - /* "Orange/distance/_distance.pyx":498 - * union = (in_any + unk1_in2 + in1_unk2 - * + ps[col1] * unk1_not2 - * + ps[col2] * not1_unk2 # <<<<<<<<<<<<<< - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - * if union != 0: - */ - __pyx_t_30 = __pyx_v_col2; - - /* "Orange/distance/_distance.pyx":499 - * + ps[col1] * unk1_not2 - * + ps[col2] * not1_unk2 - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) # <<<<<<<<<<<<<< - * if union != 0: - * intersection = (in_both - */ - __pyx_t_31 = __pyx_v_col1; - __pyx_t_32 = __pyx_v_col2; - __pyx_v_union = (((((__pyx_v_in_any + __pyx_v_unk1_in2) + __pyx_v_in1_unk2) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_not2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_not1_unk2)) + ((1.0 - ((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_ps.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_ps.diminfo[0].strides))))) * __pyx_v_unk1_unk2)); - - /* "Orange/distance/_distance.pyx":500 - * + ps[col2] * not1_unk2 - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - * if union != 0: # <<<<<<<<<<<<<< - * intersection = (in_both - * + ps[col1] * unk1_in2 + - */ - __pyx_t_12 = ((__pyx_v_union != 0.0) != 0); - if (__pyx_t_12) { - - /* "Orange/distance/_distance.pyx":502 - * if union != 0: - * intersection = (in_both - * + ps[col1] * unk1_in2 + # <<<<<<<<<<<<<< - * + ps[col2] * in1_unk2 + - * + ps[col1] * ps[col2] * unk1_unk2) - */ - __pyx_t_33 = __pyx_v_col1; - - /* "Orange/distance/_distance.pyx":503 - * intersection = (in_both - * + ps[col1] * unk1_in2 + - * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< - * + ps[col1] * ps[col2] * unk1_unk2) - * distances[col1, col2] = distances[col2, col1] = \ - */ - __pyx_t_34 = __pyx_v_col2; - - /* "Orange/distance/_distance.pyx":504 - * + ps[col1] * unk1_in2 + - * + ps[col2] * in1_unk2 + - * + ps[col1] * ps[col2] * unk1_unk2) # <<<<<<<<<<<<<< - * distances[col1, col2] = distances[col2, col1] = \ - * 1 - intersection / union - */ - __pyx_t_35 = __pyx_v_col1; - __pyx_t_36 = __pyx_v_col2; - - /* "Orange/distance/_distance.pyx":503 - * intersection = (in_both - * + ps[col1] * unk1_in2 + - * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< - * + ps[col1] * ps[col2] * unk1_unk2) - * distances[col1, col2] = distances[col2, col1] = \ - */ - __pyx_v_intersection = (((__pyx_v_in_both + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_in2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_in1_unk2)) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_ps.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_ps.diminfo[0].strides))) * __pyx_v_unk1_unk2)); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_step); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6); + __pyx_t_3 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { + __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5); __pyx_t_11 = 0; + __pyx_t_12 = NULL; + } else { + __pyx_t_11 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_12 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 482, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 482, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } else { + if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 482, __pyx_L1_error) + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + #endif + } + } else { + __pyx_t_6 = __pyx_t_12(__pyx_t_5); + if (unlikely(!__pyx_t_6)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 482, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_6); + } + __pyx_t_10 = __Pyx_PyInt_As_long(__pyx_t_6); if (unlikely((__pyx_t_10 == (long)-1) && PyErr_Occurred())) __PYX_ERR(0, 482, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_col_start = __pyx_t_10; - /* "Orange/distance/_distance.pyx":506 - * + ps[col1] * ps[col2] * unk1_unk2) - * distances[col1, col2] = distances[col2, col1] = \ - * 1 - intersection / union # <<<<<<<<<<<<<< - * else: - * for col2 in range(col1): + /* "Orange/distance/_distance.pyx":483 + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) # <<<<<<<<<<<<<< + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: */ - __pyx_t_37 = (1.0 - (__pyx_v_intersection / __pyx_v_union)); + __pyx_t_3 = __Pyx_PyInt_From_long(((__pyx_v_col_start * 0x64) / __pyx_v_n_cols)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_callback); + __pyx_t_4 = __pyx_v_callback; __pyx_t_13 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_6 = (__pyx_t_13) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_13, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 483, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "Orange/distance/_distance.pyx":505 - * + ps[col2] * in1_unk2 + - * + ps[col1] * ps[col2] * unk1_unk2) - * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< - * 1 - intersection / union - * else: - */ - __pyx_t_38 = __pyx_v_col1; - __pyx_t_39 = __pyx_v_col2; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_38 * __pyx_v_distances.strides[0]) ) + __pyx_t_39 * __pyx_v_distances.strides[1]) )) = __pyx_t_37; - __pyx_t_40 = __pyx_v_col2; - __pyx_t_41 = __pyx_v_col1; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_40 * __pyx_v_distances.strides[0]) ) + __pyx_t_41 * __pyx_v_distances.strides[1]) )) = __pyx_t_37; - - /* "Orange/distance/_distance.pyx":500 - * + ps[col2] * not1_unk2 - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - * if union != 0: # <<<<<<<<<<<<<< - * intersection = (in_both - * + ps[col1] * unk1_in2 + + /* "Orange/distance/_distance.pyx":484 + * for col_start in range(0, n_cols, step): + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): # <<<<<<<<<<<<<< + * with nogil: + * if nans[col1]: */ - } - } + __pyx_t_14 = __pyx_v_n_cols; + __pyx_t_10 = (__pyx_v_col_start + __pyx_v_step); + if (((__pyx_t_14 < __pyx_t_10) != 0)) { + __pyx_t_8 = __pyx_t_14; + } else { + __pyx_t_8 = __pyx_t_10; + } + __pyx_t_10 = __pyx_t_8; + __pyx_t_8 = __pyx_t_10; + for (__pyx_t_14 = __pyx_v_col_start; __pyx_t_14 < __pyx_t_8; __pyx_t_14+=1) { + __pyx_v_col1 = __pyx_t_14; - /* "Orange/distance/_distance.pyx":473 - * with nogil: - * for col1 in range(n_cols): - * if nans[col1]: # <<<<<<<<<<<<<< - * for col2 in range(col1): - * in_both = in_any = 0 + /* "Orange/distance/_distance.pyx":485 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * if nans[col1]: + * for col2 in range(col1): */ - goto __pyx_L8; - } + { + #ifdef WITH_THREAD + PyThreadState *_save; + Py_UNBLOCK_THREADS + __Pyx_FastGIL_Remember(); + #endif + /*try:*/ { - /* "Orange/distance/_distance.pyx":508 - * 1 - intersection / union - * else: - * for col2 in range(col1): # <<<<<<<<<<<<<< - * if nans[col2]: + /* "Orange/distance/_distance.pyx":486 + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: + * if nans[col1]: # <<<<<<<<<<<<<< + * for col2 in range(col1): * in_both = in_any = 0 */ - /*else*/ { - __pyx_t_13 = __pyx_v_col1; - __pyx_t_14 = __pyx_t_13; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_col2 = __pyx_t_15; + __pyx_t_15 = __pyx_v_col1; + __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_nans.diminfo[0].strides)) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":509 - * else: - * for col2 in range(col1): - * if nans[col2]: # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":487 + * with nogil: + * if nans[col1]: + * for col2 in range(col1): # <<<<<<<<<<<<<< * in_both = in_any = 0 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 */ - __pyx_t_42 = __pyx_v_col2; - __pyx_t_12 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_nans.diminfo[0].strides)) != 0); - if (__pyx_t_12) { + __pyx_t_17 = __pyx_v_col1; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_col2 = __pyx_t_19; - /* "Orange/distance/_distance.pyx":510 - * for col2 in range(col1): - * if nans[col2]: + /* "Orange/distance/_distance.pyx":488 + * if nans[col1]: + * for col2 in range(col1): * in_both = in_any = 0 # <<<<<<<<<<<<<< * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 * for row in range(n_rows): @@ -11507,12 +11485,12 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_in_both = 0; __pyx_v_in_any = 0; - /* "Orange/distance/_distance.pyx":511 - * if nans[col2]: + /* "Orange/distance/_distance.pyx":489 + * for col2 in range(col1): * in_both = in_any = 0 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 # <<<<<<<<<<<<<< * for row in range(n_rows): - * ival1 = nonzeros[row, col1] + * val1, val2 = x[row, col1], x[row, col2] */ __pyx_v_in1_unk2 = 0; __pyx_v_unk1_in2 = 0; @@ -11520,368 +11498,767 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __pyx_v_unk1_not2 = 0; __pyx_v_not1_unk2 = 0; - /* "Orange/distance/_distance.pyx":512 + /* "Orange/distance/_distance.pyx":490 * in_both = in_any = 0 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 * for row in range(n_rows): # <<<<<<<<<<<<<< - * ival1 = nonzeros[row, col1] - * val2 = x[row, col2] + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): */ - __pyx_t_16 = __pyx_v_n_rows; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_row = __pyx_t_18; + __pyx_t_20 = __pyx_v_n_rows; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_row = __pyx_t_22; - /* "Orange/distance/_distance.pyx":513 + /* "Orange/distance/_distance.pyx":491 * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 * for row in range(n_rows): - * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< - * val2 = x[row, col2] - * if npy_isnan(val2): + * val1, val2 = x[row, col1], x[row, col2] # <<<<<<<<<<<<<< + * if npy_isnan(val1): + * if npy_isnan(val2): */ - __pyx_t_43 = __pyx_v_row; - __pyx_t_44 = __pyx_v_col1; - __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_44, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); + __pyx_t_23 = __pyx_v_row; + __pyx_t_24 = __pyx_v_col1; + __pyx_t_25 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_24, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_t_26 = __pyx_v_row; + __pyx_t_27 = __pyx_v_col2; + __pyx_t_28 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_v_val1 = __pyx_t_25; + __pyx_v_val2 = __pyx_t_28; - /* "Orange/distance/_distance.pyx":514 + /* "Orange/distance/_distance.pyx":492 * for row in range(n_rows): - * ival1 = nonzeros[row, col1] - * val2 = x[row, col2] # <<<<<<<<<<<<<< - * if npy_isnan(val2): - * if ival1: + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * unk1_unk2 += 1 */ - __pyx_t_45 = __pyx_v_row; - __pyx_t_46 = __pyx_v_col2; - __pyx_v_val2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_46, __pyx_pybuffernd_x.diminfo[1].strides)); + __pyx_t_16 = (npy_isnan(__pyx_v_val1) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":515 - * ival1 = nonzeros[row, col1] - * val2 = x[row, col2] - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * if ival1: + /* "Orange/distance/_distance.pyx":493 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * unk1_unk2 += 1 + * elif val2 != 0: + */ + __pyx_t_16 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":494 + * if npy_isnan(val1): + * if npy_isnan(val2): + * unk1_unk2 += 1 # <<<<<<<<<<<<<< + * elif val2 != 0: + * unk1_in2 += 1 + */ + __pyx_v_unk1_unk2 = (__pyx_v_unk1_unk2 + 1); + + /* "Orange/distance/_distance.pyx":493 + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * unk1_unk2 += 1 + * elif val2 != 0: + */ + goto __pyx_L18; + } + + /* "Orange/distance/_distance.pyx":495 + * if npy_isnan(val2): + * unk1_unk2 += 1 + * elif val2 != 0: # <<<<<<<<<<<<<< + * unk1_in2 += 1 + * else: + */ + __pyx_t_16 = ((__pyx_v_val2 != 0.0) != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":496 + * unk1_unk2 += 1 + * elif val2 != 0: + * unk1_in2 += 1 # <<<<<<<<<<<<<< + * else: + * unk1_not2 += 1 + */ + __pyx_v_unk1_in2 = (__pyx_v_unk1_in2 + 1); + + /* "Orange/distance/_distance.pyx":495 + * if npy_isnan(val2): + * unk1_unk2 += 1 + * elif val2 != 0: # <<<<<<<<<<<<<< + * unk1_in2 += 1 + * else: + */ + goto __pyx_L18; + } + + /* "Orange/distance/_distance.pyx":498 + * unk1_in2 += 1 + * else: + * unk1_not2 += 1 # <<<<<<<<<<<<<< + * elif npy_isnan(val2): + * if val1 != 0: + */ + /*else*/ { + __pyx_v_unk1_not2 = (__pyx_v_unk1_not2 + 1); + } + __pyx_L18:; + + /* "Orange/distance/_distance.pyx":492 + * for row in range(n_rows): + * val1, val2 = x[row, col1], x[row, col2] + * if npy_isnan(val1): # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * unk1_unk2 += 1 + */ + goto __pyx_L17; + } + + /* "Orange/distance/_distance.pyx":499 + * else: + * unk1_not2 += 1 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * if val1 != 0: * in1_unk2 += 1 */ - __pyx_t_12 = (npy_isnan(__pyx_v_val2) != 0); - if (__pyx_t_12) { + __pyx_t_16 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":516 - * val2 = x[row, col2] - * if npy_isnan(val2): - * if ival1: # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":500 + * unk1_not2 += 1 + * elif npy_isnan(val2): + * if val1 != 0: # <<<<<<<<<<<<<< * in1_unk2 += 1 * else: */ - __pyx_t_12 = (__pyx_v_ival1 != 0); - if (__pyx_t_12) { + __pyx_t_16 = ((__pyx_v_val1 != 0.0) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":517 - * if npy_isnan(val2): - * if ival1: + /* "Orange/distance/_distance.pyx":501 + * elif npy_isnan(val2): + * if val1 != 0: * in1_unk2 += 1 # <<<<<<<<<<<<<< * else: * not1_unk2 += 1 */ __pyx_v_in1_unk2 = (__pyx_v_in1_unk2 + 1); - /* "Orange/distance/_distance.pyx":516 - * val2 = x[row, col2] - * if npy_isnan(val2): - * if ival1: # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":500 + * unk1_not2 += 1 + * elif npy_isnan(val2): + * if val1 != 0: # <<<<<<<<<<<<<< * in1_unk2 += 1 * else: */ - goto __pyx_L23; + goto __pyx_L19; } - /* "Orange/distance/_distance.pyx":519 + /* "Orange/distance/_distance.pyx":503 * in1_unk2 += 1 * else: * not1_unk2 += 1 # <<<<<<<<<<<<<< * else: - * ival2 = nonzeros[row, col2] + * ival1 = nonzeros[row, col1] */ /*else*/ { __pyx_v_not1_unk2 = (__pyx_v_not1_unk2 + 1); } - __pyx_L23:; + __pyx_L19:; - /* "Orange/distance/_distance.pyx":515 - * ival1 = nonzeros[row, col1] - * val2 = x[row, col2] - * if npy_isnan(val2): # <<<<<<<<<<<<<< - * if ival1: + /* "Orange/distance/_distance.pyx":499 + * else: + * unk1_not2 += 1 + * elif npy_isnan(val2): # <<<<<<<<<<<<<< + * if val1 != 0: * in1_unk2 += 1 */ - goto __pyx_L22; + goto __pyx_L17; } - /* "Orange/distance/_distance.pyx":521 + /* "Orange/distance/_distance.pyx":505 * not1_unk2 += 1 * else: - * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< + * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< + * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 - * in_any += ival1 | ival2 */ /*else*/ { - __pyx_t_47 = __pyx_v_row; - __pyx_t_48 = __pyx_v_col2; - __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); + __pyx_t_29 = __pyx_v_row; + __pyx_t_30 = __pyx_v_col1; + __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_30, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":522 + /* "Orange/distance/_distance.pyx":506 * else: + * ival1 = nonzeros[row, col1] + * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< + * in_both += ival1 & ival2 + * in_any += ival1 | ival2 + */ + __pyx_t_31 = __pyx_v_row; + __pyx_t_32 = __pyx_v_col2; + __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); + + /* "Orange/distance/_distance.pyx":507 + * ival1 = nonzeros[row, col1] * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 # <<<<<<<<<<<<<< * in_any += ival1 | ival2 - * distances[col1, col2] = distances[col2, col1] = \ + * union = (in_any + unk1_in2 + in1_unk2 */ __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); - /* "Orange/distance/_distance.pyx":523 + /* "Orange/distance/_distance.pyx":508 * ival2 = nonzeros[row, col2] * in_both += ival1 & ival2 * in_any += ival1 | ival2 # <<<<<<<<<<<<<< - * distances[col1, col2] = distances[col2, col1] = \ - * 1 - float(in_both + * union = (in_any + unk1_in2 + in1_unk2 + * + ps[col1] * unk1_not2 */ __pyx_v_in_any = (__pyx_v_in_any + (__pyx_v_ival1 | __pyx_v_ival2)); } - __pyx_L22:; + __pyx_L17:; } - /* "Orange/distance/_distance.pyx":526 - * distances[col1, col2] = distances[col2, col1] = \ - * 1 - float(in_both - * + ps[col1] * unk1_in2 + # <<<<<<<<<<<<<< - * + ps[col2] * in1_unk2 + - * + ps[col1] * ps[col2] * unk1_unk2) / \ - */ - __pyx_t_49 = __pyx_v_col1; - - /* "Orange/distance/_distance.pyx":527 - * 1 - float(in_both - * + ps[col1] * unk1_in2 + - * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< - * + ps[col1] * ps[col2] * unk1_unk2) / \ - * (in_any + unk1_in2 + in1_unk2 + - */ - __pyx_t_50 = __pyx_v_col2; - - /* "Orange/distance/_distance.pyx":528 - * + ps[col1] * unk1_in2 + - * + ps[col2] * in1_unk2 + - * + ps[col1] * ps[col2] * unk1_unk2) / \ # <<<<<<<<<<<<<< - * (in_any + unk1_in2 + in1_unk2 + - * + ps[col1] * unk1_not2 - */ - __pyx_t_51 = __pyx_v_col1; - __pyx_t_52 = __pyx_v_col2; - - /* "Orange/distance/_distance.pyx":530 - * + ps[col1] * ps[col2] * unk1_unk2) / \ - * (in_any + unk1_in2 + in1_unk2 + - * + ps[col1] * unk1_not2 # <<<<<<<<<<<<<< - * + ps[col2] * not1_unk2 - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - */ - __pyx_t_53 = __pyx_v_col1; - - /* "Orange/distance/_distance.pyx":531 - * (in_any + unk1_in2 + in1_unk2 + - * + ps[col1] * unk1_not2 - * + ps[col2] * not1_unk2 # <<<<<<<<<<<<<< - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - * else: - */ - __pyx_t_54 = __pyx_v_col2; - - /* "Orange/distance/_distance.pyx":532 - * + ps[col1] * unk1_not2 - * + ps[col2] * not1_unk2 - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) # <<<<<<<<<<<<<< - * else: - * in_both = in_any = 0 + /* "Orange/distance/_distance.pyx":510 + * in_any += ival1 | ival2 + * union = (in_any + unk1_in2 + in1_unk2 + * + ps[col1] * unk1_not2 # <<<<<<<<<<<<<< + * + ps[col2] * not1_unk2 + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) */ - __pyx_t_55 = __pyx_v_col1; - __pyx_t_56 = __pyx_v_col2; + __pyx_t_33 = __pyx_v_col1; - /* "Orange/distance/_distance.pyx":525 - * in_any += ival1 | ival2 - * distances[col1, col2] = distances[col2, col1] = \ - * 1 - float(in_both # <<<<<<<<<<<<<< - * + ps[col1] * unk1_in2 + - * + ps[col2] * in1_unk2 + + /* "Orange/distance/_distance.pyx":511 + * union = (in_any + unk1_in2 + in1_unk2 + * + ps[col1] * unk1_not2 + * + ps[col2] * not1_unk2 # <<<<<<<<<<<<<< + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + * if union != 0: */ - __pyx_t_24 = (1.0 - (((double)(((__pyx_v_in_both + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_in2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_in1_unk2)) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_ps.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_ps.diminfo[0].strides))) * __pyx_v_unk1_unk2))) / (((((__pyx_v_in_any + __pyx_v_unk1_in2) + __pyx_v_in1_unk2) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_not2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_not1_unk2)) + ((1.0 - ((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_ps.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_ps.diminfo[0].strides))))) * __pyx_v_unk1_unk2)))); + __pyx_t_34 = __pyx_v_col2; - /* "Orange/distance/_distance.pyx":524 - * in_both += ival1 & ival2 - * in_any += ival1 | ival2 - * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< - * 1 - float(in_both - * + ps[col1] * unk1_in2 + - */ - __pyx_t_57 = __pyx_v_col1; - __pyx_t_58 = __pyx_v_col2; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_57 * __pyx_v_distances.strides[0]) ) + __pyx_t_58 * __pyx_v_distances.strides[1]) )) = __pyx_t_24; - __pyx_t_59 = __pyx_v_col2; - __pyx_t_60 = __pyx_v_col1; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_59 * __pyx_v_distances.strides[0]) ) + __pyx_t_60 * __pyx_v_distances.strides[1]) )) = __pyx_t_24; - - /* "Orange/distance/_distance.pyx":509 - * else: - * for col2 in range(col1): - * if nans[col2]: # <<<<<<<<<<<<<< - * in_both = in_any = 0 - * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + /* "Orange/distance/_distance.pyx":512 + * + ps[col1] * unk1_not2 + * + ps[col2] * not1_unk2 + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) # <<<<<<<<<<<<<< + * if union != 0: + * intersection = (in_both */ - goto __pyx_L19; - } + __pyx_t_35 = __pyx_v_col1; + __pyx_t_36 = __pyx_v_col2; + __pyx_v_union = (((((__pyx_v_in_any + __pyx_v_unk1_in2) + __pyx_v_in1_unk2) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_not2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_not1_unk2)) + ((1.0 - ((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_ps.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_ps.diminfo[0].strides))))) * __pyx_v_unk1_unk2)); - /* "Orange/distance/_distance.pyx":534 - * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - * else: - * in_both = in_any = 0 # <<<<<<<<<<<<<< - * for row in range(n_rows): - * ival1 = nonzeros[row, col1] + /* "Orange/distance/_distance.pyx":513 + * + ps[col2] * not1_unk2 + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + * if union != 0: # <<<<<<<<<<<<<< + * intersection = (in_both + * + ps[col1] * unk1_in2 + */ - /*else*/ { - __pyx_v_in_both = 0; - __pyx_v_in_any = 0; + __pyx_t_16 = ((__pyx_v_union != 0.0) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":535 - * else: - * in_both = in_any = 0 - * for row in range(n_rows): # <<<<<<<<<<<<<< - * ival1 = nonzeros[row, col1] - * ival2 = nonzeros[row, col2] + /* "Orange/distance/_distance.pyx":515 + * if union != 0: + * intersection = (in_both + * + ps[col1] * unk1_in2 + # <<<<<<<<<<<<<< + * + ps[col2] * in1_unk2 + + * + ps[col1] * ps[col2] * unk1_unk2) + */ + __pyx_t_37 = __pyx_v_col1; + + /* "Orange/distance/_distance.pyx":516 + * intersection = (in_both + * + ps[col1] * unk1_in2 + + * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< + * + ps[col1] * ps[col2] * unk1_unk2) + * distances[col1, col2] = distances[col2, col1] = \ + */ + __pyx_t_38 = __pyx_v_col2; + + /* "Orange/distance/_distance.pyx":517 + * + ps[col1] * unk1_in2 + + * + ps[col2] * in1_unk2 + + * + ps[col1] * ps[col2] * unk1_unk2) # <<<<<<<<<<<<<< + * distances[col1, col2] = distances[col2, col1] = \ + * 1 - intersection / union + */ + __pyx_t_39 = __pyx_v_col1; + __pyx_t_40 = __pyx_v_col2; + + /* "Orange/distance/_distance.pyx":516 + * intersection = (in_both + * + ps[col1] * unk1_in2 + + * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< + * + ps[col1] * ps[col2] * unk1_unk2) + * distances[col1, col2] = distances[col2, col1] = \ + */ + __pyx_v_intersection = (((__pyx_v_in_both + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_in2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_in1_unk2)) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_ps.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_ps.diminfo[0].strides))) * __pyx_v_unk1_unk2)); + + /* "Orange/distance/_distance.pyx":519 + * + ps[col1] * ps[col2] * unk1_unk2) + * distances[col1, col2] = distances[col2, col1] = \ + * 1 - intersection / union # <<<<<<<<<<<<<< + * else: + * for col2 in range(col1): + */ + __pyx_t_41 = (1.0 - (__pyx_v_intersection / __pyx_v_union)); + + /* "Orange/distance/_distance.pyx":518 + * + ps[col2] * in1_unk2 + + * + ps[col1] * ps[col2] * unk1_unk2) + * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< + * 1 - intersection / union + * else: */ - __pyx_t_16 = __pyx_v_n_rows; - __pyx_t_17 = __pyx_t_16; - for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { - __pyx_v_row = __pyx_t_18; + __pyx_t_42 = __pyx_v_col1; + __pyx_t_43 = __pyx_v_col2; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_42 * __pyx_v_distances.strides[0]) ) + __pyx_t_43 * __pyx_v_distances.strides[1]) )) = __pyx_t_41; + __pyx_t_44 = __pyx_v_col2; + __pyx_t_45 = __pyx_v_col1; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_44 * __pyx_v_distances.strides[0]) ) + __pyx_t_45 * __pyx_v_distances.strides[1]) )) = __pyx_t_41; - /* "Orange/distance/_distance.pyx":536 + /* "Orange/distance/_distance.pyx":513 + * + ps[col2] * not1_unk2 + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + * if union != 0: # <<<<<<<<<<<<<< + * intersection = (in_both + * + ps[col1] * unk1_in2 + + */ + } + } + + /* "Orange/distance/_distance.pyx":486 + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: + * if nans[col1]: # <<<<<<<<<<<<<< + * for col2 in range(col1): * in_both = in_any = 0 - * for row in range(n_rows): - * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< - * ival2 = nonzeros[row, col2] - * in_both += ival1 & ival2 */ - __pyx_t_61 = __pyx_v_row; - __pyx_t_62 = __pyx_v_col1; - __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_62, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); + goto __pyx_L12; + } - /* "Orange/distance/_distance.pyx":537 - * for row in range(n_rows): - * ival1 = nonzeros[row, col1] - * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< - * in_both += ival1 & ival2 - * in_any += ival1 | ival2 + /* "Orange/distance/_distance.pyx":521 + * 1 - intersection / union + * else: + * for col2 in range(col1): # <<<<<<<<<<<<<< + * if nans[col2]: + * in_both = in_any = 0 + */ + /*else*/ { + __pyx_t_17 = __pyx_v_col1; + __pyx_t_18 = __pyx_t_17; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_col2 = __pyx_t_19; + + /* "Orange/distance/_distance.pyx":522 + * else: + * for col2 in range(col1): + * if nans[col2]: # <<<<<<<<<<<<<< + * in_both = in_any = 0 + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + */ + __pyx_t_46 = __pyx_v_col2; + __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nans.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_nans.diminfo[0].strides)) != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":523 + * for col2 in range(col1): + * if nans[col2]: + * in_both = in_any = 0 # <<<<<<<<<<<<<< + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + * for row in range(n_rows): + */ + __pyx_v_in_both = 0; + __pyx_v_in_any = 0; + + /* "Orange/distance/_distance.pyx":524 + * if nans[col2]: + * in_both = in_any = 0 + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 # <<<<<<<<<<<<<< + * for row in range(n_rows): + * ival1 = nonzeros[row, col1] + */ + __pyx_v_in1_unk2 = 0; + __pyx_v_unk1_in2 = 0; + __pyx_v_unk1_unk2 = 0; + __pyx_v_unk1_not2 = 0; + __pyx_v_not1_unk2 = 0; + + /* "Orange/distance/_distance.pyx":525 + * in_both = in_any = 0 + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + * for row in range(n_rows): # <<<<<<<<<<<<<< + * ival1 = nonzeros[row, col1] + * val2 = x[row, col2] + */ + __pyx_t_20 = __pyx_v_n_rows; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_row = __pyx_t_22; + + /* "Orange/distance/_distance.pyx":526 + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + * for row in range(n_rows): + * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< + * val2 = x[row, col2] + * if npy_isnan(val2): + */ + __pyx_t_47 = __pyx_v_row; + __pyx_t_48 = __pyx_v_col1; + __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_48, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); + + /* "Orange/distance/_distance.pyx":527 + * for row in range(n_rows): + * ival1 = nonzeros[row, col1] + * val2 = x[row, col2] # <<<<<<<<<<<<<< + * if npy_isnan(val2): + * if ival1: */ - __pyx_t_63 = __pyx_v_row; - __pyx_t_64 = __pyx_v_col2; - __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_64, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); + __pyx_t_49 = __pyx_v_row; + __pyx_t_50 = __pyx_v_col2; + __pyx_v_val2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_x.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_x.diminfo[0].strides, __pyx_t_50, __pyx_pybuffernd_x.diminfo[1].strides)); - /* "Orange/distance/_distance.pyx":538 - * ival1 = nonzeros[row, col1] - * ival2 = nonzeros[row, col2] - * in_both += ival1 & ival2 # <<<<<<<<<<<<<< - * in_any += ival1 | ival2 - * if in_any != 0: + /* "Orange/distance/_distance.pyx":528 + * ival1 = nonzeros[row, col1] + * val2 = x[row, col2] + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * if ival1: + * in1_unk2 += 1 */ - __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); + __pyx_t_16 = (npy_isnan(__pyx_v_val2) != 0); + if (__pyx_t_16) { - /* "Orange/distance/_distance.pyx":539 - * ival2 = nonzeros[row, col2] - * in_both += ival1 & ival2 - * in_any += ival1 | ival2 # <<<<<<<<<<<<<< - * if in_any != 0: + /* "Orange/distance/_distance.pyx":529 + * val2 = x[row, col2] + * if npy_isnan(val2): + * if ival1: # <<<<<<<<<<<<<< + * in1_unk2 += 1 + * else: + */ + __pyx_t_16 = (__pyx_v_ival1 != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":530 + * if npy_isnan(val2): + * if ival1: + * in1_unk2 += 1 # <<<<<<<<<<<<<< + * else: + * not1_unk2 += 1 + */ + __pyx_v_in1_unk2 = (__pyx_v_in1_unk2 + 1); + + /* "Orange/distance/_distance.pyx":529 + * val2 = x[row, col2] + * if npy_isnan(val2): + * if ival1: # <<<<<<<<<<<<<< + * in1_unk2 += 1 + * else: + */ + goto __pyx_L27; + } + + /* "Orange/distance/_distance.pyx":532 + * in1_unk2 += 1 + * else: + * not1_unk2 += 1 # <<<<<<<<<<<<<< + * else: + * ival2 = nonzeros[row, col2] + */ + /*else*/ { + __pyx_v_not1_unk2 = (__pyx_v_not1_unk2 + 1); + } + __pyx_L27:; + + /* "Orange/distance/_distance.pyx":528 + * ival1 = nonzeros[row, col1] + * val2 = x[row, col2] + * if npy_isnan(val2): # <<<<<<<<<<<<<< + * if ival1: + * in1_unk2 += 1 + */ + goto __pyx_L26; + } + + /* "Orange/distance/_distance.pyx":534 + * not1_unk2 += 1 + * else: + * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< + * in_both += ival1 & ival2 + * in_any += ival1 | ival2 + */ + /*else*/ { + __pyx_t_51 = __pyx_v_row; + __pyx_t_52 = __pyx_v_col2; + __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); + + /* "Orange/distance/_distance.pyx":535 + * else: + * ival2 = nonzeros[row, col2] + * in_both += ival1 & ival2 # <<<<<<<<<<<<<< + * in_any += ival1 | ival2 * distances[col1, col2] = distances[col2, col1] = \ */ - __pyx_v_in_any = (__pyx_v_in_any + (__pyx_v_ival1 | __pyx_v_ival2)); - } + __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); - /* "Orange/distance/_distance.pyx":540 - * in_both += ival1 & ival2 - * in_any += ival1 | ival2 - * if in_any != 0: # <<<<<<<<<<<<<< + /* "Orange/distance/_distance.pyx":536 + * ival2 = nonzeros[row, col2] + * in_both += ival1 & ival2 + * in_any += ival1 | ival2 # <<<<<<<<<<<<<< * distances[col1, col2] = distances[col2, col1] = \ - * 1 - float(in_both) / in_any + * 1 - float(in_both */ - __pyx_t_12 = ((__pyx_v_in_any != 0) != 0); - if (__pyx_t_12) { + __pyx_v_in_any = (__pyx_v_in_any + (__pyx_v_ival1 | __pyx_v_ival2)); + } + __pyx_L26:; + } - /* "Orange/distance/_distance.pyx":542 - * if in_any != 0: + /* "Orange/distance/_distance.pyx":539 * distances[col1, col2] = distances[col2, col1] = \ - * 1 - float(in_both) / in_any # <<<<<<<<<<<<<< - * - * return distances + * 1 - float(in_both + * + ps[col1] * unk1_in2 + # <<<<<<<<<<<<<< + * + ps[col2] * in1_unk2 + + * + ps[col1] * ps[col2] * unk1_unk2) / \ */ - __pyx_t_37 = (1.0 - (((double)__pyx_v_in_both) / __pyx_v_in_any)); + __pyx_t_53 = __pyx_v_col1; + + /* "Orange/distance/_distance.pyx":540 + * 1 - float(in_both + * + ps[col1] * unk1_in2 + + * + ps[col2] * in1_unk2 + # <<<<<<<<<<<<<< + * + ps[col1] * ps[col2] * unk1_unk2) / \ + * (in_any + unk1_in2 + in1_unk2 + + */ + __pyx_t_54 = __pyx_v_col2; /* "Orange/distance/_distance.pyx":541 - * in_any += ival1 | ival2 - * if in_any != 0: + * + ps[col1] * unk1_in2 + + * + ps[col2] * in1_unk2 + + * + ps[col1] * ps[col2] * unk1_unk2) / \ # <<<<<<<<<<<<<< + * (in_any + unk1_in2 + in1_unk2 + + * + ps[col1] * unk1_not2 + */ + __pyx_t_55 = __pyx_v_col1; + __pyx_t_56 = __pyx_v_col2; + + /* "Orange/distance/_distance.pyx":543 + * + ps[col1] * ps[col2] * unk1_unk2) / \ + * (in_any + unk1_in2 + in1_unk2 + + * + ps[col1] * unk1_not2 # <<<<<<<<<<<<<< + * + ps[col2] * not1_unk2 + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + */ + __pyx_t_57 = __pyx_v_col1; + + /* "Orange/distance/_distance.pyx":544 + * (in_any + unk1_in2 + in1_unk2 + + * + ps[col1] * unk1_not2 + * + ps[col2] * not1_unk2 # <<<<<<<<<<<<<< + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + * else: + */ + __pyx_t_58 = __pyx_v_col2; + + /* "Orange/distance/_distance.pyx":545 + * + ps[col1] * unk1_not2 + * + ps[col2] * not1_unk2 + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) # <<<<<<<<<<<<<< + * else: + * in_both = in_any = 0 + */ + __pyx_t_59 = __pyx_v_col1; + __pyx_t_60 = __pyx_v_col2; + + /* "Orange/distance/_distance.pyx":538 + * in_any += ival1 | ival2 + * distances[col1, col2] = distances[col2, col1] = \ + * 1 - float(in_both # <<<<<<<<<<<<<< + * + ps[col1] * unk1_in2 + + * + ps[col2] * in1_unk2 + + */ + __pyx_t_28 = (1.0 - (((double)(((__pyx_v_in_both + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_in2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_in1_unk2)) + (((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_ps.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_ps.diminfo[0].strides))) * __pyx_v_unk1_unk2))) / (((((__pyx_v_in_any + __pyx_v_unk1_in2) + __pyx_v_in1_unk2) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_unk1_not2)) + ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_ps.diminfo[0].strides)) * __pyx_v_not1_unk2)) + ((1.0 - ((1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_ps.diminfo[0].strides))) * (1.0 - (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_float64_t *, __pyx_pybuffernd_ps.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_ps.diminfo[0].strides))))) * __pyx_v_unk1_unk2)))); + + /* "Orange/distance/_distance.pyx":537 + * in_both += ival1 & ival2 + * in_any += ival1 | ival2 * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< - * 1 - float(in_both) / in_any + * 1 - float(in_both + * + ps[col1] * unk1_in2 + + */ + __pyx_t_61 = __pyx_v_col1; + __pyx_t_62 = __pyx_v_col2; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_61 * __pyx_v_distances.strides[0]) ) + __pyx_t_62 * __pyx_v_distances.strides[1]) )) = __pyx_t_28; + __pyx_t_63 = __pyx_v_col2; + __pyx_t_64 = __pyx_v_col1; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_63 * __pyx_v_distances.strides[0]) ) + __pyx_t_64 * __pyx_v_distances.strides[1]) )) = __pyx_t_28; + + /* "Orange/distance/_distance.pyx":522 + * else: + * for col2 in range(col1): + * if nans[col2]: # <<<<<<<<<<<<<< + * in_both = in_any = 0 + * in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + */ + goto __pyx_L23; + } + + /* "Orange/distance/_distance.pyx":547 + * + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + * else: + * in_both = in_any = 0 # <<<<<<<<<<<<<< + * for row in range(n_rows): + * ival1 = nonzeros[row, col1] + */ + /*else*/ { + __pyx_v_in_both = 0; + __pyx_v_in_any = 0; + + /* "Orange/distance/_distance.pyx":548 + * else: + * in_both = in_any = 0 + * for row in range(n_rows): # <<<<<<<<<<<<<< + * ival1 = nonzeros[row, col1] + * ival2 = nonzeros[row, col2] + */ + __pyx_t_20 = __pyx_v_n_rows; + __pyx_t_21 = __pyx_t_20; + for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) { + __pyx_v_row = __pyx_t_22; + + /* "Orange/distance/_distance.pyx":549 + * in_both = in_any = 0 + * for row in range(n_rows): + * ival1 = nonzeros[row, col1] # <<<<<<<<<<<<<< + * ival2 = nonzeros[row, col2] + * in_both += ival1 & ival2 + */ + __pyx_t_65 = __pyx_v_row; + __pyx_t_66 = __pyx_v_col1; + __pyx_v_ival1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_65, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_66, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); + + /* "Orange/distance/_distance.pyx":550 + * for row in range(n_rows): + * ival1 = nonzeros[row, col1] + * ival2 = nonzeros[row, col2] # <<<<<<<<<<<<<< + * in_both += ival1 & ival2 + * in_any += ival1 | ival2 + */ + __pyx_t_67 = __pyx_v_row; + __pyx_t_68 = __pyx_v_col2; + __pyx_v_ival2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int8_t *, __pyx_pybuffernd_nonzeros.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_nonzeros.diminfo[0].strides, __pyx_t_68, __pyx_pybuffernd_nonzeros.diminfo[1].strides)); + + /* "Orange/distance/_distance.pyx":551 + * ival1 = nonzeros[row, col1] + * ival2 = nonzeros[row, col2] + * in_both += ival1 & ival2 # <<<<<<<<<<<<<< + * in_any += ival1 | ival2 + * if in_any != 0: + */ + __pyx_v_in_both = (__pyx_v_in_both + (__pyx_v_ival1 & __pyx_v_ival2)); + + /* "Orange/distance/_distance.pyx":552 + * ival2 = nonzeros[row, col2] + * in_both += ival1 & ival2 + * in_any += ival1 | ival2 # <<<<<<<<<<<<<< + * if in_any != 0: + * distances[col1, col2] = distances[col2, col1] = \ + */ + __pyx_v_in_any = (__pyx_v_in_any + (__pyx_v_ival1 | __pyx_v_ival2)); + } + + /* "Orange/distance/_distance.pyx":553 + * in_both += ival1 & ival2 + * in_any += ival1 | ival2 + * if in_any != 0: # <<<<<<<<<<<<<< + * distances[col1, col2] = distances[col2, col1] = \ + * 1 - float(in_both) / in_any + */ + __pyx_t_16 = ((__pyx_v_in_any != 0) != 0); + if (__pyx_t_16) { + + /* "Orange/distance/_distance.pyx":555 + * if in_any != 0: + * distances[col1, col2] = distances[col2, col1] = \ + * 1 - float(in_both) / in_any # <<<<<<<<<<<<<< + * + * return distances + */ + __pyx_t_41 = (1.0 - (((double)__pyx_v_in_both) / __pyx_v_in_any)); + + /* "Orange/distance/_distance.pyx":554 + * in_any += ival1 | ival2 + * if in_any != 0: + * distances[col1, col2] = distances[col2, col1] = \ # <<<<<<<<<<<<<< + * 1 - float(in_both) / in_any * */ - __pyx_t_65 = __pyx_v_col1; - __pyx_t_66 = __pyx_v_col2; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_65 * __pyx_v_distances.strides[0]) ) + __pyx_t_66 * __pyx_v_distances.strides[1]) )) = __pyx_t_37; - __pyx_t_67 = __pyx_v_col2; - __pyx_t_68 = __pyx_v_col1; - *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_67 * __pyx_v_distances.strides[0]) ) + __pyx_t_68 * __pyx_v_distances.strides[1]) )) = __pyx_t_37; + __pyx_t_69 = __pyx_v_col1; + __pyx_t_70 = __pyx_v_col2; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_69 * __pyx_v_distances.strides[0]) ) + __pyx_t_70 * __pyx_v_distances.strides[1]) )) = __pyx_t_41; + __pyx_t_71 = __pyx_v_col2; + __pyx_t_72 = __pyx_v_col1; + *((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distances.data + __pyx_t_71 * __pyx_v_distances.strides[0]) ) + __pyx_t_72 * __pyx_v_distances.strides[1]) )) = __pyx_t_41; - /* "Orange/distance/_distance.pyx":540 - * in_both += ival1 & ival2 - * in_any += ival1 | ival2 - * if in_any != 0: # <<<<<<<<<<<<<< - * distances[col1, col2] = distances[col2, col1] = \ - * 1 - float(in_both) / in_any + /* "Orange/distance/_distance.pyx":553 + * in_both += ival1 & ival2 + * in_any += ival1 | ival2 + * if in_any != 0: # <<<<<<<<<<<<<< + * distances[col1, col2] = distances[col2, col1] = \ + * 1 - float(in_both) / in_any */ + } } + __pyx_L23:; } - __pyx_L19:; } + __pyx_L12:; + } + + /* "Orange/distance/_distance.pyx":485 + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): + * with nogil: # <<<<<<<<<<<<<< + * if nans[col1]: + * for col2 in range(col1): + */ + /*finally:*/ { + /*normal exit:*/{ + #ifdef WITH_THREAD + __Pyx_FastGIL_Forget(); + Py_BLOCK_THREADS + #endif + goto __pyx_L11; + } + __pyx_L11:; } - __pyx_L8:; - } } + } - /* "Orange/distance/_distance.pyx":471 - * n_rows, n_cols = x.shape[0], x.shape[1] + /* "Orange/distance/_distance.pyx":482 * distances = np.zeros((n_cols, n_cols), dtype=float) - * with nogil: # <<<<<<<<<<<<<< - * for col1 in range(n_cols): - * if nans[col1]: + * step = max(n_cols // 100, 100) + * for col_start in range(0, n_cols, step): # <<<<<<<<<<<<<< + * callback(col_start * 100 / n_cols) + * for col1 in range(col_start, min(col_start + step, n_cols)): */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - __Pyx_FastGIL_Forget(); - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "Orange/distance/_distance.pyx":544 - * 1 - float(in_both) / in_any + /* "Orange/distance/_distance.pyx":557 + * 1 - float(in_both) / in_any * * return distances # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 544, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_distances, 2, (PyObject *(*)(char *)) __pyx_memview_get_double, (int (*)(char *, PyObject *)) __pyx_memview_set_double, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 557, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; goto __pyx_L0; - /* "Orange/distance/_distance.pyx":458 + /* "Orange/distance/_distance.pyx":467 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< @@ -11896,6 +12273,7 @@ static PyObject *__pyx_pf_6Orange_8distance_9_distance_26jaccard_cols(CYTHON_UNU __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1); + __Pyx_XDECREF(__pyx_t_13); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign @@ -27961,7 +28339,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_ival2, __pyx_k_ival2, sizeof(__pyx_k_ival2), 0, 0, 1, 1}, {&__pyx_n_s_jaccard_cols, __pyx_k_jaccard_cols, sizeof(__pyx_k_jaccard_cols), 0, 0, 1, 1}, {&__pyx_n_s_jaccard_rows, __pyx_k_jaccard_rows, sizeof(__pyx_k_jaccard_rows), 0, 0, 1, 1}, - {&__pyx_n_s_jaccard_rows_locals_lambda, __pyx_k_jaccard_rows_locals_lambda, sizeof(__pyx_k_jaccard_rows_locals_lambda), 0, 0, 1, 1}, {&__pyx_n_s_lower_to_symmetric, __pyx_k_lower_to_symmetric, sizeof(__pyx_k_lower_to_symmetric), 0, 0, 1, 1}, {&__pyx_n_s_mads, __pyx_k_mads, sizeof(__pyx_k_mads), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, @@ -27984,6 +28361,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0}, {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1}, {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, + {&__pyx_n_s_next_callback, __pyx_k_next_callback, sizeof(__pyx_k_next_callback), 0, 0, 1, 1}, {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, {&__pyx_n_s_nonnans, __pyx_k_nonnans, sizeof(__pyx_k_nonnans), 0, 0, 1, 1}, {&__pyx_n_s_nonzeros, __pyx_k_nonzeros, sizeof(__pyx_k_nonzeros), 0, 0, 1, 1}, @@ -28473,38 +28851,38 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { /* "Orange/distance/_distance.pyx":366 * return float(nonzeros) / nonnans * - * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< + * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< + * callback): * cdef: - * int row, n_cols, n_rows */ - __pyx_tuple__48 = PyTuple_Pack(6, __pyx_n_s_x, __pyx_n_s_row, __pyx_n_s_n_cols, __pyx_n_s_n_rows, __pyx_n_s_flags, __pyx_n_s_col); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 366, __pyx_L1_error) + __pyx_tuple__48 = PyTuple_Pack(9, __pyx_n_s_x, __pyx_n_s_callback, __pyx_n_s_row, __pyx_n_s_n_cols, __pyx_n_s_n_rows, __pyx_n_s_step, __pyx_n_s_flags, __pyx_n_s_row_start, __pyx_n_s_col); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__48); __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_any_nan_row, 366, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 366, __pyx_L1_error) + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(2, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_any_nan_row, 366, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 366, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":382 + /* "Orange/distance/_distance.pyx":386 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< * np.ndarray[np.int8_t, ndim=2] nonzeros2, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_tuple__50 = PyTuple_Pack(21, __pyx_n_s_nonzeros1, __pyx_n_s_nonzeros2, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_nans1, __pyx_n_s_nans2, __pyx_n_s_ps, __pyx_n_s_two_tables, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 382, __pyx_L1_error) + __pyx_tuple__50 = PyTuple_Pack(25, __pyx_n_s_nonzeros1, __pyx_n_s_nonzeros2, __pyx_n_s_x1, __pyx_n_s_x2, __pyx_n_s_nans1, __pyx_n_s_nans2, __pyx_n_s_ps, __pyx_n_s_two_tables, __pyx_n_s_callback, __pyx_n_s_next_callback, __pyx_n_s_n_rows1, __pyx_n_s_n_rows2, __pyx_n_s_n_cols, __pyx_n_s_row1, __pyx_n_s_row2, __pyx_n_s_col, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_distances, __pyx_n_s_row_start); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 386, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__50); __Pyx_GIVEREF(__pyx_tuple__50); - __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(8, 0, 21, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_rows, 382, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 382, __pyx_L1_error) + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(10, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_rows, 386, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 386, __pyx_L1_error) - /* "Orange/distance/_distance.pyx":458 + /* "Orange/distance/_distance.pyx":467 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x, * np.ndarray[np.int8_t, ndim=1] nans, */ - __pyx_tuple__52 = PyTuple_Pack(23, __pyx_n_s_nonzeros, __pyx_n_s_x, __pyx_n_s_nans, __pyx_n_s_ps, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_in_both, __pyx_n_s_in_any, __pyx_n_s_in1_unk2, __pyx_n_s_unk1_in2, __pyx_n_s_unk1_unk2, __pyx_n_s_unk1_not2, __pyx_n_s_not1_unk2, __pyx_n_s_distances); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_tuple__52 = PyTuple_Pack(26, __pyx_n_s_nonzeros, __pyx_n_s_x, __pyx_n_s_nans, __pyx_n_s_ps, __pyx_n_s_callback, __pyx_n_s_n_rows, __pyx_n_s_n_cols, __pyx_n_s_col1, __pyx_n_s_col2, __pyx_n_s_row, __pyx_n_s_step, __pyx_n_s_val1, __pyx_n_s_val2, __pyx_n_s_intersection, __pyx_n_s_union, __pyx_n_s_ival1, __pyx_n_s_ival2, __pyx_n_s_in_both, __pyx_n_s_in_any, __pyx_n_s_in1_unk2, __pyx_n_s_unk1_in2, __pyx_n_s_unk1_unk2, __pyx_n_s_unk1_not2, __pyx_n_s_not1_unk2, __pyx_n_s_distances, __pyx_n_s_col_start); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 467, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__52); __Pyx_GIVEREF(__pyx_tuple__52); - __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(4, 0, 23, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_cols, 458, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(5, 0, 26, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Orange_distance__distance_pyx, __pyx_n_s_jaccard_cols, 467, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 467, __pyx_L1_error) /* "View.MemoryView":286 * return self.name @@ -29085,37 +29463,37 @@ if (!__Pyx_RefNanny) { /* "Orange/distance/_distance.pyx":366 * return float(nonzeros) / nonnans * - * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): # <<<<<<<<<<<<<< + * def any_nan_row(np.ndarray[np.float64_t, ndim=2] x, # <<<<<<<<<<<<<< + * callback): * cdef: - * int row, n_cols, n_rows */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_23any_nan_row, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_any_nan_row, __pyx_t_1) < 0) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":382 + /* "Orange/distance/_distance.pyx":386 * * * def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, # <<<<<<<<<<<<<< * np.ndarray[np.int8_t, ndim=2] nonzeros2, * np.ndarray[np.float64_t, ndim=2] x1, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_25jaccard_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 382, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_25jaccard_rows, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_rows, __pyx_t_1) < 0) __PYX_ERR(0, 382, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_rows, __pyx_t_1) < 0) __PYX_ERR(0, 386, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "Orange/distance/_distance.pyx":458 + /* "Orange/distance/_distance.pyx":467 * * * def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, # <<<<<<<<<<<<<< * np.ndarray[np.float64_t, ndim=2] x, * np.ndarray[np.int8_t, ndim=1] nans, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_27jaccard_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6Orange_8distance_9_distance_27jaccard_cols, NULL, __pyx_n_s_Orange_distance__distance); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 467, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_cols, __pyx_t_1) < 0) __PYX_ERR(0, 458, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_jaccard_cols, __pyx_t_1) < 0) __PYX_ERR(0, 467, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "Orange/distance/_distance.pyx":1 @@ -30563,644 +30941,6 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); } -/* FetchCommonType */ - static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* fake_module; - PyTypeObject* cached_type = NULL; - fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); - if (!fake_module) return NULL; - Py_INCREF(fake_module); - cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); - if (cached_type) { - if (!PyType_Check((PyObject*)cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", - type->tp_name); - goto bad; - } - if (cached_type->tp_basicsize != type->tp_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - type->tp_name); - goto bad; - } - } else { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; - } -done: - Py_DECREF(fake_module); - return cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} - -/* CythonFunction */ - #include -static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) -{ - if (unlikely(op->func_doc == NULL)) { - if (op->func.m_ml->ml_doc) { -#if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); -#else - op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); -#endif - if (unlikely(op->func_doc == NULL)) - return NULL; - } else { - Py_INCREF(Py_None); - return Py_None; - } - } - Py_INCREF(op->func_doc); - return op->func_doc; -} -static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) -{ - PyObject *tmp = op->func_doc; - if (value == NULL) { - value = Py_None; - } - Py_INCREF(value); - op->func_doc = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) -{ - if (unlikely(op->func_name == NULL)) { -#if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); -#else - op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); -#endif - if (unlikely(op->func_name == NULL)) - return NULL; - } - Py_INCREF(op->func_name); - return op->func_name; -} -static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) -#else - if (unlikely(value == NULL || !PyString_Check(value))) -#endif - { - PyErr_SetString(PyExc_TypeError, - "__name__ must be set to a string object"); - return -1; - } - tmp = op->func_name; - Py_INCREF(value); - op->func_name = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) -{ - Py_INCREF(op->func_qualname); - return op->func_qualname; -} -static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) -#else - if (unlikely(value == NULL || !PyString_Check(value))) -#endif - { - PyErr_SetString(PyExc_TypeError, - "__qualname__ must be set to a string object"); - return -1; - } - tmp = op->func_qualname; - Py_INCREF(value); - op->func_qualname = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) -{ - PyObject *self; - self = m->func_closure; - if (self == NULL) - self = Py_None; - Py_INCREF(self); - return self; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) -{ - if (unlikely(op->func_dict == NULL)) { - op->func_dict = PyDict_New(); - if (unlikely(op->func_dict == NULL)) - return NULL; - } - Py_INCREF(op->func_dict); - return op->func_dict; -} -static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context) -{ - PyObject *tmp; - if (unlikely(value == NULL)) { - PyErr_SetString(PyExc_TypeError, - "function's dictionary may not be deleted"); - return -1; - } - if (unlikely(!PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "setting function's dictionary to a non-dict"); - return -1; - } - tmp = op->func_dict; - Py_INCREF(value); - op->func_dict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) -{ - Py_INCREF(op->func_globals); - return op->func_globals; -} -static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) -{ - Py_INCREF(Py_None); - return Py_None; -} -static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) -{ - PyObject* result = (op->func_code) ? op->func_code : Py_None; - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { - int result = 0; - PyObject *res = op->defaults_getter((PyObject *) op); - if (unlikely(!res)) - return -1; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - op->defaults_tuple = PyTuple_GET_ITEM(res, 0); - Py_INCREF(op->defaults_tuple); - op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); - Py_INCREF(op->defaults_kwdict); - #else - op->defaults_tuple = PySequence_ITEM(res, 0); - if (unlikely(!op->defaults_tuple)) result = -1; - else { - op->defaults_kwdict = PySequence_ITEM(res, 1); - if (unlikely(!op->defaults_kwdict)) result = -1; - } - #endif - Py_DECREF(res); - return result; -} -static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyTuple_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__defaults__ must be set to a tuple object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_tuple; - op->defaults_tuple = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { - PyObject* result = op->defaults_tuple; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_tuple; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__kwdefaults__ must be set to a dict object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_kwdict; - op->defaults_kwdict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { - PyObject* result = op->defaults_kwdict; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_kwdict; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) { - PyObject* tmp; - if (!value || value == Py_None) { - value = NULL; - } else if (!PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__annotations__ must be set to a dict object"); - return -1; - } - Py_XINCREF(value); - tmp = op->func_annotations; - op->func_annotations = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) { - PyObject* result = op->func_annotations; - if (unlikely(!result)) { - result = PyDict_New(); - if (unlikely(!result)) return NULL; - op->func_annotations = result; - } - Py_INCREF(result); - return result; -} -static PyGetSetDef __pyx_CyFunction_getsets[] = { - {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, - {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, - {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, - {0, 0, 0, 0, 0} -}; -static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, - {0, 0, 0, 0, 0} -}; -static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(m->func.m_ml->ml_name); -#else - return PyString_FromString(m->func.m_ml->ml_name); -#endif -} -static PyMethodDef __pyx_CyFunction_methods[] = { - {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, - {0, 0, 0, 0} -}; -#if PY_VERSION_HEX < 0x030500A0 -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) -#else -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) -#endif -static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); - if (op == NULL) - return NULL; - op->flags = flags; - __Pyx_CyFunction_weakreflist(op) = NULL; - op->func.m_ml = ml; - op->func.m_self = (PyObject *) op; - Py_XINCREF(closure); - op->func_closure = closure; - Py_XINCREF(module); - op->func.m_module = module; - op->func_dict = NULL; - op->func_name = NULL; - Py_INCREF(qualname); - op->func_qualname = qualname; - op->func_doc = NULL; - op->func_classobj = NULL; - op->func_globals = globals; - Py_INCREF(op->func_globals); - Py_XINCREF(code); - op->func_code = code; - op->defaults_pyobjects = 0; - op->defaults = NULL; - op->defaults_tuple = NULL; - op->defaults_kwdict = NULL; - op->defaults_getter = NULL; - op->func_annotations = NULL; - PyObject_GC_Track(op); - return (PyObject *) op; -} -static int -__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) -{ - Py_CLEAR(m->func_closure); - Py_CLEAR(m->func.m_module); - Py_CLEAR(m->func_dict); - Py_CLEAR(m->func_name); - Py_CLEAR(m->func_qualname); - Py_CLEAR(m->func_doc); - Py_CLEAR(m->func_globals); - Py_CLEAR(m->func_code); - Py_CLEAR(m->func_classobj); - Py_CLEAR(m->defaults_tuple); - Py_CLEAR(m->defaults_kwdict); - Py_CLEAR(m->func_annotations); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_XDECREF(pydefaults[i]); - PyObject_Free(m->defaults); - m->defaults = NULL; - } - return 0; -} -static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - if (__Pyx_CyFunction_weakreflist(m) != NULL) - PyObject_ClearWeakRefs((PyObject *) m); - __Pyx_CyFunction_clear(m); - PyObject_GC_Del(m); -} -static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - PyObject_GC_UnTrack(m); - __Pyx__CyFunction_dealloc(m); -} -static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) -{ - Py_VISIT(m->func_closure); - Py_VISIT(m->func.m_module); - Py_VISIT(m->func_dict); - Py_VISIT(m->func_name); - Py_VISIT(m->func_qualname); - Py_VISIT(m->func_doc); - Py_VISIT(m->func_globals); - Py_VISIT(m->func_code); - Py_VISIT(m->func_classobj); - Py_VISIT(m->defaults_tuple); - Py_VISIT(m->defaults_kwdict); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_VISIT(pydefaults[i]); - } - return 0; -} -static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { - Py_INCREF(func); - return func; - } - if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); - } - if (obj == Py_None) - obj = NULL; - return __Pyx_PyMethod_New(func, obj, type); -} -static PyObject* -__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromFormat("", - op->func_qualname, (void *)op); -#else - return PyString_FromFormat("", - PyString_AsString(op->func_qualname), (void *)op); -#endif -} -static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { - PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = f->m_ml->ml_meth; - Py_ssize_t size; - switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { - case METH_VARARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) - return (*meth)(self, arg); - break; - case METH_VARARGS | METH_KEYWORDS: - return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); - case METH_NOARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 0)) - return (*meth)(self, NULL); - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - case METH_O: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 1)) { - PyObject *result, *arg0; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - arg0 = PyTuple_GET_ITEM(arg, 0); - #else - arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; - #endif - result = (*meth)(self, arg0); - #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) - Py_DECREF(arg0); - #endif - return result; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags in " - "__Pyx_CyFunction_Call. METH_OLDARGS is no " - "longer supported!"); - return NULL; - } - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - f->m_ml->ml_name); - return NULL; -} -static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); -} -static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { - PyObject *result; - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; - if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { - Py_ssize_t argc; - PyObject *new_args; - PyObject *self; - argc = PyTuple_GET_SIZE(args); - new_args = PyTuple_GetSlice(args, 1, argc); - if (unlikely(!new_args)) - return NULL; - self = PyTuple_GetItem(args, 0); - if (unlikely(!self)) { - Py_DECREF(new_args); - return NULL; - } - result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); - Py_DECREF(new_args); - } else { - result = __Pyx_CyFunction_Call(func, args, kw); - } - return result; -} -static PyTypeObject __pyx_CyFunctionType_type = { - PyVarObject_HEAD_INIT(0, 0) - "cython_function_or_method", - sizeof(__pyx_CyFunctionObject), - 0, - (destructor) __Pyx_CyFunction_dealloc, - 0, - 0, - 0, -#if PY_MAJOR_VERSION < 3 - 0, -#else - 0, -#endif - (reprfunc) __Pyx_CyFunction_repr, - 0, - 0, - 0, - 0, - __Pyx_CyFunction_CallAsMethod, - 0, - 0, - 0, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, - 0, - (traverseproc) __Pyx_CyFunction_traverse, - (inquiry) __Pyx_CyFunction_clear, - 0, -#if PY_VERSION_HEX < 0x030500A0 - offsetof(__pyx_CyFunctionObject, func_weakreflist), -#else - offsetof(PyCFunctionObject, m_weakreflist), -#endif - 0, - 0, - __pyx_CyFunction_methods, - __pyx_CyFunction_members, - __pyx_CyFunction_getsets, - 0, - 0, - __Pyx_CyFunction_descr_get, - 0, - offsetof(__pyx_CyFunctionObject, func_dict), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -#if PY_VERSION_HEX >= 0x030400a1 - 0, -#endif -#if PY_VERSION_HEX >= 0x030800b1 - 0, -#endif -}; -static int __pyx_CyFunction_init(void) { - __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); - if (unlikely(__pyx_CyFunctionType == NULL)) { - return -1; - } - return 0; -} -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults = PyObject_Malloc(size); - if (unlikely(!m->defaults)) - return PyErr_NoMemory(); - memset(m->defaults, 0, size); - m->defaults_pyobjects = pyobjects; - return m->defaults; -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_tuple = tuple; - Py_INCREF(tuple); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_kwdict = dict; - Py_INCREF(dict); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->func_annotations = dict; - Py_INCREF(dict); -} - /* RaiseException */ #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, diff --git a/Orange/distance/_distance.pyx b/Orange/distance/_distance.pyx index d37587726f6..96c5bab17d8 100644 --- a/Orange/distance/_distance.pyx +++ b/Orange/distance/_distance.pyx @@ -363,19 +363,23 @@ def p_nonzero(np.ndarray[np.float64_t, ndim=1] x): nonzeros += 1 return float(nonzeros) / nonnans -def any_nan_row(np.ndarray[np.float64_t, ndim=2] x): +def any_nan_row(np.ndarray[np.float64_t, ndim=2] x, + callback): cdef: - int row, n_cols, n_rows + int row, n_cols, n_rows, step np.ndarray[np.int8_t, ndim=1] flags n_rows, n_cols = x.shape[0], x.shape[1] flags = np.zeros(x.shape[0], dtype=np.int8) - with nogil: - for row in range(n_rows): - for col in range(n_cols): - if npy_isnan(x[row, col]): - flags[row] = 1 - break + step = max(n_cols // 100, 100) + for row_start in range(0, n_rows, step): + callback(row_start * 100 / n_rows) + for row in range(row_start, min(row_start + step, n_rows)): + with nogil: + for col in range(n_cols): + if npy_isnan(x[row, col]): + flags[row] = 1 + break return flags @@ -386,9 +390,11 @@ def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, np.ndarray[np.int8_t, ndim=1] nans1, np.ndarray[np.int8_t, ndim=1] nans2, np.ndarray[np.float64_t, ndim=1] ps, - char two_tables): + char two_tables, + callback, + next_callback): cdef: - int n_rows1, n_rows2, n_cols, row1, row2, col + int n_rows1, n_rows2, n_cols, row1, row2, col, step np.float64_t val1, val2, intersection, union int ival1, ival2 double [:, :] distances @@ -396,71 +402,75 @@ def jaccard_rows(np.ndarray[np.int8_t, ndim=2] nonzeros1, n_rows1, n_cols = x1.shape[0], x2.shape[1] n_rows2 = x2.shape[0] distances = np.zeros((n_rows1, n_rows2), dtype=float) - with nogil: - for row1 in range(n_rows1): - if nans1[row1]: - for row2 in range(n_rows2 if two_tables else row1): - union = intersection = 0 - for col in range(n_cols): - val1, val2 = x1[row1, col], x2[row2, col] - if npy_isnan(val1): - if npy_isnan(val2): - intersection += ps[col] ** 2 - union += 1 - (1 - ps[col]) ** 2 - elif val2 != 0: - intersection += ps[col] - union += 1 - else: - union += ps[col] - elif npy_isnan(val2): - if val1 != 0: - intersection += val1 * ps[col] - union += 1 - else: - union += ps[col] - else: - ival1 = nonzeros1[row1, col] - ival2 = nonzeros2[row2, col] - union += ival1 | ival2 - intersection += ival1 & ival2 - if union != 0: - distances[row1, row2] = 1 - intersection / union - else: - for row2 in range(n_rows2 if two_tables else row1): - union = intersection = 0 - # This case is slightly different since val1 can't be nan - if nans2[row2]: + step = max(n_rows1 // 100, 100) + for row_start in range(0, n_rows1, step): + callback(row_start * 100 / n_rows1) + for row1 in range(row_start, min(row_start + step, n_rows1)): + with nogil: + if nans1[row1]: + for row2 in range(n_rows2 if two_tables else row1): + union = intersection = 0 for col in range(n_cols): - val2 = x2[row2, col] - if nonzeros1[row1, col] != 0: - union += 1 + val1, val2 = x1[row1, col], x2[row2, col] + if npy_isnan(val1): if npy_isnan(val2): - intersection += ps[col] + intersection += ps[col] ** 2 + union += 1 - (1 - ps[col]) ** 2 elif val2 != 0: - intersection += 1 + intersection += ps[col] + union += 1 + else: + union += ps[col] elif npy_isnan(val2): - union += ps[col] - elif val2 != 0: - union += 1 - else: - for col in range(n_cols): - ival1 = nonzeros1[row1, col] - ival2 = nonzeros2[row2, col] - union += ival1 | ival2 - intersection += ival1 & ival2 - if union != 0: - distances[row1, row2] = 1 - intersection / union + if val1 != 0: + intersection += val1 * ps[col] + union += 1 + else: + union += ps[col] + else: + ival1 = nonzeros1[row1, col] + ival2 = nonzeros2[row2, col] + union += ival1 | ival2 + intersection += ival1 & ival2 + if union != 0: + distances[row1, row2] = 1 - intersection / union + else: + for row2 in range(n_rows2 if two_tables else row1): + union = intersection = 0 + # This case is slightly different since val1 can't be nan + if nans2[row2]: + for col in range(n_cols): + val2 = x2[row2, col] + if nonzeros1[row1, col] != 0: + union += 1 + if npy_isnan(val2): + intersection += ps[col] + elif val2 != 0: + intersection += 1 + elif npy_isnan(val2): + union += ps[col] + elif val2 != 0: + union += 1 + else: + for col in range(n_cols): + ival1 = nonzeros1[row1, col] + ival2 = nonzeros2[row2, col] + union += ival1 | ival2 + intersection += ival1 & ival2 + if union != 0: + distances[row1, row2] = 1 - intersection / union if not two_tables: - lower_to_symmetric(distances, lambda x: x) + lower_to_symmetric(distances, next_callback) return distances def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, np.ndarray[np.float64_t, ndim=2] x, np.ndarray[np.int8_t, ndim=1] nans, - np.ndarray[np.float64_t, ndim=1] ps): + np.ndarray[np.float64_t, ndim=1] ps, + callback): cdef: - int n_rows, n_cols, col1, col2, row + int n_rows, n_cols, col1, col2, row, step double val1, val2, intersection, union np.int8_t ival1, ival2 int in_both, in_any, in1_unk2, unk1_in2, unk1_unk2, unk1_not2, not1_unk2 @@ -468,77 +478,80 @@ def jaccard_cols(np.ndarray[np.int8_t, ndim=2] nonzeros, n_rows, n_cols = x.shape[0], x.shape[1] distances = np.zeros((n_cols, n_cols), dtype=float) - with nogil: - for col1 in range(n_cols): - if nans[col1]: - for col2 in range(col1): - in_both = in_any = 0 - in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 - for row in range(n_rows): - val1, val2 = x[row, col1], x[row, col2] - if npy_isnan(val1): - if npy_isnan(val2): - unk1_unk2 += 1 - elif val2 != 0: - unk1_in2 += 1 - else: - unk1_not2 += 1 - elif npy_isnan(val2): - if val1 != 0: - in1_unk2 += 1 - else: - not1_unk2 += 1 - else: - ival1 = nonzeros[row, col1] - ival2 = nonzeros[row, col2] - in_both += ival1 & ival2 - in_any += ival1 | ival2 - union = (in_any + unk1_in2 + in1_unk2 - + ps[col1] * unk1_not2 - + ps[col2] * not1_unk2 - + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - if union != 0: - intersection = (in_both - + ps[col1] * unk1_in2 + - + ps[col2] * in1_unk2 + - + ps[col1] * ps[col2] * unk1_unk2) - distances[col1, col2] = distances[col2, col1] = \ - 1 - intersection / union - else: - for col2 in range(col1): - if nans[col2]: + step = max(n_cols // 100, 100) + for col_start in range(0, n_cols, step): + callback(col_start * 100 / n_cols) + for col1 in range(col_start, min(col_start + step, n_cols)): + with nogil: + if nans[col1]: + for col2 in range(col1): in_both = in_any = 0 in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 for row in range(n_rows): - ival1 = nonzeros[row, col1] - val2 = x[row, col2] - if npy_isnan(val2): - if ival1: + val1, val2 = x[row, col1], x[row, col2] + if npy_isnan(val1): + if npy_isnan(val2): + unk1_unk2 += 1 + elif val2 != 0: + unk1_in2 += 1 + else: + unk1_not2 += 1 + elif npy_isnan(val2): + if val1 != 0: in1_unk2 += 1 else: not1_unk2 += 1 else: + ival1 = nonzeros[row, col1] ival2 = nonzeros[row, col2] in_both += ival1 & ival2 in_any += ival1 | ival2 - distances[col1, col2] = distances[col2, col1] = \ - 1 - float(in_both - + ps[col1] * unk1_in2 + - + ps[col2] * in1_unk2 + - + ps[col1] * ps[col2] * unk1_unk2) / \ - (in_any + unk1_in2 + in1_unk2 + - + ps[col1] * unk1_not2 - + ps[col2] * not1_unk2 - + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) - else: - in_both = in_any = 0 - for row in range(n_rows): - ival1 = nonzeros[row, col1] - ival2 = nonzeros[row, col2] - in_both += ival1 & ival2 - in_any += ival1 | ival2 - if in_any != 0: + union = (in_any + unk1_in2 + in1_unk2 + + ps[col1] * unk1_not2 + + ps[col2] * not1_unk2 + + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + if union != 0: + intersection = (in_both + + ps[col1] * unk1_in2 + + + ps[col2] * in1_unk2 + + + ps[col1] * ps[col2] * unk1_unk2) distances[col1, col2] = distances[col2, col1] = \ - 1 - float(in_both) / in_any + 1 - intersection / union + else: + for col2 in range(col1): + if nans[col2]: + in_both = in_any = 0 + in1_unk2 = unk1_in2 = unk1_unk2 = unk1_not2 = not1_unk2 = 0 + for row in range(n_rows): + ival1 = nonzeros[row, col1] + val2 = x[row, col2] + if npy_isnan(val2): + if ival1: + in1_unk2 += 1 + else: + not1_unk2 += 1 + else: + ival2 = nonzeros[row, col2] + in_both += ival1 & ival2 + in_any += ival1 | ival2 + distances[col1, col2] = distances[col2, col1] = \ + 1 - float(in_both + + ps[col1] * unk1_in2 + + + ps[col2] * in1_unk2 + + + ps[col1] * ps[col2] * unk1_unk2) / \ + (in_any + unk1_in2 + in1_unk2 + + + ps[col1] * unk1_not2 + + ps[col2] * not1_unk2 + + (1 - (1 - ps[col1]) * (1 - ps[col2])) * unk1_unk2) + else: + in_both = in_any = 0 + for row in range(n_rows): + ival1 = nonzeros[row, col1] + ival2 = nonzeros[row, col2] + in_both += ival1 & ival2 + in_any += ival1 | ival2 + if in_any != 0: + distances[col1, col2] = distances[col2, col1] = \ + 1 - float(in_both) / in_any return distances diff --git a/Orange/distance/distance.py b/Orange/distance/distance.py index ec29b445718..246d9e80037 100644 --- a/Orange/distance/distance.py +++ b/Orange/distance/distance.py @@ -465,8 +465,8 @@ class JaccardModel(FittedDistanceModel): Model for computation of cosine distances across rows and columns. All non-zero values are treated as 1. """ - def __init__(self, attributes, axis, impute, ps): - super().__init__(attributes, axis, impute) + def __init__(self, attributes, axis, impute, ps, callback): + super().__init__(attributes, axis, impute, callback) self.ps = ps def compute_distances(self, x1, x2): @@ -489,25 +489,30 @@ def _compute_dense(self, x1, x2): # view is false positive, pylint: disable=no-member nonzeros1 = np.not_equal(x1, 0).view(np.int8) if self.axis == 1: - nans1 = _distance.any_nan_row(x1) + weights = [5, 45, 50] if x2 is None else [5, 5, 45, 45] + callbacks = StepwiseCallbacks(self.callback, weights) + + nans1 = _distance.any_nan_row(x1, callbacks.next()) if x2 is None: nonzeros2, nans2 = nonzeros1, nans1 else: nonzeros2 = np.not_equal(x2, 0).view(np.int8) - nans2 = _distance.any_nan_row(x2) + nans2 = _distance.any_nan_row(x2, callbacks.next()) return _distance.jaccard_rows( nonzeros1, nonzeros2, x1, x1 if x2 is None else x2, nans1, nans2, - self.ps, - x2 is not None) + self.ps, x2 is not None, + callbacks.next(), callbacks.next() + ) else: - nans1 = _distance.any_nan_row(x1.T) + callbacks = StepwiseCallbacks(self.callback, [10, 90]) + nans1 = _distance.any_nan_row(x1.T, callbacks.next()) return _distance.jaccard_cols( - nonzeros1, x1, nans1, self.ps) + nonzeros1, x1, nans1, self.ps, callbacks.next()) - @staticmethod - def _compute_sparse(x1, x2=None): + def _compute_sparse(self, x1, x2=None): + callback = self.callback or (lambda x: x) symmetric = x2 is None if symmetric: x2 = x1 @@ -518,6 +523,7 @@ def _compute_sparse(x1, x2=None): n, m = x1.shape[0], x2.shape[0] matrix = np.zeros((n, m)) for i in range(n): + callback(i * 100 / n) xi_ind = set(x1[i].indices) for j in range(i if symmetric else m): union = len(xi_ind.union(x2[j].indices)) @@ -547,7 +553,8 @@ def fit_rows(self, attributes, x, n_vals): ps = np.fromiter( (_distance.p_nonzero(x[:, col]) for col in range(len(n_vals))), dtype=np.double, count=len(n_vals)) - return JaccardModel(attributes, self.axis, self.impute, ps) + return JaccardModel(attributes, self.axis, self.impute, + ps, self.callback) fit_cols = fit_rows