pax_global_header 0000666 0000000 0000000 00000000064 12730143670 0014515 g ustar 00root root 0000000 0000000 52 comment=8bd7b7b23715b6a329fd4e6b765a707d718d2b45
pycogent-1.9/ 0000775 0000000 0000000 00000000000 12730143670 0013216 5 ustar 00root root 0000000 0000000 pycogent-1.9/.gitignore 0000664 0000000 0000000 00000000517 12730143670 0015211 0 ustar 00root root 0000000 0000000 *.py[cod]
# C extensions
*.so
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
tests/draw_results
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# vi
.*.swp
pycogent-1.9/.hgignore 0000664 0000000 0000000 00000000233 12730143670 0015017 0 ustar 00root root 0000000 0000000 syntax:glob
.svn
*.pyc
*.pyo
*.so
*.o
*.DS_Store
*.tmproj
*.rej
*.orig
*.wpr
*.pdf
_build/*
build
*htmlcov*
*.idea
draw_results
*.coverage
*egg-info*
*.wpu pycogent-1.9/ChangeLog 0000775 0000000 0000000 00000072026 12730143670 0015002 0 ustar 00root root 0000000 0000000 *********
Changelog
*********
Cogent 1.5.3 - 1.9
==================
NOTE: There have been so many changes since the 1.5.3 release that it is not
viable to list themn all! Suffice it to say, many new features added and many bugs
have been squashed. The best way to see them is using either git or mercurial
to examine the commit logs.
Cogent 1.5.2 - 1.5.3
====================
New Features
------------
* Added a withoutLostSpans() method to Feature objects in
cogent.core.annotation. Useful after projecting features from one aligned
sequence across to another. Implemented for ordinary Features and
SimpleVariables but not xxy_list Variables.
Changes
-------
* Make Span.remapWith() a little clearer in cogent.core.location.
* Tidy annotation remapping code in cogent.core.annotation and
cogent.core.sequence so that new positions are only calculated once when
slicing, projecting, or otherwise remapping parts of sequences. The old code
was needlessly doing it twice.
Bug Fixes
---------
* Fixed bug in BLAT application controller (cogent.app.blat) which would drop
some input sequences when running assign_dna_reads_to_protein_database.
* Prevent negative widths from arising in cogent.draw.compatibility when
alignment is too wide.
Cogent 1.5.1 - 1.5.2
====================
New Features
------------
* Added new mantel_test function to cogent.maths.stats.test that allows the
type of significance test to be specified. This function is meant to replace
the pre-existing mantel function.
* Added new correlation_test function to cogent.maths.stats.test that computes
the correlation (pearson or spearman) between two vectors, in addition to
parametric and nonparametric tests of significance and confidence intervals.
This function gives more control and information than the pre-existing
correlation function. The spearman function is also a new addition.
* Added new mc_t_two_sample function to cogent.maths.stats.test that performs a
two-sample t-test and uses Monte Carlo permutations to determine
nonparametric significance (similar to R's Deducer::perm.t.test).
* Added guppy 1.1, pplacer 1.1, ParsInsert 1.04, usearch 5.2.32, rtax 0.981,
raxml 7.3.0, BLAT 34, and BWA 0.6.2 application controllers.
* Added new functions to cogent.maths.stats.rarefaction that provide
alternative ways to perform rarefaction subsampling.
* Added convenience wrappers assign_dna_reads_to_database,
assign_dna_reads_to_protein_database, and assign_dna_reads_to_dna_database
for BLAT, BWA, and usearch with consistent interface across all three.
Changes
-------
* Minimum matplotlib version now set to 1.1.0.
* Minimum Vienna package version now set to 1.8.5.
* The pearson function in cogent.maths.stats.test has more robust
error-checking.
* The mantel and mantel_test functions in cogent.maths.stats.test now check for
symmetric, hollow distance matrices as input by default, with an option to
disable these checks.
* cogent.draw.distribution_plots now uses matplotlib proxy Artists for legend
creation (this simplifies the code a bit). Added ability to set the size of
plot figures through two new optional parameters to generate_box_plots and
generate_comparative_plots. More robust checks have been put in place in
case making room for labels fails (this now uses matplotlib 1.1.0's new
tight_layout() functionality, but this can still fail in some cases).
* cogent.app.raxml (version 7.0.3) is now deprecated and will be removed in
1.6.0. Please use cogent.app.raxml_v730 instead (version 7.3.0).
* cogent.app.muscle (version 3.6) is now deprecated and will be removed in
1.6.0. Please use cogent.app.muscle_v38 instead (version 3.8).
* Updated cogent.app.uclust to handle --stepwords and --w.
Bug Fixes
---------
* improve handling of reading frames from Ensembl
* actually included the test_ensembl/test_metazoa.py file that was
accidentally overlooked.
* fixed small diff in postcript output from RNAfold
* Deprecation and discontinued warnings are now not ignored by default.
cogent.util.warning was ignored in Python 2.7 because it uses
DeprecationWarnings. These warnings are temporarily forced to not be ignored.
* Included test_app/test_formatdb.py and test_app/test_mothur.py files in
alltests.py.
* Fixed test_safe_md5 in tests.test_util.test_misc to no longer run an MD5 over
a file in PyCogent (this caused the test to break when a new release went out
because the MD5 changes due to the new version string). The test now writes a
temporary file populated with fixed data and computes the MD5 from that.
* Fixed data_file_links.html in the PyCogent documentation to correctly point
to several data files that were previously unreachable.
Cogent 1.5 - 1.5.1
==================
New Features
------------
* Alignments can now add sequences that are pairwise aligned to a sequence
already present in the alignment.
* Alignment.addSeqs has more flexibility with the specific order of sequences
now controllable by the user. Thanks to Jan Kosinski for these two very
useful patches!
* Increased options for reading Table data from files: limit keyword; and,
line based (as distinct from column-based) type-casting of delimited files.
* Flexible parser for raw Greengenes 16S records
* Add fast pairwise distance estimation for DNA/RNA sequences. Currently only
Jukes-Cantor 1969 and Tamura-Nei 1993 distances are provided. A cookbook
entry was added to building_phylogenies.
* Added a PredefinedNucleotide substitution model class. This class uses
Cython implementations for nucleotide models where analytical solutions
are available. Substantial speedups are achieved. These implementations
do not support obtaining the rate matrix. Use the older style implementation
if you require that (toggled by the rate_matrix_required argument).
* Added fit_function function. This allows to fit any model to a x and y
dataset using simplex to reduce the error between the model and the data.
* Added parsers for bowtie and for BLAT's PSL format
* Table can now read/write gzipped files.
* GeneticCode class has a getStopIndices method. Returns the index positions
of stop codons in a sequence for a user specified translation frame.
* Added LogDet metric to cogent.evolve.pairwise_distance. With able assistance
from Yicheng Zhu. Thanks Yicheng!
* Added jackknife code to cogent.maths.stats.jackknife. This can be used to
measure confidence of an estimate from a single vector or a matrix. Thanks
to Anuj Pahwa for help implementing this!
* Added abundance-based Jaccard beta diversity index (Chao et. al., 2005)
Changes
-------
* python 2.6 is now the minimum required version
* We have removed code authored by Ziheng Yang as it is not available under
an open source license. We note a modest performance hit for nucleotide and
dinucleotide models. Codon models are not affected. The PredefinedNucleotide
models recently added are faster than the older approach that used Yang's
code.
* The PredefinedNucleotide models are now available via cogent.evolve.models.
The old-style (slower) nucleotide models can be obtained by setting
rate_matrix_required=True.
* RichGenbankParser can now return WGS blocks
Bug Fixes
---------
* fixed bug that crept into doing consensus trees from tree collections.
Thanks to Klara Verbyla for catching this one!
* fixed a bug (#3170464) affecting obtaining sequences from non-chromosome
level coordinate systems. Thanks to brandoninvergo for reporting and Hua
Ying for the patch!
* fixed a bug (#2987278) associated with missing unit tests for gbseq.py
* fixed a bug (#2987264) associated with missing unit tests for paml_matrix.py
* fixed a bug (#2987238) associated with missing unit tests for tinyseq.py
Cogent 1.4.1 - 1.5
==================
New Features
------------
* major additions to Cookbook. Thanks to the many contributors (too many to
list here)!
* added AlleleFreqs attribute to ensembl Variation objects.
* added getGeneByStableId method to genome objects.
* added Introns attribute to Transcript objects and an Intron class. (Thanks
to Hua Ying for this patch!)
* added Mann-Whitney test and a Monte-Carlo version
* exploratory and confirmatory period estimation techniques (suitable for
symbolic and continuous data)
* Information theoretic measures (AIC and BIC) added
* drawing of trees with collapsed nodes
* progress display indicator support for terminal and GUI apps
* added parser for illumina HiSeq2000 and GAiix sequence files as
cogent.parse.illumina_sequence.MinimalIlluminaSequenceParser.
* added parser to FASTQ files, one of the output options for illumina's
workflow, also added cookbook demo.
* added functionality for parsing of SFF files without the Roche tools in
cogent.parse.binary_sff
Changes
-------
* thousand fold performance improvement to nmds
* >10-fold performance improvements to some Table operations
Bug Fixes
---------
* Fixed a Bug in cogent.core.alphabet that resulted in 4 tests err'ing out
when using NumPy v1.4.1
* Sourceforge bugs 2987289, 2987277, 2987378, 2987272, 2987269 were addressed
and fixed
Cogent 1.4 - 1.4.1
==================
New Features
------------
* Simplified getting genetic variation from Ensembl and provide the protein
location of nonsynonymous variants.
* rate heterogeneity variants of pre-canned continuous time substitution
models easier to define.
* Added implementation of generalised neighbour joining.
* New capabilities for examining genetic variants using Ensembl.
* Phylogenetic methods that can return collections of trees do so as a
TreeCollections object, which has writeToFile and getConsensusTree methods.
* Added uclust application controller which currently supports uclust
v1.1.579.
Changes
-------
* Major additions to Cookbook documentation courtesy of Tom Elliot. Thanks
Tom!
* Improvements to parallelisation.
Bug Fixes
---------
Cogent 1.3 - 1.4
================
New Features
------------
* added support for manipulating and handling macromolecular structures.
This includes a PDB file format parser, a hierarchical data structure
to represent molecules. Various utilities to manipulate e.g. clean-up
molecules, efficient surface area and proximity-contact calculation via
cython. Expansion into unit-cells and crystal lattices is also possible.
* added a KD-Tree class for fast nearest neighbor look-ups.
Supports k-nearest neighbours and all neighbours within radius queries
currently only in 3D.
* added new tools for evaluating clustering stresses, goodness_of_fit.
In cogent.cluster .
* added a new clustering tool, procrustes analysis. In cogent.cluster .
* phylo.distance.EstimateDistances class has a new argument, modify_lf. This
allows the use the modify the likelihood function, possibly constraining
parameters, freeing them, setting bounds, pre-optimising etc..
* cogent Table mods; added transposed and normalized methods while the summed
method can now return column or row sums.
* Added a new context dependent model class. The conditional nucleotide
frequency weighted class has been demonstrated to be superior to the model
forms of Goldman and Yang (1994) and Muse and Gaut (1994). The publication
supporting this claim is In press at Mol Biol Evol, authored by Yap,
Lindsay, Easteal and Huttley.
* added new argument to LoadTable to facilitate speedier loading of large
files. The static_column_types argument auto-generates a separator format
parser with column conversion for numeric columns.
* added BLAST XML parser + tests.
* Add compatibility matrix module for determining reticulate evolution.
* Added 'start' and 'order' options to the WLS and ML tree finding method
.trex() These allow the search of tree-space to be constrained to start at a
particular subtree and to proceed in a specified order of leaf additions.
* Consensus tree of weighted trees from phylo.maximum_likelihood.
* Add Alignment.withGapsFrom() aka mirrorGaps, mirrors the gaps into a
provided alignment.
* added ANOVA to maths.stats.test
* LoadTable gets an optional argument (static_column_types) to simplify speedy
loading of big files.
Changes
-------
* Python 2.4 is no longer supported.
* NumPy 1.3 is now the minimum supported NumPy version.
* zlib is now a dependency.
* cogent.format.table.asReportlabTable is being discontinued in version 1.5.
This is the last dependency on reportlab and removal will simplify
installation.
* the conditional nucleotide model (Yap et al 2009) will be made the default
model form for context dependent models in version 1.5.
* Change required MPI library from PyxMPI to mpi4py.
* Move all of the cogent.draw.matplotlib.* modules up to cogent.draw.*
* Substitute matplotlib for reportlab throughout cogent.draw
* cogent.db.ensembl code updated to work with the latest Ensembl release (56)
* motif prob pseudocount option, used for initial values of optimisable mprobs
* The mlagan application controller has been removed.
Bug Fixes
---------
* Fix and test for two bugs in multiple alignment, One in the pairwise.py
Hirschberg code and the other in indel_positions.py where gaps at the end
were effectively taken to be deletions and never insertions, unlike gaps at
the start.
* fix #2811993 alignment getMotifProbs. allow_gap argument now has an effect.
Cogent 1.2 - 1.3
================
New Features
------------
* Python2.6 is now supported
* added cogent.cluster.nmds, code to perform nonmetric multidimensional
scaling. Not as fast as others (e.g.: R, MASS package, isoMDS)
* Documentation ported to using the Sphinx documentation generator.
* Major additions to documentation in doc/examples.
* Added partial support for querying the Ensembl MySQL databases. This
capacity has additional dependencies (MySQL-python and SQLAlchemy). This
module should be considered alpha level code, (although it has worked
reliably for some time in the hands of the developers).
* Introduced a new substitution model family. This family has the same form as
that originally described by Muse and Gaut (Mol Biol Evol, 11, 715-24).
These models were applied in the article by Lindsay et al. (2008, Biol
Direct, 3, 52). Model state defaults to the tuple weighted matrix (eg. the
Goldman and Yang codon models). Selecting the nucleotide weighted matrix is
done using the mprob_model argument.
* Likelihood functions now have a getStatistics method. This returns cogent
Table objects. Optional arguments are with_motif_probs and with_titles where
the latter refers to the Table.Title attribute being set.
* Added rna_struct formatter and rna_plot parser
* A fast unifrac method implementation.
* Added new methods on tree related objects: TreeNode.getNodesDict;
TreeNode.reassignNames; PhyloNode.tipsWithinDistance;
PhyloNode.totalDescendingBranchLength
* Adopted Sphinx documentation system, added many new use cases, improved
existing ones.
* added setTablesFormat to likelihood function. This allows setting the
spacing, display precision of the stats tables resulting from printing a
likelihood function.
* Added non-parametric multidimensional scaling (nmds) method.
* Added a seperate app controller for FastTree v1.0
* new protein MolType, PROTEIN_WITH_STOP, that supports the stop codon new
sequence objects, ProteinWithStopSequence and ModelProteinWithStopSequence
to support the new MolType.
* Support for Cython added.
Changes
-------
* reconstructAncestralSequences has been deprecated to
reconstructAncestralSeqs. It will be removed in version 1.4.
* updated parsers
* TreeNode.getNewick is now iterative. For recursive, use
TreeNode.getNewickRecursive. Both the iterative and recursive methods of
getNewick now support the keyword 'escape_name'. DndParser now supports the
keyword 'unescape_name'. DndParser unescape_name will now try to remove
underscores (like underscore_unmunge).
* Generalized MinimalRnaalifoldParser to parse structures and energies from
RNAfold as well.
* PhyloNode.tipToTipDistances can now work on a subset of tips by passing
either a list of tip names or a list of tip nodes using the endpoints param.
* deprecating reconstructAncestralSequences to deprecating
reconstructAncestralSeqs.
* updated app controller parameters for FastTree v1.1
* Allow and require a more recent version of Pyrex.
* LoadTree is now a method of cogent.__init__
.. warning:: Pyrex is no longer the accepted way to develop extensions. Use
`Cython `_ instead.
Bug Fixes
---------
* the alignment sample methods and xsample (randint had the wrong max
argument)
* Fixes the tests that no longer work with NCBI's API changes, and sticks a
big warning for the unwary in the ncbi module pointing users to the
"official" list of reported rettypes. Note that the rettypes changed
recently and NCBI says they do not plan to support the old behavior.
* The TreeNode operators cmp, contains, and any operator that relies on those
methods will now only perform comparisons against the objects id. Prior
behavior first checked the TreeNode's Name attribute and then object id if
the Name was not present. This resulted in ambiguous behavior in certain
situations.
* Added type conversion to Mantel so it works on lists.
* kendall tau fix, bug 2794469
* Table now raises a RuntimeError if provided malformed data.
* Fixed silent type conversion in TreeNode, bug 2804431
* RangeNode is now properly passing kwargs to baseclass, bug 2804441
* DndParser was not producing correct trees in niche cases, bug 2798580
Cogent 1.1 - 1.2
================
New Features
------------
* Code for performing molecular coevolution/covariation analyses on multiple
sequence alignments, plus support files. (Described in J. Caporaso et al.
BMC Evol Biol, 8(1):327, 2008.)
* App controller for `CD-HIT `_
* A ParameterEnumerator object is now available in cogent.app.util. This
method will iterate over a range of parameters, returning parameter dicts
that can be used with the relevant app controller.
* Sequence and alignment objects that inherit from Annotatable can now mask
regions of sequence, returning new objects where the observed sequence
characters in the regions spanned by the annotations are replaced by a mask
character (mask_char).
* Table.count method. Counts the number of rows satisfying some condition.
* Format writer for stockholm and clustal formats.
* App controllers for dotur, infernal, RNAplot, RNAalifold. Parsers for
infernal and dotur.
* Empirical nucleotide substitution matrix estimation code (Described in
M. Oscamou et al. BMC Bioinformatics, 9(1):511, 2008)
New Documentation
-----------------
Usage examples (see doc/) were added for the following:
* Querying NCBI
* The motif module.
* UPGMA clustering
* For using the ParameterCombinations object and generating command lines
* Coevolution modelling
* Sequence annotation handling
* Table manipulation
* Principal components analysis (PCoA)
* Genetic code objects
* How to construct profiles, consensus seqs etc ..
Changes
-------
* PyCogent no longer relies on the Python math module. All math functions are
now imported from numpy. The main motivator was to remove casting between
numpy and Python types. Such as, a 'numpy.float64' variable unknowingly
being converted to a Python 'float' type.
* Tables.getDistinctValues now handles multiple columns.
* Table.Header is now an immutable property of Tables. Use the withNewHeader
method modifying Header labels.
* The TreeNode comparison methods now only check against the objects ID
Bug Fixes
---------
* LoadTable was ignoring title argument for standard file read.
* Fixed bug in Table.joined. When a join produces no result, now returns a
Table with 0 rows.
* Improved consistency of LoadTable with previous behaviour of cogent.Table
* Added methods to detect large sequences/alphabets and handle counts from
sequence triples correctly.
* goldman_q_dna_pair() and goldman_q_rna_pair() now average the frequency
matrix used.
* reverse complement of annotations with disjoint spans correctly preserve
order.
* Fixed ambiguity in TreeNode comparison methods which resulted in the prune
method incorrectly removing entire subtrees.
Cogent 1.0.1 - 1.1
==================
New Features
------------
* Added functionality to cogent.util.unit_test.TestCase
assertSameObj - use in place of 'assert a is b'
assertNotSameObj - use in place of 'assert a is not b'
assertIsPermutation - checks if observed is a permutation of items
assertIsProb - checks whether a value(s) are probabilities
assertIsBetween - use in place of 'assert a < obs < b'
assertLessThan - use in place of 'assert obs < value'
assertGreaterThan - use in place of 'assert obs > value'
assertSimiliarFreqs - compares frequency distributions using a G-test
assertSimiliarMeans - compares samples using a t-test
_set_suite_pvalue - set a suite wide pvalue
.. note:: both the similiarity assertions can have a pvalue specified in the
testing module. This pvalue can be overwritten during alltests.py by
calling TestCase._set_suite_pvalue(pvalue)
.. note:: All of these new assert methods can take lists as well. For instance:
obs = [1,2,3,4]
value = 5
self.assertLessThan(obs, value)
* Alignment constructor now checks for iterators (e.g. results from
parsers) and lists() them -- this allows direct construction like
Alignment(MinimalFastaParser(open(myfile.fasta))). Applies to both
dense and sparse alignments, and SequenceCollections.
* Parameterized LoadTree underscore stripping in node names, and turned it off
by default.
* new Table features and refactor
Trivial edits of the code provided by Felix Schill for SQL-like table
joining. Principally a unification of the different types of table
joins (inner- and outer-join) between 2 tables, and porting of all
testing code into test_table.rest. The method Table.joined provides
the interface (see tests/test_table.rest for usage).
* added a Table.count method
simply counts the number of rows satisfying some condition. Method
has the same args as for Table.filtered.
* Functions for obtaining the rate matrix for 2 or 3 sequences using the
Goldman method. Support for RNA and DNA.
* Additions to clustalw and muscle app controllers
muscle.py
add_seqs_to_alignment
align_two_alignments
align_unaligned_seqs
align_and_build_tree
build_tree_from_alignment
clustalw.py
align_unaligned_seqs
bootstrap_tree_from_alignment
build_tree_from_alignment
align_and_build_tree
* App controllers for Clearcut, ClustalW, Mafft
* Added midpoint rooting
* Accept FloatingPointError as well as ZeroDivisionError to accommodate numpy.
* Trees can now compare themselves to other trees using a couple of methods.
subsets: compare based on fraction of subsets of labels defined by clades that
are the same in the two trees.
tip_to_tip: compare based on correlations of tip_to_tip distances.
Both of these are fairly badly behaved statistically, so should always be
compared to a distribution of values from random (e.g. label-permuted) trees
using Monte Carlo.
* Added ability to exclude non-shared taxa from subsets tree cmp method.
* Added Zongzhi's combination and permutation implementations to transform.py.
* Added some docs to UPGMA_cluster.
* Added median in cogent.maths.stats.test
Added because the numpy version does not support an axis
parameter. This function now works like numpy functions
(sum, mean, etc...) where you can specify axis. This function should
be safe in place of numpy.median.
Changes
-------
* Many changes to the core objects, mainly for compatibility. Major changes in
this update:
- ModelSequence now inherits from SequenceI and supports the various Sequence
methods (e.g. nucleic acids can reverse-complement, etc.). Type checking is
still performed using strings (e.g. for ambiguous characters, etc.) and
could be improved, but everything seems to work. Bug # 1851959.
- ModelProteinSequence added. Bug # 1851961.
- DenseAlignment and ModelSequence can now handle the '?' character, which is
added to the Alphabet during install. Bug # 1851483.
- Fixed a severe bug in moltype constructors that mutated the dict of ambiguous
states after construction of each of the standard moltypes (for example,
preventing re-instantiation of a similar moltype after the initial install:
bug # 1851482. This would have been very confusing for anyone trying to
experiment with custom MolTypes.
- DenseAlignment now implements many methods of Alignment (some of which have
actually been moved into SequenceCollection), e.g. getGappedSeq() as per
bug # 1816573.
* Added parameter to MageListFromString and MageGroupFromString. Can now handle
'on' as well as 'off'.
* SequenceCollection, Alignment, etc. now check for duplicate seq labels and
raise exception or strip duplicates as desired. Added unit test to cover this
case.
- SequenceCollection now also produces FASTA as default __str__ behavior
like the other objects.
- DenseAlignment now iterates over its mapped items, not the indices for
those items, by default. This allows API compatibility with Alignment
but is slow: it may be worth optimizing this for cases such as detecting
ambiguous chars, as I have already implemented for gaps.
* Updated std in cogent.maths.stats.test
- std now takes an axis parameter like numpy functions (sum, mean,etc...).
- also added in a docstring and tests.
.. note::
cogent.maths.stats.test import sqrt from numpy instead of math
in order to allow std to work on arrays.
* Tree now uses iterative implementation of traverse().
.. warning::
If you **do** modify the tree while using traverse(), you will get
undesired results. If you need to modify the tree, use
traverse_recursive() instead. This only applies to the tree topology
(e.g. if you are adding or deleting nodes, or moving nodes around;
doesn't apply if you are changing branch lengths, etc.). The only two
uses I found in Cogent where the tree is modified during iteration
are in rna2d (some of the structure tree operations) and the prune()
method. I have changed both to use traverse_recursive for now.
However, there might be issues with other code. It might be worth
figuring out how to make the iterative method do the right thing
when the tree is modified -- suggestions are welcome provided they do
not impose substantial performance penalties.
* Made compatible with Python 2.4
* Changed dev status in setup call
* Dropping comments indicating windows support
Bug Fixes
---------
* Fixed bug 1850981: UPGMA does not check diagonals.
This bug was caused because the UPGMA algorithm picks the smallest
distances between nodes at each step but should not ever pick something on
the diagonal. To prevent a diagonal choice we set it to a large number,
but sometimes, for very large matrices, the diagonal sometimes is chosen
becuase the number decreases in value as the distances are averaged during
node collapse. To prevent this error, the program now checks to make sure
that the selected smallest_index is not on the diagonal. If it is, it
reassigns the diagonal to the large number.
* Fixed bug in gff.py attribute string parsing.
If attribute string did not contain double quotes, find() returned -1, so
the last character of the string was inadvertently omitted.
* Fixed error in taxonomy convenience functions that failed to pass in the specified database.
This used to be masked by ncbi's automatic conversion
between protein and nucleotide ids, but apparently this conversion no
longer operates in the tested cases.
* fixed unittest methods
Zongzhi noticed that assertFloatEqual would compare two against when a
shape (4,0) array was compared against a shape (4,4) array.
I added tests for assertFloatEqual, assertFloatEqualAbs,
assertFloatEqualRel and assertEqual. The same bug was noticed in
assertFloatEqualRel. They are now fixed. These fixes resulted in errors
in maths.stats.test.std and correlation_matrix. The std function needed
a work over, but the correlation_matrix was a fault in the test case
itself.
* fixed bug in reading tab-delimited tables
failure when a record had a missing observation in the last field
has been fixed. Line stripping of only line-feed characters is now
done.
* Fixed important bug in metric_scaling.
numpy eig() produces eigenvector array that is the transpose of Numeric eig().
Therefore, any code that does not take this into account will produce results
that are TOTALLY INCORRECT when fed to downstream analyses.
Coordinates from this module prior to this patch are incorrect and are not
to be trusted.
* Fixed a typo in dialign test
* tree __repr__ now more robust to non-str Name entries
* seqsim.rangenode traverse now compatible /w base class.
* Fixed line color bug in PR2 bias plots.
* Added method to dump raw coords from dendrogram.
* Fixed called to eigenvector when no pyrex
* Fixed bug in nonrecursive postorder traversal if not root
Cogent 1.0 - (9/8/2007)
=======================
* Initial release
pycogent-1.9/README 0000775 0000000 0000000 00000010241 12730143670 0014077 0 ustar 00root root 0000000 0000000 The Readme
==========
:Download: `From github `_ or follow the :ref:`quick-install` instructions.
Dependencies
------------
The toolkit requires Python 2.5.1 or greater, and Numpy 1.3 or greater. Aside from these the dependencies below are optional and the code will work as is. A C compiler, however, will allow external C module's responsible for the likelihood and matrix exponentiation calculations to be compiled, resulting in significantly improved performance.
.. _required:
Required
^^^^^^^^
- Python_: the language the toolkit is primarily written in, and in which the user writes control scripts.
- Numpy_: This is a python module used for speeding up matrix computations. It is available as source code for \*nix.
- zlib_: This is a compression library which is available for all platforms and comes pre-installed on most too. If, by chance, your platform doesn't have this installed then download the source from the zlib_ site and follow the install instructions, or refer to the instructions for `compiling matplotlib`_.
.. note:: On some linux platforms (like Ubuntu), you must specifically install a ``python-dev`` package so that the Python_ header files required for building some external dependencies are available.
Optional
^^^^^^^^
- C compiler: This is standard on most \*nix platforms. On Macos X this is available for free in the Developer tools which, if you don't already have them, can be obtained from Apple_.
- Matplotlib_: used to plot several kinds of graphs related to codon usage. For installation, see these instructions for `compiling matplotlib`_.
- Cython_: This module is only necessary if you are a developer who wants to modify the \*.pyx files.
- mpi4py_: Message Passing Interface interface, required for parallel computation.
- SQLAlchemy_ and a mysql connector such as `PyMySQL `_: These are required for the Ensembl querying code.
See the :ref:`quick-install` approach for how these can be grabbed using the ``all`` option..
Installation
------------
See the :ref:`quick-install`.
Testing
-------
``PyCogent/tests`` contains all the tests. You can most readily run the tests using the ``PyCogent/run_tests`` shell script. This is done by typing:
.. code-block:: guess
$ sh run_tests
which will automatically build extensions in place, set up the PYTHONPATH and run ``PyCogent/tests/alltests.py``. Note that if certain optional applications are not installed this will be indicated in the output as "can't find" or "not installed". A "`.`" will be printed to screen for each test and if they all pass, you'll see output like:
.. code-block:: guess
Ran 3299 tests in 58.128s
OK
Tips for usage
--------------
A good IDE can greatly simplify writing control scripts. Features such as code completion and definition look-up are extremely useful. For a complete list of `editors go here`_.
To get help on attributes of an object in python, use
.. code-block:: python
>>> dir(myalign)
to list the attributes of ``myalign`` or
.. code-block:: python
>>> help(myalign.writeToFile)
to figure out how to use the ``myalign.writeToFile`` method. Also note that the directory structure of the package is similar to the import statements required to use a module -- to see the contents of ``alignment.py`` or ``sequence.py`` you need to look in the directory ``cogent/core`` path, to use the classes in those files you specify ``cogent.core`` for importing.
.. _Python: http://www.python.org
.. _Cython: http://www.cython.org/
.. _Numpy: http://numpy.scipy.org/
.. _Matplotlib: http://matplotlib.sourceforge.net
.. _Apple: http://www.apple.com
.. _Pyrex: http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/
.. _`editors go here`: http://www.python.org/cgi-bin/moinmoin/PythonEditors
.. _mpi4py: http://code.google.com/p/mpi4py
.. _`restructured text`: http://docutils.sourceforge.net/rst.html
.. _gcc: http://gcc.gnu.org/
.. _SQLAlchemy: http://www.sqlalchemy.org
.. _`mysql-connector-python`: https://pypi.python.org/pypi/mysql-connector-python
.. _zlib: http://www.zlib.net/
.. _`compiling matplotlib`: http://sourceforge.net/projects/pycogent/forums/forum/651121/topic/5635916
pycogent-1.9/README.md 0000664 0000000 0000000 00000001056 12730143670 0014477 0 ustar 00root root 0000000 0000000 PyCogent: A toolkit for making sense from sequence
==================================================
The official PyCogent source code repository. For details on PyCogent, see http://www.pycogent.org/.
PyCogent includes connectors to remote databases, built-in generalized probabilistic techniques for working with biological sequences, and controllers for 3rd party applications.
For PyCogent news and announcements, including notification of new releases, you can subscribe to the [PyCogent News and Announcements Blog](http://pycogent.wordpress.com).
pycogent-1.9/cogent/ 0000775 0000000 0000000 00000000000 12730143670 0014475 5 ustar 00root root 0000000 0000000 pycogent-1.9/cogent/__init__.py 0000664 0000000 0000000 00000023654 12730143670 0016620 0 ustar 00root root 0000000 0000000 """The most commonly used constructors are available from this toplevel module.
The rest are in the subpackages: phylo, evolve, maths, draw, parse and format."""
import sys, os, re, cPickle
import numpy
__author__ = ""
__copyright__ = "Copyright 2007-2016, The Cogent Project"
__credits__ = ["Gavin Huttley", "Rob Knight", "Peter Maxwell",
"Jeremy Widmann", "Catherine Lozupone", "Matthew Wakefield",
"Edward Lang", "Greg Caporaso", "Mike Robeson",
"Micah Hamady", "Sandra Smit", "Zongzhi Liu",
"Andrew Butterfield", "Amanda Birmingham", "Brett Easton",
"Hua Ying", "Jason Carnes", "Raymond Sammut",
"Helen Lindsay", "Daniel McDonald"]
__license__ = "GPL"
__version__ = "1.9"
__maintainer__ = "Gavin Huttley"
__email__ = "gavin.huttley@anu.edu.au"
__status__ = "Production"
#SUPPORT2425
if sys.version_info < (2, 6):
py_version = ".".join([str(n) for n in sys.version_info])
raise RuntimeError("Python-2.6 or greater is required, Python-%s used." % py_version)
numpy_version = re.split("[^\d]", numpy.__version__)
numpy_version_info = tuple([int(i) for i in numpy_version if i.isdigit()])
if numpy_version_info < (1, 3):
raise RuntimeError("Numpy-1.3 is required, %s found." % numpy_version)
version = __version__
version_info = tuple([int(v) for v in version.split(".") if v.isdigit()])
from cogent.util.table import Table as _Table
from cogent.parse.table import load_delimited, autogen_reader
from cogent.core.tree import TreeBuilder, TreeError
from cogent.parse.tree_xml import parse_string as tree_xml_parse_string
from cogent.parse.newick import parse_string as newick_parse_string
from cogent.core.alignment import SequenceCollection
from cogent.core.alignment import Alignment
from cogent.parse.sequence import FromFilenameParser
from cogent.parse.structure import FromFilenameStructureParser
#note that moltype has to be imported last, because it sets the moltype in
#the objects created by the other modules.
from cogent.core.moltype import ASCII, DNA, RNA, PROTEIN, STANDARD_CODON, \
CodonAlphabet
def Sequence(moltype=None, seq=None, name=None, filename=None, format=None):
if seq is None:
for (a_name, a_seq) in FromFilenameParser(filename, format):
if seq is None:
seq = a_seq
if name is None:
name = a_name
else:
raise ValueError("Multiple sequences in '%s'" % filename)
if moltype is not None:
seq = moltype.makeSequence(seq)
elif not hasattr(seq, 'MolType'):
seq = ASCII.makeSequence(seq)
if name is not None:
seq.Name = name
return seq
def LoadSeqs(filename=None, format=None, data=None, moltype=None,
name=None, aligned=True, label_to_name=None, parser_kw={},
constructor_kw={}, **kw):
"""Initialize an alignment or collection of sequences.
Arguments:
- filename: name of the sequence file
- format: format of the sequence file
- data: optional explicit provision of sequences
- moltype: the MolType, eg DNA, PROTEIN
- aligned: set True if sequences are already aligned and have the same
length, results in an Alignment object. If False, a SequenceCollection
instance is returned instead. If callable, will use as a constructor
(e.g. can pass in DenseAlignment or CodonAlignment).
- label_to_name: function for converting original name into another
name. Default behavior is to preserve the original FASTA label and
comment.
To remove all FASTA label comments, and pass in only the label, pass in:
label_to_name=lambda x: x.split()[0]
To look up names in a dict, pass in:
label_to_name = lambda x: d.get(x, default_name)
...where d is a dict that's in scope, and default_name is what you want
to assign any sequence that isn't in the dict.
If format is None, will attempt to infer format from the filename
suffix. If label_to_name is None, will attempt to infer correct
conversion from the format.
"""
if filename is None:
assert data is not None
assert format is None
assert not kw, kw
else:
assert data is None, (filename, data)
data = list(FromFilenameParser(filename, format, **parser_kw))
# the following is a temp hack until we have the load API sorted out.
if aligned: #if callable, call it -- expect either f(data) or bool
if hasattr(aligned, '__call__'):
return aligned(data=data, MolType=moltype, Name=name,
label_to_name=label_to_name, **constructor_kw)
else: #was not callable, but wasn't False
return Alignment(data=data, MolType=moltype, Name=name,
label_to_name=label_to_name, **constructor_kw)
else: #generic case: return SequenceCollection
return SequenceCollection(data, MolType=moltype, Name=name,
label_to_name=label_to_name, **constructor_kw)
def LoadStructure(filename, format=None, parser_kw={}):
"""Initialize a Structure from data contained in filename.
Arguments:
- filename: name of the filename to create structure from.
- format: the optional file format extension.
- parser_kw: optional keyword arguments for the parser."""
# currently there is no support for string-input
assert filename is not None, 'No filename given.'
return FromFilenameStructureParser(filename, format, **parser_kw)
def LoadTable(filename=None, sep=',', reader=None, header=None, rows=None,
row_order=None, digits=4, space=4, title='', missing_data='',
max_width = 1e100, row_ids=False, legend='', column_templates=None,
dtype=None, static_column_types=False, limit=None, **kwargs):
"""
Arguments:
- filename: path to file containing a pickled table
- sep: the delimiting character between columns
- reader: a parser for reading filename. This approach assumes the first
row returned by the reader will be the header row.
- static_column_types: if True, and reader is None, identifies columns
with a numeric data type (int, float) from the first non-header row.
This assumes all subsequent entries in that column are of the same type.
Default is False.
- header: column headings
- rows: a 2D dict, list or tuple. If a dict, it must have column
headings as top level keys, and common row labels as keys in each
column.
- row_order: the order in which rows will be pulled from the twoDdict
- digits: floating point resolution
- space: number of spaces between columns or a string
- title: as implied
- missing_data: character assigned if a row has no entry for a column
- max_width: maximum column width for printing
- row_ids: if True, the 0'th column is used as row identifiers and keys
for slicing.
- legend: table legend
- column_templates: dict of column headings: string format templates
or a function that will handle the formatting.
- dtype: optional numpy array typecode.
- limit: exits after this many lines. Only applied for non pickled data
file types.
"""
#
if filename is not None and not (reader or static_column_types):
if filename[filename.rfind(".")+1:] == 'pickle':
f = file(filename, 'U')
loaded_table = cPickle.load(f)
f.close()
return _Table(**loaded_table)
sep = sep or kwargs.pop('delimiter', None)
header, rows, loaded_title, legend = load_delimited(filename,
delimiter = sep, limit=limit, **kwargs)
title = title or loaded_title
elif filename and (reader or static_column_types):
f = file(filename, "r")
if not reader:
reader = autogen_reader(f, sep, limit=limit,
with_title=kwargs.get('with_title', False))
rows = [row for row in reader(f)]
f.close()
header = rows.pop(0)
table = _Table(header=header, rows=rows, digits=digits, row_order=row_order,
title=title,
dtype=dtype, column_templates=column_templates, space=space,
missing_data=missing_data, max_width=max_width, row_ids=row_ids,
legend=legend)
return table
def LoadTree(filename=None, treestring=None, tip_names=None, format=None, \
underscore_unmunge=False):
"""Constructor for tree.
Arguments, use only one of:
- filename: a file containing a newick or xml formatted tree.
- treestring: a newick or xml formatted tree string.
- tip_names: a list of tip names.
Note: underscore_unmunging is turned off by default, although it is part
of the Newick format. Set underscore_unmunge to True to replace underscores
with spaces in all names read.
"""
if filename:
assert not (treestring or tip_names)
treestring = open(filename).read()
if format is None and filename.endswith('.xml'):
format = "xml"
if treestring:
assert not tip_names
if format is None and treestring.startswith('<'):
format = "xml"
if format == "xml":
parser = tree_xml_parse_string
else:
parser = newick_parse_string
tree_builder = TreeBuilder().createEdge
#FIXME: More general strategy for underscore_unmunge
if parser is newick_parse_string:
tree = parser(treestring, tree_builder, \
underscore_unmunge=underscore_unmunge)
else:
tree = parser(treestring, tree_builder)
if not tree.NameLoaded:
tree.Name = 'root'
elif tip_names:
tree_builder = TreeBuilder().createEdge
tips = [tree_builder([], tip_name, {}) for tip_name in tip_names]
tree = tree_builder(tips, 'root', {})
else:
raise TreeError, 'filename or treestring not specified'
return tree
pycogent-1.9/cogent/align/ 0000775 0000000 0000000 00000000000 12730143670 0015567 5 ustar 00root root 0000000 0000000 pycogent-1.9/cogent/align/__init__.py 0000664 0000000 0000000 00000001217 12730143670 0017701 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python
from align import make_dna_scoring_dict, _align_pairwise, \
classic_align_pairwise, local_pairwise, global_pairwise
__all__ = ['algorithm', 'align', 'dp_calculation', 'indel_model',
'indel_positions', 'pairwise', 'partial_order_graph', 'progressive',
'pycompare', 'traceback']
__author__ = ""
__copyright__ = "Copyright 2007-2016, The Cogent Project"
__credits__ = ["Peter Maxwell", "Jeremy Widmann", "Gavin Huttley",
"Rob Knight"]
__license__ = "GPL"
__version__ = "1.9"
__maintainer__ = "Gavin Huttley"
__email__ = "gavin.huttley@anu.edu.au"
__status__ = "Production"
pycogent-1.9/cogent/align/_compare.c 0000664 0000000 0000000 00000264210 12730143670 0017525 0 ustar 00root root 0000000 0000000 /* Generated by Cython 0.16 on Fri Sep 14 13:38:21 2012 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
#error Cython requires Python 2.4+.
#else
#include /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
#ifndef __stdcall
#define __stdcall
#endif
#ifndef __cdecl
#define __cdecl
#endif
#ifndef __fastcall
#define __fastcall
#endif
#endif
#ifndef DL_IMPORT
#define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
#define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
#define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
#define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if CYTHON_COMPILING_IN_PYPY
#define __Pyx_PyCFunction_Call PyObject_Call
#else
#define __Pyx_PyCFunction_Call PyCFunction_Call
#endif
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#define PY_FORMAT_SIZE_T ""
#define PyInt_FromSsize_t(z) PyInt_FromLong(z)
#define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o)
#define PyNumber_Index(o) PyNumber_Int(o)
#define PyIndex_Check(o) PyNumber_Check(o)
#define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#define __PYX_BUILD_PY_SSIZE_T "i"
#else
#define __PYX_BUILD_PY_SSIZE_T "n"
#endif
#if PY_VERSION_HEX < 0x02060000
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
#define PyVarObject_HEAD_INIT(type, size) \
PyObject_HEAD_INIT(type) size,
#define PyType_Modified(t)
typedef struct {
void *buf;
PyObject *obj;
Py_ssize_t len;
Py_ssize_t itemsize;
int readonly;
int ndim;
char *format;
Py_ssize_t *shape;
Py_ssize_t *strides;
Py_ssize_t *suboffsets;
void *internal;
} Py_buffer;
#define PyBUF_SIMPLE 0
#define PyBUF_WRITABLE 0x0001
#define PyBUF_FORMAT 0x0004
#define PyBUF_ND 0x0008
#define PyBUF_STRIDES (0x0010 | PyBUF_ND)
#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
#define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
#define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#if PY_MAJOR_VERSION < 3
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#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
#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
#define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#endif
#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_CHECKTYPES 0
#define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH)
#define CYTHON_PEP393_ENABLED 1
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#else
#define CYTHON_PEP393_ENABLED 0
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBaseString_Type PyUnicode_Type
#define PyStringObject PyUnicodeObject
#define PyString_Type PyUnicode_Type
#define PyString_Check PyUnicode_Check
#define PyString_CheckExact PyUnicode_CheckExact
#endif
#if PY_VERSION_HEX < 0x02060000
#define PyBytesObject PyStringObject
#define PyBytes_Type PyString_Type
#define PyBytes_Check PyString_Check
#define PyBytes_CheckExact PyString_CheckExact
#define PyBytes_FromString PyString_FromString
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
#define PyBytes_FromFormat PyString_FromFormat
#define PyBytes_DecodeEscape PyString_DecodeEscape
#define PyBytes_AsString PyString_AsString
#define PyBytes_AsStringAndSize PyString_AsStringAndSize
#define PyBytes_Size PyString_Size
#define PyBytes_AS_STRING PyString_AS_STRING
#define PyBytes_GET_SIZE PyString_GET_SIZE
#define PyBytes_Repr PyString_Repr
#define PyBytes_Concat PyString_Concat
#define PyBytes_ConcatAndDel PyString_ConcatAndDel
#endif
#if PY_VERSION_HEX < 0x02060000
#define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
#define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
#define PyIntObject PyLongObject
#define PyInt_Type PyLong_Type
#define PyInt_Check(op) PyLong_Check(op)
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
#define PyInt_FromString PyLong_FromString
#define PyInt_FromUnicode PyLong_FromUnicode
#define PyInt_FromLong PyLong_FromLong
#define PyInt_FromSize_t PyLong_FromSize_t
#define PyInt_FromSsize_t PyLong_FromSsize_t
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AS_LONG PyLong_AS_LONG
#define PyInt_AsSsize_t PyLong_AsSsize_t
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBoolObject PyLongObject
#endif
#if PY_VERSION_HEX < 0x03020000
typedef long Py_hash_t;
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
#else
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
#endif
#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
#define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
#define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
#define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
#define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
#define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
#define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif
#if PY_MAJOR_VERSION >= 3
#define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
#if PY_VERSION_HEX < 0x02050000
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
#else
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
#define __Pyx_NAMESTR(n) ((char *)(n))
#define __Pyx_DOCSTR(n) ((char *)(n))
#else
#define __Pyx_NAMESTR(n) (n)
#define __Pyx_DOCSTR(n) (n)
#endif
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
#else
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
#endif
#ifndef __PYX_EXTERN_C
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#endif
#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include
#define __PYX_HAVE__cogent__align___compare
#define __PYX_HAVE_API__cogent__align___compare
#ifdef _OPENMP
#include
#endif /* _OPENMP */
#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif
/* inline attribute */
#ifndef CYTHON_INLINE
#if defined(__GNUC__)
#define CYTHON_INLINE __inline__
#elif defined(_MSC_VER)
#define CYTHON_INLINE __inline
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define CYTHON_INLINE inline
#else
#define CYTHON_INLINE
#endif
#endif
/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
/* Type Conversion Predeclarations */
#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
static const char *__pyx_f[] = {
"_compare.pyx",
};
/*--- Type declarations ---*/
#ifndef CYTHON_REFNANNY
#define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
typedef struct {
void (*INCREF)(void*, PyObject*, int);
void (*DECREF)(void*, PyObject*, int);
void (*GOTREF)(void*, PyObject*, int);
void (*GIVEREF)(void*, PyObject*, int);
void* (*SetupContext)(const char*, int, const char*);
void (*FinishContext)(void**);
} __Pyx_RefNannyAPIStruct;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
if (acquire_gil) { \
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
PyGILState_Release(__pyx_gilstate_save); \
} else { \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
}
#else
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
#define __Pyx_RefNannyFinishContext() \
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
#define __Pyx_RefNannyDeclarations
#define __Pyx_RefNannySetupContext(name, acquire_gil)
#define __Pyx_RefNannyFinishContext()
#define __Pyx_INCREF(r) Py_INCREF(r)
#define __Pyx_DECREF(r) Py_DECREF(r)
#define __Pyx_GOTREF(r)
#define __Pyx_GIVEREF(r)
#define __Pyx_XINCREF(r) Py_XINCREF(r)
#define __Pyx_XDECREF(r) Py_XDECREF(r)
#define __Pyx_XGOTREF(r)
#define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
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); /*proto*/
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
const char* function_name); /*proto*/
#include
static CYTHON_INLINE int __Pyx_mod_int(int, int); /* proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_Pop(PyObject* L) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02040000
if (likely(PyList_CheckExact(L))
&& likely(PyList_GET_SIZE(L) > (((PyListObject*)L)->allocated >> 1))) {
Py_SIZE(L) -= 1;
return PyList_GET_ITEM(L, PyList_GET_SIZE(L));
}
#if PY_VERSION_HEX >= 0x02050000
else if (Py_TYPE(L) == (&PySet_Type)) {
return PySet_Pop(L);
}
#endif
#endif
return PyObject_CallMethod(L, (char*)"pop", NULL);
}
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
static int __Pyx_check_binary_version(void);
typedef struct {
int code_line;
PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
int count;
int max_count;
__Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename); /*proto*/
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Module declarations from 'cogent.align._compare' */
static int __pyx_f_6cogent_5align_8_compare_cmax(int, int); /*proto*/
static int __pyx_f_6cogent_5align_8_compare_cmin(int, int); /*proto*/
#define __Pyx_MODULE_NAME "cogent.align._compare"
int __pyx_module_is_main_cogent__align___compare = 0;
/* Implementation of 'cogent.align._compare' */
static PyObject *__pyx_pf_6cogent_5align_8_compare_segments_from_diagonal(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_seq1, char *__pyx_v_seq2, int __pyx_v_window, int __pyx_v_threshold, int __pyx_v_min_gap_length, int __pyx_v_diagonal); /* proto */
static char __pyx_k_1[] = "50x speedup for dotplots, but sequences must be strings and scoring is based on identity only\n";
static char __pyx_k_3[] = "('1', '5', '3-dev')";
static char __pyx_k_6[] = "segments_from_diagonal";
static char __pyx_k_7[] = "/Users/jrideout/.virtualenvs/pycogent/trunk/cogent/align/_compare.pyx";
static char __pyx_k_8[] = "cogent.align._compare";
static char __pyx_k__i[] = "i";
static char __pyx_k__j[] = "j";
static char __pyx_k__k[] = "k";
static char __pyx_k__i_hi[] = "i_hi";
static char __pyx_k__i_lo[] = "i_lo";
static char __pyx_k__len1[] = "len1";
static char __pyx_k__len2[] = "len2";
static char __pyx_k__seq1[] = "seq1";
static char __pyx_k__seq2[] = "seq2";
static char __pyx_k__score[] = "score";
static char __pyx_k__start[] = "start";
static char __pyx_k__result[] = "result";
static char __pyx_k__scores[] = "scores";
static char __pyx_k__window[] = "window";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__diagonal[] = "diagonal";
static char __pyx_k__was_high[] = "was_high";
static char __pyx_k__prior_end[] = "prior_end";
static char __pyx_k__threshold[] = "threshold";
static char __pyx_k__jumped_end[] = "jumped_end";
static char __pyx_k____version__[] = "__version__";
static char __pyx_k__version_info[] = "version_info";
static char __pyx_k__min_gap_length[] = "min_gap_length";
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_n_s_6;
static PyObject *__pyx_kp_s_7;
static PyObject *__pyx_n_s_8;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s____version__;
static PyObject *__pyx_n_s__diagonal;
static PyObject *__pyx_n_s__i;
static PyObject *__pyx_n_s__i_hi;
static PyObject *__pyx_n_s__i_lo;
static PyObject *__pyx_n_s__j;
static PyObject *__pyx_n_s__jumped_end;
static PyObject *__pyx_n_s__k;
static PyObject *__pyx_n_s__len1;
static PyObject *__pyx_n_s__len2;
static PyObject *__pyx_n_s__min_gap_length;
static PyObject *__pyx_n_s__prior_end;
static PyObject *__pyx_n_s__result;
static PyObject *__pyx_n_s__score;
static PyObject *__pyx_n_s__scores;
static PyObject *__pyx_n_s__seq1;
static PyObject *__pyx_n_s__seq2;
static PyObject *__pyx_n_s__start;
static PyObject *__pyx_n_s__threshold;
static PyObject *__pyx_n_s__version_info;
static PyObject *__pyx_n_s__was_high;
static PyObject *__pyx_n_s__window;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_3;
static PyObject *__pyx_k_tuple_2;
static PyObject *__pyx_k_tuple_4;
static PyObject *__pyx_k_codeobj_5;
/* "cogent/align/_compare.pyx":7
* __version__ = "('1', '5', '3-dev')"
*
* cdef int cmax(int a, int b): # <<<<<<<<<<<<<<
* if a > b:
* return a
*/
static int __pyx_f_6cogent_5align_8_compare_cmax(int __pyx_v_a, int __pyx_v_b) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("cmax", 0);
/* "cogent/align/_compare.pyx":8
*
* cdef int cmax(int a, int b):
* if a > b: # <<<<<<<<<<<<<<
* return a
* else:
*/
__pyx_t_1 = (__pyx_v_a > __pyx_v_b);
if (__pyx_t_1) {
/* "cogent/align/_compare.pyx":9
* cdef int cmax(int a, int b):
* if a > b:
* return a # <<<<<<<<<<<<<<
* else:
* return b
*/
__pyx_r = __pyx_v_a;
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
/* "cogent/align/_compare.pyx":11
* return a
* else:
* return b # <<<<<<<<<<<<<<
*
* cdef int cmin(int a, int b):
*/
__pyx_r = __pyx_v_b;
goto __pyx_L0;
}
__pyx_L3:;
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "cogent/align/_compare.pyx":13
* return b
*
* cdef int cmin(int a, int b): # <<<<<<<<<<<<<<
* if a < b:
* return a
*/
static int __pyx_f_6cogent_5align_8_compare_cmin(int __pyx_v_a, int __pyx_v_b) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("cmin", 0);
/* "cogent/align/_compare.pyx":14
*
* cdef int cmin(int a, int b):
* if a < b: # <<<<<<<<<<<<<<
* return a
* else:
*/
__pyx_t_1 = (__pyx_v_a < __pyx_v_b);
if (__pyx_t_1) {
/* "cogent/align/_compare.pyx":15
* cdef int cmin(int a, int b):
* if a < b:
* return a # <<<<<<<<<<<<<<
* else:
* return b
*/
__pyx_r = __pyx_v_a;
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
/* "cogent/align/_compare.pyx":17
* return a
* else:
* return b # <<<<<<<<<<<<<<
*
* def segments_from_diagonal(
*/
__pyx_r = __pyx_v_b;
goto __pyx_L0;
}
__pyx_L3:;
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6cogent_5align_8_compare_1segments_from_diagonal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cogent_5align_8_compare_segments_from_diagonal[] = "List of ((x1,y1), (x2,y2)) for diagonal line segments scoring >= threshold/window";
static PyMethodDef __pyx_mdef_6cogent_5align_8_compare_1segments_from_diagonal = {__Pyx_NAMESTR("segments_from_diagonal"), (PyCFunction)__pyx_pw_6cogent_5align_8_compare_1segments_from_diagonal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cogent_5align_8_compare_segments_from_diagonal)};
static PyObject *__pyx_pw_6cogent_5align_8_compare_1segments_from_diagonal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
char *__pyx_v_seq1;
char *__pyx_v_seq2;
int __pyx_v_window;
int __pyx_v_threshold;
int __pyx_v_min_gap_length;
int __pyx_v_diagonal;
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__seq1,&__pyx_n_s__seq2,&__pyx_n_s__window,&__pyx_n_s__threshold,&__pyx_n_s__min_gap_length,&__pyx_n_s__diagonal,0};
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("segments_from_diagonal (wrapper)", 0);
__pyx_self = __pyx_self;
{
PyObject* values[6] = {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 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seq1);
if (likely(values[0])) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seq2);
if (likely(values[1])) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("segments_from_diagonal", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__window);
if (likely(values[2])) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("segments_from_diagonal", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__threshold);
if (likely(values[3])) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("segments_from_diagonal", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 4:
values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__min_gap_length);
if (likely(values[4])) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("segments_from_diagonal", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 5:
values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__diagonal);
if (likely(values[5])) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("segments_from_diagonal", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "segments_from_diagonal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
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);
values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
}
__pyx_v_seq1 = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_seq1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_seq2 = PyBytes_AsString(values[1]); if (unlikely((!__pyx_v_seq2) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_window = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_window == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_threshold = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_threshold == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_min_gap_length = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_min_gap_length == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_diagonal = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_diagonal == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("segments_from_diagonal", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cogent.align._compare.segments_from_diagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6cogent_5align_8_compare_segments_from_diagonal(__pyx_self, __pyx_v_seq1, __pyx_v_seq2, __pyx_v_window, __pyx_v_threshold, __pyx_v_min_gap_length, __pyx_v_diagonal);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "cogent/align/_compare.pyx":19
* return b
*
* def segments_from_diagonal( # <<<<<<<<<<<<<<
* char seq1[],
* char seq2[],
*/
static PyObject *__pyx_pf_6cogent_5align_8_compare_segments_from_diagonal(CYTHON_UNUSED PyObject *__pyx_self, char *__pyx_v_seq1, char *__pyx_v_seq2, int __pyx_v_window, int __pyx_v_threshold, int __pyx_v_min_gap_length, int __pyx_v_diagonal) {
int __pyx_v_was_high;
int __pyx_v_score;
int __pyx_v_i;
int __pyx_v_i_lo;
int __pyx_v_i_hi;
int __pyx_v_j;
int __pyx_v_k;
int __pyx_v_start;
int __pyx_v_prior_end;
int __pyx_v_len1;
int __pyx_v_len2;
int __pyx_v_scores[100];
PyObject *__pyx_v_result = NULL;
CYTHON_UNUSED PyObject *__pyx_v_jumped_end = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
size_t __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *(*__pyx_t_8)(PyObject *);
int __pyx_t_9;
int __pyx_t_10;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("segments_from_diagonal", 0);
/* "cogent/align/_compare.pyx":31
* cdef int len1, len2
* cdef int scores[100] # yuk - use malloc?
* assert window < 100 # <<<<<<<<<<<<<<
* len1 = len(seq1)
* len2 = len(seq2)
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
if (unlikely(!(__pyx_v_window < 100))) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "cogent/align/_compare.pyx":32
* cdef int scores[100] # yuk - use malloc?
* assert window < 100
* len1 = len(seq1) # <<<<<<<<<<<<<<
* len2 = len(seq2)
* result = []
*/
__pyx_t_1 = strlen(__pyx_v_seq1);
__pyx_v_len1 = __pyx_t_1;
/* "cogent/align/_compare.pyx":33
* assert window < 100
* len1 = len(seq1)
* len2 = len(seq2) # <<<<<<<<<<<<<<
* result = []
* was_high = 0
*/
__pyx_t_1 = strlen(__pyx_v_seq2);
__pyx_v_len2 = __pyx_t_1;
/* "cogent/align/_compare.pyx":34
* len1 = len(seq1)
* len2 = len(seq2)
* result = [] # <<<<<<<<<<<<<<
* was_high = 0
* for i from 0 <= i < window:
*/
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_v_result = __pyx_t_2;
__pyx_t_2 = 0;
/* "cogent/align/_compare.pyx":35
* len2 = len(seq2)
* result = []
* was_high = 0 # <<<<<<<<<<<<<<
* for i from 0 <= i < window:
* scores[i] = 0
*/
__pyx_v_was_high = 0;
/* "cogent/align/_compare.pyx":36
* result = []
* was_high = 0
* for i from 0 <= i < window: # <<<<<<<<<<<<<<
* scores[i] = 0
* score = 0
*/
__pyx_t_3 = __pyx_v_window;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
/* "cogent/align/_compare.pyx":37
* was_high = 0
* for i from 0 <= i < window:
* scores[i] = 0 # <<<<<<<<<<<<<<
* score = 0
* i_lo = cmax(0, 0-diagonal)
*/
(__pyx_v_scores[__pyx_v_i]) = 0;
}
/* "cogent/align/_compare.pyx":38
* for i from 0 <= i < window:
* scores[i] = 0
* score = 0 # <<<<<<<<<<<<<<
* i_lo = cmax(0, 0-diagonal)
* i_hi = cmin(len1, len2-diagonal)
*/
__pyx_v_score = 0;
/* "cogent/align/_compare.pyx":39
* scores[i] = 0
* score = 0
* i_lo = cmax(0, 0-diagonal) # <<<<<<<<<<<<<<
* i_hi = cmin(len1, len2-diagonal)
* prior_end = 0
*/
__pyx_v_i_lo = __pyx_f_6cogent_5align_8_compare_cmax(0, (0 - __pyx_v_diagonal));
/* "cogent/align/_compare.pyx":40
* score = 0
* i_lo = cmax(0, 0-diagonal)
* i_hi = cmin(len1, len2-diagonal) # <<<<<<<<<<<<<<
* prior_end = 0
* for i from i_lo <= i < i_hi:
*/
__pyx_v_i_hi = __pyx_f_6cogent_5align_8_compare_cmin(__pyx_v_len1, (__pyx_v_len2 - __pyx_v_diagonal));
/* "cogent/align/_compare.pyx":41
* i_lo = cmax(0, 0-diagonal)
* i_hi = cmin(len1, len2-diagonal)
* prior_end = 0 # <<<<<<<<<<<<<<
* for i from i_lo <= i < i_hi:
* j = i + diagonal
*/
__pyx_v_prior_end = 0;
/* "cogent/align/_compare.pyx":42
* i_hi = cmin(len1, len2-diagonal)
* prior_end = 0
* for i from i_lo <= i < i_hi: # <<<<<<<<<<<<<<
* j = i + diagonal
* k = i % window
*/
__pyx_t_3 = __pyx_v_i_hi;
for (__pyx_v_i = __pyx_v_i_lo; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
/* "cogent/align/_compare.pyx":43
* prior_end = 0
* for i from i_lo <= i < i_hi:
* j = i + diagonal # <<<<<<<<<<<<<<
* k = i % window
* score -= scores[k]
*/
__pyx_v_j = (__pyx_v_i + __pyx_v_diagonal);
/* "cogent/align/_compare.pyx":44
* for i from i_lo <= i < i_hi:
* j = i + diagonal
* k = i % window # <<<<<<<<<<<<<<
* score -= scores[k]
* scores[k] = (seq1[i] == seq2[j])
*/
if (unlikely(__pyx_v_window == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_k = __Pyx_mod_int(__pyx_v_i, __pyx_v_window);
/* "cogent/align/_compare.pyx":45
* j = i + diagonal
* k = i % window
* score -= scores[k] # <<<<<<<<<<<<<<
* scores[k] = (seq1[i] == seq2[j])
* score += scores[k]
*/
__pyx_v_score = (__pyx_v_score - (__pyx_v_scores[__pyx_v_k]));
/* "cogent/align/_compare.pyx":46
* k = i % window
* score -= scores[k]
* scores[k] = (seq1[i] == seq2[j]) # <<<<<<<<<<<<<<
* score += scores[k]
* if score >= threshold:
*/
(__pyx_v_scores[__pyx_v_k]) = ((__pyx_v_seq1[__pyx_v_i]) == (__pyx_v_seq2[__pyx_v_j]));
/* "cogent/align/_compare.pyx":47
* score -= scores[k]
* scores[k] = (seq1[i] == seq2[j])
* score += scores[k] # <<<<<<<<<<<<<<
* if score >= threshold:
* if not was_high:
*/
__pyx_v_score = (__pyx_v_score + (__pyx_v_scores[__pyx_v_k]));
/* "cogent/align/_compare.pyx":48
* scores[k] = (seq1[i] == seq2[j])
* score += scores[k]
* if score >= threshold: # <<<<<<<<<<<<<<
* if not was_high:
* start = cmax(i_lo, i - window)
*/
__pyx_t_4 = (__pyx_v_score >= __pyx_v_threshold);
if (__pyx_t_4) {
/* "cogent/align/_compare.pyx":49
* score += scores[k]
* if score >= threshold:
* if not was_high: # <<<<<<<<<<<<<<
* start = cmax(i_lo, i - window)
* if min_gap_length and prior_end:
*/
__pyx_t_4 = (!__pyx_v_was_high);
if (__pyx_t_4) {
/* "cogent/align/_compare.pyx":50
* if score >= threshold:
* if not was_high:
* start = cmax(i_lo, i - window) # <<<<<<<<<<<<<<
* if min_gap_length and prior_end:
* if start < prior_end + min_gap_length:
*/
__pyx_v_start = __pyx_f_6cogent_5align_8_compare_cmax(__pyx_v_i_lo, (__pyx_v_i - __pyx_v_window));
/* "cogent/align/_compare.pyx":51
* if not was_high:
* start = cmax(i_lo, i - window)
* if min_gap_length and prior_end: # <<<<<<<<<<<<<<
* if start < prior_end + min_gap_length:
* (start, jumped_end) = result.pop()
*/
if (__pyx_v_min_gap_length) {
__pyx_t_4 = __pyx_v_prior_end;
} else {
__pyx_t_4 = __pyx_v_min_gap_length;
}
if (__pyx_t_4) {
/* "cogent/align/_compare.pyx":52
* start = cmax(i_lo, i - window)
* if min_gap_length and prior_end:
* if start < prior_end + min_gap_length: # <<<<<<<<<<<<<<
* (start, jumped_end) = result.pop()
* was_high = 1
*/
__pyx_t_4 = (__pyx_v_start < (__pyx_v_prior_end + __pyx_v_min_gap_length));
if (__pyx_t_4) {
/* "cogent/align/_compare.pyx":53
* if min_gap_length and prior_end:
* if start < prior_end + min_gap_length:
* (start, jumped_end) = result.pop() # <<<<<<<<<<<<<<
* was_high = 1
* else:
*/
__pyx_t_2 = __Pyx_PyObject_Pop(((PyObject *)__pyx_v_result)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
PyObject* sequence = __pyx_t_2;
if (likely(PyTuple_CheckExact(sequence))) {
if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_6 = PyTuple_GET_ITEM(sequence, 1);
} else {
if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_5 = PyList_GET_ITEM(sequence, 0);
__pyx_t_6 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_5);
__Pyx_INCREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
} else {
Py_ssize_t index = -1;
__pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L11_unpacking_failed;
__Pyx_GOTREF(__pyx_t_5);
index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L11_unpacking_failed;
__Pyx_GOTREF(__pyx_t_6);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L12_unpacking_done;
__pyx_L11_unpacking_failed:;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L12_unpacking_done:;
}
__pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_v_start = __pyx_t_9;
__Pyx_XDECREF(__pyx_v_jumped_end);
__pyx_v_jumped_end = __pyx_t_6;
__pyx_t_6 = 0;
goto __pyx_L10;
}
__pyx_L10:;
goto __pyx_L9;
}
__pyx_L9:;
/* "cogent/align/_compare.pyx":54
* if start < prior_end + min_gap_length:
* (start, jumped_end) = result.pop()
* was_high = 1 # <<<<<<<<<<<<<<
* else:
* if was_high:
*/
__pyx_v_was_high = 1;
goto __pyx_L8;
}
__pyx_L8:;
goto __pyx_L7;
}
/*else*/ {
/* "cogent/align/_compare.pyx":56
* was_high = 1
* else:
* if was_high: # <<<<<<<<<<<<<<
* result.append((start, i))
* prior_end = i
*/
if (__pyx_v_was_high) {
/* "cogent/align/_compare.pyx":57
* else:
* if was_high:
* result.append((start, i)) # <<<<<<<<<<<<<<
* prior_end = i
* was_high = 0
*/
__pyx_t_2 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_6 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
__pyx_t_2 = 0;
__pyx_t_6 = 0;
__pyx_t_10 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_5)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
/* "cogent/align/_compare.pyx":58
* if was_high:
* result.append((start, i))
* prior_end = i # <<<<<<<<<<<<<<
* was_high = 0
* if was_high:
*/
__pyx_v_prior_end = __pyx_v_i;
/* "cogent/align/_compare.pyx":59
* result.append((start, i))
* prior_end = i
* was_high = 0 # <<<<<<<<<<<<<<
* if was_high:
* result.append((start, i_hi))
*/
__pyx_v_was_high = 0;
goto __pyx_L13;
}
__pyx_L13:;
}
__pyx_L7:;
}
/* "cogent/align/_compare.pyx":60
* prior_end = i
* was_high = 0
* if was_high: # <<<<<<<<<<<<<<
* result.append((start, i_hi))
* return result
*/
if (__pyx_v_was_high) {
/* "cogent/align/_compare.pyx":61
* was_high = 0
* if was_high:
* result.append((start, i_hi)) # <<<<<<<<<<<<<<
* return result
*/
__pyx_t_5 = PyInt_FromLong(__pyx_v_start); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_6 = PyInt_FromLong(__pyx_v_i_hi); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6);
__Pyx_GIVEREF(__pyx_t_6);
__pyx_t_5 = 0;
__pyx_t_6 = 0;
__pyx_t_10 = PyList_Append(__pyx_v_result, ((PyObject *)__pyx_t_2)); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
goto __pyx_L14;
}
__pyx_L14:;
/* "cogent/align/_compare.pyx":62
* if was_high:
* result.append((start, i_hi))
* return result # <<<<<<<<<<<<<<
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_result));
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("cogent.align._compare.segments_from_diagonal", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_result);
__Pyx_XDECREF(__pyx_v_jumped_end);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyMethodDef __pyx_methods[] = {
{0, 0, 0, 0}
};
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
PyModuleDef_HEAD_INIT,
__Pyx_NAMESTR("_compare"),
__Pyx_DOCSTR(__pyx_k_1), /* m_doc */
-1, /* m_size */
__pyx_methods /* m_methods */,
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL /* m_free */
};
#endif
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
{&__pyx_n_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 1},
{&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
{&__pyx_n_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 1},
{&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
{&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
{&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1},
{&__pyx_n_s__diagonal, __pyx_k__diagonal, sizeof(__pyx_k__diagonal), 0, 0, 1, 1},
{&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
{&__pyx_n_s__i_hi, __pyx_k__i_hi, sizeof(__pyx_k__i_hi), 0, 0, 1, 1},
{&__pyx_n_s__i_lo, __pyx_k__i_lo, sizeof(__pyx_k__i_lo), 0, 0, 1, 1},
{&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1},
{&__pyx_n_s__jumped_end, __pyx_k__jumped_end, sizeof(__pyx_k__jumped_end), 0, 0, 1, 1},
{&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1},
{&__pyx_n_s__len1, __pyx_k__len1, sizeof(__pyx_k__len1), 0, 0, 1, 1},
{&__pyx_n_s__len2, __pyx_k__len2, sizeof(__pyx_k__len2), 0, 0, 1, 1},
{&__pyx_n_s__min_gap_length, __pyx_k__min_gap_length, sizeof(__pyx_k__min_gap_length), 0, 0, 1, 1},
{&__pyx_n_s__prior_end, __pyx_k__prior_end, sizeof(__pyx_k__prior_end), 0, 0, 1, 1},
{&__pyx_n_s__result, __pyx_k__result, sizeof(__pyx_k__result), 0, 0, 1, 1},
{&__pyx_n_s__score, __pyx_k__score, sizeof(__pyx_k__score), 0, 0, 1, 1},
{&__pyx_n_s__scores, __pyx_k__scores, sizeof(__pyx_k__scores), 0, 0, 1, 1},
{&__pyx_n_s__seq1, __pyx_k__seq1, sizeof(__pyx_k__seq1), 0, 0, 1, 1},
{&__pyx_n_s__seq2, __pyx_k__seq2, sizeof(__pyx_k__seq2), 0, 0, 1, 1},
{&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
{&__pyx_n_s__threshold, __pyx_k__threshold, sizeof(__pyx_k__threshold), 0, 0, 1, 1},
{&__pyx_n_s__version_info, __pyx_k__version_info, sizeof(__pyx_k__version_info), 0, 0, 1, 1},
{&__pyx_n_s__was_high, __pyx_k__was_high, sizeof(__pyx_k__was_high), 0, 0, 1, 1},
{&__pyx_n_s__window, __pyx_k__window, sizeof(__pyx_k__window), 0, 0, 1, 1},
{0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
return 0;
}
static int __Pyx_InitCachedConstants(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
/* "cogent/align/_compare.pyx":4
* """
*
* version_info = (1, 3) # <<<<<<<<<<<<<<
* __version__ = "('1', '5', '3-dev')"
*
*/
__pyx_k_tuple_2 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_2);
__Pyx_INCREF(__pyx_int_1);
PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, __pyx_int_1);
__Pyx_GIVEREF(__pyx_int_1);
__Pyx_INCREF(__pyx_int_3);
PyTuple_SET_ITEM(__pyx_k_tuple_2, 1, __pyx_int_3);
__Pyx_GIVEREF(__pyx_int_3);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
/* "cogent/align/_compare.pyx":19
* return b
*
* def segments_from_diagonal( # <<<<<<<<<<<<<<
* char seq1[],
* char seq2[],
*/
__pyx_k_tuple_4 = PyTuple_New(20); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_4);
__Pyx_INCREF(((PyObject *)__pyx_n_s__seq1));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_n_s__seq1));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__seq1));
__Pyx_INCREF(((PyObject *)__pyx_n_s__seq2));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 1, ((PyObject *)__pyx_n_s__seq2));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__seq2));
__Pyx_INCREF(((PyObject *)__pyx_n_s__window));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 2, ((PyObject *)__pyx_n_s__window));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__window));
__Pyx_INCREF(((PyObject *)__pyx_n_s__threshold));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 3, ((PyObject *)__pyx_n_s__threshold));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__threshold));
__Pyx_INCREF(((PyObject *)__pyx_n_s__min_gap_length));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 4, ((PyObject *)__pyx_n_s__min_gap_length));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__min_gap_length));
__Pyx_INCREF(((PyObject *)__pyx_n_s__diagonal));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 5, ((PyObject *)__pyx_n_s__diagonal));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__diagonal));
__Pyx_INCREF(((PyObject *)__pyx_n_s__was_high));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 6, ((PyObject *)__pyx_n_s__was_high));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__was_high));
__Pyx_INCREF(((PyObject *)__pyx_n_s__score));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 7, ((PyObject *)__pyx_n_s__score));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__score));
__Pyx_INCREF(((PyObject *)__pyx_n_s__i));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 8, ((PyObject *)__pyx_n_s__i));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
__Pyx_INCREF(((PyObject *)__pyx_n_s__i_lo));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 9, ((PyObject *)__pyx_n_s__i_lo));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__i_lo));
__Pyx_INCREF(((PyObject *)__pyx_n_s__i_hi));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 10, ((PyObject *)__pyx_n_s__i_hi));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__i_hi));
__Pyx_INCREF(((PyObject *)__pyx_n_s__j));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 11, ((PyObject *)__pyx_n_s__j));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
__Pyx_INCREF(((PyObject *)__pyx_n_s__k));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 12, ((PyObject *)__pyx_n_s__k));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__k));
__Pyx_INCREF(((PyObject *)__pyx_n_s__start));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 13, ((PyObject *)__pyx_n_s__start));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__start));
__Pyx_INCREF(((PyObject *)__pyx_n_s__prior_end));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 14, ((PyObject *)__pyx_n_s__prior_end));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__prior_end));
__Pyx_INCREF(((PyObject *)__pyx_n_s__len1));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 15, ((PyObject *)__pyx_n_s__len1));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__len1));
__Pyx_INCREF(((PyObject *)__pyx_n_s__len2));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 16, ((PyObject *)__pyx_n_s__len2));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__len2));
__Pyx_INCREF(((PyObject *)__pyx_n_s__scores));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 17, ((PyObject *)__pyx_n_s__scores));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__scores));
__Pyx_INCREF(((PyObject *)__pyx_n_s__result));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 18, ((PyObject *)__pyx_n_s__result));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__result));
__Pyx_INCREF(((PyObject *)__pyx_n_s__jumped_end));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 19, ((PyObject *)__pyx_n_s__jumped_end));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__jumped_end));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
__pyx_k_codeobj_5 = (PyObject*)__Pyx_PyCode_New(6, 0, 20, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_7, __pyx_n_s_6, 19, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
__Pyx_RefNannyFinishContext();
return -1;
}
static int __Pyx_InitGlobals(void) {
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
return 0;
__pyx_L1_error:;
return -1;
}
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_compare(void); /*proto*/
PyMODINIT_FUNC init_compare(void)
#else
PyMODINIT_FUNC PyInit__compare(void); /*proto*/
PyMODINIT_FUNC PyInit__compare(void)
#endif
{
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannyDeclarations
#if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
PyErr_Clear();
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
if (!__Pyx_RefNanny)
Py_FatalError("failed to import 'refnanny' module");
}
#endif
__Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__compare(void)", 0);
if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#ifdef __Pyx_CyFunction_USED
if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_FusedFunction_USED
if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_Generator_USED
if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
/*--- Library function declarations ---*/
/*--- Threads initialization code ---*/
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
#ifdef WITH_THREAD /* Python build with threading support? */
PyEval_InitThreads();
#endif
#endif
/*--- Module creation code ---*/
#if PY_MAJOR_VERSION < 3
__pyx_m = Py_InitModule4(__Pyx_NAMESTR("_compare"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_1), 0, PYTHON_API_VERSION);
#else
__pyx_m = PyModule_Create(&__pyx_moduledef);
#endif
if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
#if PY_MAJOR_VERSION < 3
Py_INCREF(__pyx_m);
#endif
__pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
/*--- Initialize various global constants etc. ---*/
if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_module_is_main_cogent__align___compare) {
if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
/*--- Builtin init code ---*/
if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Constants init code ---*/
if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Global init code ---*/
/*--- Variable export code ---*/
/*--- Function export code ---*/
/*--- Type init code ---*/
/*--- Type import code ---*/
/*--- Variable import code ---*/
/*--- Function import code ---*/
/*--- Execution code ---*/
/* "cogent/align/_compare.pyx":4
* """
*
* version_info = (1, 3) # <<<<<<<<<<<<<<
* __version__ = "('1', '5', '3-dev')"
*
*/
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__version_info, ((PyObject *)__pyx_k_tuple_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_compare.pyx":5
*
* version_info = (1, 3)
* __version__ = "('1', '5', '3-dev')" # <<<<<<<<<<<<<<
*
* cdef int cmax(int a, int b):
*/
if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_compare.pyx":19
* return b
*
* def segments_from_diagonal( # <<<<<<<<<<<<<<
* char seq1[],
* char seq2[],
*/
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6cogent_5align_8_compare_1segments_from_diagonal, NULL, __pyx_n_s_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s_6, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "cogent/align/_compare.pyx":1
* """50x speedup for dotplots, but sequences must be strings and scoring is based on identity only # <<<<<<<<<<<<<<
* """
*
*/
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
if (__pyx_m) {
__Pyx_AddTraceback("init cogent.align._compare", __pyx_clineno, __pyx_lineno, __pyx_filename);
Py_DECREF(__pyx_m); __pyx_m = 0;
} else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_ImportError, "init cogent.align._compare");
}
__pyx_L0:;
__Pyx_RefNannyFinishContext();
#if PY_MAJOR_VERSION < 3
return;
#else
return __pyx_m;
#endif
}
/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
PyObject *m = NULL, *p = NULL;
void *r = NULL;
m = PyImport_ImportModule((char *)modname);
if (!m) goto end;
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
if (!p) goto end;
r = PyLong_AsVoidPtr(p);
end:
Py_XDECREF(p);
Py_XDECREF(m);
return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */
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,
"%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
func_name, more_or_less, num_expected,
(num_expected == 1) ? "" : "s", num_found);
}
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_AS_STRING(kw_name));
#endif
}
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;
} else {
#if PY_MAJOR_VERSION < 3
if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
#else
if (unlikely(!PyUnicode_Check(key))) {
#endif
goto invalid_keyword_type;
} else {
for (name = first_kw_arg; *name; name++) {
#if PY_MAJOR_VERSION >= 3
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
PyUnicode_Compare(**name, key) == 0) break;
#else
if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
_PyString_Eq(**name, key)) break;
#endif
}
if (*name) {
values[name-argnames] = value;
} else {
for (name=argnames; name != first_kw_arg; name++) {
if (**name == key) goto arg_passed_twice;
#if PY_MAJOR_VERSION >= 3
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
#else
if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
_PyString_Eq(**name, key)) goto arg_passed_twice;
#endif
}
if (kwds2) {
if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
} else {
goto invalid_keyword;
}
}
}
}
}
return 0;
arg_passed_twice:
__Pyx_RaiseDoubleKeywordsError(function_name, **name);
goto bad;
invalid_keyword_type:
PyErr_Format(PyExc_TypeError,
"%s() keywords must be strings", function_name);
goto bad;
invalid_keyword:
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
"%s() got an unexpected keyword argument '%s'",
function_name, PyString_AsString(key));
#else
"%s() got an unexpected keyword argument '%U'",
function_name, key);
#endif
bad:
return -1;
}
static CYTHON_INLINE int __Pyx_mod_int(int a, int b) {
int r = a % b;
r += ((r != 0) & ((r ^ b) < 0)) * b;
return r;
}
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
PyErr_Format(PyExc_ValueError,
"need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
index, (index == 1) ? "" : "s");
}
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
PyErr_Format(PyExc_ValueError,
"too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
}
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
if (unlikely(retval)) {
Py_DECREF(retval);
__Pyx_RaiseTooManyValuesError(expected);
return -1;
} else if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
PyErr_Clear();
return 0;
} else {
return -1;
}
}
return 0;
}
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(unsigned char) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(unsigned char)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to unsigned char" :
"value too large to convert to unsigned char");
}
return (unsigned char)-1;
}
return (unsigned char)val;
}
return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(unsigned short) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(unsigned short)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to unsigned short" :
"value too large to convert to unsigned short");
}
return (unsigned short)-1;
}
return (unsigned short)val;
}
return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(unsigned int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(unsigned int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to unsigned int" :
"value too large to convert to unsigned int");
}
return (unsigned int)-1;
}
return (unsigned int)val;
}
return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
const char neg_one = (char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(char) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(char)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to char" :
"value too large to convert to char");
}
return (char)-1;
}
return (char)val;
}
return (char)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
const short neg_one = (short)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(short) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(short)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to short" :
"value too large to convert to short");
}
return (short)-1;
}
return (short)val;
}
return (short)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
const int neg_one = (int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to int" :
"value too large to convert to int");
}
return (int)-1;
}
return (int)val;
}
return (int)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
const signed char neg_one = (signed char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(signed char) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(signed char)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to signed char" :
"value too large to convert to signed char");
}
return (signed char)-1;
}
return (signed char)val;
}
return (signed char)__Pyx_PyInt_AsSignedLong(x);
}
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
const signed short neg_one = (signed short)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(signed short) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(signed short)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to signed short" :
"value too large to convert to signed short");
}
return (signed short)-1;
}
return (signed short)val;
}
return (signed short)__Pyx_PyInt_AsSignedLong(x);
}
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
const signed int neg_one = (signed int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(signed int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(signed int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to signed int" :
"value too large to convert to signed int");
}
return (signed int)-1;
}
return (signed int)val;
}
return (signed int)__Pyx_PyInt_AsSignedLong(x);
}
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
const int neg_one = (int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to int" :
"value too large to convert to int");
}
return (int)-1;
}
return (int)val;
}
return (int)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned long");
return (unsigned long)-1;
}
return (unsigned long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned long");
return (unsigned long)-1;
}
return (unsigned long)PyLong_AsUnsignedLong(x);
} else {
return (unsigned long)PyLong_AsLong(x);
}
} else {
unsigned long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (unsigned long)-1;
val = __Pyx_PyInt_AsUnsignedLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned PY_LONG_LONG");
return (unsigned PY_LONG_LONG)-1;
}
return (unsigned PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned PY_LONG_LONG");
return (unsigned PY_LONG_LONG)-1;
}
return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
unsigned PY_LONG_LONG val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (unsigned PY_LONG_LONG)-1;
val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
const long neg_one = (long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to long");
return (long)-1;
}
return (long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to long");
return (long)-1;
}
return (long)PyLong_AsUnsignedLong(x);
} else {
return (long)PyLong_AsLong(x);
}
} else {
long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (long)-1;
val = __Pyx_PyInt_AsLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to PY_LONG_LONG");
return (PY_LONG_LONG)-1;
}
return (PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to PY_LONG_LONG");
return (PY_LONG_LONG)-1;
}
return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
return (PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
PY_LONG_LONG val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (PY_LONG_LONG)-1;
val = __Pyx_PyInt_AsLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
const signed long neg_one = (signed long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed long");
return (signed long)-1;
}
return (signed long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed long");
return (signed long)-1;
}
return (signed long)PyLong_AsUnsignedLong(x);
} else {
return (signed long)PyLong_AsLong(x);
}
} else {
signed long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (signed long)-1;
val = __Pyx_PyInt_AsSignedLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed PY_LONG_LONG");
return (signed PY_LONG_LONG)-1;
}
return (signed PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed PY_LONG_LONG");
return (signed PY_LONG_LONG)-1;
}
return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
signed PY_LONG_LONG val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (signed PY_LONG_LONG)-1;
val = __Pyx_PyInt_AsSignedLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
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());
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
char message[200];
PyOS_snprintf(message, sizeof(message),
"compiletime version %s of module '%.100s' "
"does not match runtime version %s",
ctversion, __Pyx_MODULE_NAME, rtversion);
#if PY_VERSION_HEX < 0x02050000
return PyErr_Warn(NULL, message);
#else
return PyErr_WarnEx(NULL, message, 1);
#endif
}
return 0;
}
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;
}
while (start < end) {
mid = (start + end) / 2;
if (code_line < entries[mid].code_line) {
end = mid;
} else if (code_line > entries[mid].code_line) {
start = mid + 1;
} else {
return mid;
}
}
if (code_line <= entries[mid].code_line) {
return mid;
} else {
return mid + 1;
}
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
PyCodeObject* code_object;
int pos;
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
return NULL;
}
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
return NULL;
}
code_object = __pyx_code_cache.entries[pos].code_object;
Py_INCREF(code_object);
return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
int pos, i;
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
if (unlikely(!code_line)) {
return;
}
if (unlikely(!entries)) {
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
if (likely(entries)) {
__pyx_code_cache.entries = entries;
__pyx_code_cache.max_count = 64;
__pyx_code_cache.count = 1;
entries[0].code_line = code_line;
entries[0].code_object = code_object;
Py_INCREF(code_object);
}
return;
}
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
PyCodeObject* tmp = entries[pos].code_object;
entries[pos].code_object = code_object;
Py_DECREF(tmp);
return;
}
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
int new_max = __pyx_code_cache.max_count + 64;
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
__pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
if (unlikely(!entries)) {
return;
}
__pyx_code_cache.entries = entries;
__pyx_code_cache.max_count = new_max;
}
for (i=__pyx_code_cache.count; i>pos; i--) {
entries[i] = entries[i-1];
}
entries[pos].code_line = code_line;
entries[pos].code_object = code_object;
__pyx_code_cache.count++;
Py_INCREF(code_object);
}
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
const char *funcname, int c_line,
int py_line, const char *filename) {
PyCodeObject *py_code = 0;
PyObject *py_srcfile = 0;
PyObject *py_funcname = 0;
#if PY_MAJOR_VERSION < 3
py_srcfile = PyString_FromString(filename);
#else
py_srcfile = PyUnicode_FromString(filename);
#endif
if (!py_srcfile) goto bad;
if (c_line) {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
#else
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
#endif
}
else {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromString(funcname);
#else
py_funcname = PyUnicode_FromString(funcname);
#endif
}
if (!py_funcname) goto bad;
py_code = __Pyx_PyCode_New(
0, /*int argcount,*/
0, /*int kwonlyargcount,*/
0, /*int nlocals,*/
0, /*int stacksize,*/
0, /*int flags,*/
__pyx_empty_bytes, /*PyObject *code,*/
__pyx_empty_tuple, /*PyObject *consts,*/
__pyx_empty_tuple, /*PyObject *names,*/
__pyx_empty_tuple, /*PyObject *varnames,*/
__pyx_empty_tuple, /*PyObject *freevars,*/
__pyx_empty_tuple, /*PyObject *cellvars,*/
py_srcfile, /*PyObject *filename,*/
py_funcname, /*PyObject *name,*/
py_line, /*int firstlineno,*/
__pyx_empty_bytes /*PyObject *lnotab*/
);
Py_DECREF(py_srcfile);
Py_DECREF(py_funcname);
return py_code;
bad:
Py_XDECREF(py_srcfile);
Py_XDECREF(py_funcname);
return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename) {
PyCodeObject *py_code = 0;
PyObject *py_globals = 0;
PyFrameObject *py_frame = 0;
py_code = __pyx_find_code_object(c_line ? c_line : py_line);
if (!py_code) {
py_code = __Pyx_CreateCodeObjectForTraceback(
funcname, c_line, py_line, filename);
if (!py_code) goto bad;
__pyx_insert_code_object(c_line ? c_line : py_line, py_code);
}
py_globals = PyModule_GetDict(__pyx_m);
if (!py_globals) goto bad;
py_frame = PyFrame_New(
PyThreadState_GET(), /*PyThreadState *tstate,*/
py_code, /*PyCodeObject *code,*/
py_globals, /*PyObject *globals,*/
0 /*PyObject *locals*/
);
if (!py_frame) goto bad;
py_frame->f_lineno = py_line;
PyTraceBack_Here(py_frame);
bad:
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
}
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
while (t->p) {
#if PY_MAJOR_VERSION < 3
if (t->is_unicode) {
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
} else if (t->intern) {
*t->p = PyString_InternFromString(t->s);
} else {
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
}
#else /* Python 3+ has unicode identifiers */
if (t->is_unicode | t->is_str) {
if (t->intern) {
*t->p = PyUnicode_InternFromString(t->s);
} else if (t->encoding) {
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
} else {
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
}
} else {
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
}
#endif
if (!*t->p)
return -1;
++t;
}
return 0;
}
/* Type Conversion Functions */
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
int is_true = x == Py_True;
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
PyNumberMethods *m;
const char *name = NULL;
PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
if (PyInt_Check(x) || PyLong_Check(x))
#else
if (PyLong_Check(x))
#endif
return Py_INCREF(x), x;
m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
if (m && m->nb_int) {
name = "int";
res = PyNumber_Int(x);
}
else if (m && m->nb_long) {
name = "long";
res = PyNumber_Long(x);
}
#else
if (m && m->nb_int) {
name = "int";
res = PyNumber_Long(x);
}
#endif
if (res) {
#if PY_VERSION_HEX < 0x03000000
if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
if (!PyLong_Check(res)) {
#endif
PyErr_Format(PyExc_TypeError,
"__%s__ returned non-%s (type %.200s)",
name, name, Py_TYPE(res)->tp_name);
Py_DECREF(res);
return NULL;
}
}
else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError,
"an integer is required");
}
return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
Py_ssize_t ival;
PyObject* x = PyNumber_Index(b);
if (!x) return -1;
ival = PyInt_AsSsize_t(x);
Py_DECREF(x);
return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
if (ival <= LONG_MAX)
return PyInt_FromLong((long)ival);
else {
unsigned char *bytes = (unsigned char *) &ival;
int one = 1; int little = (int)*(unsigned char*)&one;
return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
}
#else
return PyInt_FromSize_t(ival);
#endif
}
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
return (size_t)-1;
} else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to size_t");
return (size_t)-1;
}
return (size_t)val;
}
#endif /* Py_PYTHON_H */
pycogent-1.9/cogent/align/_compare.pyx 0000664 0000000 0000000 00000003245 12730143670 0020122 0 ustar 00root root 0000000 0000000 """50x speedup for dotplots, but sequences must be strings and scoring is based on identity only
"""
version_info = (1, 3)
__version__ = "('1', '9')"
cdef int cmax(int a, int b):
if a > b:
return a
else:
return b
cdef int cmin(int a, int b):
if a < b:
return a
else:
return b
def segments_from_diagonal(
char seq1[],
char seq2[],
int window,
int threshold,
int min_gap_length,
int diagonal):
"""List of ((x1,y1), (x2,y2)) for diagonal line segments scoring >= threshold/window"""
cdef int was_high, score, i, i_lo, i_hi, j, k, start, prior_end
cdef int len1, len2
cdef int scores[100] # yuk - use malloc?
assert window < 100
len1 = len(seq1)
len2 = len(seq2)
result = []
was_high = 0
for i from 0 <= i < window:
scores[i] = 0
score = 0
i_lo = cmax(0, 0-diagonal)
i_hi = cmin(len1, len2-diagonal)
prior_end = 0
for i from i_lo <= i < i_hi:
j = i + diagonal
k = i % window
score -= scores[k]
scores[k] = (seq1[i] == seq2[j])
score += scores[k]
if score >= threshold:
if not was_high:
start = cmax(i_lo, i - window)
if min_gap_length and prior_end:
if start < prior_end + min_gap_length:
(start, jumped_end) = result.pop()
was_high = 1
else:
if was_high:
result.append((start, i))
prior_end = i
was_high = 0
if was_high:
result.append((start, i_hi))
return result
pycogent-1.9/cogent/align/_pairwise_pogs.c 0000664 0000000 0000000 00003062522 12730143670 0020757 0 ustar 00root root 0000000 0000000 /* Generated by Cython 0.17.1 on Sat Nov 3 13:26:59 2012 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
#error Cython requires Python 2.4+.
#else
#include /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
#ifndef __stdcall
#define __stdcall
#endif
#ifndef __cdecl
#define __cdecl
#endif
#ifndef __fastcall
#define __fastcall
#endif
#endif
#ifndef DL_IMPORT
#define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
#define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
#define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
#define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#define PY_FORMAT_SIZE_T ""
#define CYTHON_FORMAT_SSIZE_T ""
#define PyInt_FromSsize_t(z) PyInt_FromLong(z)
#define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o)
#define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
(PyErr_Format(PyExc_TypeError, \
"expected index value, got %.200s", Py_TYPE(o)->tp_name), \
(PyObject*)0))
#define PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
#define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#define __PYX_BUILD_PY_SSIZE_T "i"
#else
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#endif
#if PY_VERSION_HEX < 0x02060000
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
#define PyVarObject_HEAD_INIT(type, size) \
PyObject_HEAD_INIT(type) size,
#define PyType_Modified(t)
typedef struct {
void *buf;
PyObject *obj;
Py_ssize_t len;
Py_ssize_t itemsize;
int readonly;
int ndim;
char *format;
Py_ssize_t *shape;
Py_ssize_t *strides;
Py_ssize_t *suboffsets;
void *internal;
} Py_buffer;
#define PyBUF_SIMPLE 0
#define PyBUF_WRITABLE 0x0001
#define PyBUF_FORMAT 0x0004
#define PyBUF_ND 0x0008
#define PyBUF_STRIDES (0x0010 | PyBUF_ND)
#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
#define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
#define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#if PY_MAJOR_VERSION < 3
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#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
#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
#define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#endif
#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_CHECKTYPES 0
#define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
#define CYTHON_PEP393_ENABLED 1
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
0 : _PyUnicode_Ready((PyObject *)(op)))
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
#else
#define CYTHON_PEP393_ENABLED 0
#define __Pyx_PyUnicode_READY(op) (0)
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
#define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBaseString_Type PyUnicode_Type
#define PyStringObject PyUnicodeObject
#define PyString_Type PyUnicode_Type
#define PyString_Check PyUnicode_Check
#define PyString_CheckExact PyUnicode_CheckExact
#endif
#if PY_VERSION_HEX < 0x02060000
#define PyBytesObject PyStringObject
#define PyBytes_Type PyString_Type
#define PyBytes_Check PyString_Check
#define PyBytes_CheckExact PyString_CheckExact
#define PyBytes_FromString PyString_FromString
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
#define PyBytes_FromFormat PyString_FromFormat
#define PyBytes_DecodeEscape PyString_DecodeEscape
#define PyBytes_AsString PyString_AsString
#define PyBytes_AsStringAndSize PyString_AsStringAndSize
#define PyBytes_Size PyString_Size
#define PyBytes_AS_STRING PyString_AS_STRING
#define PyBytes_GET_SIZE PyString_GET_SIZE
#define PyBytes_Repr PyString_Repr
#define PyBytes_Concat PyString_Concat
#define PyBytes_ConcatAndDel PyString_ConcatAndDel
#endif
#if PY_VERSION_HEX < 0x02060000
#define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
#define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
#define PyIntObject PyLongObject
#define PyInt_Type PyLong_Type
#define PyInt_Check(op) PyLong_Check(op)
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
#define PyInt_FromString PyLong_FromString
#define PyInt_FromUnicode PyLong_FromUnicode
#define PyInt_FromLong PyLong_FromLong
#define PyInt_FromSize_t PyLong_FromSize_t
#define PyInt_FromSsize_t PyLong_FromSsize_t
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AS_LONG PyLong_AS_LONG
#define PyInt_AsSsize_t PyLong_AsSsize_t
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBoolObject PyLongObject
#endif
#if PY_VERSION_HEX < 0x03020000
typedef long Py_hash_t;
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
#else
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
#endif
#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
#define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
#define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
#define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
#define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
#define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
#define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif
#if PY_MAJOR_VERSION >= 3
#define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
#if PY_VERSION_HEX < 0x02050000
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
#else
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
#define __Pyx_NAMESTR(n) ((char *)(n))
#define __Pyx_DOCSTR(n) ((char *)(n))
#else
#define __Pyx_NAMESTR(n) (n)
#define __Pyx_DOCSTR(n) (n)
#endif
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
#else
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
#endif
#ifndef __PYX_EXTERN_C
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#endif
#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include
#define __PYX_HAVE__cogent__align___pairwise_pogs
#define __PYX_HAVE_API__cogent__align___pairwise_pogs
#include "limits.h"
#include "math.h"
#include "pythread.h"
#include "string.h"
#include "stdlib.h"
#include "stdio.h"
#include "pystate.h"
#ifdef _OPENMP
#include
#endif /* _OPENMP */
#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif
/* inline attribute */
#ifndef CYTHON_INLINE
#if defined(__GNUC__)
#define CYTHON_INLINE __inline__
#elif defined(_MSC_VER)
#define CYTHON_INLINE __inline
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define CYTHON_INLINE inline
#else
#define CYTHON_INLINE
#endif
#endif
/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
/* Type Conversion Predeclarations */
#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
static const char *__pyx_f[] = {
"numerical_pyrex.pyx",
"_pairwise_pogs.pyx",
"stringsource",
};
struct __pyx_memoryview_obj;
typedef struct {
struct __pyx_memoryview_obj *memview;
char *data;
Py_ssize_t shape[8];
Py_ssize_t strides[8];
Py_ssize_t suboffsets[8];
} __Pyx_memviewslice;
#define IS_UNSIGNED(type) (((type) -1) > 0)
struct __Pyx_StructField_;
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
typedef struct {
const char* name; /* for error messages only */
struct __Pyx_StructField_* fields;
size_t size; /* sizeof(type) */
size_t arraysize[8]; /* length of array in each dimension */
int ndim;
char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */
char is_unsigned;
int flags;
} __Pyx_TypeInfo;
typedef struct __Pyx_StructField_ {
__Pyx_TypeInfo* type;
const char* name;
size_t offset;
} __Pyx_StructField;
typedef struct {
__Pyx_StructField* field;
size_t parent_offset;
} __Pyx_BufFmt_StackElem;
typedef struct {
__Pyx_StructField root;
__Pyx_BufFmt_StackElem* head;
size_t fmt_offset;
size_t new_count, enc_count;
size_t struct_alignment;
int is_complex;
char enc_type;
char new_packmode;
char enc_packmode;
char is_valid_array;
} __Pyx_BufFmt_Context;
#include
#ifndef CYTHON_ATOMICS
#define CYTHON_ATOMICS 1
#endif
#define __pyx_atomic_int_type int
/* todo: Portland pgcc, maybe OS X's OSAtomicIncrement32,
libatomic + autotools-like distutils support? Such a pain... */
#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 || \
(__GNUC_MINOR__ == 1 && __GNUC_PATHLEVEL >= 2))
#define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
#define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
#ifdef __PYX_DEBUG_ATOMICS
#warning "Using GNU atomics"
#endif
#elif CYTHON_ATOMICS && MSC_VER
#include
#define __pyx_atomic_int_type LONG
#define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
#define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
#ifdef __PYX_DEBUG_ATOMICS
#warning "Using MSVC atomics"
#endif
#elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
#define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
#define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
#ifdef __PYX_DEBUG_ATOMICS
#warning "Using Intel atomics"
#endif
#else
#undef CYTHON_ATOMICS
#define CYTHON_ATOMICS 0
#ifdef __PYX_DEBUG_ATOMICS
#warning "Not using atomics"
#endif
#endif
typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
#if CYTHON_ATOMICS
#define __pyx_add_acquisition_count(memview) \
__pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
#define __pyx_sub_acquisition_count(memview) \
__pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
#else
#define __pyx_add_acquisition_count(memview) \
__pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
#define __pyx_sub_acquisition_count(memview) \
__pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
#endif
/*--- Type declarations ---*/
struct __pyx_memoryview_obj;
struct __pyx_array_obj;
struct __pyx_MemviewEnum_obj;
struct __pyx_memoryviewslice_obj;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":31
* int
*
* ctypedef double[::1] Double1D # <<<<<<<<<<<<<<
* ctypedef double[:, ::1] Double2D
* ctypedef double[:, :, ::1] Double3D
*/
typedef __Pyx_memviewslice __pyx_t_6cogent_5align_14_pairwise_pogs_Double1D;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":32
*
* ctypedef double[::1] Double1D
* ctypedef double[:, ::1] Double2D # <<<<<<<<<<<<<<
* ctypedef double[:, :, ::1] Double3D
* ctypedef long[::1] Long1D
*/
typedef __Pyx_memviewslice __pyx_t_6cogent_5align_14_pairwise_pogs_Double2D;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":33
* ctypedef double[::1] Double1D
* ctypedef double[:, ::1] Double2D
* ctypedef double[:, :, ::1] Double3D # <<<<<<<<<<<<<<
* ctypedef long[::1] Long1D
* ctypedef long[:, ::1] Long2D
*/
typedef __Pyx_memviewslice __pyx_t_6cogent_5align_14_pairwise_pogs_Double3D;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":34
* ctypedef double[:, ::1] Double2D
* ctypedef double[:, :, ::1] Double3D
* ctypedef long[::1] Long1D # <<<<<<<<<<<<<<
* ctypedef long[:, ::1] Long2D
* ctypedef long[:, :, ::1] Long3D
*/
typedef __Pyx_memviewslice __pyx_t_6cogent_5align_14_pairwise_pogs_Long1D;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":35
* ctypedef double[:, :, ::1] Double3D
* ctypedef long[::1] Long1D
* ctypedef long[:, ::1] Long2D # <<<<<<<<<<<<<<
* ctypedef long[:, :, ::1] Long3D
*
*/
typedef __Pyx_memviewslice __pyx_t_6cogent_5align_14_pairwise_pogs_Long2D;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":36
* ctypedef long[::1] Long1D
* ctypedef long[:, ::1] Long2D
* ctypedef long[:, :, ::1] Long3D # <<<<<<<<<<<<<<
*
*
*/
typedef __Pyx_memviewslice __pyx_t_6cogent_5align_14_pairwise_pogs_Long3D;
/* "cogent/align/_pairwise_pogs.pyx":31
* return "%s * SCALE_STEP ** %s %s" % (mantissa, exponent, msg)
*
* ctypedef unsigned char [:,:,::1] UChar3D # <<<<<<<<<<<<<<
*
* def calc_rows(Long1D plan, Long1D seq1_index, Long1D seq2_index,
*/
typedef __Pyx_memviewslice __pyx_t_6cogent_5align_14_pairwise_pogs_UChar3D;
/* "View.MemoryView":308
*
* @cname('__pyx_memoryview')
* cdef class memoryview(object): # <<<<<<<<<<<<<<
*
* cdef object obj
*/
struct __pyx_memoryview_obj {
PyObject_HEAD
struct __pyx_vtabstruct_memoryview *__pyx_vtab;
PyObject *obj;
PyObject *_size;
PyObject *_array_interface;
PyThread_type_lock lock;
__pyx_atomic_int acquisition_count[2];
__pyx_atomic_int *acquisition_count_aligned_p;
Py_buffer view;
int flags;
int dtype_is_object;
__Pyx_TypeInfo *typeinfo;
};
/* "View.MemoryView":96
*
* @cname("__pyx_array")
* cdef class array: # <<<<<<<<<<<<<<
*
* cdef:
*/
struct __pyx_array_obj {
PyObject_HEAD
char *data;
Py_ssize_t len;
char *format;
int ndim;
Py_ssize_t *_shape;
Py_ssize_t *_strides;
Py_ssize_t itemsize;
PyObject *mode;
PyObject *_format;
void (*callback_free_data)(void *);
int free_data;
int dtype_is_object;
};
/* "View.MemoryView":275
*
* @cname('__pyx_MemviewEnum')
* cdef class Enum(object): # <<<<<<<<<<<<<<
* cdef object name
* def __init__(self, name):
*/
struct __pyx_MemviewEnum_obj {
PyObject_HEAD
PyObject *name;
};
/* "View.MemoryView":927
*
* @cname('__pyx_memoryviewslice')
* cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
* "Internal class for passing memoryview slices to Python"
*
*/
struct __pyx_memoryviewslice_obj {
struct __pyx_memoryview_obj __pyx_base;
__Pyx_memviewslice from_slice;
PyObject *from_object;
PyObject *(*to_object_func)(char *);
int (*to_dtype_func)(char *, PyObject *);
};
/* "View.MemoryView":308
*
* @cname('__pyx_memoryview')
* cdef class memoryview(object): # <<<<<<<<<<<<<<
*
* cdef object obj
*/
struct __pyx_vtabstruct_memoryview {
char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
};
static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
/* "View.MemoryView":927
*
* @cname('__pyx_memoryviewslice')
* cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
* "Internal class for passing memoryview slices to Python"
*
*/
struct __pyx_vtabstruct__memoryviewslice {
struct __pyx_vtabstruct_memoryview __pyx_base;
};
static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
#ifndef CYTHON_REFNANNY
#define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
typedef struct {
void (*INCREF)(void*, PyObject*, int);
void (*DECREF)(void*, PyObject*, int);
void (*GOTREF)(void*, PyObject*, int);
void (*GIVEREF)(void*, PyObject*, int);
void* (*SetupContext)(const char*, int, const char*);
void (*FinishContext)(void**);
} __Pyx_RefNannyAPIStruct;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
if (acquire_gil) { \
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
PyGILState_Release(__pyx_gilstate_save); \
} else { \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
}
#else
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
#define __Pyx_RefNannyFinishContext() \
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
#define __Pyx_RefNannyDeclarations
#define __Pyx_RefNannySetupContext(name, acquire_gil)
#define __Pyx_RefNannyFinishContext()
#define __Pyx_INCREF(r) Py_INCREF(r)
#define __Pyx_DECREF(r) Py_DECREF(r)
#define __Pyx_GOTREF(r)
#define __Pyx_GIVEREF(r)
#define __Pyx_XINCREF(r) Py_XINCREF(r)
#define __Pyx_XDECREF(r) Py_XDECREF(r)
#define __Pyx_XGOTREF(r)
#define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*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); /*proto*/
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
const char* function_name); /*proto*/
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
__Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
#define __Pyx_MEMVIEW_DIRECT 1
#define __Pyx_MEMVIEW_PTR 2
#define __Pyx_MEMVIEW_FULL 4
#define __Pyx_MEMVIEW_CONTIG 8
#define __Pyx_MEMVIEW_STRIDED 16
#define __Pyx_MEMVIEW_FOLLOW 32
#define __Pyx_IS_C_CONTIG 1
#define __Pyx_IS_F_CONTIG 2
static int __Pyx_ValidateAndInit_memviewslice(
int *axes_specs,
int c_or_f_flag,
int buf_flags,
int ndim,
__Pyx_TypeInfo *dtype,
__Pyx_BufFmt_StackElem stack[],
__Pyx_memviewslice *memviewslice,
PyObject *original_obj);
static int __Pyx_init_memviewslice(
struct __pyx_memoryview_obj *memview,
int ndim,
__Pyx_memviewslice *memviewslice,
int memview_is_new_reference);
static CYTHON_INLINE int __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
PyThread_type_lock lock);
static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
PyThread_type_lock lock);
#define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
#define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
#define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
const char *name, int exact); /*proto*/
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */
#define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/
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));
#include
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
PyObject *r;
if (!j) return NULL;
r = PyObject_GetItem(o, j);
Py_DECREF(j);
return r;
}
#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
__Pyx_GetItemInt_List_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
PyObject *r = PyList_GET_ITEM(o, i);
Py_INCREF(r);
return r;
}
else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
Py_INCREF(r);
return r;
}
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
return PySequence_GetItem(o, i);
#endif
}
#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
__Pyx_GetItemInt_Tuple_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
PyObject *r = PyTuple_GET_ITEM(o, i);
Py_INCREF(r);
return r;
}
else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
Py_INCREF(r);
return r;
}
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
return PySequence_GetItem(o, i);
#endif
}
#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
__Pyx_GetItemInt_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
if (PyList_CheckExact(o)) {
Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
PyObject *r = PyList_GET_ITEM(o, n);
Py_INCREF(r);
return r;
}
}
else if (PyTuple_CheckExact(o)) {
Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
PyObject *r = PyTuple_GET_ITEM(o, n);
Py_INCREF(r);
return r;
}
} else { /* inlined PySequence_GetItem() */
PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
if (likely(m && m->sq_item)) {
if (unlikely(i < 0) && likely(m->sq_length)) {
Py_ssize_t l = m->sq_length(o);
if (unlikely(l < 0)) return NULL;
i += l;
}
return m->sq_item(o, i);
}
}
#else
if (PySequence_Check(o)) {
return PySequence_GetItem(o, i);
}
#endif
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}
static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
PyListObject* L = (PyListObject*) list;
Py_ssize_t len = Py_SIZE(list);
if (likely(L->allocated > len)) {
Py_INCREF(x);
PyList_SET_ITEM(list, len, x);
Py_SIZE(list) = len+1;
return 0;
}
return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif
static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_suboffsets(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
#ifndef __PYX_FORCE_INIT_THREADS
#define __PYX_FORCE_INIT_THREADS 0
#endif
static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/
typedef struct {
Py_ssize_t shape, strides, suboffsets;
} __Pyx_Buf_DimInfo;
typedef struct {
size_t refcount;
Py_buffer pybuffer;
} __Pyx_Buffer;
typedef struct {
__Pyx_Buffer *rcbuffer;
char *data;
__Pyx_Buf_DimInfo diminfo[8];
} __Pyx_LocalBuf_ND;
#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
static void __Pyx_ReleaseBuffer(Py_buffer *view);
#else
#define __Pyx_GetBuffer PyObject_GetBuffer
#define __Pyx_ReleaseBuffer PyBuffer_Release
#endif
static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_long(PyObject *);
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(PyObject *);
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(PyObject *);
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(PyObject *);
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(PyObject *);
static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice *mvs,
char order, int ndim);
static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
__Pyx_memviewslice *slice2,
int ndim, size_t itemsize);
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,
int dtype_is_object);
static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_long(PyObject *);
static void __Pyx_WriteUnraisable(const char *name, int clineno,
int lineno, const char *filename); /*proto*/
static int __Pyx_check_binary_version(void);
static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
typedef struct {
int code_line;
PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
int count;
int max_count;
__Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename); /*proto*/
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Module declarations from 'cogent.align._pairwise_pogs' */
static PyTypeObject *__pyx_array_type = 0;
static PyTypeObject *__pyx_MemviewEnum_type = 0;
static PyTypeObject *__pyx_memoryview_type = 0;
static PyTypeObject *__pyx_memoryviewslice_type = 0;
static double __pyx_v_6cogent_5align_14_pairwise_pogs_SCALE_STEP;
static double __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_FLOAT_VALUE;
static int __pyx_v_6cogent_5align_14_pairwise_pogs_MAX_XCOUNT;
static long __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_SCALE;
static long __pyx_v_6cogent_5align_14_pairwise_pogs_MAX_SCALE;
static PyObject *generic = 0;
static PyObject *strided = 0;
static PyObject *indirect = 0;
static PyObject *contiguous = 0;
static PyObject *indirect_contiguous = 0;
static int __pyx_fuse_0__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(PyObject *, Py_ssize_t, Py_ssize_t *); /*proto*/
static int __pyx_fuse_1__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(PyObject *, Py_ssize_t, long *); /*proto*/
static int __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(PyObject *, Py_ssize_t, int *); /*proto*/
static int __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray1D(__Pyx_memviewslice, int *); /*proto*/
static int __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray2D(__Pyx_memviewslice, int *, int *); /*proto*/
static int __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray2D(__Pyx_memviewslice, int *, int *); /*proto*/
static int __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray3D(__Pyx_memviewslice, int *, int *, int *); /*proto*/
static int __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray3D(__Pyx_memviewslice, int *, int *, int *); /*proto*/
static int __pyx_fuse_2_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray3D(__Pyx_memviewslice, int *, int *, int *); /*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*/
static int __pyx_memoryview_check(PyObject *); /*proto*/
static PyObject *_unellipsify(PyObject *, int); /*proto*/
static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, int); /*proto*/
static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_long = { "long", NULL, sizeof(long), { 0 }, 0, IS_UNSIGNED(long) ? 'U' : 'I', IS_UNSIGNED(long), 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_unsigned_char = { "unsigned char", NULL, sizeof(unsigned char), { 0 }, 0, IS_UNSIGNED(unsigned char) ? 'U' : 'I', IS_UNSIGNED(unsigned char), 0 };
#define __Pyx_MODULE_NAME "cogent.align._pairwise_pogs"
int __pyx_module_is_main_cogent__align___pairwise_pogs = 0;
/* Implementation of 'cogent.align._pairwise_pogs' */
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_ArithmeticError;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_Ellipsis;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_xrange;
static PyObject *__pyx_builtin_id;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_pf_6cogent_5align_14_pairwise_pogs_fmpt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mantissa, PyObject *__pyx_v_exponent, PyObject *__pyx_v_msg); /* proto */
static PyObject *__pyx_pf_6cogent_5align_14_pairwise_pogs_2calc_rows(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_6cogent_5align_14_pairwise_pogs_Long1D __pyx_v_plan, __pyx_t_6cogent_5align_14_pairwise_pogs_Long1D __pyx_v_seq1_index, __pyx_t_6cogent_5align_14_pairwise_pogs_Long1D __pyx_v_seq2_index, int __pyx_v_i_low, int __pyx_v_i_high, int __pyx_v_j_low, int __pyx_v_j_high, PyObject *__pyx_v_preds, __pyx_t_6cogent_5align_14_pairwise_pogs_Long2D __pyx_v_state_directions, __pyx_t_6cogent_5align_14_pairwise_pogs_Double2D __pyx_v_T, __pyx_t_6cogent_5align_14_pairwise_pogs_Double2D __pyx_v_xgap_scores, __pyx_t_6cogent_5align_14_pairwise_pogs_Double2D __pyx_v_ygap_scores, __pyx_t_6cogent_5align_14_pairwise_pogs_Double3D __pyx_v_match_scores, PyObject *__pyx_v_rows, __pyx_t_6cogent_5align_14_pairwise_pogs_UChar3D __pyx_v_track, PyObject *__pyx_v_track_enc, int __pyx_v_viterbi, int __pyx_v_use_logs, int __pyx_v_local, int __pyx_v_use_scaling); /* proto */
static int __pyx_array_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 */
static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *get_memview_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
static int __pyx_MemviewEnum_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_MemviewEnum_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static PyObject *__pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview__get__base_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static char __pyx_k_1[] = "%s dimension is %s, expected %s";
static char __pyx_k_2[] = "%s dimension is %s, too big";
static char __pyx_k_3[] = "Array required, got None";
static char __pyx_k_10[] = "";
static char __pyx_k_11[] = "%s * SCALE_STEP ** %s %s";
static char __pyx_k_12[] = "transition is a negative probability";
static char __pyx_k_13[] = "product is a negative probability";
static char __pyx_k_14[] = "is unexpectedly large";
static char __pyx_k_15[] = "Empty shape tuple for cython.array";
static char __pyx_k_17[] = "itemsize <= 0 for cython.array";
static char __pyx_k_20[] = "unable to allocate shape or strides.";
static char __pyx_k_22[] = "Invalid shape in axis %d: %d.";
static char __pyx_k_23[] = "Invalid mode, expected 'c' or 'fortran', got %s";
static char __pyx_k_25[] = "unable to allocate array data.";
static char __pyx_k_27[] = "Can only create a buffer that is contiguous in memory.";
static char __pyx_k_29[] = "Unable to convert item to object";
static char __pyx_k_31[] = "Buffer view does not expose strides";
static char __pyx_k_33[] = "";
static char __pyx_k_34[] = "";
static char __pyx_k_37[] = "Cannot index with type '%s'";
static char __pyx_k_39[] = "Indirect dimensions not supported";
static char __pyx_k_41[] = "Index out of bounds (axis %d)";
static char __pyx_k_42[] = "Step may not be zero (axis %d)";
static char __pyx_k_43[] = "All dimensions preceding dimension %d must be indexed and not sliced";
static char __pyx_k_44[] = "Out of bounds on buffer access (axis %d)";
static char __pyx_k_45[] = "Cannot transpose memoryview with indirect dimensions";
static char __pyx_k_46[] = "got differing extents in dimension %d (got %d and %d)";
static char __pyx_k_47[] = "Dimension %d is not direct";
static char __pyx_k_48[] = "('1', '5', '3-dev')";
static char __pyx_k_52[] = "/Users/maxwell/Documents/Work/Cogent/cogent/align/_pairwise_pogs.pyx";
static char __pyx_k_53[] = "cogent.align._pairwise_pogs";
static char __pyx_k_54[] = "source_row_index_cache";
static char __pyx_k_55[] = "overall_max_mantissa";
static char __pyx_k_56[] = "overall_max_exponent";
static char __pyx_k_59[] = "getbuffer(obj, view, flags)";
static char __pyx_k_60[] = "";
static char __pyx_k_62[] = "";
static char __pyx_k_64[] = "";
static char __pyx_k_66[] = "";
static char __pyx_k_68[] = "";
static char __pyx_k__N[] = "N";
static char __pyx_k__O[] = "O";
static char __pyx_k__T[] = "T";
static char __pyx_k__a[] = "a";
static char __pyx_k__b[] = "b";
static char __pyx_k__c[] = "c";
static char __pyx_k__i[] = "i";
static char __pyx_k__j[] = "j";
static char __pyx_k__x[] = "x";
static char __pyx_k__y[] = "y";
static char __pyx_k__d4[] = "d4";
static char __pyx_k__dx[] = "dx";
static char __pyx_k__dy[] = "dy";
static char __pyx_k__id[] = "id";
static char __pyx_k__1st[] = "1st";
static char __pyx_k__2nd[] = "2nd";
static char __pyx_k__3rd[] = "3rd";
static char __pyx_k__bin[] = "bin";
static char __pyx_k__msg[] = "msg";
static char __pyx_k__obj[] = "obj";
static char __pyx_k__base[] = "base";
static char __pyx_k__fmpt[] = "fmpt";
static char __pyx_k__mode[] = "mode";
static char __pyx_k__name[] = "name";
static char __pyx_k__ndim[] = "ndim";
static char __pyx_k__pack[] = "pack";
static char __pyx_k__plan[] = "plan";
static char __pyx_k__pog1[] = "pog1";
static char __pyx_k__pog2[] = "pog2";
static char __pyx_k__rows[] = "rows";
static char __pyx_k__size[] = "size";
static char __pyx_k__step[] = "step";
static char __pyx_k__stop[] = "stop";
static char __pyx_k__ASCII[] = "ASCII";
static char __pyx_k__a_low[] = "a_low";
static char __pyx_k__b_low[] = "b_low";
static char __pyx_k__error[] = "error";
static char __pyx_k__flags[] = "flags";
static char __pyx_k__i_low[] = "i_low";
static char __pyx_k__j_low[] = "j_low";
static char __pyx_k__local[] = "local";
static char __pyx_k__max_x[] = "max_x";
static char __pyx_k__max_y[] = "max_y";
static char __pyx_k__preds[] = "preds";
static char __pyx_k__range[] = "range";
static char __pyx_k__score[] = "score";
static char __pyx_k__shape[] = "shape";
static char __pyx_k__start[] = "start";
static char __pyx_k__state[] = "state";
static char __pyx_k__track[] = "track";
static char __pyx_k__a_high[] = "a_high";
static char __pyx_k__b_high[] = "b_high";
static char __pyx_k__decode[] = "decode";
static char __pyx_k__encode[] = "encode";
static char __pyx_k__extend[] = "extend";
static char __pyx_k__format[] = "format";
static char __pyx_k__i_high[] = "i_high";
static char __pyx_k__j_high[] = "j_high";
static char __pyx_k__last_i[] = "last_i";
static char __pyx_k__last_j[] = "last_j";
static char __pyx_k__prev_i[] = "prev_i";
static char __pyx_k__prev_j[] = "prev_j";
static char __pyx_k__struct[] = "struct";
static char __pyx_k__unpack[] = "unpack";
static char __pyx_k__xrange[] = "xrange";
static char __pyx_k__a_count[] = "a_count";
static char __pyx_k__b_count[] = "b_count";
static char __pyx_k__d_score[] = "d_score";
static char __pyx_k__fortran[] = "fortran";
static char __pyx_k__memview[] = "memview";
static char __pyx_k__tcode_s[] = "tcode_s";
static char __pyx_k__tcode_x[] = "tcode_x";
static char __pyx_k__tcode_y[] = "tcode_y";
static char __pyx_k__viterbi[] = "viterbi";
static char __pyx_k__Ellipsis[] = "Ellipsis";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____name__[] = "__name__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__exponent[] = "exponent";
static char __pyx_k__itemsize[] = "itemsize";
static char __pyx_k__mantissa[] = "mantissa";
static char __pyx_k__tmp_rows[] = "tmp_rows";
static char __pyx_k__use_logs[] = "use_logs";
static char __pyx_k__TypeError[] = "TypeError";
static char __pyx_k____class__[] = "__class__";
static char __pyx_k__bin_count[] = "bin_count";
static char __pyx_k__calc_rows[] = "calc_rows";
static char __pyx_k__enumerate[] = "enumerate";
static char __pyx_k__exponents[] = "exponents";
static char __pyx_k__i_sources[] = "i_sources";
static char __pyx_k__j_sources[] = "j_sources";
static char __pyx_k__mantissas[] = "mantissas";
static char __pyx_k__pointer_a[] = "pointer_a";
static char __pyx_k__pointer_b[] = "pointer_b";
static char __pyx_k__row_count[] = "row_count";
static char __pyx_k__track_enc[] = "track_enc";
static char __pyx_k__IndexError[] = "IndexError";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k__dest_state[] = "dest_state";
static char __pyx_k__impossible[] = "impossible";
static char __pyx_k__last_state[] = "last_state";
static char __pyx_k__prev_state[] = "prev_state";
static char __pyx_k__row_count1[] = "row_count1";
static char __pyx_k__row_length[] = "row_length";
static char __pyx_k__seq1_index[] = "seq1_index";
static char __pyx_k__seq2_index[] = "seq2_index";
static char __pyx_k__underflows[] = "underflows";
static char __pyx_k__MemoryError[] = "MemoryError";
static char __pyx_k____version__[] = "__version__";
static char __pyx_k__dest_states[] = "dest_states";
static char __pyx_k__partial_sum[] = "partial_sum";
static char __pyx_k__row_length1[] = "row_length1";
static char __pyx_k__use_scaling[] = "use_scaling";
static char __pyx_k__xgap_scores[] = "xgap_scores";
static char __pyx_k__ygap_scores[] = "ygap_scores";
static char __pyx_k__i_link_count[] = "i_link_count";
static char __pyx_k__j_link_count[] = "j_link_count";
static char __pyx_k__match_scores[] = "match_scores";
static char __pyx_k__max_exponent[] = "max_exponent";
static char __pyx_k__max_mantissa[] = "max_mantissa";
static char __pyx_k__version_info[] = "version_info";
static char __pyx_k__i_sources_end[] = "i_sources_end";
static char __pyx_k__j_sources_end[] = "j_sources_end";
static char __pyx_k__pointer_state[] = "pointer_state";
static char __pyx_k__min_prev_state[] = "min_prev_state";
static char __pyx_k__ArithmeticError[] = "ArithmeticError";
static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer";
static char __pyx_k__allocate_buffer[] = "allocate_buffer";
static char __pyx_k__asCombinedArray[] = "asCombinedArray";
static char __pyx_k__dtype_is_object[] = "dtype_is_object";
static char __pyx_k__i_sources_start[] = "i_sources_start";
static char __pyx_k__j_sources_start[] = "j_sources_start";
static char __pyx_k__sub_partial_sum[] = "sub_partial_sum";
static char __pyx_k__source_row_index[] = "source_row_index";
static char __pyx_k__state_directions[] = "state_directions";
static char __pyx_k__current_row_index[] = "current_row_index";
static char __pyx_k__i_sources_offsets[] = "i_sources_offsets";
static char __pyx_k__j_sources_offsets[] = "j_sources_offsets";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_s_10;
static PyObject *__pyx_kp_s_11;
static PyObject *__pyx_kp_s_12;
static PyObject *__pyx_kp_s_13;
static PyObject *__pyx_kp_s_14;
static PyObject *__pyx_kp_s_15;
static PyObject *__pyx_kp_s_17;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_kp_s_20;
static PyObject *__pyx_kp_s_22;
static PyObject *__pyx_kp_s_23;
static PyObject *__pyx_kp_s_25;
static PyObject *__pyx_kp_s_27;
static PyObject *__pyx_kp_s_29;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_31;
static PyObject *__pyx_kp_s_33;
static PyObject *__pyx_kp_s_34;
static PyObject *__pyx_kp_s_37;
static PyObject *__pyx_kp_s_39;
static PyObject *__pyx_kp_s_44;
static PyObject *__pyx_kp_s_46;
static PyObject *__pyx_kp_s_48;
static PyObject *__pyx_kp_s_52;
static PyObject *__pyx_n_s_53;
static PyObject *__pyx_n_s_54;
static PyObject *__pyx_n_s_55;
static PyObject *__pyx_n_s_56;
static PyObject *__pyx_kp_s_60;
static PyObject *__pyx_kp_s_62;
static PyObject *__pyx_kp_s_64;
static PyObject *__pyx_kp_s_66;
static PyObject *__pyx_kp_s_68;
static PyObject *__pyx_kp_s__1st;
static PyObject *__pyx_kp_s__2nd;
static PyObject *__pyx_kp_s__3rd;
static PyObject *__pyx_n_s__ASCII;
static PyObject *__pyx_n_s__ArithmeticError;
static PyObject *__pyx_n_s__Ellipsis;
static PyObject *__pyx_n_s__IndexError;
static PyObject *__pyx_n_s__MemoryError;
static PyObject *__pyx_n_s__N;
static PyObject *__pyx_n_b__O;
static PyObject *__pyx_n_s__T;
static PyObject *__pyx_n_s__TypeError;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____class__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____name__;
static PyObject *__pyx_n_s____pyx_getbuffer;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s____version__;
static PyObject *__pyx_n_s__a;
static PyObject *__pyx_n_s__a_count;
static PyObject *__pyx_n_s__a_high;
static PyObject *__pyx_n_s__a_low;
static PyObject *__pyx_n_s__allocate_buffer;
static PyObject *__pyx_n_s__asCombinedArray;
static PyObject *__pyx_n_s__b;
static PyObject *__pyx_n_s__b_count;
static PyObject *__pyx_n_s__b_high;
static PyObject *__pyx_n_s__b_low;
static PyObject *__pyx_n_s__base;
static PyObject *__pyx_n_s__bin;
static PyObject *__pyx_n_s__bin_count;
static PyObject *__pyx_n_b__c;
static PyObject *__pyx_n_s__c;
static PyObject *__pyx_n_u__c;
static PyObject *__pyx_n_s__calc_rows;
static PyObject *__pyx_n_s__current_row_index;
static PyObject *__pyx_n_s__d4;
static PyObject *__pyx_n_s__d_score;
static PyObject *__pyx_n_s__decode;
static PyObject *__pyx_n_s__dest_state;
static PyObject *__pyx_n_s__dest_states;
static PyObject *__pyx_n_s__dtype_is_object;
static PyObject *__pyx_n_s__dx;
static PyObject *__pyx_n_s__dy;
static PyObject *__pyx_n_s__encode;
static PyObject *__pyx_n_s__enumerate;
static PyObject *__pyx_n_s__error;
static PyObject *__pyx_n_s__exponent;
static PyObject *__pyx_n_s__exponents;
static PyObject *__pyx_n_s__extend;
static PyObject *__pyx_n_s__flags;
static PyObject *__pyx_n_s__fmpt;
static PyObject *__pyx_n_s__format;
static PyObject *__pyx_n_b__fortran;
static PyObject *__pyx_n_s__fortran;
static PyObject *__pyx_n_s__i;
static PyObject *__pyx_n_s__i_high;
static PyObject *__pyx_n_s__i_link_count;
static PyObject *__pyx_n_s__i_low;
static PyObject *__pyx_n_s__i_sources;
static PyObject *__pyx_n_s__i_sources_end;
static PyObject *__pyx_n_s__i_sources_offsets;
static PyObject *__pyx_n_s__i_sources_start;
static PyObject *__pyx_n_s__id;
static PyObject *__pyx_n_s__impossible;
static PyObject *__pyx_n_s__itemsize;
static PyObject *__pyx_n_s__j;
static PyObject *__pyx_n_s__j_high;
static PyObject *__pyx_n_s__j_link_count;
static PyObject *__pyx_n_s__j_low;
static PyObject *__pyx_n_s__j_sources;
static PyObject *__pyx_n_s__j_sources_end;
static PyObject *__pyx_n_s__j_sources_offsets;
static PyObject *__pyx_n_s__j_sources_start;
static PyObject *__pyx_n_s__last_i;
static PyObject *__pyx_n_s__last_j;
static PyObject *__pyx_n_s__last_state;
static PyObject *__pyx_n_s__local;
static PyObject *__pyx_n_s__mantissa;
static PyObject *__pyx_n_s__mantissas;
static PyObject *__pyx_n_s__match_scores;
static PyObject *__pyx_n_s__max_exponent;
static PyObject *__pyx_n_s__max_mantissa;
static PyObject *__pyx_n_s__max_x;
static PyObject *__pyx_n_s__max_y;
static PyObject *__pyx_n_s__memview;
static PyObject *__pyx_n_s__min_prev_state;
static PyObject *__pyx_n_s__mode;
static PyObject *__pyx_n_s__msg;
static PyObject *__pyx_n_s__name;
static PyObject *__pyx_n_s__ndim;
static PyObject *__pyx_n_s__obj;
static PyObject *__pyx_n_s__pack;
static PyObject *__pyx_n_s__partial_sum;
static PyObject *__pyx_n_s__plan;
static PyObject *__pyx_n_s__pog1;
static PyObject *__pyx_n_s__pog2;
static PyObject *__pyx_n_s__pointer_a;
static PyObject *__pyx_n_s__pointer_b;
static PyObject *__pyx_n_s__pointer_state;
static PyObject *__pyx_n_s__preds;
static PyObject *__pyx_n_s__prev_i;
static PyObject *__pyx_n_s__prev_j;
static PyObject *__pyx_n_s__prev_state;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__row_count;
static PyObject *__pyx_n_s__row_count1;
static PyObject *__pyx_n_s__row_length;
static PyObject *__pyx_n_s__row_length1;
static PyObject *__pyx_n_s__rows;
static PyObject *__pyx_n_s__score;
static PyObject *__pyx_n_s__seq1_index;
static PyObject *__pyx_n_s__seq2_index;
static PyObject *__pyx_n_s__shape;
static PyObject *__pyx_n_s__size;
static PyObject *__pyx_n_s__source_row_index;
static PyObject *__pyx_n_s__start;
static PyObject *__pyx_n_s__state;
static PyObject *__pyx_n_s__state_directions;
static PyObject *__pyx_n_s__step;
static PyObject *__pyx_n_s__stop;
static PyObject *__pyx_n_s__struct;
static PyObject *__pyx_n_s__sub_partial_sum;
static PyObject *__pyx_n_s__tcode_s;
static PyObject *__pyx_n_s__tcode_x;
static PyObject *__pyx_n_s__tcode_y;
static PyObject *__pyx_n_s__tmp_rows;
static PyObject *__pyx_n_s__track;
static PyObject *__pyx_n_s__track_enc;
static PyObject *__pyx_n_s__underflows;
static PyObject *__pyx_n_s__unpack;
static PyObject *__pyx_n_s__use_logs;
static PyObject *__pyx_n_s__use_scaling;
static PyObject *__pyx_n_s__version_info;
static PyObject *__pyx_n_s__viterbi;
static PyObject *__pyx_n_s__x;
static PyObject *__pyx_n_s__xgap_scores;
static PyObject *__pyx_n_s__xrange;
static PyObject *__pyx_n_s__y;
static PyObject *__pyx_n_s__ygap_scores;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_k_tuple_4;
static PyObject *__pyx_k_tuple_5;
static PyObject *__pyx_k_tuple_6;
static PyObject *__pyx_k_tuple_7;
static PyObject *__pyx_k_tuple_8;
static PyObject *__pyx_k_tuple_9;
static PyObject *__pyx_k_tuple_16;
static PyObject *__pyx_k_tuple_18;
static PyObject *__pyx_k_tuple_19;
static PyObject *__pyx_k_tuple_21;
static PyObject *__pyx_k_tuple_24;
static PyObject *__pyx_k_tuple_26;
static PyObject *__pyx_k_tuple_28;
static PyObject *__pyx_k_tuple_30;
static PyObject *__pyx_k_tuple_32;
static PyObject *__pyx_k_tuple_35;
static PyObject *__pyx_k_tuple_36;
static PyObject *__pyx_k_tuple_38;
static PyObject *__pyx_k_tuple_40;
static PyObject *__pyx_k_tuple_49;
static PyObject *__pyx_k_tuple_50;
static PyObject *__pyx_k_tuple_57;
static PyObject *__pyx_k_tuple_61;
static PyObject *__pyx_k_tuple_63;
static PyObject *__pyx_k_tuple_65;
static PyObject *__pyx_k_tuple_67;
static PyObject *__pyx_k_tuple_69;
static PyObject *__pyx_k_codeobj_51;
static PyObject *__pyx_k_codeobj_58;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":39
*
*
* cdef int checkDim(dimension, Py_ssize_t val, dim *var) except 1: # <<<<<<<<<<<<<<
* if var[0] == 0:
* # Length unspecified, take it from the provided array
*/
static int __pyx_fuse_0__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(PyObject *__pyx_v_dimension, Py_ssize_t __pyx_v_val, Py_ssize_t *__pyx_v_var) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_0checkDim", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":40
*
* cdef int checkDim(dimension, Py_ssize_t val, dim *var) except 1:
* if var[0] == 0: # <<<<<<<<<<<<<<
* # Length unspecified, take it from the provided array
* if dim is int:
*/
__pyx_t_1 = ((__pyx_v_var[0]) == 0);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":51
* var[0] = val
* else:
* var[0] = val # <<<<<<<<<<<<<<
*
* elif var[0] != val:
*/
(__pyx_v_var[0]) = __pyx_v_val;
goto __pyx_L3;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":53
* var[0] = val
*
* elif var[0] != val: # <<<<<<<<<<<<<<
* # Length already specified, but not the same
* raise ValueError("%s dimension is %s, expected %s" %
*/
__pyx_t_1 = ((__pyx_v_var[0]) != __pyx_v_val);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":56
* # Length already specified, but not the same
* raise ValueError("%s dimension is %s, expected %s" %
* (dimension, val, var[0])) # <<<<<<<<<<<<<<
* else:
* # Length matches what was expected
*/
__pyx_t_2 = PyInt_FromSsize_t(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyInt_FromSsize_t((__pyx_v_var[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_dimension);
__Pyx_GIVEREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_2 = 0;
__pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
/*else*/ {
}
__pyx_L3:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("cogent.align._pairwise_pogs.checkDim", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":39
*
*
* cdef int checkDim(dimension, Py_ssize_t val, dim *var) except 1: # <<<<<<<<<<<<<<
* if var[0] == 0:
* # Length unspecified, take it from the provided array
*/
static int __pyx_fuse_1__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(PyObject *__pyx_v_dimension, Py_ssize_t __pyx_v_val, long *__pyx_v_var) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_1checkDim", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":40
*
* cdef int checkDim(dimension, Py_ssize_t val, dim *var) except 1:
* if var[0] == 0: # <<<<<<<<<<<<<<
* # Length unspecified, take it from the provided array
* if dim is int:
*/
__pyx_t_1 = ((__pyx_v_var[0]) == 0);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":47
* var[0] = val
* elif dim is long:
* if val > LONG_MAX: # <<<<<<<<<<<<<<
* raise ValueError("%s dimension is %s, too big" % (dimension, val))
* var[0] = val
*/
__pyx_t_1 = (__pyx_v_val > LONG_MAX);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":48
* elif dim is long:
* if val > LONG_MAX:
* raise ValueError("%s dimension is %s, too big" % (dimension, val)) # <<<<<<<<<<<<<<
* var[0] = val
* else:
*/
__pyx_t_2 = PyInt_FromSsize_t(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_dimension);
__Pyx_GIVEREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
__pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L4;
}
__pyx_L4:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":49
* if val > LONG_MAX:
* raise ValueError("%s dimension is %s, too big" % (dimension, val))
* var[0] = val # <<<<<<<<<<<<<<
* else:
* var[0] = val
*/
(__pyx_v_var[0]) = ((long)__pyx_v_val);
goto __pyx_L3;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":53
* var[0] = val
*
* elif var[0] != val: # <<<<<<<<<<<<<<
* # Length already specified, but not the same
* raise ValueError("%s dimension is %s, expected %s" %
*/
__pyx_t_1 = ((__pyx_v_var[0]) != __pyx_v_val);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":56
* # Length already specified, but not the same
* raise ValueError("%s dimension is %s, expected %s" %
* (dimension, val, var[0])) # <<<<<<<<<<<<<<
* else:
* # Length matches what was expected
*/
__pyx_t_2 = PyInt_FromSsize_t(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyInt_FromLong((__pyx_v_var[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_dimension);
__Pyx_GIVEREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_2 = 0;
__pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
/*else*/ {
}
__pyx_L3:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("cogent.align._pairwise_pogs.checkDim", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":39
*
*
* cdef int checkDim(dimension, Py_ssize_t val, dim *var) except 1: # <<<<<<<<<<<<<<
* if var[0] == 0:
* # Length unspecified, take it from the provided array
*/
static int __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(PyObject *__pyx_v_dimension, Py_ssize_t __pyx_v_val, int *__pyx_v_var) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_2checkDim", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":40
*
* cdef int checkDim(dimension, Py_ssize_t val, dim *var) except 1:
* if var[0] == 0: # <<<<<<<<<<<<<<
* # Length unspecified, take it from the provided array
* if dim is int:
*/
__pyx_t_1 = ((__pyx_v_var[0]) == 0);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":43
* # Length unspecified, take it from the provided array
* if dim is int:
* if val > INT_MAX: # <<<<<<<<<<<<<<
* raise ValueError("%s dimension is %s, too big" % (dimension, val))
* var[0] = val
*/
__pyx_t_1 = (__pyx_v_val > INT_MAX);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":44
* if dim is int:
* if val > INT_MAX:
* raise ValueError("%s dimension is %s, too big" % (dimension, val)) # <<<<<<<<<<<<<<
* var[0] = val
* elif dim is long:
*/
__pyx_t_2 = PyInt_FromSsize_t(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_dimension);
__Pyx_GIVEREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
__pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L4;
}
__pyx_L4:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":45
* if val > INT_MAX:
* raise ValueError("%s dimension is %s, too big" % (dimension, val))
* var[0] = val # <<<<<<<<<<<<<<
* elif dim is long:
* if val > LONG_MAX:
*/
(__pyx_v_var[0]) = ((int)__pyx_v_val);
goto __pyx_L3;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":53
* var[0] = val
*
* elif var[0] != val: # <<<<<<<<<<<<<<
* # Length already specified, but not the same
* raise ValueError("%s dimension is %s, expected %s" %
*/
__pyx_t_1 = ((__pyx_v_var[0]) != __pyx_v_val);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":56
* # Length already specified, but not the same
* raise ValueError("%s dimension is %s, expected %s" %
* (dimension, val, var[0])) # <<<<<<<<<<<<<<
* else:
* # Length matches what was expected
*/
__pyx_t_2 = PyInt_FromSsize_t(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyInt_FromLong((__pyx_v_var[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_dimension);
__Pyx_GIVEREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_2 = 0;
__pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
/*else*/ {
}
__pyx_L3:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("cogent.align._pairwise_pogs.checkDim", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":62
*
*
* cdef int checkArray1D(num[::1] a, dim *x) except 1: # <<<<<<<<<<<<<<
* if a is None:
* raise ValueError('Array required, got None')
*/
static int __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray1D(__Pyx_memviewslice __pyx_v_a, int *__pyx_v_x) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_1_2checkArray1D", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":63
*
* cdef int checkArray1D(num[::1] a, dim *x) except 1:
* if a is None: # <<<<<<<<<<<<<<
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
*/
__pyx_t_1 = (((PyObject *) __pyx_v_a.memview) == Py_None);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":64
* cdef int checkArray1D(num[::1] a, dim *x) except 1:
* if a is None:
* raise ValueError('Array required, got None') # <<<<<<<<<<<<<<
* checkDim('1st', a.shape[0], x)
*
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":65
* if a is None:
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x) # <<<<<<<<<<<<<<
*
* cdef int checkArray2D(num[:, ::1] a, dim *x, dim *y) except 1:
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__1st);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(__pyx_t_2, (__pyx_v_a.shape[0]), __pyx_v_x); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArray1D", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":67
* checkDim('1st', a.shape[0], x)
*
* cdef int checkArray2D(num[:, ::1] a, dim *x, dim *y) except 1: # <<<<<<<<<<<<<<
* if a is None:
* raise ValueError('Array required, got None')
*/
static int __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray2D(__Pyx_memviewslice __pyx_v_a, int *__pyx_v_x, int *__pyx_v_y) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_0_2checkArray2D", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":68
*
* cdef int checkArray2D(num[:, ::1] a, dim *x, dim *y) except 1:
* if a is None: # <<<<<<<<<<<<<<
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
*/
__pyx_t_1 = (((PyObject *) __pyx_v_a.memview) == Py_None);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":69
* cdef int checkArray2D(num[:, ::1] a, dim *x, dim *y) except 1:
* if a is None:
* raise ValueError('Array required, got None') # <<<<<<<<<<<<<<
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":70
* if a is None:
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x) # <<<<<<<<<<<<<<
* checkDim('2nd', a.shape[1], y)
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__1st);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(__pyx_t_2, (__pyx_v_a.shape[0]), __pyx_v_x); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":71
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y) # <<<<<<<<<<<<<<
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__2nd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(__pyx_t_2, (__pyx_v_a.shape[1]), __pyx_v_y); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArray2D", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":67
* checkDim('1st', a.shape[0], x)
*
* cdef int checkArray2D(num[:, ::1] a, dim *x, dim *y) except 1: # <<<<<<<<<<<<<<
* if a is None:
* raise ValueError('Array required, got None')
*/
static int __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray2D(__Pyx_memviewslice __pyx_v_a, int *__pyx_v_x, int *__pyx_v_y) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_1_2checkArray2D", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":68
*
* cdef int checkArray2D(num[:, ::1] a, dim *x, dim *y) except 1:
* if a is None: # <<<<<<<<<<<<<<
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
*/
__pyx_t_1 = (((PyObject *) __pyx_v_a.memview) == Py_None);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":69
* cdef int checkArray2D(num[:, ::1] a, dim *x, dim *y) except 1:
* if a is None:
* raise ValueError('Array required, got None') # <<<<<<<<<<<<<<
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":70
* if a is None:
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x) # <<<<<<<<<<<<<<
* checkDim('2nd', a.shape[1], y)
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__1st);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(__pyx_t_2, (__pyx_v_a.shape[0]), __pyx_v_x); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":71
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y) # <<<<<<<<<<<<<<
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__2nd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(__pyx_t_2, (__pyx_v_a.shape[1]), __pyx_v_y); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArray2D", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":73
* checkDim('2nd', a.shape[1], y)
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1: # <<<<<<<<<<<<<<
* if a is None:
* raise ValueError('Array required, got None')
*/
static int __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray3D(__Pyx_memviewslice __pyx_v_a, int *__pyx_v_x, int *__pyx_v_y, int *__pyx_v_z) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_0_2checkArray3D", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":74
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
* if a is None: # <<<<<<<<<<<<<<
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
*/
__pyx_t_1 = (((PyObject *) __pyx_v_a.memview) == Py_None);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":75
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
* if a is None:
* raise ValueError('Array required, got None') # <<<<<<<<<<<<<<
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":76
* if a is None:
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x) # <<<<<<<<<<<<<<
* checkDim('2nd', a.shape[1], y)
* checkDim('3rd', a.shape[2], z)
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__1st);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(__pyx_t_2, (__pyx_v_a.shape[0]), __pyx_v_x); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":77
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y) # <<<<<<<<<<<<<<
* checkDim('3rd', a.shape[2], z)
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__2nd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(__pyx_t_2, (__pyx_v_a.shape[1]), __pyx_v_y); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":78
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
* checkDim('3rd', a.shape[2], z) # <<<<<<<<<<<<<<
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__3rd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(__pyx_t_2, (__pyx_v_a.shape[2]), __pyx_v_z); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArray3D", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":73
* checkDim('2nd', a.shape[1], y)
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1: # <<<<<<<<<<<<<<
* if a is None:
* raise ValueError('Array required, got None')
*/
static int __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray3D(__Pyx_memviewslice __pyx_v_a, int *__pyx_v_x, int *__pyx_v_y, int *__pyx_v_z) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_1_2checkArray3D", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":74
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
* if a is None: # <<<<<<<<<<<<<<
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
*/
__pyx_t_1 = (((PyObject *) __pyx_v_a.memview) == Py_None);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":75
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
* if a is None:
* raise ValueError('Array required, got None') # <<<<<<<<<<<<<<
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":76
* if a is None:
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x) # <<<<<<<<<<<<<<
* checkDim('2nd', a.shape[1], y)
* checkDim('3rd', a.shape[2], z)
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__1st);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(__pyx_t_2, (__pyx_v_a.shape[0]), __pyx_v_x); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":77
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y) # <<<<<<<<<<<<<<
* checkDim('3rd', a.shape[2], z)
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__2nd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(__pyx_t_2, (__pyx_v_a.shape[1]), __pyx_v_y); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":78
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
* checkDim('3rd', a.shape[2], z) # <<<<<<<<<<<<<<
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__3rd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(__pyx_t_2, (__pyx_v_a.shape[2]), __pyx_v_z); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArray3D", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":73
* checkDim('2nd', a.shape[1], y)
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1: # <<<<<<<<<<<<<<
* if a is None:
* raise ValueError('Array required, got None')
*/
static int __pyx_fuse_2_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray3D(__Pyx_memviewslice __pyx_v_a, int *__pyx_v_x, int *__pyx_v_y, int *__pyx_v_z) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_2_2checkArray3D", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":74
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
* if a is None: # <<<<<<<<<<<<<<
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
*/
__pyx_t_1 = (((PyObject *) __pyx_v_a.memview) == Py_None);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":75
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
* if a is None:
* raise ValueError('Array required, got None') # <<<<<<<<<<<<<<
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":76
* if a is None:
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x) # <<<<<<<<<<<<<<
* checkDim('2nd', a.shape[1], y)
* checkDim('3rd', a.shape[2], z)
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__1st);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(__pyx_t_2, (__pyx_v_a.shape[0]), __pyx_v_x); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":77
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y) # <<<<<<<<<<<<<<
* checkDim('3rd', a.shape[2], z)
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__2nd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(__pyx_t_2, (__pyx_v_a.shape[1]), __pyx_v_y); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":78
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
* checkDim('3rd', a.shape[2], z) # <<<<<<<<<<<<<<
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__3rd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkDim(__pyx_t_2, (__pyx_v_a.shape[2]), __pyx_v_z); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArray3D", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6cogent_5align_14_pairwise_pogs_1fmpt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6cogent_5align_14_pairwise_pogs_1fmpt = {__Pyx_NAMESTR("fmpt"), (PyCFunction)__pyx_pw_6cogent_5align_14_pairwise_pogs_1fmpt, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6cogent_5align_14_pairwise_pogs_1fmpt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_mantissa = 0;
PyObject *__pyx_v_exponent = 0;
PyObject *__pyx_v_msg = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("fmpt (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mantissa,&__pyx_n_s__exponent,&__pyx_n_s__msg,0};
PyObject* values[3] = {0,0,0};
values[2] = ((PyObject *)__pyx_kp_s_10);
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mantissa)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exponent)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("fmpt", 0, 2, 3, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__msg);
if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fmpt") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_mantissa = values[0];
__pyx_v_exponent = values[1];
__pyx_v_msg = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("fmpt", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cogent.align._pairwise_pogs.fmpt", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6cogent_5align_14_pairwise_pogs_fmpt(__pyx_self, __pyx_v_mantissa, __pyx_v_exponent, __pyx_v_msg);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "cogent/align/_pairwise_pogs.pyx":28
* MAX_SCALE = +10000 # or 0 if all numbers should be probabilities
*
* def fmpt(mantissa, exponent, msg=''): # <<<<<<<<<<<<<<
* return "%s * SCALE_STEP ** %s %s" % (mantissa, exponent, msg)
*
*/
static PyObject *__pyx_pf_6cogent_5align_14_pairwise_pogs_fmpt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mantissa, PyObject *__pyx_v_exponent, PyObject *__pyx_v_msg) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("fmpt", 0);
/* "cogent/align/_pairwise_pogs.pyx":29
*
* def fmpt(mantissa, exponent, msg=''):
* return "%s * SCALE_STEP ** %s %s" % (mantissa, exponent, msg) # <<<<<<<<<<<<<<
*
* ctypedef unsigned char [:,:,::1] UChar3D
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_mantissa);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_mantissa);
__Pyx_GIVEREF(__pyx_v_mantissa);
__Pyx_INCREF(__pyx_v_exponent);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_exponent);
__Pyx_GIVEREF(__pyx_v_exponent);
__Pyx_INCREF(__pyx_v_msg);
PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_msg);
__Pyx_GIVEREF(__pyx_v_msg);
__pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_r = ((PyObject *)__pyx_t_2);
__pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cogent.align._pairwise_pogs.fmpt", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6cogent_5align_14_pairwise_pogs_3calc_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cogent_5align_14_pairwise_pogs_2calc_rows[] = "The ultimate in 2D Pyrex dynamic programming - Forward or Viterbi \n algorithm, with doubles or with slower but practically unoverflowable \n (double, long) GMP-like numbers. Viterbi is also available in the ever \n popular addition-of-logs version. All this with any possible pair HMM \n transition matrix.\n \n One time to use something faster than this is when the inputs are sequences\n rather than alignments. This code expects alignments (which can be single\n sequences) represented as POGs (ie: DAGs).\n \n Limitations\n - HMM states must be in a sensible order: M and X, then Y, then END.\n ";
static PyMethodDef __pyx_mdef_6cogent_5align_14_pairwise_pogs_3calc_rows = {__Pyx_NAMESTR("calc_rows"), (PyCFunction)__pyx_pw_6cogent_5align_14_pairwise_pogs_3calc_rows, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cogent_5align_14_pairwise_pogs_2calc_rows)};
static PyObject *__pyx_pw_6cogent_5align_14_pairwise_pogs_3calc_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__pyx_t_6cogent_5align_14_pairwise_pogs_Long1D __pyx_v_plan = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_pogs_Long1D __pyx_v_seq1_index = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_pogs_Long1D __pyx_v_seq2_index = { 0, 0, { 0 }, { 0 }, { 0 } };
int __pyx_v_i_low;
int __pyx_v_i_high;
int __pyx_v_j_low;
int __pyx_v_j_high;
PyObject *__pyx_v_preds = 0;
__pyx_t_6cogent_5align_14_pairwise_pogs_Long2D __pyx_v_state_directions = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_pogs_Double2D __pyx_v_T = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_pogs_Double2D __pyx_v_xgap_scores = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_pogs_Double2D __pyx_v_ygap_scores = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_pogs_Double3D __pyx_v_match_scores = { 0, 0, { 0 }, { 0 }, { 0 } };
PyObject *__pyx_v_rows = 0;
__pyx_t_6cogent_5align_14_pairwise_pogs_UChar3D __pyx_v_track = { 0, 0, { 0 }, { 0 }, { 0 } };
PyObject *__pyx_v_track_enc = 0;
int __pyx_v_viterbi;
int __pyx_v_use_logs;
int __pyx_v_local;
int __pyx_v_use_scaling;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("calc_rows (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__plan,&__pyx_n_s__seq1_index,&__pyx_n_s__seq2_index,&__pyx_n_s__i_low,&__pyx_n_s__i_high,&__pyx_n_s__j_low,&__pyx_n_s__j_high,&__pyx_n_s__preds,&__pyx_n_s__state_directions,&__pyx_n_s__T,&__pyx_n_s__xgap_scores,&__pyx_n_s__ygap_scores,&__pyx_n_s__match_scores,&__pyx_n_s__rows,&__pyx_n_s__track,&__pyx_n_s__track_enc,&__pyx_n_s__viterbi,&__pyx_n_s__use_logs,&__pyx_n_s__local,&__pyx_n_s__use_scaling,0};
PyObject* values[20] = {0,0,0,0,0,0,0,0,0,0,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 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__plan)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seq1_index)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seq2_index)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_low)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 3); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 4:
if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_high)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 4); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 5:
if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j_low)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 5); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 6:
if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j_high)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 6); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 7:
if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__preds)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 7); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 8:
if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__state_directions)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 8); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 9:
if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__T)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 9); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 10:
if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xgap_scores)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 10); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 11:
if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ygap_scores)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 11); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 12:
if (likely((values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__match_scores)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 12); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 13:
if (likely((values[13] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rows)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 13); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 14:
if (likely((values[14] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__track)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 14); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 15:
if (likely((values[15] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__track_enc)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 15); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 16:
if (likely((values[16] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__viterbi)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 16); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 17:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_logs);
if (value) { values[17] = value; kw_args--; }
}
case 18:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__local);
if (value) { values[18] = value; kw_args--; }
}
case 19:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_scaling);
if (value) { values[19] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calc_rows") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_plan = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[0]); if (unlikely(!__pyx_v_plan.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_seq1_index = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[1]); if (unlikely(!__pyx_v_seq1_index.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_seq2_index = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[2]); if (unlikely(!__pyx_v_seq2_index.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_i_low = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_i_low == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_i_high = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_i_high == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_j_low = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_j_low == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_j_high = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_j_high == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_preds = values[7];
__pyx_v_state_directions = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(values[8]); if (unlikely(!__pyx_v_state_directions.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_T = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[9]); if (unlikely(!__pyx_v_T.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_xgap_scores = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[10]); if (unlikely(!__pyx_v_xgap_scores.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_ygap_scores = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[11]); if (unlikely(!__pyx_v_ygap_scores.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_match_scores = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[12]); if (unlikely(!__pyx_v_match_scores.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_rows = values[13];
__pyx_v_track = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(values[14]); if (unlikely(!__pyx_v_track.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_track_enc = values[15];
__pyx_v_viterbi = __Pyx_PyInt_AsInt(values[16]); if (unlikely((__pyx_v_viterbi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
if (values[17]) {
__pyx_v_use_logs = __Pyx_PyInt_AsInt(values[17]); if (unlikely((__pyx_v_use_logs == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
__pyx_v_use_logs = ((int)0);
}
if (values[18]) {
__pyx_v_local = __Pyx_PyInt_AsInt(values[18]); if (unlikely((__pyx_v_local == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
/* "cogent/align/_pairwise_pogs.pyx":37
* Long2D state_directions, Double2D T,
* Double2D xgap_scores, Double2D ygap_scores, Double3D match_scores,
* rows, UChar3D track, track_enc, int viterbi, int use_logs=0, int local=False, # <<<<<<<<<<<<<<
* int use_scaling=True):
*
*/
__pyx_v_local = ((int)0);
}
if (values[19]) {
__pyx_v_use_scaling = __Pyx_PyInt_AsInt(values[19]); if (unlikely((__pyx_v_use_scaling == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
/* "cogent/align/_pairwise_pogs.pyx":38
* Double2D xgap_scores, Double2D ygap_scores, Double3D match_scores,
* rows, UChar3D track, track_enc, int viterbi, int use_logs=0, int local=False,
* int use_scaling=True): # <<<<<<<<<<<<<<
*
* """The ultimate in 2D Pyrex dynamic programming - Forward or Viterbi
*/
__pyx_v_use_scaling = ((int)1);
}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cogent.align._pairwise_pogs.calc_rows", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6cogent_5align_14_pairwise_pogs_2calc_rows(__pyx_self, __pyx_v_plan, __pyx_v_seq1_index, __pyx_v_seq2_index, __pyx_v_i_low, __pyx_v_i_high, __pyx_v_j_low, __pyx_v_j_high, __pyx_v_preds, __pyx_v_state_directions, __pyx_v_T, __pyx_v_xgap_scores, __pyx_v_ygap_scores, __pyx_v_match_scores, __pyx_v_rows, __pyx_v_track, __pyx_v_track_enc, __pyx_v_viterbi, __pyx_v_use_logs, __pyx_v_local, __pyx_v_use_scaling);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "cogent/align/_pairwise_pogs.pyx":33
* ctypedef unsigned char [:,:,::1] UChar3D
*
* def calc_rows(Long1D plan, Long1D seq1_index, Long1D seq2_index, # <<<<<<<<<<<<<<
* int i_low, int i_high, int j_low, int j_high, preds,
* Long2D state_directions, Double2D T,
*/
static PyObject *__pyx_pf_6cogent_5align_14_pairwise_pogs_2calc_rows(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_6cogent_5align_14_pairwise_pogs_Long1D __pyx_v_plan, __pyx_t_6cogent_5align_14_pairwise_pogs_Long1D __pyx_v_seq1_index, __pyx_t_6cogent_5align_14_pairwise_pogs_Long1D __pyx_v_seq2_index, int __pyx_v_i_low, int __pyx_v_i_high, int __pyx_v_j_low, int __pyx_v_j_high, PyObject *__pyx_v_preds, __pyx_t_6cogent_5align_14_pairwise_pogs_Long2D __pyx_v_state_directions, __pyx_t_6cogent_5align_14_pairwise_pogs_Double2D __pyx_v_T, __pyx_t_6cogent_5align_14_pairwise_pogs_Double2D __pyx_v_xgap_scores, __pyx_t_6cogent_5align_14_pairwise_pogs_Double2D __pyx_v_ygap_scores, __pyx_t_6cogent_5align_14_pairwise_pogs_Double3D __pyx_v_match_scores, PyObject *__pyx_v_rows, __pyx_t_6cogent_5align_14_pairwise_pogs_UChar3D __pyx_v_track, PyObject *__pyx_v_track_enc, int __pyx_v_viterbi, int __pyx_v_use_logs, int __pyx_v_local, int __pyx_v_use_scaling) {
int __pyx_v_prev_i;
int __pyx_v_prev_j;
int __pyx_v_state;
int __pyx_v_prev_state;
int __pyx_v_min_prev_state;
int __pyx_v_N;
int __pyx_v_row_length;
int __pyx_v_row_length1;
int __pyx_v_row_count;
int __pyx_v_row_count1;
int __pyx_v_tmp_rows;
int __pyx_v_a_count;
int __pyx_v_a;
int __pyx_v_b;
int __pyx_v_a_low;
int __pyx_v_a_high;
int __pyx_v_b_low;
int __pyx_v_b_high;
int __pyx_v_dest_states;
int __pyx_v_dest_state;
int __pyx_v_d4;
int __pyx_v_j;
int __pyx_v_i;
int __pyx_v_last_i;
int __pyx_v_last_j;
int __pyx_v_last_state;
int __pyx_v_bin;
int __pyx_v_x;
int __pyx_v_y;
int __pyx_v_bin_count;
int __pyx_v_max_x;
int __pyx_v_max_y;
int __pyx_v_current_row_index;
int __pyx_v_source_row_index;
int __pyx_v_source_row_index_cache[256];
int __pyx_v_i_link_count;
int __pyx_v_j_link_count;
int __pyx_v_dx;
int __pyx_v_dy;
int __pyx_v_tcode_x;
int __pyx_v_tcode_y;
int __pyx_v_tcode_s;
double __pyx_v_d_score;
double __pyx_v_mantissa;
double __pyx_v_partial_sum;
double __pyx_v_sub_partial_sum;
double __pyx_v_max_mantissa;
double __pyx_v_overall_max_mantissa;
long __pyx_v_exponent;
long __pyx_v_max_exponent;
long __pyx_v_overall_max_exponent;
__pyx_t_6cogent_5align_14_pairwise_pogs_Double3D __pyx_v_mantissas = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_pogs_Long3D __pyx_v_exponents = { 0, 0, { 0 }, { 0 }, { 0 } };
long __pyx_v_pointer_a;
long __pyx_v_pointer_b;
long __pyx_v_pointer_state;
__pyx_t_6cogent_5align_14_pairwise_pogs_Long1D __pyx_v_i_sources = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_pogs_Long1D __pyx_v_i_sources_offsets = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_pogs_Long1D __pyx_v_j_sources = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_pogs_Long1D __pyx_v_j_sources_offsets = { 0, 0, { 0 }, { 0 }, { 0 } };
long __pyx_v_i_sources_start;
long __pyx_v_i_sources_end;
long __pyx_v_j_sources_start;
long __pyx_v_j_sources_end;
PyObject *__pyx_v_pog1 = NULL;
PyObject *__pyx_v_pog2 = NULL;
double __pyx_v_impossible;
double __pyx_v_score;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
int __pyx_t_4;
long __pyx_t_5;
int __pyx_t_6;
int __pyx_t_7;
int __pyx_t_8;
PyObject *__pyx_t_9 = NULL;
PyObject *__pyx_t_10 = NULL;
PyObject *__pyx_t_11 = NULL;
PyObject *(*__pyx_t_12)(PyObject *);
PyObject *__pyx_t_13 = NULL;
__pyx_t_6cogent_5align_14_pairwise_pogs_Long1D __pyx_t_14 = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_pogs_Long1D __pyx_t_15 = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_pogs_Double3D __pyx_t_16 = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_pogs_Long3D __pyx_t_17 = { 0, 0, { 0 }, { 0 }, { 0 } };
int __pyx_t_18;
int __pyx_t_19;
__pyx_t_6cogent_5align_14_pairwise_pogs_UChar3D __pyx_t_20 = { 0, 0, { 0 }, { 0 }, { 0 } };
int __pyx_t_21;
int __pyx_t_22;
long __pyx_t_23;
int __pyx_t_24;
double __pyx_t_25;
Py_ssize_t __pyx_t_26;
Py_ssize_t __pyx_t_27;
int __pyx_t_28;
Py_ssize_t __pyx_t_29;
Py_ssize_t __pyx_t_30;
int __pyx_t_31;
Py_ssize_t __pyx_t_32;
Py_ssize_t __pyx_t_33;
int __pyx_t_34;
Py_ssize_t __pyx_t_35;
Py_ssize_t __pyx_t_36;
int __pyx_t_37;
int __pyx_t_38;
long __pyx_t_39;
int __pyx_t_40;
int __pyx_t_41;
Py_ssize_t __pyx_t_42;
int __pyx_t_43;
Py_ssize_t __pyx_t_44;
int __pyx_t_45;
Py_ssize_t __pyx_t_46;
int __pyx_t_47;
Py_ssize_t __pyx_t_48;
int __pyx_t_49;
int __pyx_t_50;
long __pyx_t_51;
int __pyx_t_52;
int __pyx_t_53;
int __pyx_t_54;
int __pyx_t_55;
int __pyx_t_56;
int __pyx_t_57;
int __pyx_t_58;
int __pyx_t_59;
int __pyx_t_60;
int __pyx_t_61;
int __pyx_t_62;
long __pyx_t_63;
int __pyx_t_64;
int __pyx_t_65;
int __pyx_t_66;
int __pyx_t_67;
int __pyx_t_68;
int __pyx_t_69;
int __pyx_t_70;
int __pyx_t_71;
int __pyx_t_72;
int __pyx_t_73;
int __pyx_t_74;
int __pyx_t_75;
int __pyx_t_76;
int __pyx_t_77;
int __pyx_t_78;
int __pyx_t_79;
int __pyx_t_80;
int __pyx_t_81;
int __pyx_t_82;
int __pyx_t_83;
int __pyx_t_84;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("calc_rows", 0);
/* "cogent/align/_pairwise_pogs.pyx":77
* cdef long j_sources_start, j_sources_end
*
* assert not (use_logs and not viterbi) # <<<<<<<<<<<<<<
* assert not (use_logs and use_scaling)
* assert not (local and not viterbi)
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
if (__pyx_v_use_logs) {
__pyx_t_1 = (!__pyx_v_viterbi);
__pyx_t_2 = __pyx_t_1;
} else {
__pyx_t_2 = __pyx_v_use_logs;
}
if (unlikely(!(!__pyx_t_2))) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "cogent/align/_pairwise_pogs.pyx":78
*
* assert not (use_logs and not viterbi)
* assert not (use_logs and use_scaling) # <<<<<<<<<<<<<<
* assert not (local and not viterbi)
*
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
if (__pyx_v_use_logs) {
__pyx_t_2 = __pyx_v_use_scaling;
} else {
__pyx_t_2 = __pyx_v_use_logs;
}
if (unlikely(!(!__pyx_t_2))) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "cogent/align/_pairwise_pogs.pyx":79
* assert not (use_logs and not viterbi)
* assert not (use_logs and use_scaling)
* assert not (local and not viterbi) # <<<<<<<<<<<<<<
*
* N = 0
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
if (__pyx_v_local) {
__pyx_t_2 = (!__pyx_v_viterbi);
__pyx_t_1 = __pyx_t_2;
} else {
__pyx_t_1 = __pyx_v_local;
}
if (unlikely(!(!__pyx_t_1))) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "cogent/align/_pairwise_pogs.pyx":81
* assert not (local and not viterbi)
*
* N = 0 # <<<<<<<<<<<<<<
* checkArray2D(T, &N, &N)
* row_length = 0
*/
__pyx_v_N = 0;
/* "cogent/align/_pairwise_pogs.pyx":82
*
* N = 0
* checkArray2D(T, &N, &N) # <<<<<<<<<<<<<<
* row_length = 0
* row_count = 0
*/
__pyx_t_3 = __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray2D(__pyx_v_T, (&__pyx_v_N), (&__pyx_v_N)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":83
* N = 0
* checkArray2D(T, &N, &N)
* row_length = 0 # <<<<<<<<<<<<<<
* row_count = 0
* checkArray1D(plan, &row_count)
*/
__pyx_v_row_length = 0;
/* "cogent/align/_pairwise_pogs.pyx":84
* checkArray2D(T, &N, &N)
* row_length = 0
* row_count = 0 # <<<<<<<<<<<<<<
* checkArray1D(plan, &row_count)
*
*/
__pyx_v_row_count = 0;
/* "cogent/align/_pairwise_pogs.pyx":85
* row_length = 0
* row_count = 0
* checkArray1D(plan, &row_count) # <<<<<<<<<<<<<<
*
* dest_states = 0
*/
__pyx_t_3 = __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray1D(__pyx_v_plan, (&__pyx_v_row_count)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":87
* checkArray1D(plan, &row_count)
*
* dest_states = 0 # <<<<<<<<<<<<<<
* d4 = 4
* # Array of (state, bin, dx, dy) tuples describing the HMM states.
*/
__pyx_v_dest_states = 0;
/* "cogent/align/_pairwise_pogs.pyx":88
*
* dest_states = 0
* d4 = 4 # <<<<<<<<<<<<<<
* # Array of (state, bin, dx, dy) tuples describing the HMM states.
* checkArray2D(state_directions, &dest_states, &d4)
*/
__pyx_v_d4 = 4;
/* "cogent/align/_pairwise_pogs.pyx":90
* d4 = 4
* # Array of (state, bin, dx, dy) tuples describing the HMM states.
* checkArray2D(state_directions, &dest_states, &d4) # <<<<<<<<<<<<<<
*
* checkArray1D(seq1_index, &row_count)
*/
__pyx_t_3 = __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray2D(__pyx_v_state_directions, (&__pyx_v_dest_states), (&__pyx_v_d4)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":92
* checkArray2D(state_directions, &dest_states, &d4)
*
* checkArray1D(seq1_index, &row_count) # <<<<<<<<<<<<<<
* checkArray1D(seq2_index, &row_length)
*
*/
__pyx_t_3 = __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray1D(__pyx_v_seq1_index, (&__pyx_v_row_count)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":93
*
* checkArray1D(seq1_index, &row_count)
* checkArray1D(seq2_index, &row_length) # <<<<<<<<<<<<<<
*
* max_x = max_y = bin_count = 0
*/
__pyx_t_3 = __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray1D(__pyx_v_seq2_index, (&__pyx_v_row_length)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":95
* checkArray1D(seq2_index, &row_length)
*
* max_x = max_y = bin_count = 0 # <<<<<<<<<<<<<<
* checkArray3D(match_scores, &bin_count, &max_x, &max_y)
* checkArray2D(xgap_scores, &bin_count, &max_x)
*/
__pyx_v_max_x = 0;
__pyx_v_max_y = 0;
__pyx_v_bin_count = 0;
/* "cogent/align/_pairwise_pogs.pyx":96
*
* max_x = max_y = bin_count = 0
* checkArray3D(match_scores, &bin_count, &max_x, &max_y) # <<<<<<<<<<<<<<
* checkArray2D(xgap_scores, &bin_count, &max_x)
* checkArray2D(ygap_scores, &bin_count, &max_y)
*/
__pyx_t_3 = __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray3D(__pyx_v_match_scores, (&__pyx_v_bin_count), (&__pyx_v_max_x), (&__pyx_v_max_y)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":97
* max_x = max_y = bin_count = 0
* checkArray3D(match_scores, &bin_count, &max_x, &max_y)
* checkArray2D(xgap_scores, &bin_count, &max_x) # <<<<<<<<<<<<<<
* checkArray2D(ygap_scores, &bin_count, &max_y)
*
*/
__pyx_t_3 = __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray2D(__pyx_v_xgap_scores, (&__pyx_v_bin_count), (&__pyx_v_max_x)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":98
* checkArray3D(match_scores, &bin_count, &max_x, &max_y)
* checkArray2D(xgap_scores, &bin_count, &max_x)
* checkArray2D(ygap_scores, &bin_count, &max_y) # <<<<<<<<<<<<<<
*
* for i from 0 <= i < row_count:
*/
__pyx_t_3 = __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray2D(__pyx_v_ygap_scores, (&__pyx_v_bin_count), (&__pyx_v_max_y)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":100
* checkArray2D(ygap_scores, &bin_count, &max_y)
*
* for i from 0 <= i < row_count: # <<<<<<<<<<<<<<
* assert 0 <= seq1_index[i] < max_x
* for j from 0 <= j < row_length:
*/
__pyx_t_3 = __pyx_v_row_count;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
/* "cogent/align/_pairwise_pogs.pyx":101
*
* for i from 0 <= i < row_count:
* assert 0 <= seq1_index[i] < max_x # <<<<<<<<<<<<<<
* for j from 0 <= j < row_length:
* assert 0 <= seq2_index[j] < max_y
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
__pyx_t_4 = __pyx_v_i;
__pyx_t_5 = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_seq1_index.data) + __pyx_t_4)) )));
__pyx_t_1 = (0 <= __pyx_t_5);
if (__pyx_t_1) {
__pyx_t_1 = (__pyx_t_5 < __pyx_v_max_x);
}
if (unlikely(!__pyx_t_1)) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
}
/* "cogent/align/_pairwise_pogs.pyx":102
* for i from 0 <= i < row_count:
* assert 0 <= seq1_index[i] < max_x
* for j from 0 <= j < row_length: # <<<<<<<<<<<<<<
* assert 0 <= seq2_index[j] < max_y
*
*/
__pyx_t_3 = __pyx_v_row_length;
for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_3; __pyx_v_j++) {
/* "cogent/align/_pairwise_pogs.pyx":103
* assert 0 <= seq1_index[i] < max_x
* for j from 0 <= j < row_length:
* assert 0 <= seq2_index[j] < max_y # <<<<<<<<<<<<<<
*
* assert j_low >= 0 and j_high > j_low and j_high <= row_length
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
__pyx_t_6 = __pyx_v_j;
__pyx_t_5 = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_seq2_index.data) + __pyx_t_6)) )));
__pyx_t_1 = (0 <= __pyx_t_5);
if (__pyx_t_1) {
__pyx_t_1 = (__pyx_t_5 < __pyx_v_max_y);
}
if (unlikely(!__pyx_t_1)) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
}
/* "cogent/align/_pairwise_pogs.pyx":105
* assert 0 <= seq2_index[j] < max_y
*
* assert j_low >= 0 and j_high > j_low and j_high <= row_length # <<<<<<<<<<<<<<
*
* (pog1, pog2) = preds
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
__pyx_t_1 = (__pyx_v_j_low >= 0);
if (__pyx_t_1) {
__pyx_t_2 = (__pyx_v_j_high > __pyx_v_j_low);
if (__pyx_t_2) {
__pyx_t_7 = (__pyx_v_j_high <= __pyx_v_row_length);
__pyx_t_8 = __pyx_t_7;
} else {
__pyx_t_8 = __pyx_t_2;
}
__pyx_t_2 = __pyx_t_8;
} else {
__pyx_t_2 = __pyx_t_1;
}
if (unlikely(!__pyx_t_2)) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "cogent/align/_pairwise_pogs.pyx":107
* assert j_low >= 0 and j_high > j_low and j_high <= row_length
*
* (pog1, pog2) = preds # <<<<<<<<<<<<<<
* (j_sources, j_sources_offsets) = pog2.asCombinedArray()
* j_link_count = 0
*/
if ((likely(PyTuple_CheckExact(__pyx_v_preds))) || (PyList_CheckExact(__pyx_v_preds))) {
PyObject* sequence = __pyx_v_preds;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_9 = PyList_GET_ITEM(sequence, 0);
__pyx_t_10 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(__pyx_t_10);
#else
__pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else
{
Py_ssize_t index = -1;
__pyx_t_11 = PyObject_GetIter(__pyx_v_preds); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed;
__Pyx_GOTREF(__pyx_t_9);
index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L7_unpacking_failed;
__Pyx_GOTREF(__pyx_t_10);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_12 = NULL;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
goto __pyx_L8_unpacking_done;
__pyx_L7_unpacking_failed:;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_12 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L8_unpacking_done:;
}
__pyx_v_pog1 = __pyx_t_9;
__pyx_t_9 = 0;
__pyx_v_pog2 = __pyx_t_10;
__pyx_t_10 = 0;
/* "cogent/align/_pairwise_pogs.pyx":108
*
* (pog1, pog2) = preds
* (j_sources, j_sources_offsets) = pog2.asCombinedArray() # <<<<<<<<<<<<<<
* j_link_count = 0
* checkArray1D(j_sources, &j_link_count)
*/
__pyx_t_10 = PyObject_GetAttr(__pyx_v_pog2, __pyx_n_s__asCombinedArray); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
PyObject* sequence = __pyx_t_9;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_10 = PyList_GET_ITEM(sequence, 0);
__pyx_t_11 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_10);
__Pyx_INCREF(__pyx_t_11);
#else
__pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
} else
{
Py_ssize_t index = -1;
__pyx_t_13 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_12 = Py_TYPE(__pyx_t_13)->tp_iternext;
index = 0; __pyx_t_10 = __pyx_t_12(__pyx_t_13); if (unlikely(!__pyx_t_10)) goto __pyx_L9_unpacking_failed;
__Pyx_GOTREF(__pyx_t_10);
index = 1; __pyx_t_11 = __pyx_t_12(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L9_unpacking_failed;
__Pyx_GOTREF(__pyx_t_11);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_12 = NULL;
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
goto __pyx_L10_unpacking_done;
__pyx_L9_unpacking_failed:;
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
__pyx_t_12 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L10_unpacking_done:;
}
__pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_10);
if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_11);
if (unlikely(!__pyx_t_15.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_v_j_sources = __pyx_t_14;
__pyx_t_14.memview = NULL;
__pyx_t_14.data = NULL;
__pyx_v_j_sources_offsets = __pyx_t_15;
__pyx_t_15.memview = NULL;
__pyx_t_15.data = NULL;
/* "cogent/align/_pairwise_pogs.pyx":109
* (pog1, pog2) = preds
* (j_sources, j_sources_offsets) = pog2.asCombinedArray()
* j_link_count = 0 # <<<<<<<<<<<<<<
* checkArray1D(j_sources, &j_link_count)
* row_length1 = row_length + 1
*/
__pyx_v_j_link_count = 0;
/* "cogent/align/_pairwise_pogs.pyx":110
* (j_sources, j_sources_offsets) = pog2.asCombinedArray()
* j_link_count = 0
* checkArray1D(j_sources, &j_link_count) # <<<<<<<<<<<<<<
* row_length1 = row_length + 1
* checkArray1D(j_sources_offsets, &row_length1)
*/
__pyx_t_3 = __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray1D(__pyx_v_j_sources, (&__pyx_v_j_link_count)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":111
* j_link_count = 0
* checkArray1D(j_sources, &j_link_count)
* row_length1 = row_length + 1 # <<<<<<<<<<<<<<
* checkArray1D(j_sources_offsets, &row_length1)
*
*/
__pyx_v_row_length1 = (__pyx_v_row_length + 1);
/* "cogent/align/_pairwise_pogs.pyx":112
* checkArray1D(j_sources, &j_link_count)
* row_length1 = row_length + 1
* checkArray1D(j_sources_offsets, &row_length1) # <<<<<<<<<<<<<<
*
* (i_sources, i_sources_offsets) = pog1.asCombinedArray()
*/
__pyx_t_3 = __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray1D(__pyx_v_j_sources_offsets, (&__pyx_v_row_length1)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":114
* checkArray1D(j_sources_offsets, &row_length1)
*
* (i_sources, i_sources_offsets) = pog1.asCombinedArray() # <<<<<<<<<<<<<<
* i_link_count = 0
* checkArray1D(i_sources, &i_link_count)
*/
__pyx_t_9 = PyObject_GetAttr(__pyx_v_pog1, __pyx_n_s__asCombinedArray); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_11 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
if ((likely(PyTuple_CheckExact(__pyx_t_11))) || (PyList_CheckExact(__pyx_t_11))) {
PyObject* sequence = __pyx_t_11;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_9 = PyList_GET_ITEM(sequence, 0);
__pyx_t_10 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(__pyx_t_10);
#else
__pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
} else
{
Py_ssize_t index = -1;
__pyx_t_13 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_12 = Py_TYPE(__pyx_t_13)->tp_iternext;
index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_13); if (unlikely(!__pyx_t_9)) goto __pyx_L11_unpacking_failed;
__Pyx_GOTREF(__pyx_t_9);
index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_13); if (unlikely(!__pyx_t_10)) goto __pyx_L11_unpacking_failed;
__Pyx_GOTREF(__pyx_t_10);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_13), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_12 = NULL;
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
goto __pyx_L12_unpacking_done;
__pyx_L11_unpacking_failed:;
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
__pyx_t_12 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L12_unpacking_done:;
}
__pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_9);
if (unlikely(!__pyx_t_15.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dc_long(__pyx_t_10);
if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_v_i_sources = __pyx_t_15;
__pyx_t_15.memview = NULL;
__pyx_t_15.data = NULL;
__pyx_v_i_sources_offsets = __pyx_t_14;
__pyx_t_14.memview = NULL;
__pyx_t_14.data = NULL;
/* "cogent/align/_pairwise_pogs.pyx":115
*
* (i_sources, i_sources_offsets) = pog1.asCombinedArray()
* i_link_count = 0 # <<<<<<<<<<<<<<
* checkArray1D(i_sources, &i_link_count)
* row_count1 = row_count + 1
*/
__pyx_v_i_link_count = 0;
/* "cogent/align/_pairwise_pogs.pyx":116
* (i_sources, i_sources_offsets) = pog1.asCombinedArray()
* i_link_count = 0
* checkArray1D(i_sources, &i_link_count) # <<<<<<<<<<<<<<
* row_count1 = row_count + 1
* checkArray1D(i_sources_offsets, &row_count1)
*/
__pyx_t_3 = __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray1D(__pyx_v_i_sources, (&__pyx_v_i_link_count)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":117
* i_link_count = 0
* checkArray1D(i_sources, &i_link_count)
* row_count1 = row_count + 1 # <<<<<<<<<<<<<<
* checkArray1D(i_sources_offsets, &row_count1)
*
*/
__pyx_v_row_count1 = (__pyx_v_row_count + 1);
/* "cogent/align/_pairwise_pogs.pyx":118
* checkArray1D(i_sources, &i_link_count)
* row_count1 = row_count + 1
* checkArray1D(i_sources_offsets, &row_count1) # <<<<<<<<<<<<<<
*
* (mantissas, exponents) = rows
*/
__pyx_t_3 = __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray1D(__pyx_v_i_sources_offsets, (&__pyx_v_row_count1)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":120
* checkArray1D(i_sources_offsets, &row_count1)
*
* (mantissas, exponents) = rows # <<<<<<<<<<<<<<
* tmp_rows = 0
* checkArray3D(mantissas, &tmp_rows, &row_length, &N)
*/
if ((likely(PyTuple_CheckExact(__pyx_v_rows))) || (PyList_CheckExact(__pyx_v_rows))) {
PyObject* sequence = __pyx_v_rows;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_11 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_11 = PyList_GET_ITEM(sequence, 0);
__pyx_t_10 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_11);
__Pyx_INCREF(__pyx_t_10);
#else
__pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else
{
Py_ssize_t index = -1;
__pyx_t_9 = PyObject_GetIter(__pyx_v_rows); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_12 = Py_TYPE(__pyx_t_9)->tp_iternext;
index = 0; __pyx_t_11 = __pyx_t_12(__pyx_t_9); if (unlikely(!__pyx_t_11)) goto __pyx_L13_unpacking_failed;
__Pyx_GOTREF(__pyx_t_11);
index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_9); if (unlikely(!__pyx_t_10)) goto __pyx_L13_unpacking_failed;
__Pyx_GOTREF(__pyx_t_10);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_9), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_12 = NULL;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
goto __pyx_L14_unpacking_done;
__pyx_L13_unpacking_failed:;
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_12 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L14_unpacking_done:;
}
__pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_11);
if (unlikely(!__pyx_t_16.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_long(__pyx_t_10);
if (unlikely(!__pyx_t_17.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_v_mantissas = __pyx_t_16;
__pyx_t_16.memview = NULL;
__pyx_t_16.data = NULL;
__pyx_v_exponents = __pyx_t_17;
__pyx_t_17.memview = NULL;
__pyx_t_17.data = NULL;
/* "cogent/align/_pairwise_pogs.pyx":121
*
* (mantissas, exponents) = rows
* tmp_rows = 0 # <<<<<<<<<<<<<<
* checkArray3D(mantissas, &tmp_rows, &row_length, &N)
* if use_scaling:
*/
__pyx_v_tmp_rows = 0;
/* "cogent/align/_pairwise_pogs.pyx":122
* (mantissas, exponents) = rows
* tmp_rows = 0
* checkArray3D(mantissas, &tmp_rows, &row_length, &N) # <<<<<<<<<<<<<<
* if use_scaling:
* checkArray3D(exponents, &tmp_rows, &row_length, &N)
*/
__pyx_t_3 = __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray3D(__pyx_v_mantissas, (&__pyx_v_tmp_rows), (&__pyx_v_row_length), (&__pyx_v_N)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":123
* tmp_rows = 0
* checkArray3D(mantissas, &tmp_rows, &row_length, &N)
* if use_scaling: # <<<<<<<<<<<<<<
* checkArray3D(exponents, &tmp_rows, &row_length, &N)
*
*/
if (__pyx_v_use_scaling) {
/* "cogent/align/_pairwise_pogs.pyx":124
* checkArray3D(mantissas, &tmp_rows, &row_length, &N)
* if use_scaling:
* checkArray3D(exponents, &tmp_rows, &row_length, &N) # <<<<<<<<<<<<<<
*
* cdef double impossible
*/
__pyx_t_3 = __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray3D(__pyx_v_exponents, (&__pyx_v_tmp_rows), (&__pyx_v_row_length), (&__pyx_v_N)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L15;
}
__pyx_L15:;
/* "cogent/align/_pairwise_pogs.pyx":127
*
* cdef double impossible
* if use_logs: # <<<<<<<<<<<<<<
* impossible = log(0.0) # -inf
* else:
*/
if (__pyx_v_use_logs) {
/* "cogent/align/_pairwise_pogs.pyx":128
* cdef double impossible
* if use_logs:
* impossible = log(0.0) # -inf # <<<<<<<<<<<<<<
* else:
* impossible = 0.0
*/
__pyx_v_impossible = log(0.0);
goto __pyx_L16;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":130
* impossible = log(0.0) # -inf
* else:
* impossible = 0.0 # <<<<<<<<<<<<<<
*
* if viterbi and track is not None and track_enc is not None:
*/
__pyx_v_impossible = 0.0;
}
__pyx_L16:;
/* "cogent/align/_pairwise_pogs.pyx":132
* impossible = 0.0
*
* if viterbi and track is not None and track_enc is not None: # <<<<<<<<<<<<<<
* checkArray3D(track, &row_count, &row_length, &N)
* (tcode_x, tcode_y, tcode_s) = track_enc
*/
if (__pyx_v_viterbi) {
__pyx_t_2 = (((PyObject *) __pyx_v_track.memview) != Py_None);
if (__pyx_t_2) {
__pyx_t_1 = (__pyx_v_track_enc != Py_None);
__pyx_t_8 = __pyx_t_1;
} else {
__pyx_t_8 = __pyx_t_2;
}
__pyx_t_2 = __pyx_t_8;
} else {
__pyx_t_2 = __pyx_v_viterbi;
}
if (__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":133
*
* if viterbi and track is not None and track_enc is not None:
* checkArray3D(track, &row_count, &row_length, &N) # <<<<<<<<<<<<<<
* (tcode_x, tcode_y, tcode_s) = track_enc
* else:
*/
__pyx_t_3 = __pyx_fuse_2_2__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray3D(__pyx_v_track, (&__pyx_v_row_count), (&__pyx_v_row_length), (&__pyx_v_N)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":134
* if viterbi and track is not None and track_enc is not None:
* checkArray3D(track, &row_count, &row_length, &N)
* (tcode_x, tcode_y, tcode_s) = track_enc # <<<<<<<<<<<<<<
* else:
* track = None
*/
if ((likely(PyTuple_CheckExact(__pyx_v_track_enc))) || (PyList_CheckExact(__pyx_v_track_enc))) {
PyObject* sequence = __pyx_v_track_enc;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 3)) {
if (size > 3) __Pyx_RaiseTooManyValuesError(3);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_11 = PyTuple_GET_ITEM(sequence, 1);
__pyx_t_9 = PyTuple_GET_ITEM(sequence, 2);
} else {
__pyx_t_10 = PyList_GET_ITEM(sequence, 0);
__pyx_t_11 = PyList_GET_ITEM(sequence, 1);
__pyx_t_9 = PyList_GET_ITEM(sequence, 2);
}
__Pyx_INCREF(__pyx_t_10);
__Pyx_INCREF(__pyx_t_11);
__Pyx_INCREF(__pyx_t_9);
#else
__pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_9 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else
{
Py_ssize_t index = -1;
__pyx_t_13 = PyObject_GetIter(__pyx_v_track_enc); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
__pyx_t_12 = Py_TYPE(__pyx_t_13)->tp_iternext;
index = 0; __pyx_t_10 = __pyx_t_12(__pyx_t_13); if (unlikely(!__pyx_t_10)) goto __pyx_L18_unpacking_failed;
__Pyx_GOTREF(__pyx_t_10);
index = 1; __pyx_t_11 = __pyx_t_12(__pyx_t_13); if (unlikely(!__pyx_t_11)) goto __pyx_L18_unpacking_failed;
__Pyx_GOTREF(__pyx_t_11);
index = 2; __pyx_t_9 = __pyx_t_12(__pyx_t_13); if (unlikely(!__pyx_t_9)) goto __pyx_L18_unpacking_failed;
__Pyx_GOTREF(__pyx_t_9);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_13), 3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_12 = NULL;
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
goto __pyx_L19_unpacking_done;
__pyx_L18_unpacking_failed:;
__Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
__pyx_t_12 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L19_unpacking_done:;
}
__pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_18 = __Pyx_PyInt_AsInt(__pyx_t_11); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_19 = __Pyx_PyInt_AsInt(__pyx_t_9); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_v_tcode_x = __pyx_t_3;
__pyx_v_tcode_y = __pyx_t_18;
__pyx_v_tcode_s = __pyx_t_19;
goto __pyx_L17;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":136
* (tcode_x, tcode_y, tcode_s) = track_enc
* else:
* track = None # <<<<<<<<<<<<<<
* tcode_x = tcode_y = tcode_s = 0
*
*/
__pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(Py_None);
if (unlikely(!__pyx_t_20.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__PYX_XDEC_MEMVIEW(&__pyx_v_track, 1);
__pyx_v_track = __pyx_t_20;
__pyx_t_20.memview = NULL;
__pyx_t_20.data = NULL;
/* "cogent/align/_pairwise_pogs.pyx":137
* else:
* track = None
* tcode_x = tcode_y = tcode_s = 0 # <<<<<<<<<<<<<<
*
* # For local
*/
__pyx_v_tcode_x = 0;
__pyx_v_tcode_y = 0;
__pyx_v_tcode_s = 0;
}
__pyx_L17:;
/* "cogent/align/_pairwise_pogs.pyx":140
*
* # For local
* overall_max_exponent = MIN_SCALE # <<<<<<<<<<<<<<
* overall_max_mantissa = impossible
* last_i = last_j = last_state = -1
*/
__pyx_v_overall_max_exponent = __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_SCALE;
/* "cogent/align/_pairwise_pogs.pyx":141
* # For local
* overall_max_exponent = MIN_SCALE
* overall_max_mantissa = impossible # <<<<<<<<<<<<<<
* last_i = last_j = last_state = -1
*
*/
__pyx_v_overall_max_mantissa = __pyx_v_impossible;
/* "cogent/align/_pairwise_pogs.pyx":142
* overall_max_exponent = MIN_SCALE
* overall_max_mantissa = impossible
* last_i = last_j = last_state = -1 # <<<<<<<<<<<<<<
*
* for i from i_low <= i < i_high:
*/
__pyx_v_last_i = -1;
__pyx_v_last_j = -1;
__pyx_v_last_state = -1;
/* "cogent/align/_pairwise_pogs.pyx":144
* last_i = last_j = last_state = -1
*
* for i from i_low <= i < i_high: # <<<<<<<<<<<<<<
* x = seq1_index[i]
*
*/
__pyx_t_19 = __pyx_v_i_high;
for (__pyx_v_i = __pyx_v_i_low; __pyx_v_i < __pyx_t_19; __pyx_v_i++) {
/* "cogent/align/_pairwise_pogs.pyx":145
*
* for i from i_low <= i < i_high:
* x = seq1_index[i] # <<<<<<<<<<<<<<
*
* if PyErr_CheckSignals():
*/
__pyx_t_18 = __pyx_v_i;
__pyx_v_x = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_seq1_index.data) + __pyx_t_18)) )));
/* "cogent/align/_pairwise_pogs.pyx":147
* x = seq1_index[i]
*
* if PyErr_CheckSignals(): # <<<<<<<<<<<<<<
* raise PyErr_Occurred()
*
*/
__pyx_t_3 = PyErr_CheckSignals();
if (__pyx_t_3) {
/* "cogent/align/_pairwise_pogs.pyx":148
*
* if PyErr_CheckSignals():
* raise PyErr_Occurred() # <<<<<<<<<<<<<<
*
* i_sources_start = i_sources_offsets[i]
*/
__pyx_t_9 = PyErr_Occurred(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_Raise(__pyx_t_9, 0, 0, 0);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L22;
}
__pyx_L22:;
/* "cogent/align/_pairwise_pogs.pyx":150
* raise PyErr_Occurred()
*
* i_sources_start = i_sources_offsets[i] # <<<<<<<<<<<<<<
* i_sources_end = i_sources_offsets[i+1]
*
*/
__pyx_t_3 = __pyx_v_i;
__pyx_v_i_sources_start = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_i_sources_offsets.data) + __pyx_t_3)) )));
/* "cogent/align/_pairwise_pogs.pyx":151
*
* i_sources_start = i_sources_offsets[i]
* i_sources_end = i_sources_offsets[i+1] # <<<<<<<<<<<<<<
*
* current_row_index = plan[i]
*/
__pyx_t_5 = (__pyx_v_i + 1);
__pyx_v_i_sources_end = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_i_sources_offsets.data) + __pyx_t_5)) )));
/* "cogent/align/_pairwise_pogs.pyx":153
* i_sources_end = i_sources_offsets[i+1]
*
* current_row_index = plan[i] # <<<<<<<<<<<<<<
* source_row_index_cache[0] = current_row_index
*
*/
__pyx_t_21 = __pyx_v_i;
__pyx_v_current_row_index = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_plan.data) + __pyx_t_21)) )));
/* "cogent/align/_pairwise_pogs.pyx":154
*
* current_row_index = plan[i]
* source_row_index_cache[0] = current_row_index # <<<<<<<<<<<<<<
*
* a_count = i_sources_end-i_sources_start
*/
(__pyx_v_source_row_index_cache[0]) = __pyx_v_current_row_index;
/* "cogent/align/_pairwise_pogs.pyx":156
* source_row_index_cache[0] = current_row_index
*
* a_count = i_sources_end-i_sources_start # <<<<<<<<<<<<<<
* for a from 0 <= a < a_count:
* prev_i = i_sources[a+i_sources_start]
*/
__pyx_v_a_count = (__pyx_v_i_sources_end - __pyx_v_i_sources_start);
/* "cogent/align/_pairwise_pogs.pyx":157
*
* a_count = i_sources_end-i_sources_start
* for a from 0 <= a < a_count: # <<<<<<<<<<<<<<
* prev_i = i_sources[a+i_sources_start]
* source_row_index_cache[a+1] = plan[prev_i]
*/
__pyx_t_22 = __pyx_v_a_count;
for (__pyx_v_a = 0; __pyx_v_a < __pyx_t_22; __pyx_v_a++) {
/* "cogent/align/_pairwise_pogs.pyx":158
* a_count = i_sources_end-i_sources_start
* for a from 0 <= a < a_count:
* prev_i = i_sources[a+i_sources_start] # <<<<<<<<<<<<<<
* source_row_index_cache[a+1] = plan[prev_i]
*
*/
__pyx_t_23 = (__pyx_v_a + __pyx_v_i_sources_start);
__pyx_v_prev_i = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_i_sources.data) + __pyx_t_23)) )));
/* "cogent/align/_pairwise_pogs.pyx":159
* for a from 0 <= a < a_count:
* prev_i = i_sources[a+i_sources_start]
* source_row_index_cache[a+1] = plan[prev_i] # <<<<<<<<<<<<<<
*
* if i == 0:
*/
__pyx_t_24 = __pyx_v_prev_i;
(__pyx_v_source_row_index_cache[(__pyx_v_a + 1)]) = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_plan.data) + __pyx_t_24)) )));
}
/* "cogent/align/_pairwise_pogs.pyx":161
* source_row_index_cache[a+1] = plan[prev_i]
*
* if i == 0: # <<<<<<<<<<<<<<
* mantissas[current_row_index, 0, 0] = (0.0 if use_logs else 1.0)
* if use_scaling:
*/
__pyx_t_2 = (__pyx_v_i == 0);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":162
*
* if i == 0:
* mantissas[current_row_index, 0, 0] = (0.0 if use_logs else 1.0) # <<<<<<<<<<<<<<
* if use_scaling:
* exponents[current_row_index, 0, 0] = 0
*/
if (__pyx_v_use_logs) {
__pyx_t_25 = 0.0;
} else {
__pyx_t_25 = 1.0;
}
__pyx_t_22 = __pyx_v_current_row_index;
__pyx_t_26 = 0;
__pyx_t_27 = 0;
*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mantissas.data + __pyx_t_22 * __pyx_v_mantissas.strides[0]) ) + __pyx_t_26 * __pyx_v_mantissas.strides[1]) )) + __pyx_t_27)) )) = __pyx_t_25;
/* "cogent/align/_pairwise_pogs.pyx":163
* if i == 0:
* mantissas[current_row_index, 0, 0] = (0.0 if use_logs else 1.0)
* if use_scaling: # <<<<<<<<<<<<<<
* exponents[current_row_index, 0, 0] = 0
* else:
*/
if (__pyx_v_use_scaling) {
/* "cogent/align/_pairwise_pogs.pyx":164
* mantissas[current_row_index, 0, 0] = (0.0 if use_logs else 1.0)
* if use_scaling:
* exponents[current_row_index, 0, 0] = 0 # <<<<<<<<<<<<<<
* else:
* mantissas[current_row_index, 0, 0] = impossible
*/
__pyx_t_28 = __pyx_v_current_row_index;
__pyx_t_29 = 0;
__pyx_t_30 = 0;
*((long *) ( /* dim=2 */ ((char *) (((long *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_exponents.data + __pyx_t_28 * __pyx_v_exponents.strides[0]) ) + __pyx_t_29 * __pyx_v_exponents.strides[1]) )) + __pyx_t_30)) )) = 0;
goto __pyx_L26;
}
__pyx_L26:;
goto __pyx_L25;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":166
* exponents[current_row_index, 0, 0] = 0
* else:
* mantissas[current_row_index, 0, 0] = impossible # <<<<<<<<<<<<<<
* if use_scaling:
* exponents[current_row_index, 0, 0] = MIN_SCALE
*/
__pyx_t_31 = __pyx_v_current_row_index;
__pyx_t_32 = 0;
__pyx_t_33 = 0;
*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mantissas.data + __pyx_t_31 * __pyx_v_mantissas.strides[0]) ) + __pyx_t_32 * __pyx_v_mantissas.strides[1]) )) + __pyx_t_33)) )) = __pyx_v_impossible;
/* "cogent/align/_pairwise_pogs.pyx":167
* else:
* mantissas[current_row_index, 0, 0] = impossible
* if use_scaling: # <<<<<<<<<<<<<<
* exponents[current_row_index, 0, 0] = MIN_SCALE
*
*/
if (__pyx_v_use_scaling) {
/* "cogent/align/_pairwise_pogs.pyx":168
* mantissas[current_row_index, 0, 0] = impossible
* if use_scaling:
* exponents[current_row_index, 0, 0] = MIN_SCALE # <<<<<<<<<<<<<<
*
* j_sources_end = j_sources_offsets[j_low]
*/
__pyx_t_34 = __pyx_v_current_row_index;
__pyx_t_35 = 0;
__pyx_t_36 = 0;
*((long *) ( /* dim=2 */ ((char *) (((long *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_exponents.data + __pyx_t_34 * __pyx_v_exponents.strides[0]) ) + __pyx_t_35 * __pyx_v_exponents.strides[1]) )) + __pyx_t_36)) )) = __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_SCALE;
goto __pyx_L27;
}
__pyx_L27:;
}
__pyx_L25:;
/* "cogent/align/_pairwise_pogs.pyx":170
* exponents[current_row_index, 0, 0] = MIN_SCALE
*
* j_sources_end = j_sources_offsets[j_low] # <<<<<<<<<<<<<<
* for j from j_low <= j < j_high:
* j_sources_start = j_sources_end
*/
__pyx_t_37 = __pyx_v_j_low;
__pyx_v_j_sources_end = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_j_sources_offsets.data) + __pyx_t_37)) )));
/* "cogent/align/_pairwise_pogs.pyx":171
*
* j_sources_end = j_sources_offsets[j_low]
* for j from j_low <= j < j_high: # <<<<<<<<<<<<<<
* j_sources_start = j_sources_end
* j_sources_end = j_sources_offsets[j+1]
*/
__pyx_t_38 = __pyx_v_j_high;
for (__pyx_v_j = __pyx_v_j_low; __pyx_v_j < __pyx_t_38; __pyx_v_j++) {
/* "cogent/align/_pairwise_pogs.pyx":172
* j_sources_end = j_sources_offsets[j_low]
* for j from j_low <= j < j_high:
* j_sources_start = j_sources_end # <<<<<<<<<<<<<<
* j_sources_end = j_sources_offsets[j+1]
*
*/
__pyx_v_j_sources_start = __pyx_v_j_sources_end;
/* "cogent/align/_pairwise_pogs.pyx":173
* for j from j_low <= j < j_high:
* j_sources_start = j_sources_end
* j_sources_end = j_sources_offsets[j+1] # <<<<<<<<<<<<<<
*
* for dest_state from 0 <= dest_state < dest_states:
*/
__pyx_t_39 = (__pyx_v_j + 1);
__pyx_v_j_sources_end = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_j_sources_offsets.data) + __pyx_t_39)) )));
/* "cogent/align/_pairwise_pogs.pyx":175
* j_sources_end = j_sources_offsets[j+1]
*
* for dest_state from 0 <= dest_state < dest_states: # <<<<<<<<<<<<<<
* state = state_directions[dest_state, 0]
* bin = state_directions[dest_state, 1]
*/
__pyx_t_40 = __pyx_v_dest_states;
for (__pyx_v_dest_state = 0; __pyx_v_dest_state < __pyx_t_40; __pyx_v_dest_state++) {
/* "cogent/align/_pairwise_pogs.pyx":176
*
* for dest_state from 0 <= dest_state < dest_states:
* state = state_directions[dest_state, 0] # <<<<<<<<<<<<<<
* bin = state_directions[dest_state, 1]
* dx = state_directions[dest_state, 2]
*/
__pyx_t_41 = __pyx_v_dest_state;
__pyx_t_42 = 0;
__pyx_v_state = (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_state_directions.data + __pyx_t_41 * __pyx_v_state_directions.strides[0]) )) + __pyx_t_42)) )));
/* "cogent/align/_pairwise_pogs.pyx":177
* for dest_state from 0 <= dest_state < dest_states:
* state = state_directions[dest_state, 0]
* bin = state_directions[dest_state, 1] # <<<<<<<<<<<<<<
* dx = state_directions[dest_state, 2]
* dy = state_directions[dest_state, 3]
*/
__pyx_t_43 = __pyx_v_dest_state;
__pyx_t_44 = 1;
__pyx_v_bin = (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_state_directions.data + __pyx_t_43 * __pyx_v_state_directions.strides[0]) )) + __pyx_t_44)) )));
/* "cogent/align/_pairwise_pogs.pyx":178
* state = state_directions[dest_state, 0]
* bin = state_directions[dest_state, 1]
* dx = state_directions[dest_state, 2] # <<<<<<<<<<<<<<
* dy = state_directions[dest_state, 3]
*
*/
__pyx_t_45 = __pyx_v_dest_state;
__pyx_t_46 = 2;
__pyx_v_dx = (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_state_directions.data + __pyx_t_45 * __pyx_v_state_directions.strides[0]) )) + __pyx_t_46)) )));
/* "cogent/align/_pairwise_pogs.pyx":179
* bin = state_directions[dest_state, 1]
* dx = state_directions[dest_state, 2]
* dy = state_directions[dest_state, 3] # <<<<<<<<<<<<<<
*
* max_mantissa = impossible
*/
__pyx_t_47 = __pyx_v_dest_state;
__pyx_t_48 = 3;
__pyx_v_dy = (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_state_directions.data + __pyx_t_47 * __pyx_v_state_directions.strides[0]) )) + __pyx_t_48)) )));
/* "cogent/align/_pairwise_pogs.pyx":181
* dy = state_directions[dest_state, 3]
*
* max_mantissa = impossible # <<<<<<<<<<<<<<
* max_exponent = MIN_SCALE
* partial_sum = 0.0
*/
__pyx_v_max_mantissa = __pyx_v_impossible;
/* "cogent/align/_pairwise_pogs.pyx":182
*
* max_mantissa = impossible
* max_exponent = MIN_SCALE # <<<<<<<<<<<<<<
* partial_sum = 0.0
* pointer_state = N # ie ERROR
*/
__pyx_v_max_exponent = __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_SCALE;
/* "cogent/align/_pairwise_pogs.pyx":183
* max_mantissa = impossible
* max_exponent = MIN_SCALE
* partial_sum = 0.0 # <<<<<<<<<<<<<<
* pointer_state = N # ie ERROR
*
*/
__pyx_v_partial_sum = 0.0;
/* "cogent/align/_pairwise_pogs.pyx":184
* max_exponent = MIN_SCALE
* partial_sum = 0.0
* pointer_state = N # ie ERROR # <<<<<<<<<<<<<<
*
* if dx:
*/
__pyx_v_pointer_state = __pyx_v_N;
/* "cogent/align/_pairwise_pogs.pyx":186
* pointer_state = N # ie ERROR
*
* if dx: # <<<<<<<<<<<<<<
* a_low = 1
* a_high = a_count + 1
*/
if (__pyx_v_dx) {
/* "cogent/align/_pairwise_pogs.pyx":187
*
* if dx:
* a_low = 1 # <<<<<<<<<<<<<<
* a_high = a_count + 1
* else:
*/
__pyx_v_a_low = 1;
/* "cogent/align/_pairwise_pogs.pyx":188
* if dx:
* a_low = 1
* a_high = a_count + 1 # <<<<<<<<<<<<<<
* else:
* a_low = 0
*/
__pyx_v_a_high = (__pyx_v_a_count + 1);
goto __pyx_L32;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":190
* a_high = a_count + 1
* else:
* a_low = 0 # <<<<<<<<<<<<<<
* a_high = 1
*
*/
__pyx_v_a_low = 0;
/* "cogent/align/_pairwise_pogs.pyx":191
* else:
* a_low = 0
* a_high = 1 # <<<<<<<<<<<<<<
*
* if dy:
*/
__pyx_v_a_high = 1;
}
__pyx_L32:;
/* "cogent/align/_pairwise_pogs.pyx":193
* a_high = 1
*
* if dy: # <<<<<<<<<<<<<<
* b_low = 1
* b_high = j_sources_end - j_sources_start + 1
*/
if (__pyx_v_dy) {
/* "cogent/align/_pairwise_pogs.pyx":194
*
* if dy:
* b_low = 1 # <<<<<<<<<<<<<<
* b_high = j_sources_end - j_sources_start + 1
* else:
*/
__pyx_v_b_low = 1;
/* "cogent/align/_pairwise_pogs.pyx":195
* if dy:
* b_low = 1
* b_high = j_sources_end - j_sources_start + 1 # <<<<<<<<<<<<<<
* else:
* b_low = 0
*/
__pyx_v_b_high = ((__pyx_v_j_sources_end - __pyx_v_j_sources_start) + 1);
goto __pyx_L33;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":197
* b_high = j_sources_end - j_sources_start + 1
* else:
* b_low = 0 # <<<<<<<<<<<<<<
* b_high = 1
*
*/
__pyx_v_b_low = 0;
/* "cogent/align/_pairwise_pogs.pyx":198
* else:
* b_low = 0
* b_high = 1 # <<<<<<<<<<<<<<
*
* if use_scaling:
*/
__pyx_v_b_high = 1;
}
__pyx_L33:;
/* "cogent/align/_pairwise_pogs.pyx":200
* b_high = 1
*
* if use_scaling: # <<<<<<<<<<<<<<
* sub_partial_sum = 0.0
* # keep these next 9 lines same as below
*/
if (__pyx_v_use_scaling) {
/* "cogent/align/_pairwise_pogs.pyx":201
*
* if use_scaling:
* sub_partial_sum = 0.0 # <<<<<<<<<<<<<<
* # keep these next 9 lines same as below
* for a from a_low <= a < a_high:
*/
__pyx_v_sub_partial_sum = 0.0;
/* "cogent/align/_pairwise_pogs.pyx":203
* sub_partial_sum = 0.0
* # keep these next 9 lines same as below
* for a from a_low <= a < a_high: # <<<<<<<<<<<<<<
* source_row_index = source_row_index_cache[a]
* for b from b_low <= b < b_high:
*/
__pyx_t_49 = __pyx_v_a_high;
for (__pyx_v_a = __pyx_v_a_low; __pyx_v_a < __pyx_t_49; __pyx_v_a++) {
/* "cogent/align/_pairwise_pogs.pyx":204
* # keep these next 9 lines same as below
* for a from a_low <= a < a_high:
* source_row_index = source_row_index_cache[a] # <<<<<<<<<<<<<<
* for b from b_low <= b < b_high:
* if dy:
*/
__pyx_v_source_row_index = (__pyx_v_source_row_index_cache[__pyx_v_a]);
/* "cogent/align/_pairwise_pogs.pyx":205
* for a from a_low <= a < a_high:
* source_row_index = source_row_index_cache[a]
* for b from b_low <= b < b_high: # <<<<<<<<<<<<<<
* if dy:
* prev_j = j_sources[b-1+j_sources_start]
*/
__pyx_t_50 = __pyx_v_b_high;
for (__pyx_v_b = __pyx_v_b_low; __pyx_v_b < __pyx_t_50; __pyx_v_b++) {
/* "cogent/align/_pairwise_pogs.pyx":206
* source_row_index = source_row_index_cache[a]
* for b from b_low <= b < b_high:
* if dy: # <<<<<<<<<<<<<<
* prev_j = j_sources[b-1+j_sources_start]
* else:
*/
if (__pyx_v_dy) {
/* "cogent/align/_pairwise_pogs.pyx":207
* for b from b_low <= b < b_high:
* if dy:
* prev_j = j_sources[b-1+j_sources_start] # <<<<<<<<<<<<<<
* else:
* prev_j = j
*/
__pyx_t_51 = ((__pyx_v_b - 1) + __pyx_v_j_sources_start);
__pyx_v_prev_j = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_j_sources.data) + __pyx_t_51)) )));
goto __pyx_L39;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":209
* prev_j = j_sources[b-1+j_sources_start]
* else:
* prev_j = j # <<<<<<<<<<<<<<
* min_prev_state = (prev_j > 0)
* for prev_state from min_prev_state <= prev_state < N:
*/
__pyx_v_prev_j = __pyx_v_j;
}
__pyx_L39:;
/* "cogent/align/_pairwise_pogs.pyx":210
* else:
* prev_j = j
* min_prev_state = (prev_j > 0) # <<<<<<<<<<<<<<
* for prev_state from min_prev_state <= prev_state < N:
* exponent = exponents[source_row_index, prev_j, prev_state]
*/
__pyx_v_min_prev_state = (__pyx_v_prev_j > 0);
/* "cogent/align/_pairwise_pogs.pyx":211
* prev_j = j
* min_prev_state = (prev_j > 0)
* for prev_state from min_prev_state <= prev_state < N: # <<<<<<<<<<<<<<
* exponent = exponents[source_row_index, prev_j, prev_state]
* if exponent == MIN_SCALE:
*/
__pyx_t_52 = __pyx_v_N;
for (__pyx_v_prev_state = __pyx_v_min_prev_state; __pyx_v_prev_state < __pyx_t_52; __pyx_v_prev_state++) {
/* "cogent/align/_pairwise_pogs.pyx":212
* min_prev_state = (prev_j > 0)
* for prev_state from min_prev_state <= prev_state < N:
* exponent = exponents[source_row_index, prev_j, prev_state] # <<<<<<<<<<<<<<
* if exponent == MIN_SCALE:
* continue
*/
__pyx_t_53 = __pyx_v_source_row_index;
__pyx_t_54 = __pyx_v_prev_j;
__pyx_t_55 = __pyx_v_prev_state;
__pyx_v_exponent = (*((long *) ( /* dim=2 */ ((char *) (((long *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_exponents.data + __pyx_t_53 * __pyx_v_exponents.strides[0]) ) + __pyx_t_54 * __pyx_v_exponents.strides[1]) )) + __pyx_t_55)) )));
/* "cogent/align/_pairwise_pogs.pyx":213
* for prev_state from min_prev_state <= prev_state < N:
* exponent = exponents[source_row_index, prev_j, prev_state]
* if exponent == MIN_SCALE: # <<<<<<<<<<<<<<
* continue
*
*/
__pyx_t_2 = (__pyx_v_exponent == __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_SCALE);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":214
* exponent = exponents[source_row_index, prev_j, prev_state]
* if exponent == MIN_SCALE:
* continue # <<<<<<<<<<<<<<
*
* mantissa = mantissas[source_row_index, prev_j, prev_state]
*/
goto __pyx_L40_continue;
goto __pyx_L42;
}
__pyx_L42:;
/* "cogent/align/_pairwise_pogs.pyx":216
* continue
*
* mantissa = mantissas[source_row_index, prev_j, prev_state] # <<<<<<<<<<<<<<
* mantissa = mantissa * T[prev_state, state]
*
*/
__pyx_t_56 = __pyx_v_source_row_index;
__pyx_t_57 = __pyx_v_prev_j;
__pyx_t_58 = __pyx_v_prev_state;
__pyx_v_mantissa = (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mantissas.data + __pyx_t_56 * __pyx_v_mantissas.strides[0]) ) + __pyx_t_57 * __pyx_v_mantissas.strides[1]) )) + __pyx_t_58)) )));
/* "cogent/align/_pairwise_pogs.pyx":217
*
* mantissa = mantissas[source_row_index, prev_j, prev_state]
* mantissa = mantissa * T[prev_state, state] # <<<<<<<<<<<<<<
*
* if mantissa < MIN_FLOAT_VALUE:
*/
__pyx_t_59 = __pyx_v_prev_state;
__pyx_t_60 = __pyx_v_state;
__pyx_v_mantissa = (__pyx_v_mantissa * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_T.data + __pyx_t_59 * __pyx_v_T.strides[0]) )) + __pyx_t_60)) ))));
/* "cogent/align/_pairwise_pogs.pyx":219
* mantissa = mantissa * T[prev_state, state]
*
* if mantissa < MIN_FLOAT_VALUE: # <<<<<<<<<<<<<<
* if mantissa == 0.0:
* continue
*/
__pyx_t_2 = (__pyx_v_mantissa < __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_FLOAT_VALUE);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":220
*
* if mantissa < MIN_FLOAT_VALUE:
* if mantissa == 0.0: # <<<<<<<<<<<<<<
* continue
* if mantissa < 0.0:
*/
__pyx_t_2 = (__pyx_v_mantissa == 0.0);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":221
* if mantissa < MIN_FLOAT_VALUE:
* if mantissa == 0.0:
* continue # <<<<<<<<<<<<<<
* if mantissa < 0.0:
* if T[prev_state, state] < 0.0:
*/
goto __pyx_L40_continue;
goto __pyx_L44;
}
__pyx_L44:;
/* "cogent/align/_pairwise_pogs.pyx":222
* if mantissa == 0.0:
* continue
* if mantissa < 0.0: # <<<<<<<<<<<<<<
* if T[prev_state, state] < 0.0:
* raise ArithmeticError(fmpt(mantissa, exponent,
*/
__pyx_t_2 = (__pyx_v_mantissa < 0.0);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":223
* continue
* if mantissa < 0.0:
* if T[prev_state, state] < 0.0: # <<<<<<<<<<<<<<
* raise ArithmeticError(fmpt(mantissa, exponent,
* "transition is a negative probability"))
*/
__pyx_t_61 = __pyx_v_prev_state;
__pyx_t_62 = __pyx_v_state;
__pyx_t_2 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_T.data + __pyx_t_61 * __pyx_v_T.strides[0]) )) + __pyx_t_62)) ))) < 0.0);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":224
* if mantissa < 0.0:
* if T[prev_state, state] < 0.0:
* raise ArithmeticError(fmpt(mantissa, exponent, # <<<<<<<<<<<<<<
* "transition is a negative probability"))
* raise ArithmeticError(fmpt(mantissa, exponent,
*/
__pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__fmpt); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_11 = PyFloat_FromDouble(__pyx_v_mantissa); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_10 = PyInt_FromLong(__pyx_v_exponent); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
PyTuple_SET_ITEM(__pyx_t_13, 2, ((PyObject *)__pyx_kp_s_12));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12));
__pyx_t_11 = 0;
__pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
__pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
__pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_builtin_ArithmeticError, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
__Pyx_Raise(__pyx_t_10, 0, 0, 0);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L46;
}
__pyx_L46:;
/* "cogent/align/_pairwise_pogs.pyx":226
* raise ArithmeticError(fmpt(mantissa, exponent,
* "transition is a negative probability"))
* raise ArithmeticError(fmpt(mantissa, exponent, # <<<<<<<<<<<<<<
* "product is a negative probability"))
* while mantissa < MIN_FLOAT_VALUE:
*/
__pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__fmpt); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_13 = PyFloat_FromDouble(__pyx_v_mantissa); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
__pyx_t_9 = PyInt_FromLong(__pyx_v_exponent); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13);
__Pyx_GIVEREF(__pyx_t_13);
PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
PyTuple_SET_ITEM(__pyx_t_11, 2, ((PyObject *)__pyx_kp_s_13));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
__pyx_t_13 = 0;
__pyx_t_9 = 0;
__pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
__pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
__pyx_t_9 = 0;
__pyx_t_9 = PyObject_Call(__pyx_builtin_ArithmeticError, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
__Pyx_Raise(__pyx_t_9, 0, 0, 0);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L45;
}
__pyx_L45:;
/* "cogent/align/_pairwise_pogs.pyx":228
* raise ArithmeticError(fmpt(mantissa, exponent,
* "product is a negative probability"))
* while mantissa < MIN_FLOAT_VALUE: # <<<<<<<<<<<<<<
* mantissa *= SCALE_STEP
* exponent += -1
*/
while (1) {
__pyx_t_2 = (__pyx_v_mantissa < __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_FLOAT_VALUE);
if (!__pyx_t_2) break;
/* "cogent/align/_pairwise_pogs.pyx":229
* "product is a negative probability"))
* while mantissa < MIN_FLOAT_VALUE:
* mantissa *= SCALE_STEP # <<<<<<<<<<<<<<
* exponent += -1
* if exponent <= MIN_SCALE:
*/
__pyx_v_mantissa = (__pyx_v_mantissa * __pyx_v_6cogent_5align_14_pairwise_pogs_SCALE_STEP);
/* "cogent/align/_pairwise_pogs.pyx":230
* while mantissa < MIN_FLOAT_VALUE:
* mantissa *= SCALE_STEP
* exponent += -1 # <<<<<<<<<<<<<<
* if exponent <= MIN_SCALE:
* raise ArithmeticError(fmpt(mantissa, exponent,
*/
__pyx_v_exponent = (__pyx_v_exponent + -1);
/* "cogent/align/_pairwise_pogs.pyx":231
* mantissa *= SCALE_STEP
* exponent += -1
* if exponent <= MIN_SCALE: # <<<<<<<<<<<<<<
* raise ArithmeticError(fmpt(mantissa, exponent,
* "underflows"))
*/
__pyx_t_2 = (__pyx_v_exponent <= __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_SCALE);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":232
* exponent += -1
* if exponent <= MIN_SCALE:
* raise ArithmeticError(fmpt(mantissa, exponent, # <<<<<<<<<<<<<<
* "underflows"))
*
*/
__pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__fmpt); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_11 = PyFloat_FromDouble(__pyx_v_mantissa); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_10 = PyInt_FromLong(__pyx_v_exponent); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
__Pyx_INCREF(((PyObject *)__pyx_n_s__underflows));
PyTuple_SET_ITEM(__pyx_t_13, 2, ((PyObject *)__pyx_n_s__underflows));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__underflows));
__pyx_t_11 = 0;
__pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
__pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
__pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_builtin_ArithmeticError, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0;
__Pyx_Raise(__pyx_t_10, 0, 0, 0);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L49;
}
__pyx_L49:;
}
goto __pyx_L43;
}
/* "cogent/align/_pairwise_pogs.pyx":235
* "underflows"))
*
* elif mantissa > 1.0: # <<<<<<<<<<<<<<
* mantissa *= MIN_FLOAT_VALUE
* exponent += 1
*/
__pyx_t_2 = (__pyx_v_mantissa > 1.0);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":236
*
* elif mantissa > 1.0:
* mantissa *= MIN_FLOAT_VALUE # <<<<<<<<<<<<<<
* exponent += 1
* if exponent > MAX_SCALE:
*/
__pyx_v_mantissa = (__pyx_v_mantissa * __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_FLOAT_VALUE);
/* "cogent/align/_pairwise_pogs.pyx":237
* elif mantissa > 1.0:
* mantissa *= MIN_FLOAT_VALUE
* exponent += 1 # <<<<<<<<<<<<<<
* if exponent > MAX_SCALE:
* raise ArithmeticError(fmpt(mantissa, exponent,
*/
__pyx_v_exponent = (__pyx_v_exponent + 1);
/* "cogent/align/_pairwise_pogs.pyx":238
* mantissa *= MIN_FLOAT_VALUE
* exponent += 1
* if exponent > MAX_SCALE: # <<<<<<<<<<<<<<
* raise ArithmeticError(fmpt(mantissa, exponent,
* "is unexpectedly large"))
*/
__pyx_t_2 = (__pyx_v_exponent > __pyx_v_6cogent_5align_14_pairwise_pogs_MAX_SCALE);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":239
* exponent += 1
* if exponent > MAX_SCALE:
* raise ArithmeticError(fmpt(mantissa, exponent, # <<<<<<<<<<<<<<
* "is unexpectedly large"))
*
*/
__pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__fmpt); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_13 = PyFloat_FromDouble(__pyx_v_mantissa); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
__pyx_t_9 = PyInt_FromLong(__pyx_v_exponent); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_13);
__Pyx_GIVEREF(__pyx_t_13);
PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
PyTuple_SET_ITEM(__pyx_t_11, 2, ((PyObject *)__pyx_kp_s_14));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
__pyx_t_13 = 0;
__pyx_t_9 = 0;
__pyx_t_9 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
__pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
__pyx_t_9 = 0;
__pyx_t_9 = PyObject_Call(__pyx_builtin_ArithmeticError, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0;
__Pyx_Raise(__pyx_t_9, 0, 0, 0);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L50;
}
__pyx_L50:;
goto __pyx_L43;
}
__pyx_L43:;
/* "cogent/align/_pairwise_pogs.pyx":242
* "is unexpectedly large"))
*
* if exponent > max_exponent: # <<<<<<<<<<<<<<
* if exponent == max_exponent + 1:
* sub_partial_sum = partial_sum
*/
__pyx_t_2 = (__pyx_v_exponent > __pyx_v_max_exponent);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":243
*
* if exponent > max_exponent:
* if exponent == max_exponent + 1: # <<<<<<<<<<<<<<
* sub_partial_sum = partial_sum
* else:
*/
__pyx_t_2 = (__pyx_v_exponent == (__pyx_v_max_exponent + 1));
if (__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":244
* if exponent > max_exponent:
* if exponent == max_exponent + 1:
* sub_partial_sum = partial_sum # <<<<<<<<<<<<<<
* else:
* sub_partial_sum = 0.0
*/
__pyx_v_sub_partial_sum = __pyx_v_partial_sum;
goto __pyx_L52;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":246
* sub_partial_sum = partial_sum
* else:
* sub_partial_sum = 0.0 # <<<<<<<<<<<<<<
* partial_sum = 0.0
* max_mantissa = 0.0
*/
__pyx_v_sub_partial_sum = 0.0;
}
__pyx_L52:;
/* "cogent/align/_pairwise_pogs.pyx":247
* else:
* sub_partial_sum = 0.0
* partial_sum = 0.0 # <<<<<<<<<<<<<<
* max_mantissa = 0.0
* max_exponent = exponent
*/
__pyx_v_partial_sum = 0.0;
/* "cogent/align/_pairwise_pogs.pyx":248
* sub_partial_sum = 0.0
* partial_sum = 0.0
* max_mantissa = 0.0 # <<<<<<<<<<<<<<
* max_exponent = exponent
*
*/
__pyx_v_max_mantissa = 0.0;
/* "cogent/align/_pairwise_pogs.pyx":249
* partial_sum = 0.0
* max_mantissa = 0.0
* max_exponent = exponent # <<<<<<<<<<<<<<
*
* if exponent == max_exponent:
*/
__pyx_v_max_exponent = __pyx_v_exponent;
goto __pyx_L51;
}
__pyx_L51:;
/* "cogent/align/_pairwise_pogs.pyx":251
* max_exponent = exponent
*
* if exponent == max_exponent: # <<<<<<<<<<<<<<
* partial_sum += mantissa
* if viterbi and mantissa > max_mantissa:
*/
__pyx_t_2 = (__pyx_v_exponent == __pyx_v_max_exponent);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":252
*
* if exponent == max_exponent:
* partial_sum += mantissa # <<<<<<<<<<<<<<
* if viterbi and mantissa > max_mantissa:
* max_mantissa = mantissa
*/
__pyx_v_partial_sum = (__pyx_v_partial_sum + __pyx_v_mantissa);
/* "cogent/align/_pairwise_pogs.pyx":253
* if exponent == max_exponent:
* partial_sum += mantissa
* if viterbi and mantissa > max_mantissa: # <<<<<<<<<<<<<<
* max_mantissa = mantissa
* pointer_state = prev_state
*/
if (__pyx_v_viterbi) {
__pyx_t_2 = (__pyx_v_mantissa > __pyx_v_max_mantissa);
__pyx_t_8 = __pyx_t_2;
} else {
__pyx_t_8 = __pyx_v_viterbi;
}
if (__pyx_t_8) {
/* "cogent/align/_pairwise_pogs.pyx":254
* partial_sum += mantissa
* if viterbi and mantissa > max_mantissa:
* max_mantissa = mantissa # <<<<<<<<<<<<<<
* pointer_state = prev_state
* pointer_a = a
*/
__pyx_v_max_mantissa = __pyx_v_mantissa;
/* "cogent/align/_pairwise_pogs.pyx":255
* if viterbi and mantissa > max_mantissa:
* max_mantissa = mantissa
* pointer_state = prev_state # <<<<<<<<<<<<<<
* pointer_a = a
* pointer_b = b
*/
__pyx_v_pointer_state = __pyx_v_prev_state;
/* "cogent/align/_pairwise_pogs.pyx":256
* max_mantissa = mantissa
* pointer_state = prev_state
* pointer_a = a # <<<<<<<<<<<<<<
* pointer_b = b
*
*/
__pyx_v_pointer_a = __pyx_v_a;
/* "cogent/align/_pairwise_pogs.pyx":257
* pointer_state = prev_state
* pointer_a = a
* pointer_b = b # <<<<<<<<<<<<<<
*
* elif exponent == max_exponent - 1:
*/
__pyx_v_pointer_b = __pyx_v_b;
goto __pyx_L54;
}
__pyx_L54:;
goto __pyx_L53;
}
/* "cogent/align/_pairwise_pogs.pyx":259
* pointer_b = b
*
* elif exponent == max_exponent - 1: # <<<<<<<<<<<<<<
* sub_partial_sum += mantissa
*
*/
__pyx_t_8 = (__pyx_v_exponent == (__pyx_v_max_exponent - 1));
if (__pyx_t_8) {
/* "cogent/align/_pairwise_pogs.pyx":260
*
* elif exponent == max_exponent - 1:
* sub_partial_sum += mantissa # <<<<<<<<<<<<<<
*
* partial_sum += sub_partial_sum * MIN_FLOAT_VALUE
*/
__pyx_v_sub_partial_sum = (__pyx_v_sub_partial_sum + __pyx_v_mantissa);
goto __pyx_L53;
}
__pyx_L53:;
__pyx_L40_continue:;
}
/* "cogent/align/_pairwise_pogs.pyx":262
* sub_partial_sum += mantissa
*
* partial_sum += sub_partial_sum * MIN_FLOAT_VALUE # <<<<<<<<<<<<<<
* else:
* # keep these next 9 lines same as above
*/
__pyx_v_partial_sum = (__pyx_v_partial_sum + (__pyx_v_sub_partial_sum * __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_FLOAT_VALUE));
}
}
goto __pyx_L34;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":265
* else:
* # keep these next 9 lines same as above
* for a from a_low <= a < a_high: # <<<<<<<<<<<<<<
* source_row_index = source_row_index_cache[a]
* for b from b_low <= b < b_high:
*/
__pyx_t_49 = __pyx_v_a_high;
for (__pyx_v_a = __pyx_v_a_low; __pyx_v_a < __pyx_t_49; __pyx_v_a++) {
/* "cogent/align/_pairwise_pogs.pyx":266
* # keep these next 9 lines same as above
* for a from a_low <= a < a_high:
* source_row_index = source_row_index_cache[a] # <<<<<<<<<<<<<<
* for b from b_low <= b < b_high:
* if dy:
*/
__pyx_v_source_row_index = (__pyx_v_source_row_index_cache[__pyx_v_a]);
/* "cogent/align/_pairwise_pogs.pyx":267
* for a from a_low <= a < a_high:
* source_row_index = source_row_index_cache[a]
* for b from b_low <= b < b_high: # <<<<<<<<<<<<<<
* if dy:
* prev_j = j_sources[b-1+j_sources_start]
*/
__pyx_t_50 = __pyx_v_b_high;
for (__pyx_v_b = __pyx_v_b_low; __pyx_v_b < __pyx_t_50; __pyx_v_b++) {
/* "cogent/align/_pairwise_pogs.pyx":268
* source_row_index = source_row_index_cache[a]
* for b from b_low <= b < b_high:
* if dy: # <<<<<<<<<<<<<<
* prev_j = j_sources[b-1+j_sources_start]
* else:
*/
if (__pyx_v_dy) {
/* "cogent/align/_pairwise_pogs.pyx":269
* for b from b_low <= b < b_high:
* if dy:
* prev_j = j_sources[b-1+j_sources_start] # <<<<<<<<<<<<<<
* else:
* prev_j = j
*/
__pyx_t_63 = ((__pyx_v_b - 1) + __pyx_v_j_sources_start);
__pyx_v_prev_j = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_j_sources.data) + __pyx_t_63)) )));
goto __pyx_L59;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":271
* prev_j = j_sources[b-1+j_sources_start]
* else:
* prev_j = j # <<<<<<<<<<<<<<
* min_prev_state = (prev_j > 0)
* for prev_state from min_prev_state <= prev_state < N:
*/
__pyx_v_prev_j = __pyx_v_j;
}
__pyx_L59:;
/* "cogent/align/_pairwise_pogs.pyx":272
* else:
* prev_j = j
* min_prev_state = (prev_j > 0) # <<<<<<<<<<<<<<
* for prev_state from min_prev_state <= prev_state < N:
* mantissa = mantissas[source_row_index, prev_j, prev_state]
*/
__pyx_v_min_prev_state = (__pyx_v_prev_j > 0);
/* "cogent/align/_pairwise_pogs.pyx":273
* prev_j = j
* min_prev_state = (prev_j > 0)
* for prev_state from min_prev_state <= prev_state < N: # <<<<<<<<<<<<<<
* mantissa = mantissas[source_row_index, prev_j, prev_state]
* if use_logs:
*/
__pyx_t_52 = __pyx_v_N;
for (__pyx_v_prev_state = __pyx_v_min_prev_state; __pyx_v_prev_state < __pyx_t_52; __pyx_v_prev_state++) {
/* "cogent/align/_pairwise_pogs.pyx":274
* min_prev_state = (prev_j > 0)
* for prev_state from min_prev_state <= prev_state < N:
* mantissa = mantissas[source_row_index, prev_j, prev_state] # <<<<<<<<<<<<<<
* if use_logs:
* mantissa = mantissa + T[prev_state, state]
*/
__pyx_t_64 = __pyx_v_source_row_index;
__pyx_t_65 = __pyx_v_prev_j;
__pyx_t_66 = __pyx_v_prev_state;
__pyx_v_mantissa = (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mantissas.data + __pyx_t_64 * __pyx_v_mantissas.strides[0]) ) + __pyx_t_65 * __pyx_v_mantissas.strides[1]) )) + __pyx_t_66)) )));
/* "cogent/align/_pairwise_pogs.pyx":275
* for prev_state from min_prev_state <= prev_state < N:
* mantissa = mantissas[source_row_index, prev_j, prev_state]
* if use_logs: # <<<<<<<<<<<<<<
* mantissa = mantissa + T[prev_state, state]
* else:
*/
if (__pyx_v_use_logs) {
/* "cogent/align/_pairwise_pogs.pyx":276
* mantissa = mantissas[source_row_index, prev_j, prev_state]
* if use_logs:
* mantissa = mantissa + T[prev_state, state] # <<<<<<<<<<<<<<
* else:
* mantissa = mantissa * T[prev_state, state]
*/
__pyx_t_67 = __pyx_v_prev_state;
__pyx_t_68 = __pyx_v_state;
__pyx_v_mantissa = (__pyx_v_mantissa + (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_T.data + __pyx_t_67 * __pyx_v_T.strides[0]) )) + __pyx_t_68)) ))));
goto __pyx_L62;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":278
* mantissa = mantissa + T[prev_state, state]
* else:
* mantissa = mantissa * T[prev_state, state] # <<<<<<<<<<<<<<
* partial_sum += mantissa
* if viterbi and mantissa > max_mantissa:
*/
__pyx_t_69 = __pyx_v_prev_state;
__pyx_t_70 = __pyx_v_state;
__pyx_v_mantissa = (__pyx_v_mantissa * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_T.data + __pyx_t_69 * __pyx_v_T.strides[0]) )) + __pyx_t_70)) ))));
/* "cogent/align/_pairwise_pogs.pyx":279
* else:
* mantissa = mantissa * T[prev_state, state]
* partial_sum += mantissa # <<<<<<<<<<<<<<
* if viterbi and mantissa > max_mantissa:
* max_mantissa = mantissa
*/
__pyx_v_partial_sum = (__pyx_v_partial_sum + __pyx_v_mantissa);
}
__pyx_L62:;
/* "cogent/align/_pairwise_pogs.pyx":280
* mantissa = mantissa * T[prev_state, state]
* partial_sum += mantissa
* if viterbi and mantissa > max_mantissa: # <<<<<<<<<<<<<<
* max_mantissa = mantissa
* pointer_state = prev_state
*/
if (__pyx_v_viterbi) {
__pyx_t_8 = (__pyx_v_mantissa > __pyx_v_max_mantissa);
__pyx_t_2 = __pyx_t_8;
} else {
__pyx_t_2 = __pyx_v_viterbi;
}
if (__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":281
* partial_sum += mantissa
* if viterbi and mantissa > max_mantissa:
* max_mantissa = mantissa # <<<<<<<<<<<<<<
* pointer_state = prev_state
* pointer_a = a
*/
__pyx_v_max_mantissa = __pyx_v_mantissa;
/* "cogent/align/_pairwise_pogs.pyx":282
* if viterbi and mantissa > max_mantissa:
* max_mantissa = mantissa
* pointer_state = prev_state # <<<<<<<<<<<<<<
* pointer_a = a
* pointer_b = b
*/
__pyx_v_pointer_state = __pyx_v_prev_state;
/* "cogent/align/_pairwise_pogs.pyx":283
* max_mantissa = mantissa
* pointer_state = prev_state
* pointer_a = a # <<<<<<<<<<<<<<
* pointer_b = b
*
*/
__pyx_v_pointer_a = __pyx_v_a;
/* "cogent/align/_pairwise_pogs.pyx":284
* pointer_state = prev_state
* pointer_a = a
* pointer_b = b # <<<<<<<<<<<<<<
*
* if viterbi:
*/
__pyx_v_pointer_b = __pyx_v_b;
goto __pyx_L63;
}
__pyx_L63:;
}
}
}
}
__pyx_L34:;
/* "cogent/align/_pairwise_pogs.pyx":286
* pointer_b = b
*
* if viterbi: # <<<<<<<<<<<<<<
* mantissa = max_mantissa
* if track is not None:
*/
if (__pyx_v_viterbi) {
/* "cogent/align/_pairwise_pogs.pyx":287
*
* if viterbi:
* mantissa = max_mantissa # <<<<<<<<<<<<<<
* if track is not None:
* track[i, j, state] = (
*/
__pyx_v_mantissa = __pyx_v_max_mantissa;
/* "cogent/align/_pairwise_pogs.pyx":288
* if viterbi:
* mantissa = max_mantissa
* if track is not None: # <<<<<<<<<<<<<<
* track[i, j, state] = (
* (pointer_a << tcode_x) |
*/
__pyx_t_2 = (((PyObject *) __pyx_v_track.memview) != Py_None);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":289
* mantissa = max_mantissa
* if track is not None:
* track[i, j, state] = ( # <<<<<<<<<<<<<<
* (pointer_a << tcode_x) |
* (pointer_b << tcode_y) |
*/
__pyx_t_49 = __pyx_v_i;
__pyx_t_50 = __pyx_v_j;
__pyx_t_52 = __pyx_v_state;
*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_track.data + __pyx_t_49 * __pyx_v_track.strides[0]) ) + __pyx_t_50 * __pyx_v_track.strides[1]) )) + __pyx_t_52)) )) = (((__pyx_v_pointer_a << __pyx_v_tcode_x) | (__pyx_v_pointer_b << __pyx_v_tcode_y)) | (__pyx_v_pointer_state << __pyx_v_tcode_s));
goto __pyx_L65;
}
__pyx_L65:;
goto __pyx_L64;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":294
* (pointer_state << tcode_s))
* else:
* mantissa = partial_sum # <<<<<<<<<<<<<<
*
* if dy:
*/
__pyx_v_mantissa = __pyx_v_partial_sum;
}
__pyx_L64:;
/* "cogent/align/_pairwise_pogs.pyx":296
* mantissa = partial_sum
*
* if dy: # <<<<<<<<<<<<<<
* y = seq2_index[j]
* if dx:
*/
if (__pyx_v_dy) {
/* "cogent/align/_pairwise_pogs.pyx":297
*
* if dy:
* y = seq2_index[j] # <<<<<<<<<<<<<<
* if dx:
* d_score = match_scores[bin, x, y]
*/
__pyx_t_71 = __pyx_v_j;
__pyx_v_y = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_seq2_index.data) + __pyx_t_71)) )));
/* "cogent/align/_pairwise_pogs.pyx":298
* if dy:
* y = seq2_index[j]
* if dx: # <<<<<<<<<<<<<<
* d_score = match_scores[bin, x, y]
* else:
*/
if (__pyx_v_dx) {
/* "cogent/align/_pairwise_pogs.pyx":299
* y = seq2_index[j]
* if dx:
* d_score = match_scores[bin, x, y] # <<<<<<<<<<<<<<
* else:
* d_score = ygap_scores[bin, y]
*/
__pyx_t_72 = __pyx_v_bin;
__pyx_t_73 = __pyx_v_x;
__pyx_t_74 = __pyx_v_y;
__pyx_v_d_score = (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_match_scores.data + __pyx_t_72 * __pyx_v_match_scores.strides[0]) ) + __pyx_t_73 * __pyx_v_match_scores.strides[1]) )) + __pyx_t_74)) )));
goto __pyx_L67;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":301
* d_score = match_scores[bin, x, y]
* else:
* d_score = ygap_scores[bin, y] # <<<<<<<<<<<<<<
* elif dx:
* d_score = xgap_scores[bin, x]
*/
__pyx_t_75 = __pyx_v_bin;
__pyx_t_76 = __pyx_v_y;
__pyx_v_d_score = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_ygap_scores.data + __pyx_t_75 * __pyx_v_ygap_scores.strides[0]) )) + __pyx_t_76)) )));
}
__pyx_L67:;
goto __pyx_L66;
}
/* "cogent/align/_pairwise_pogs.pyx":302
* else:
* d_score = ygap_scores[bin, y]
* elif dx: # <<<<<<<<<<<<<<
* d_score = xgap_scores[bin, x]
* elif use_logs:
*/
if (__pyx_v_dx) {
/* "cogent/align/_pairwise_pogs.pyx":303
* d_score = ygap_scores[bin, y]
* elif dx:
* d_score = xgap_scores[bin, x] # <<<<<<<<<<<<<<
* elif use_logs:
* d_score = 0.0
*/
__pyx_t_77 = __pyx_v_bin;
__pyx_t_78 = __pyx_v_x;
__pyx_v_d_score = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_xgap_scores.data + __pyx_t_77 * __pyx_v_xgap_scores.strides[0]) )) + __pyx_t_78)) )));
goto __pyx_L66;
}
/* "cogent/align/_pairwise_pogs.pyx":304
* elif dx:
* d_score = xgap_scores[bin, x]
* elif use_logs: # <<<<<<<<<<<<<<
* d_score = 0.0
* else:
*/
if (__pyx_v_use_logs) {
/* "cogent/align/_pairwise_pogs.pyx":305
* d_score = xgap_scores[bin, x]
* elif use_logs:
* d_score = 0.0 # <<<<<<<<<<<<<<
* else:
* d_score = 1.0
*/
__pyx_v_d_score = 0.0;
goto __pyx_L66;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":307
* d_score = 0.0
* else:
* d_score = 1.0 # <<<<<<<<<<<<<<
*
* if use_logs:
*/
__pyx_v_d_score = 1.0;
}
__pyx_L66:;
/* "cogent/align/_pairwise_pogs.pyx":309
* d_score = 1.0
*
* if use_logs: # <<<<<<<<<<<<<<
* mantissa += d_score
* else:
*/
if (__pyx_v_use_logs) {
/* "cogent/align/_pairwise_pogs.pyx":310
*
* if use_logs:
* mantissa += d_score # <<<<<<<<<<<<<<
* else:
* mantissa *= d_score
*/
__pyx_v_mantissa = (__pyx_v_mantissa + __pyx_v_d_score);
goto __pyx_L68;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":312
* mantissa += d_score
* else:
* mantissa *= d_score # <<<<<<<<<<<<<<
*
* mantissas[current_row_index, j, state] = mantissa
*/
__pyx_v_mantissa = (__pyx_v_mantissa * __pyx_v_d_score);
}
__pyx_L68:;
/* "cogent/align/_pairwise_pogs.pyx":314
* mantissa *= d_score
*
* mantissas[current_row_index, j, state] = mantissa # <<<<<<<<<<<<<<
* if use_scaling:
* exponents[current_row_index, j, state] = max_exponent
*/
__pyx_t_79 = __pyx_v_current_row_index;
__pyx_t_80 = __pyx_v_j;
__pyx_t_81 = __pyx_v_state;
*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mantissas.data + __pyx_t_79 * __pyx_v_mantissas.strides[0]) ) + __pyx_t_80 * __pyx_v_mantissas.strides[1]) )) + __pyx_t_81)) )) = __pyx_v_mantissa;
/* "cogent/align/_pairwise_pogs.pyx":315
*
* mantissas[current_row_index, j, state] = mantissa
* if use_scaling: # <<<<<<<<<<<<<<
* exponents[current_row_index, j, state] = max_exponent
*
*/
if (__pyx_v_use_scaling) {
/* "cogent/align/_pairwise_pogs.pyx":316
* mantissas[current_row_index, j, state] = mantissa
* if use_scaling:
* exponents[current_row_index, j, state] = max_exponent # <<<<<<<<<<<<<<
*
* if local and dx and dy:
*/
__pyx_t_82 = __pyx_v_current_row_index;
__pyx_t_83 = __pyx_v_j;
__pyx_t_84 = __pyx_v_state;
*((long *) ( /* dim=2 */ ((char *) (((long *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_exponents.data + __pyx_t_82 * __pyx_v_exponents.strides[0]) ) + __pyx_t_83 * __pyx_v_exponents.strides[1]) )) + __pyx_t_84)) )) = __pyx_v_max_exponent;
goto __pyx_L69;
}
__pyx_L69:;
/* "cogent/align/_pairwise_pogs.pyx":318
* exponents[current_row_index, j, state] = max_exponent
*
* if local and dx and dy: # <<<<<<<<<<<<<<
* if (use_scaling and max_exponent > overall_max_exponent) or (
* (not use_scaling or max_exponent == overall_max_exponent) and (
*/
if (__pyx_v_local) {
if (__pyx_v_dx) {
__pyx_t_2 = __pyx_v_dy;
} else {
__pyx_t_2 = __pyx_v_dx;
}
__pyx_t_8 = __pyx_t_2;
} else {
__pyx_t_8 = __pyx_v_local;
}
if (__pyx_t_8) {
/* "cogent/align/_pairwise_pogs.pyx":319
*
* if local and dx and dy:
* if (use_scaling and max_exponent > overall_max_exponent) or ( # <<<<<<<<<<<<<<
* (not use_scaling or max_exponent == overall_max_exponent) and (
* mantissa > overall_max_mantissa)):
*/
if (__pyx_v_use_scaling) {
__pyx_t_8 = (__pyx_v_max_exponent > __pyx_v_overall_max_exponent);
__pyx_t_2 = __pyx_t_8;
} else {
__pyx_t_2 = __pyx_v_use_scaling;
}
if (!__pyx_t_2) {
/* "cogent/align/_pairwise_pogs.pyx":320
* if local and dx and dy:
* if (use_scaling and max_exponent > overall_max_exponent) or (
* (not use_scaling or max_exponent == overall_max_exponent) and ( # <<<<<<<<<<<<<<
* mantissa > overall_max_mantissa)):
* overall_max_exponent = max_exponent
*/
__pyx_t_8 = (!__pyx_v_use_scaling);
if (!__pyx_t_8) {
__pyx_t_1 = (__pyx_v_max_exponent == __pyx_v_overall_max_exponent);
__pyx_t_7 = __pyx_t_1;
} else {
__pyx_t_7 = __pyx_t_8;
}
if (__pyx_t_7) {
/* "cogent/align/_pairwise_pogs.pyx":321
* if (use_scaling and max_exponent > overall_max_exponent) or (
* (not use_scaling or max_exponent == overall_max_exponent) and (
* mantissa > overall_max_mantissa)): # <<<<<<<<<<<<<<
* overall_max_exponent = max_exponent
* overall_max_mantissa = mantissa
*/
__pyx_t_8 = (__pyx_v_mantissa > __pyx_v_overall_max_mantissa);
__pyx_t_1 = __pyx_t_8;
} else {
__pyx_t_1 = __pyx_t_7;
}
__pyx_t_7 = __pyx_t_1;
} else {
__pyx_t_7 = __pyx_t_2;
}
if (__pyx_t_7) {
/* "cogent/align/_pairwise_pogs.pyx":322
* (not use_scaling or max_exponent == overall_max_exponent) and (
* mantissa > overall_max_mantissa)):
* overall_max_exponent = max_exponent # <<<<<<<<<<<<<<
* overall_max_mantissa = mantissa
* last_i = i
*/
__pyx_v_overall_max_exponent = __pyx_v_max_exponent;
/* "cogent/align/_pairwise_pogs.pyx":323
* mantissa > overall_max_mantissa)):
* overall_max_exponent = max_exponent
* overall_max_mantissa = mantissa # <<<<<<<<<<<<<<
* last_i = i
* last_j = j
*/
__pyx_v_overall_max_mantissa = __pyx_v_mantissa;
/* "cogent/align/_pairwise_pogs.pyx":324
* overall_max_exponent = max_exponent
* overall_max_mantissa = mantissa
* last_i = i # <<<<<<<<<<<<<<
* last_j = j
* last_state = state
*/
__pyx_v_last_i = __pyx_v_i;
/* "cogent/align/_pairwise_pogs.pyx":325
* overall_max_mantissa = mantissa
* last_i = i
* last_j = j # <<<<<<<<<<<<<<
* last_state = state
* if not local:
*/
__pyx_v_last_j = __pyx_v_j;
/* "cogent/align/_pairwise_pogs.pyx":326
* last_i = i
* last_j = j
* last_state = state # <<<<<<<<<<<<<<
* if not local:
* last_i = i_high - 1
*/
__pyx_v_last_state = __pyx_v_state;
goto __pyx_L71;
}
__pyx_L71:;
goto __pyx_L70;
}
__pyx_L70:;
}
}
}
/* "cogent/align/_pairwise_pogs.pyx":327
* last_j = j
* last_state = state
* if not local: # <<<<<<<<<<<<<<
* last_i = i_high - 1
* last_j = j_high - 1
*/
__pyx_t_7 = (!__pyx_v_local);
if (__pyx_t_7) {
/* "cogent/align/_pairwise_pogs.pyx":328
* last_state = state
* if not local:
* last_i = i_high - 1 # <<<<<<<<<<<<<<
* last_j = j_high - 1
* last_state = state
*/
__pyx_v_last_i = (__pyx_v_i_high - 1);
/* "cogent/align/_pairwise_pogs.pyx":329
* if not local:
* last_i = i_high - 1
* last_j = j_high - 1 # <<<<<<<<<<<<<<
* last_state = state
* else:
*/
__pyx_v_last_j = (__pyx_v_j_high - 1);
/* "cogent/align/_pairwise_pogs.pyx":330
* last_i = i_high - 1
* last_j = j_high - 1
* last_state = state # <<<<<<<<<<<<<<
* else:
* mantissa = overall_max_mantissa
*/
__pyx_v_last_state = __pyx_v_state;
goto __pyx_L72;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":332
* last_state = state
* else:
* mantissa = overall_max_mantissa # <<<<<<<<<<<<<<
* max_exponent = overall_max_exponent
*
*/
__pyx_v_mantissa = __pyx_v_overall_max_mantissa;
/* "cogent/align/_pairwise_pogs.pyx":333
* else:
* mantissa = overall_max_mantissa
* max_exponent = overall_max_exponent # <<<<<<<<<<<<<<
*
* if use_scaling:
*/
__pyx_v_max_exponent = __pyx_v_overall_max_exponent;
}
__pyx_L72:;
/* "cogent/align/_pairwise_pogs.pyx":335
* max_exponent = overall_max_exponent
*
* if use_scaling: # <<<<<<<<<<<<<<
* score = log(mantissa) + log(SCALE_STEP) * max_exponent
* elif use_logs:
*/
if (__pyx_v_use_scaling) {
/* "cogent/align/_pairwise_pogs.pyx":336
*
* if use_scaling:
* score = log(mantissa) + log(SCALE_STEP) * max_exponent # <<<<<<<<<<<<<<
* elif use_logs:
* score = mantissa
*/
__pyx_v_score = (log(__pyx_v_mantissa) + (log(__pyx_v_6cogent_5align_14_pairwise_pogs_SCALE_STEP) * __pyx_v_max_exponent));
goto __pyx_L73;
}
/* "cogent/align/_pairwise_pogs.pyx":337
* if use_scaling:
* score = log(mantissa) + log(SCALE_STEP) * max_exponent
* elif use_logs: # <<<<<<<<<<<<<<
* score = mantissa
* else:
*/
if (__pyx_v_use_logs) {
/* "cogent/align/_pairwise_pogs.pyx":338
* score = log(mantissa) + log(SCALE_STEP) * max_exponent
* elif use_logs:
* score = mantissa # <<<<<<<<<<<<<<
* else:
* score = log(mantissa)
*/
__pyx_v_score = __pyx_v_mantissa;
goto __pyx_L73;
}
/*else*/ {
/* "cogent/align/_pairwise_pogs.pyx":340
* score = mantissa
* else:
* score = log(mantissa) # <<<<<<<<<<<<<<
* return ((last_i, last_j), last_state, score)
*/
__pyx_v_score = log(__pyx_v_mantissa);
}
__pyx_L73:;
/* "cogent/align/_pairwise_pogs.pyx":341
* else:
* score = log(mantissa)
* return ((last_i, last_j), last_state, score) # <<<<<<<<<<<<<<
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_9 = PyInt_FromLong(__pyx_v_last_i); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_11 = PyInt_FromLong(__pyx_v_last_j); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__pyx_t_9 = 0;
__pyx_t_11 = 0;
__pyx_t_11 = PyInt_FromLong(__pyx_v_last_state); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_9 = PyFloat_FromDouble(__pyx_v_score); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_13);
PyTuple_SET_ITEM(__pyx_t_13, 0, ((PyObject *)__pyx_t_10));
__Pyx_GIVEREF(((PyObject *)__pyx_t_10));
PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
__pyx_t_10 = 0;
__pyx_t_11 = 0;
__pyx_t_9 = 0;
__pyx_r = ((PyObject *)__pyx_t_13);
__pyx_t_13 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_9);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_XDECREF(__pyx_t_13);
__PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
__PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
__PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
__PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
__PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
__Pyx_AddTraceback("cogent.align._pairwise_pogs.calc_rows", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__PYX_XDEC_MEMVIEW(&__pyx_v_mantissas, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_exponents, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_i_sources, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_i_sources_offsets, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_j_sources, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_j_sources_offsets, 1);
__Pyx_XDECREF(__pyx_v_pog1);
__Pyx_XDECREF(__pyx_v_pog2);
__PYX_XDEC_MEMVIEW(&__pyx_v_plan, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_seq1_index, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_seq2_index, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_state_directions, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_T, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_xgap_scores, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_ygap_scores, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_match_scores, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_track, 1);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_shape = 0;
Py_ssize_t __pyx_v_itemsize;
PyObject *__pyx_v_format = 0;
PyObject *__pyx_v_mode = 0;
int __pyx_v_allocate_buffer;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__shape,&__pyx_n_s__itemsize,&__pyx_n_s__format,&__pyx_n_s__mode,&__pyx_n_s__allocate_buffer,0};
PyObject* values[5] = {0,0,0,0,0};
values[3] = ((PyObject *)__pyx_n_u__c);
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);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shape)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__itemsize)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode);
if (value) { values[3] = value; kw_args--; }
}
case 4:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__allocate_buffer);
if (value) { values[4] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__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_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
/* "View.MemoryView":114
*
* def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
* mode=u"c", bint allocate_buffer=True): # <<<<<<<<<<<<<<
*
* cdef int idx
*/
__pyx_v_allocate_buffer = ((int)1);
}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
PyErr_Format(PyExc_TypeError, "Argument 'format' must not be None"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_r = __pyx_array_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);
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":113
* cdef bint dtype_is_object
*
* def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
* mode=u"c", bint allocate_buffer=True):
*
*/
static int __pyx_array_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) {
int __pyx_v_idx;
Py_ssize_t __pyx_v_i;
PyObject **__pyx_v_p;
PyObject *__pyx_v_encode = NULL;
PyObject *__pyx_v_dim = NULL;
char __pyx_v_order;
PyObject *__pyx_v_decode = NULL;
int __pyx_r;
__Pyx_RefNannyDeclarations
Py_ssize_t __pyx_t_1;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
char *__pyx_t_6;
int __pyx_t_7;
int __pyx_t_8;
int __pyx_t_9;
Py_ssize_t __pyx_t_10;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
__Pyx_INCREF(__pyx_v_format);
__Pyx_INCREF(__pyx_v_mode);
/* "View.MemoryView":120
* cdef PyObject **p
*
* self.ndim = len(shape) # <<<<<<<<<<<<<<
* self.itemsize = itemsize
*
*/
if (unlikely(((PyObject *)__pyx_v_shape) == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_shape)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->ndim = __pyx_t_1;
/* "View.MemoryView":121
*
* self.ndim = len(shape)
* self.itemsize = itemsize # <<<<<<<<<<<<<<
*
* if not self.ndim:
*/
__pyx_v_self->itemsize = __pyx_v_itemsize;
/* "View.MemoryView":123
* self.itemsize = itemsize
*
* if not self.ndim: # <<<<<<<<<<<<<<
* raise ValueError("Empty shape tuple for cython.array")
*
*/
__pyx_t_2 = (!__pyx_v_self->ndim);
if (__pyx_t_2) {
/* "View.MemoryView":124
*
* if not self.ndim:
* raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
*
* if self.itemsize <= 0:
*/
__pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":126
* raise ValueError("Empty shape tuple for cython.array")
*
* if self.itemsize <= 0: # <<<<<<<<<<<<<<
* raise ValueError("itemsize <= 0 for cython.array")
*
*/
__pyx_t_2 = (__pyx_v_self->itemsize <= 0);
if (__pyx_t_2) {
/* "View.MemoryView":127
*
* if self.itemsize <= 0:
* raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
*
* encode = getattr(format, 'encode', None)
*/
__pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L4;
}
__pyx_L4:;
/* "View.MemoryView":129
* raise ValueError("itemsize <= 0 for cython.array")
*
* encode = getattr(format, 'encode', None) # <<<<<<<<<<<<<<
* if encode:
* format = encode('ASCII')
*/
__pyx_t_3 = ((PyObject *)__pyx_n_s__encode);
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = Py_None;
__Pyx_INCREF(__pyx_t_4);
__pyx_t_5 = __Pyx_GetAttr3(__pyx_v_format, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_encode = __pyx_t_5;
__pyx_t_5 = 0;
/* "View.MemoryView":130
*
* encode = getattr(format, 'encode', None)
* if encode: # <<<<<<<<<<<<<<
* format = encode('ASCII')
* self._format = format
*/
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_encode); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
/* "View.MemoryView":131
* encode = getattr(format, 'encode', None)
* if encode:
* format = encode('ASCII') # <<<<<<<<<<<<<<
* self._format = format
* self.format = self._format
*/
__pyx_t_5 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_v_format);
__pyx_v_format = __pyx_t_5;
__pyx_t_5 = 0;
goto __pyx_L5;
}
__pyx_L5:;
/* "View.MemoryView":132
* if encode:
* format = encode('ASCII')
* self._format = format # <<<<<<<<<<<<<<
* self.format = self._format
*
*/
if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_format)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_INCREF(__pyx_v_format);
__Pyx_GIVEREF(__pyx_v_format);
__Pyx_GOTREF(__pyx_v_self->_format);
__Pyx_DECREF(((PyObject *)__pyx_v_self->_format));
__pyx_v_self->_format = ((PyObject*)__pyx_v_format);
/* "View.MemoryView":133
* format = encode('ASCII')
* self._format = format
* self.format = self._format # <<<<<<<<<<<<<<
*
* self._shape = malloc(sizeof(Py_ssize_t)*self.ndim)
*/
__pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->format = __pyx_t_6;
/* "View.MemoryView":135
* self.format = self._format
*
* self._shape = malloc(sizeof(Py_ssize_t)*self.ndim) # <<<<<<<<<<<<<<
* self._strides = malloc(sizeof(Py_ssize_t)*self.ndim)
*
*/
__pyx_v_self->_shape = ((Py_ssize_t *)malloc(((sizeof(Py_ssize_t)) * __pyx_v_self->ndim)));
/* "View.MemoryView":136
*
* self._shape = malloc(sizeof(Py_ssize_t)*self.ndim)
* self._strides = malloc(sizeof(Py_ssize_t)*self.ndim) # <<<<<<<<<<<<<<
*
* if not self._shape or not self._strides:
*/
__pyx_v_self->_strides = ((Py_ssize_t *)malloc(((sizeof(Py_ssize_t)) * __pyx_v_self->ndim)));
/* "View.MemoryView":138
* self._strides = malloc(sizeof(Py_ssize_t)*self.ndim)
*
* if not self._shape or not self._strides: # <<<<<<<<<<<<<<
* free(self._shape)
* free(self._strides)
*/
__pyx_t_2 = (!(__pyx_v_self->_shape != 0));
if (!__pyx_t_2) {
__pyx_t_7 = (!(__pyx_v_self->_strides != 0));
__pyx_t_8 = __pyx_t_7;
} else {
__pyx_t_8 = __pyx_t_2;
}
if (__pyx_t_8) {
/* "View.MemoryView":139
*
* if not self._shape or not self._strides:
* free(self._shape) # <<<<<<<<<<<<<<
* free(self._strides)
* raise MemoryError("unable to allocate shape or strides.")
*/
free(__pyx_v_self->_shape);
/* "View.MemoryView":140
* if not self._shape or not self._strides:
* free(self._shape)
* free(self._strides) # <<<<<<<<<<<<<<
* raise MemoryError("unable to allocate shape or strides.")
*
*/
free(__pyx_v_self->_strides);
/* "View.MemoryView":141
* free(self._shape)
* free(self._strides)
* raise MemoryError("unable to allocate shape or strides.") # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_5 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
__pyx_L6:;
/* "View.MemoryView":144
*
*
* idx = 0 # <<<<<<<<<<<<<<
* for idx, dim in enumerate(shape):
* if dim <= 0:
*/
__pyx_v_idx = 0;
/* "View.MemoryView":145
*
* idx = 0
* for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
* if dim <= 0:
* raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
*/
__pyx_t_9 = 0;
__pyx_t_5 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
for (;;) {
if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__Pyx_XDECREF(__pyx_v_dim);
__pyx_v_dim = __pyx_t_4;
__pyx_t_4 = 0;
__pyx_v_idx = __pyx_t_9;
__pyx_t_9 = (__pyx_t_9 + 1);
/* "View.MemoryView":146
* idx = 0
* for idx, dim in enumerate(shape):
* if dim <= 0: # <<<<<<<<<<<<<<
* raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
*
*/
__pyx_t_4 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_8) {
/* "View.MemoryView":147
* 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_4 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_dim);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_dim);
__Pyx_GIVEREF(__pyx_v_dim);
__pyx_t_4 = 0;
__pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
__Pyx_GIVEREF(((PyObject *)__pyx_t_4));
__pyx_t_4 = 0;
__pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
/* "View.MemoryView":149
* raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
*
* self._shape[idx] = dim # <<<<<<<<<<<<<<
* idx += 1
*
*/
__pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
(__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_t_10;
/* "View.MemoryView":150
*
* self._shape[idx] = dim
* idx += 1 # <<<<<<<<<<<<<<
*
* if mode not in ("fortran", "c"):
*/
__pyx_v_idx = (__pyx_v_idx + 1);
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "View.MemoryView":152
* idx += 1
*
* if mode not in ("fortran", "c"): # <<<<<<<<<<<<<<
* raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
*
*/
__Pyx_INCREF(__pyx_v_mode);
__pyx_t_5 = __pyx_v_mode;
__pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (((int)__pyx_t_8)) {
__pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_7 = ((int)__pyx_t_2);
} else {
__pyx_t_7 = ((int)__pyx_t_8);
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_8 = __pyx_t_7;
if (__pyx_t_8) {
/* "View.MemoryView":153
*
* if mode not in ("fortran", "c"):
* raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<<
*
* cdef char order
*/
__pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_v_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
__pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_5, 0, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L10;
}
__pyx_L10:;
/* "View.MemoryView":156
*
* cdef char order
* if mode == 'fortran': # <<<<<<<<<<<<<<
* order = 'F'
* else:
*/
__pyx_t_5 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_8) {
/* "View.MemoryView":157
* cdef char order
* if mode == 'fortran':
* order = 'F' # <<<<<<<<<<<<<<
* else:
* order = 'C'
*/
__pyx_v_order = 'F';
goto __pyx_L11;
}
/*else*/ {
/* "View.MemoryView":159
* order = 'F'
* else:
* order = 'C' # <<<<<<<<<<<<<<
*
* self.len = fill_contig_strides_array(self._shape, self._strides,
*/
__pyx_v_order = 'C';
}
__pyx_L11:;
/* "View.MemoryView":161
* order = 'C'
*
* self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<<
* itemsize, self.ndim, order)
*
*/
__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":164
* itemsize, self.ndim, order)
*
* decode = getattr(mode, 'decode', None) # <<<<<<<<<<<<<<
* if decode:
* mode = decode('ASCII')
*/
__pyx_t_5 = ((PyObject *)__pyx_n_s__decode);
__Pyx_INCREF(__pyx_t_5);
__pyx_t_4 = Py_None;
__Pyx_INCREF(__pyx_t_4);
__pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_decode = __pyx_t_3;
__pyx_t_3 = 0;
/* "View.MemoryView":165
*
* decode = getattr(mode, 'decode', None)
* if decode: # <<<<<<<<<<<<<<
* mode = decode('ASCII')
* self.mode = mode
*/
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_8) {
/* "View.MemoryView":166
* decode = getattr(mode, 'decode', None)
* if decode:
* mode = decode('ASCII') # <<<<<<<<<<<<<<
* self.mode = mode
*
*/
__pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_v_mode);
__pyx_v_mode = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L12;
}
__pyx_L12:;
/* "View.MemoryView":167
* if decode:
* mode = decode('ASCII')
* self.mode = mode # <<<<<<<<<<<<<<
*
* self.free_data = allocate_buffer
*/
if (!(likely(PyUnicode_CheckExact(__pyx_v_mode))||((__pyx_v_mode) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected unicode, got %.200s", Py_TYPE(__pyx_v_mode)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_INCREF(__pyx_v_mode);
__Pyx_GIVEREF(__pyx_v_mode);
__Pyx_GOTREF(__pyx_v_self->mode);
__Pyx_DECREF(((PyObject *)__pyx_v_self->mode));
__pyx_v_self->mode = ((PyObject*)__pyx_v_mode);
/* "View.MemoryView":169
* self.mode = mode
*
* self.free_data = allocate_buffer # <<<<<<<<<<<<<<
* self.dtype_is_object = format == b'O'
* if allocate_buffer:
*/
__pyx_v_self->free_data = __pyx_v_allocate_buffer;
/* "View.MemoryView":170
*
* self.free_data = allocate_buffer
* self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<<
* if allocate_buffer:
* self.data = malloc(self.len)
*/
__pyx_t_3 = PyObject_RichCompare(__pyx_v_format, ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_self->dtype_is_object = __pyx_t_8;
/* "View.MemoryView":171
* self.free_data = allocate_buffer
* self.dtype_is_object = format == b'O'
* if allocate_buffer: # <<<<<<<<<<<<<<
* self.data = malloc(self.len)
* if not self.data:
*/
if (__pyx_v_allocate_buffer) {
/* "View.MemoryView":172
* self.dtype_is_object = format == b'O'
* if allocate_buffer:
* self.data = malloc(self.len) # <<<<<<<<<<<<<<
* if not self.data:
* raise MemoryError("unable to allocate array data.")
*/
__pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
/* "View.MemoryView":173
* if allocate_buffer:
* self.data = malloc(self.len)
* if not self.data: # <<<<<<<<<<<<<<
* raise MemoryError("unable to allocate array data.")
*
*/
__pyx_t_8 = (!(__pyx_v_self->data != 0));
if (__pyx_t_8) {
/* "View.MemoryView":174
* self.data = malloc(self.len)
* if not self.data:
* raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
*
* if self.dtype_is_object:
*/
__pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L14;
}
__pyx_L14:;
/* "View.MemoryView":176
* raise MemoryError("unable to allocate array data.")
*
* if self.dtype_is_object: # <<<<<<<<<<<<<<
* p = self.data
* for i in range(self.len / itemsize):
*/
if (__pyx_v_self->dtype_is_object) {
/* "View.MemoryView":177
*
* if self.dtype_is_object:
* p = self.data # <<<<<<<<<<<<<<
* for i in range(self.len / itemsize):
* p[i] = Py_None
*/
__pyx_v_p = ((PyObject **)__pyx_v_self->data);
/* "View.MemoryView":178
* if self.dtype_is_object:
* p = self.data
* for i in range(self.len / itemsize): # <<<<<<<<<<<<<<
* p[i] = Py_None
* Py_INCREF(Py_None)
*/
if (unlikely(__pyx_v_itemsize == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
PyErr_Format(PyExc_OverflowError, "value too large to perform division");
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_1; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "View.MemoryView":179
* p = self.data
* for i in range(self.len / itemsize):
* p[i] = Py_None # <<<<<<<<<<<<<<
* Py_INCREF(Py_None)
*
*/
(__pyx_v_p[__pyx_v_i]) = Py_None;
/* "View.MemoryView":180
* for i in range(self.len / itemsize):
* p[i] = Py_None
* Py_INCREF(Py_None) # <<<<<<<<<<<<<<
*
* @cname('getbuffer')
*/
Py_INCREF(Py_None);
}
goto __pyx_L15;
}
__pyx_L15:;
goto __pyx_L13;
}
__pyx_L13:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_encode);
__Pyx_XDECREF(__pyx_v_dim);
__Pyx_XDECREF(__pyx_v_decode);
__Pyx_XDECREF(__pyx_v_format);
__Pyx_XDECREF(__pyx_v_mode);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
__pyx_r = __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":183
*
* @cname('getbuffer')
* def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
* cdef int bufmode = -1
* if self.mode == b"c":
*/
static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
int __pyx_v_bufmode;
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getbuffer__", 0);
if (__pyx_v_info != NULL) {
__pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
__Pyx_GIVEREF(__pyx_v_info->obj);
}
/* "View.MemoryView":184
* @cname('getbuffer')
* def __getbuffer__(self, Py_buffer *info, int flags):
* cdef int bufmode = -1 # <<<<<<<<<<<<<<
* if self.mode == b"c":
* bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
*/
__pyx_v_bufmode = -1;
/* "View.MemoryView":185
* def __getbuffer__(self, Py_buffer *info, int flags):
* cdef int bufmode = -1
* if self.mode == b"c": # <<<<<<<<<<<<<<
* bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
* elif self.mode == b"fortran":
*/
__pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__c), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
/* "View.MemoryView":186
* cdef int bufmode = -1
* if self.mode == b"c":
* bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
* elif self.mode == b"fortran":
* bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
*/
__pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
goto __pyx_L3;
}
/* "View.MemoryView":187
* if self.mode == b"c":
* bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
* elif self.mode == b"fortran": # <<<<<<<<<<<<<<
* bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
* if not (flags & bufmode):
*/
__pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
/* "View.MemoryView":188
* bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
* elif self.mode == b"fortran":
* bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
* if not (flags & bufmode):
* raise ValueError("Can only create a buffer that is contiguous in memory.")
*/
__pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":189
* elif self.mode == b"fortran":
* 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
*/
__pyx_t_1 = (!(__pyx_v_flags & __pyx_v_bufmode));
if (__pyx_t_1) {
/* "View.MemoryView":190
* 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_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L4;
}
__pyx_L4:;
/* "View.MemoryView":191
* if not (flags & bufmode):
* raise ValueError("Can only create a buffer that is contiguous in memory.")
* info.buf = self.data # <<<<<<<<<<<<<<
* info.len = self.len
* info.ndim = self.ndim
*/
__pyx_v_info->buf = __pyx_v_self->data;
/* "View.MemoryView":192
* raise ValueError("Can only create a buffer that is contiguous in memory.")
* info.buf = self.data
* info.len = self.len # <<<<<<<<<<<<<<
* info.ndim = self.ndim
* info.shape = self._shape
*/
__pyx_v_info->len = __pyx_v_self->len;
/* "View.MemoryView":193
* info.buf = self.data
* info.len = self.len
* info.ndim = self.ndim # <<<<<<<<<<<<<<
* info.shape = self._shape
* info.strides = self._strides
*/
__pyx_v_info->ndim = __pyx_v_self->ndim;
/* "View.MemoryView":194
* info.len = self.len
* info.ndim = self.ndim
* info.shape = self._shape # <<<<<<<<<<<<<<
* info.strides = self._strides
* info.suboffsets = NULL
*/
__pyx_v_info->shape = __pyx_v_self->_shape;
/* "View.MemoryView":195
* info.ndim = self.ndim
* info.shape = self._shape
* info.strides = self._strides # <<<<<<<<<<<<<<
* info.suboffsets = NULL
* info.itemsize = self.itemsize
*/
__pyx_v_info->strides = __pyx_v_self->_strides;
/* "View.MemoryView":196
* info.shape = self._shape
* info.strides = self._strides
* info.suboffsets = NULL # <<<<<<<<<<<<<<
* info.itemsize = self.itemsize
* info.readonly = 0
*/
__pyx_v_info->suboffsets = NULL;
/* "View.MemoryView":197
* info.strides = self._strides
* info.suboffsets = NULL
* info.itemsize = self.itemsize # <<<<<<<<<<<<<<
* info.readonly = 0
*
*/
__pyx_v_info->itemsize = __pyx_v_self->itemsize;
/* "View.MemoryView":198
* info.suboffsets = NULL
* info.itemsize = self.itemsize
* info.readonly = 0 # <<<<<<<<<<<<<<
*
* if flags & PyBUF_FORMAT:
*/
__pyx_v_info->readonly = 0;
/* "View.MemoryView":200
* info.readonly = 0
*
* if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
* info.format = self.format
* else:
*/
__pyx_t_3 = (__pyx_v_flags & PyBUF_FORMAT);
if (__pyx_t_3) {
/* "View.MemoryView":201
*
* if flags & PyBUF_FORMAT:
* info.format = self.format # <<<<<<<<<<<<<<
* else:
* info.format = NULL
*/
__pyx_v_info->format = __pyx_v_self->format;
goto __pyx_L5;
}
/*else*/ {
/* "View.MemoryView":203
* info.format = self.format
* else:
* info.format = NULL # <<<<<<<<<<<<<<
*
* info.obj = self
*/
__pyx_v_info->format = NULL;
}
__pyx_L5:;
/* "View.MemoryView":205
* info.format = NULL
*
* info.obj = self # <<<<<<<<<<<<<<
*
* __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
*/
__Pyx_INCREF(((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
__Pyx_GOTREF(__pyx_v_info->obj);
__Pyx_DECREF(__pyx_v_info->obj);
__pyx_v_info->obj = ((PyObject *)__pyx_v_self);
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
__Pyx_GOTREF(__pyx_v_info->obj);
__Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
}
goto __pyx_L2;
__pyx_L0:;
if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
__Pyx_GOTREF(Py_None);
__Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
}
__pyx_L2:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_array_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
}
/* "View.MemoryView":209
* __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
*
* def __dealloc__(array self): # <<<<<<<<<<<<<<
* if self.callback_free_data != NULL:
* self.callback_free_data(self.data)
*/
static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
/* "View.MemoryView":210
*
* def __dealloc__(array self):
* if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
* self.callback_free_data(self.data)
* elif self.free_data:
*/
__pyx_t_1 = (__pyx_v_self->callback_free_data != NULL);
if (__pyx_t_1) {
/* "View.MemoryView":211
* def __dealloc__(array self):
* if self.callback_free_data != NULL:
* self.callback_free_data(self.data) # <<<<<<<<<<<<<<
* elif self.free_data:
* if self.dtype_is_object:
*/
__pyx_v_self->callback_free_data(__pyx_v_self->data);
goto __pyx_L3;
}
/* "View.MemoryView":212
* if self.callback_free_data != NULL:
* self.callback_free_data(self.data)
* elif self.free_data: # <<<<<<<<<<<<<<
* if self.dtype_is_object:
* refcount_objects_in_slice(self.data, self._shape,
*/
if (__pyx_v_self->free_data) {
/* "View.MemoryView":213
* self.callback_free_data(self.data)
* elif self.free_data:
* if self.dtype_is_object: # <<<<<<<<<<<<<<
* refcount_objects_in_slice(self.data, self._shape,
* self._strides, self.ndim, False)
*/
if (__pyx_v_self->dtype_is_object) {
/* "View.MemoryView":215
* if self.dtype_is_object:
* refcount_objects_in_slice(self.data, self._shape,
* self._strides, self.ndim, False) # <<<<<<<<<<<<<<
* free(self.data)
*
*/
__pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
goto __pyx_L4;
}
__pyx_L4:;
/* "View.MemoryView":216
* refcount_objects_in_slice(self.data, self._shape,
* self._strides, self.ndim, False)
* free(self.data) # <<<<<<<<<<<<<<
*
* free(self._strides)
*/
free(__pyx_v_self->data);
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":218
* free(self.data)
*
* free(self._strides) # <<<<<<<<<<<<<<
* free(self._shape)
*
*/
free(__pyx_v_self->_strides);
/* "View.MemoryView":219
*
* free(self._strides)
* free(self._shape) # <<<<<<<<<<<<<<
*
* property memview:
*/
free(__pyx_v_self->_shape);
__Pyx_RefNannyFinishContext();
}
/* Python wrapper */
static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/
static PyObject *get_memview(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = get_memview_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":223
* property memview:
* @cname('get_memview')
* def __get__(self): # <<<<<<<<<<<<<<
*
* flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
*/
static PyObject *get_memview_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
int __pyx_v_flags;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":225
* def __get__(self):
*
* flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<<
* return memoryview(self, flags, self.dtype_is_object)
*
*/
__pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
/* "View.MemoryView":226
*
* flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
* return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_1 = 0;
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
__pyx_r = __pyx_array_MemoryView_5array_6__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":229
*
*
* def __getattr__(self, attr): # <<<<<<<<<<<<<<
* return getattr(self.memview, attr)
*
*/
static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getattr__", 0);
/* "View.MemoryView":230
*
* def __getattr__(self, attr):
* return getattr(self.memview, attr) # <<<<<<<<<<<<<<
*
* def __getitem__(self, item):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __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;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
__pyx_r = __pyx_array_MemoryView_5array_8__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":232
* return getattr(self.memview, attr)
*
* def __getitem__(self, item): # <<<<<<<<<<<<<<
* return self.memview[item]
*
*/
static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
/* "View.MemoryView":233
*
* def __getitem__(self, item):
* return self.memview[item] # <<<<<<<<<<<<<<
*
* def __setitem__(self, item, value):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __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;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
__pyx_r = __pyx_array_MemoryView_5array_10__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":235
* return self.memview[item]
*
* def __setitem__(self, item, value): # <<<<<<<<<<<<<<
* self.memview[item] = value
*
*/
static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
/* "View.MemoryView":236
*
* def __setitem__(self, item, value):
* self.memview[item] = value # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":240
*
* @cname("__pyx_array_new")
* cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
* char *mode, char *buf):
* cdef array result
*/
static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) {
struct __pyx_array_obj *__pyx_v_result = 0;
struct __pyx_array_obj *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("array_cwrapper", 0);
/* "View.MemoryView":244
* cdef array result
*
* if buf == NULL: # <<<<<<<<<<<<<<
* result = array(shape, itemsize, format, mode.decode('ASCII'))
* else:
*/
__pyx_t_1 = (__pyx_v_buf == NULL);
if (__pyx_t_1) {
/* "View.MemoryView":245
*
* 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_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_4 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_INCREF(((PyObject *)__pyx_v_shape));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_shape));
__Pyx_GIVEREF(((PyObject *)__pyx_v_shape));
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_t_4));
__Pyx_GIVEREF(((PyObject *)__pyx_t_4));
__pyx_t_2 = 0;
__pyx_t_3 = 0;
__pyx_t_4 = 0;
__pyx_t_4 = PyObject_Call(((PyObject *)((PyObject *)__pyx_array_type)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
__pyx_t_4 = 0;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":247
* 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_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__pyx_t_3 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)__pyx_v_shape));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_shape));
__Pyx_GIVEREF(((PyObject *)__pyx_v_shape));
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_t_5));
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_4 = 0;
__pyx_t_5 = 0;
__pyx_t_3 = 0;
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
/* "View.MemoryView":248
* else:
* result = array(shape, itemsize, format, mode.decode('ASCII'),
* allocate_buffer=False) # <<<<<<<<<<<<<<
* result.data = buf
*
*/
__pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__allocate_buffer), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(((PyObject *)((PyObject *)__pyx_array_type)), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
__pyx_t_5 = 0;
/* "View.MemoryView":249
* result = array(shape, itemsize, format, mode.decode('ASCII'),
* allocate_buffer=False)
* result.data = buf # <<<<<<<<<<<<<<
*
* return result
*/
__pyx_v_result->data = __pyx_v_buf;
}
__pyx_L3:;
/* "View.MemoryView":251
* result.data = buf
*
* return result # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(((PyObject *)__pyx_r));
__Pyx_INCREF(((PyObject *)__pyx_v_result));
__pyx_r = __pyx_v_result;
goto __pyx_L0;
__pyx_r = ((struct __pyx_array_obj *)Py_None); __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_result);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_name = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,0};
PyObject* values[1] = {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 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name)) != 0)) kw_args--;
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_filename = __pyx_f[2]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
}
__pyx_v_name = values[0];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_MemviewEnum_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":277
* cdef class Enum(object):
* cdef object name
* def __init__(self, name): # <<<<<<<<<<<<<<
* self.name = name
* def __repr__(self):
*/
static int __pyx_MemviewEnum_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
/* "View.MemoryView":278
* cdef object name
* def __init__(self, name):
* self.name = name # <<<<<<<<<<<<<<
* def __repr__(self):
* return self.name
*/
__Pyx_INCREF(__pyx_v_name);
__Pyx_GIVEREF(__pyx_v_name);
__Pyx_GOTREF(__pyx_v_self->name);
__Pyx_DECREF(__pyx_v_self->name);
__pyx_v_self->name = __pyx_v_name;
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
__pyx_r = __pyx_MemviewEnum_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":279
* def __init__(self, name):
* self.name = name
* def __repr__(self): # <<<<<<<<<<<<<<
* return self.name
*
*/
static PyObject *__pyx_MemviewEnum_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__repr__", 0);
/* "View.MemoryView":280
* self.name = name
* def __repr__(self):
* return self.name # <<<<<<<<<<<<<<
*
* cdef generic = Enum("")
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->name);
__pyx_r = __pyx_v_self->name;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":294
*
* @cname('__pyx_align_pointer')
* cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
* "Align pointer memory on a given boundary"
* cdef Py_intptr_t aligned_p = memory
*/
static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
Py_intptr_t __pyx_v_aligned_p;
size_t __pyx_v_offset;
void *__pyx_r;
int __pyx_t_1;
/* "View.MemoryView":296
* cdef void *align_pointer(void *memory, size_t alignment) nogil:
* "Align pointer memory on a given boundary"
* cdef Py_intptr_t aligned_p = memory # <<<<<<<<<<<<<<
* cdef size_t offset
*
*/
__pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
/* "View.MemoryView":300
*
* with cython.cdivision(True):
* offset = aligned_p % alignment # <<<<<<<<<<<<<<
*
* if offset > 0:
*/
__pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
/* "View.MemoryView":302
* offset = aligned_p % alignment
*
* if offset > 0: # <<<<<<<<<<<<<<
* aligned_p += alignment - offset
*
*/
__pyx_t_1 = (__pyx_v_offset > 0);
if (__pyx_t_1) {
/* "View.MemoryView":303
*
* if offset > 0:
* aligned_p += alignment - offset # <<<<<<<<<<<<<<
*
* return aligned_p
*/
__pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":305
* aligned_p += alignment - offset
*
* return aligned_p # <<<<<<<<<<<<<<
*
* @cname('__pyx_memoryview')
*/
__pyx_r = ((void *)__pyx_v_aligned_p);
goto __pyx_L0;
__pyx_r = 0;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_obj = 0;
int __pyx_v_flags;
int __pyx_v_dtype_is_object;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__obj,&__pyx_n_s__flags,&__pyx_n_s__dtype_is_object,0};
PyObject* values[3] = {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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtype_is_object);
if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_obj = values[0];
__pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
/* "View.MemoryView":323
* cdef __Pyx_TypeInfo *typeinfo
*
* def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
* self.obj = obj
* self.flags = flags
*/
__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_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_memoryview_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
/* "View.MemoryView":324
*
* def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
* self.obj = obj # <<<<<<<<<<<<<<
* self.flags = flags
* if type(self) is memoryview or obj is not None:
*/
__Pyx_INCREF(__pyx_v_obj);
__Pyx_GIVEREF(__pyx_v_obj);
__Pyx_GOTREF(__pyx_v_self->obj);
__Pyx_DECREF(__pyx_v_self->obj);
__pyx_v_self->obj = __pyx_v_obj;
/* "View.MemoryView":325
* def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
* self.obj = obj
* self.flags = flags # <<<<<<<<<<<<<<
* if type(self) is memoryview or obj is not None:
* __Pyx_GetBuffer(obj, &self.view, flags)
*/
__pyx_v_self->flags = __pyx_v_flags;
/* "View.MemoryView":326
* self.obj = obj
* 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_t_1 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)((PyObject *)__pyx_memoryview_type)));
if (!__pyx_t_1) {
__pyx_t_2 = (__pyx_v_obj != Py_None);
__pyx_t_3 = __pyx_t_2;
} else {
__pyx_t_3 = __pyx_t_1;
}
if (__pyx_t_3) {
/* "View.MemoryView":327
* 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 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "View.MemoryView":328
* 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
* Py_INCREF(Py_None)
*/
__pyx_t_3 = (((PyObject *)__pyx_v_self->view.obj) == NULL);
if (__pyx_t_3) {
/* "View.MemoryView":329
* __Pyx_GetBuffer(obj, &self.view, flags)
* if self.view.obj == NULL:
* (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<<
* Py_INCREF(Py_None)
*
*/
((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
/* "View.MemoryView":330
* if self.view.obj == NULL:
* (<__pyx_buffer *> &self.view).obj = Py_None
* Py_INCREF(Py_None) # <<<<<<<<<<<<<<
*
* self.lock = PyThread_allocate_lock()
*/
Py_INCREF(Py_None);
goto __pyx_L4;
}
__pyx_L4:;
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":332
* Py_INCREF(Py_None)
*
* self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<<
* if self.lock == NULL:
* raise MemoryError
*/
__pyx_v_self->lock = PyThread_allocate_lock();
/* "View.MemoryView":333
*
* self.lock = PyThread_allocate_lock()
* if self.lock == NULL: # <<<<<<<<<<<<<<
* raise MemoryError
*
*/
__pyx_t_3 = (__pyx_v_self->lock == NULL);
if (__pyx_t_3) {
/* "View.MemoryView":334
* self.lock = PyThread_allocate_lock()
* if self.lock == NULL:
* raise MemoryError # <<<<<<<<<<<<<<
*
* if flags & PyBUF_FORMAT:
*/
PyErr_NoMemory(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L5;
}
__pyx_L5:;
/* "View.MemoryView":336
* raise MemoryError
*
* if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
* self.dtype_is_object = self.view.format == b'O'
* else:
*/
__pyx_t_4 = (__pyx_v_flags & PyBUF_FORMAT);
if (__pyx_t_4) {
/* "View.MemoryView":337
*
* if flags & PyBUF_FORMAT:
* self.dtype_is_object = self.view.format == b'O' # <<<<<<<<<<<<<<
* else:
* self.dtype_is_object = dtype_is_object
*/
__pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_v_self->dtype_is_object = __pyx_t_3;
goto __pyx_L6;
}
/*else*/ {
/* "View.MemoryView":339
* self.dtype_is_object = self.view.format == b'O'
* else:
* self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<<
*
* self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
*/
__pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
}
__pyx_L6:;
/* "View.MemoryView":341
* self.dtype_is_object = dtype_is_object
*
* self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<<
* &self.acquisition_count[0], sizeof(__pyx_atomic_int))
* self.typeinfo = NULL
*/
__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":343
* self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
* &self.acquisition_count[0], sizeof(__pyx_atomic_int))
* self.typeinfo = NULL # <<<<<<<<<<<<<<
*
* def __dealloc__(memoryview self):
*/
__pyx_v_self->typeinfo = NULL;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_memoryview_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
}
/* "View.MemoryView":345
* self.typeinfo = NULL
*
* def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
* if self.obj is not None:
* __Pyx_ReleaseBuffer(&self.view)
*/
static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
/* "View.MemoryView":346
*
* def __dealloc__(memoryview self):
* if self.obj is not None: # <<<<<<<<<<<<<<
* __Pyx_ReleaseBuffer(&self.view)
*
*/
__pyx_t_1 = (__pyx_v_self->obj != Py_None);
if (__pyx_t_1) {
/* "View.MemoryView":347
* def __dealloc__(memoryview self):
* if self.obj is not None:
* __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<<
*
* if self.lock != NULL:
*/
__Pyx_ReleaseBuffer((&__pyx_v_self->view));
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":349
* __Pyx_ReleaseBuffer(&self.view)
*
* if self.lock != NULL: # <<<<<<<<<<<<<<
* PyThread_free_lock(self.lock)
*
*/
__pyx_t_1 = (__pyx_v_self->lock != NULL);
if (__pyx_t_1) {
/* "View.MemoryView":350
*
* if self.lock != NULL:
* PyThread_free_lock(self.lock) # <<<<<<<<<<<<<<
*
* cdef char *get_item_pointer(memoryview self, object index) except NULL:
*/
PyThread_free_lock(__pyx_v_self->lock);
goto __pyx_L4;
}
__pyx_L4:;
__Pyx_RefNannyFinishContext();
}
/* "View.MemoryView":352
* PyThread_free_lock(self.lock)
*
* cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
* cdef Py_ssize_t dim
* cdef char *itemp = self.view.buf
*/
static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
Py_ssize_t __pyx_v_dim;
char *__pyx_v_itemp;
PyObject *__pyx_v_idx = NULL;
char *__pyx_r;
__Pyx_RefNannyDeclarations
Py_ssize_t __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
Py_ssize_t __pyx_t_3;
PyObject *(*__pyx_t_4)(PyObject *);
PyObject *__pyx_t_5 = NULL;
Py_ssize_t __pyx_t_6;
char *__pyx_t_7;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_item_pointer", 0);
/* "View.MemoryView":354
* cdef char *get_item_pointer(memoryview self, object index) except NULL:
* cdef Py_ssize_t dim
* cdef char *itemp = self.view.buf # <<<<<<<<<<<<<<
*
* for dim, idx in enumerate(index):
*/
__pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
/* "View.MemoryView":356
* cdef char *itemp = self.view.buf
*
* for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
* itemp = pybuffer_index(&self.view, itemp, idx, dim)
*
*/
__pyx_t_1 = 0;
if (PyList_CheckExact(__pyx_v_index) || PyTuple_CheckExact(__pyx_v_index)) {
__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_filename = __pyx_f[2]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
}
for (;;) {
if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__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_filename = __pyx_f[2]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__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_filename = __pyx_f[2]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_5 = __pyx_t_4(__pyx_t_2);
if (unlikely(!__pyx_t_5)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_5);
}
__Pyx_XDECREF(__pyx_v_idx);
__pyx_v_idx = __pyx_t_5;
__pyx_t_5 = 0;
__pyx_v_dim = __pyx_t_1;
__pyx_t_1 = (__pyx_t_1 + 1);
/* "View.MemoryView":357
*
* 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_filename = __pyx_f[2]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __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 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_itemp = __pyx_t_7;
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "View.MemoryView":359
* itemp = pybuffer_index(&self.view, itemp, idx, dim)
*
* return itemp # <<<<<<<<<<<<<<
*
*
*/
__pyx_r = __pyx_v_itemp;
goto __pyx_L0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_idx);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":362
*
*
* def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
* if index is Ellipsis:
* return self
*/
static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
PyObject *__pyx_v_have_slices = NULL;
PyObject *__pyx_v_indices = NULL;
char *__pyx_v_itemp;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *(*__pyx_t_6)(PyObject *);
char *__pyx_t_7;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
/* "View.MemoryView":363
*
* def __getitem__(memoryview self, object index):
* if index is Ellipsis: # <<<<<<<<<<<<<<
* return self
*
*/
__pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
if (__pyx_t_1) {
/* "View.MemoryView":364
* def __getitem__(memoryview self, object index):
* if index is Ellipsis:
* return self # <<<<<<<<<<<<<<
*
* have_slices, indices = _unellipsify(index, self.view.ndim)
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_self));
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":366
* return self
*
* have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
*
* cdef char *itemp
*/
__pyx_t_2 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (likely(PyTuple_CheckExact(__pyx_t_2))) {
PyObject* sequence = __pyx_t_2;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
#else
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
} else if (1) {
__Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
} else
{
Py_ssize_t index = -1;
__pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
__Pyx_GOTREF(__pyx_t_4);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_6 = NULL;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L5_unpacking_done;
__pyx_L4_unpacking_failed:;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_6 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L5_unpacking_done:;
}
__pyx_v_have_slices = __pyx_t_3;
__pyx_t_3 = 0;
__pyx_v_indices = __pyx_t_4;
__pyx_t_4 = 0;
/* "View.MemoryView":369
*
* cdef char *itemp
* if have_slices: # <<<<<<<<<<<<<<
* return memview_slice(self, indices)
* else:
*/
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
/* "View.MemoryView":370
* cdef char *itemp
* if have_slices:
* return memview_slice(self, indices) # <<<<<<<<<<<<<<
* else:
* itemp = self.get_item_pointer(indices)
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
/*else*/ {
/* "View.MemoryView":372
* return memview_slice(self, indices)
* else:
* itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<<
* return self.convert_item_to_object(itemp)
*
*/
__pyx_t_7 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_itemp = __pyx_t_7;
/* "View.MemoryView":373
* else:
* itemp = self.get_item_pointer(indices)
* return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<<
*
* def __setitem__(memoryview self, object index, object value):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
}
__pyx_L6:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_have_slices);
__Pyx_XDECREF(__pyx_v_indices);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":375
* return self.convert_item_to_object(itemp)
*
* def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
* have_slices, index = _unellipsify(index, self.view.ndim)
*
*/
static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
PyObject *__pyx_v_have_slices = NULL;
PyObject *__pyx_v_obj = NULL;
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *(*__pyx_t_5)(PyObject *);
int __pyx_t_6;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
__Pyx_INCREF(__pyx_v_index);
/* "View.MemoryView":376
*
* def __setitem__(memoryview self, object index, object value):
* have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
*
* if have_slices:
*/
__pyx_t_1 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (likely(PyTuple_CheckExact(__pyx_t_1))) {
PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
__Pyx_INCREF(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
#else
__pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
} else if (1) {
__Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
} else
{
Py_ssize_t index = -1;
__pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
__Pyx_GOTREF(__pyx_t_2);
index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_5 = NULL;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L4_unpacking_done;
__pyx_L3_unpacking_failed:;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L4_unpacking_done:;
}
__pyx_v_have_slices = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_v_index);
__pyx_v_index = __pyx_t_3;
__pyx_t_3 = 0;
/* "View.MemoryView":378
* have_slices, index = _unellipsify(index, self.view.ndim)
*
* if have_slices: # <<<<<<<<<<<<<<
* obj = self.is_slice(value)
* if obj:
*/
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_6) {
/* "View.MemoryView":379
*
* if have_slices:
* obj = self.is_slice(value) # <<<<<<<<<<<<<<
* if obj:
* self.setitem_slice_assignment(self[index], obj)
*/
__pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_obj = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":380
* if have_slices:
* obj = self.is_slice(value)
* if obj: # <<<<<<<<<<<<<<
* self.setitem_slice_assignment(self[index], obj)
* else:
*/
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_6) {
/* "View.MemoryView":381
* 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_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (!__pyx_t_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L6;
}
/*else*/ {
/* "View.MemoryView":383
* self.setitem_slice_assignment(self[index], obj)
* else:
* self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<<
* else:
* self.setitem_indexed(index, value)
*/
__pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__pyx_L6:;
goto __pyx_L5;
}
/*else*/ {
/* "View.MemoryView":385
* self.setitem_slice_assign_scalar(self[index], value)
* else:
* self.setitem_indexed(index, value) # <<<<<<<<<<<<<<
*
* cdef is_slice(self, obj):
*/
__pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__pyx_L5:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_have_slices);
__Pyx_XDECREF(__pyx_v_obj);
__Pyx_XDECREF(__pyx_v_index);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":387
* self.setitem_indexed(index, value)
*
* cdef is_slice(self, obj): # <<<<<<<<<<<<<<
* if not isinstance(obj, memoryview):
* try:
*/
static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
int __pyx_t_9;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("is_slice", 0);
__Pyx_INCREF(__pyx_v_obj);
/* "View.MemoryView":388
*
* cdef is_slice(self, obj):
* if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
* try:
* obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
*/
__pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_3 = (!__pyx_t_2);
if (__pyx_t_3) {
/* "View.MemoryView":389
* cdef is_slice(self, obj):
* if not isinstance(obj, memoryview):
* try: # <<<<<<<<<<<<<<
* obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
* self.dtype_is_object)
*/
{
__Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_4);
__Pyx_XGOTREF(__pyx_t_5);
__Pyx_XGOTREF(__pyx_t_6);
/*try:*/ {
/* "View.MemoryView":390
* if not isinstance(obj, memoryview):
* try:
* obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
* self.dtype_is_object)
* except TypeError:
*/
__pyx_t_1 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_1);
/* "View.MemoryView":391
* try:
* obj = memoryview(obj, self.flags|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_filename = __pyx_f[2]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_INCREF(__pyx_v_obj);
PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
__Pyx_GIVEREF(__pyx_v_obj);
PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
__Pyx_GIVEREF(__pyx_t_7);
__pyx_t_1 = 0;
__pyx_t_7 = 0;
__pyx_t_7 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_v_obj);
__pyx_v_obj = __pyx_t_7;
__pyx_t_7 = 0;
}
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L11_try_end;
__pyx_L4_error:;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
/* "View.MemoryView":392
* obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
* self.dtype_is_object)
* except TypeError: # <<<<<<<<<<<<<<
* return None
*
*/
__pyx_t_9 = 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_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_GOTREF(__pyx_t_8);
__Pyx_GOTREF(__pyx_t_1);
/* "View.MemoryView":393
* self.dtype_is_object)
* except TypeError:
* return None # <<<<<<<<<<<<<<
*
* return obj
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(Py_None);
__pyx_r = Py_None;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L7_except_return;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L5_exception_handled;
}
__pyx_L6_except_error:;
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
goto __pyx_L1_error;
__pyx_L7_except_return:;
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
goto __pyx_L0;
__pyx_L5_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
__pyx_L11_try_end:;
}
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":395
* return None
*
* return obj # <<<<<<<<<<<<<<
*
* cdef setitem_slice_assignment(self, dst, src):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_obj);
__pyx_r = __pyx_v_obj;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_obj);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":397
* return obj
*
* cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
* cdef __Pyx_memviewslice dst_slice
* cdef __Pyx_memviewslice src_slice
*/
static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
__Pyx_memviewslice __pyx_v_dst_slice;
__Pyx_memviewslice __pyx_v_src_slice;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_t_4;
int __pyx_t_5;
int __pyx_t_6;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
/* "View.MemoryView":401
* 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_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = __pyx_v_src;
__Pyx_INCREF(__pyx_t_1);
/* "View.MemoryView":402
*
* 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_filename = __pyx_f[2]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = __pyx_v_dst;
__Pyx_INCREF(__pyx_t_2);
/* "View.MemoryView":403
* 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_3 = PyObject_GetAttr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_GetAttr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_1), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_2), (&__pyx_v_dst_slice))[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":405
* src.ndim, dst.ndim, self.dtype_is_object)
*
* cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
* cdef int array[128]
* cdef void *tmp = NULL
*/
static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
int __pyx_v_array[128];
void *__pyx_v_tmp;
void *__pyx_v_item;
__Pyx_memviewslice __pyx_v_tmp_slice;
__Pyx_memviewslice *__pyx_v_dst_slice;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
/* "View.MemoryView":407
* cdef setitem_slice_assign_scalar(self, memoryview dst, value):
* cdef int array[128]
* cdef void *tmp = NULL # <<<<<<<<<<<<<<
* cdef void *item
*
*/
__pyx_v_tmp = NULL;
/* "View.MemoryView":411
*
* cdef __Pyx_memviewslice tmp_slice, *dst_slice
* dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<<
*
* if self.view.itemsize > sizeof(array):
*/
__pyx_v_dst_slice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));
/* "View.MemoryView":413
* dst_slice = get_slice_from_memview(dst, &tmp_slice)
*
* if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
* tmp = malloc(self.view.itemsize)
* if tmp == NULL:
*/
__pyx_t_1 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array)));
if (__pyx_t_1) {
/* "View.MemoryView":414
*
* if self.view.itemsize > sizeof(array):
* tmp = malloc(self.view.itemsize) # <<<<<<<<<<<<<<
* if tmp == NULL:
* raise MemoryError
*/
__pyx_v_tmp = malloc(__pyx_v_self->view.itemsize);
/* "View.MemoryView":415
* if self.view.itemsize > sizeof(array):
* tmp = malloc(self.view.itemsize)
* if tmp == NULL: # <<<<<<<<<<<<<<
* raise MemoryError
* item = tmp
*/
__pyx_t_1 = (__pyx_v_tmp == NULL);
if (__pyx_t_1) {
/* "View.MemoryView":416
* tmp = malloc(self.view.itemsize)
* if tmp == NULL:
* raise MemoryError # <<<<<<<<<<<<<<
* item = tmp
* else:
*/
PyErr_NoMemory(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L4;
}
__pyx_L4:;
/* "View.MemoryView":417
* if tmp == NULL:
* raise MemoryError
* item = tmp # <<<<<<<<<<<<<<
* else:
* item = array
*/
__pyx_v_item = __pyx_v_tmp;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":419
* item = tmp
* else:
* item = array # <<<<<<<<<<<<<<
*
* if self.dtype_is_object:
*/
__pyx_v_item = ((void *)__pyx_v_array);
}
__pyx_L3:;
/* "View.MemoryView":421
* item = array
*
* if self.dtype_is_object: # <<<<<<<<<<<<<<
* ( item)[0] = value
* else:
*/
if (__pyx_v_self->dtype_is_object) {
/* "View.MemoryView":422
*
* if self.dtype_is_object:
* ( item)[0] = value # <<<<<<<<<<<<<<
* else:
* try:
*/
(((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
goto __pyx_L5;
}
/*else*/ {
/* "View.MemoryView":424
* ( item)[0] = value
* else:
* try: # <<<<<<<<<<<<<<
* self.assign_item_from_object( item, value)
* except:
*/
{
__Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_4);
/*try:*/ {
/* "View.MemoryView":425
* else:
* try:
* self.assign_item_from_object( item, value) # <<<<<<<<<<<<<<
* except:
* free(tmp)
*/
__pyx_t_5 = ((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_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L13_try_end;
__pyx_L6_error:;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "View.MemoryView":426
* try:
* self.assign_item_from_object( item, value)
* except: # <<<<<<<<<<<<<<
* free(tmp)
* raise
*/
/*except:*/ {
__Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_6);
__Pyx_GOTREF(__pyx_t_7);
/* "View.MemoryView":427
* self.assign_item_from_object( item, value)
* except:
* free(tmp) # <<<<<<<<<<<<<<
* raise
*
*/
free(__pyx_v_tmp);
/* "View.MemoryView":428
* except:
* free(tmp)
* raise # <<<<<<<<<<<<<<
*
*
*/
__Pyx_GIVEREF(__pyx_t_5);
__Pyx_GIVEREF(__pyx_t_6);
__Pyx_GIVEREF(__pyx_t_7);
__Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
__pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L7_exception_handled;
}
__pyx_L8_except_error:;
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
goto __pyx_L1_error;
__pyx_L7_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
__pyx_L13_try_end:;
}
}
__pyx_L5:;
/* "View.MemoryView":432
*
*
* 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,
*/
__pyx_t_1 = (__pyx_v_self->view.suboffsets != NULL);
if (__pyx_t_1) {
/* "View.MemoryView":433
*
* 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_7 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L16;
}
__pyx_L16:;
/* "View.MemoryView":435
* 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) # <<<<<<<<<<<<<<
* free(tmp)
*
*/
__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":436
* slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
* item, self.dtype_is_object)
* free(tmp) # <<<<<<<<<<<<<<
*
* cdef setitem_indexed(self, index, value):
*/
free(__pyx_v_tmp);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":438
* free(tmp)
*
* cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
* cdef char *itemp = self.get_item_pointer(index)
* self.assign_item_from_object(itemp, value)
*/
static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
char *__pyx_v_itemp;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
char *__pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("setitem_indexed", 0);
/* "View.MemoryView":439
*
* 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 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_itemp = __pyx_t_1;
/* "View.MemoryView":440
* 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_filename = __pyx_f[2]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":442
* self.assign_item_from_object(itemp, value)
*
* cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
* """Only used if instantiated manually by the user, or if Cython doesn't
* know how to convert the type"""
*/
static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
PyObject *__pyx_v_struct = NULL;
PyObject *__pyx_v_bytesitem = 0;
PyObject *__pyx_v_result = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
size_t __pyx_t_7;
int __pyx_t_8;
int __pyx_t_9;
PyObject *__pyx_t_10 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("convert_item_to_object", 0);
/* "View.MemoryView":445
* """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(((PyObject *)__pyx_n_s__struct), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_struct = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":448
* cdef bytes bytesitem
*
* bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<<
* try:
* result = struct.unpack(self.view.format, bytesitem)
*/
__pyx_t_1 = PyBytes_FromStringAndSize(((const char*)__pyx_v_itemp) + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_v_bytesitem = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":449
*
* bytesitem = itemp[:self.view.itemsize]
* try: # <<<<<<<<<<<<<<
* result = struct.unpack(self.view.format, bytesitem)
* except struct.error:
*/
{
__Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_4);
/*try:*/ {
/* "View.MemoryView":450
* 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_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_bytesitem));
PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_bytesitem));
__Pyx_GIVEREF(((PyObject *)__pyx_v_bytesitem));
__pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
__pyx_v_result = __pyx_t_5;
__pyx_t_5 = 0;
}
/*else:*/ {
/* "View.MemoryView":454
* raise ValueError("Unable to convert item to object")
* else:
* if len(self.view.format) == 1: # <<<<<<<<<<<<<<
* return result[0]
* return result
*/
__pyx_t_7 = strlen(__pyx_v_self->view.format);
__pyx_t_8 = (__pyx_t_7 == 1);
if (__pyx_t_8) {
/* "View.MemoryView":455
* else:
* if len(self.view.format) == 1:
* return result[0] # <<<<<<<<<<<<<<
* return result
*
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_r = __pyx_t_5;
__pyx_t_5 = 0;
goto __pyx_L6_except_return;
goto __pyx_L11;
}
__pyx_L11:;
/* "View.MemoryView":456
* if len(self.view.format) == 1:
* return result[0]
* return result # <<<<<<<<<<<<<<
*
* cdef assign_item_from_object(self, char *itemp, object value):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L6_except_return;
}
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L10_try_end;
__pyx_L3_error:;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "View.MemoryView":451
* try:
* result = struct.unpack(self.view.format, bytesitem)
* except struct.error: # <<<<<<<<<<<<<<
* raise ValueError("Unable to convert item to object")
* else:
*/
__pyx_t_5 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_5);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_9) {
__Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_6);
__Pyx_GOTREF(__pyx_t_1);
/* "View.MemoryView":452
* 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_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_Raise(__pyx_t_10, 0, 0, 0);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L4_exception_handled;
}
__pyx_L5_except_error:;
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
goto __pyx_L1_error;
__pyx_L6_except_return:;
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
goto __pyx_L0;
__pyx_L4_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
__pyx_L10_try_end:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_struct);
__Pyx_XDECREF(__pyx_v_bytesitem);
__Pyx_XDECREF(__pyx_v_result);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":458
* return result
*
* cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
* """Only used if instantiated manually by the user, or if Cython doesn't
* know how to convert the type"""
*/
static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
PyObject *__pyx_v_struct = NULL;
char __pyx_v_c;
PyObject *__pyx_v_bytesvalue = 0;
Py_ssize_t __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
Py_ssize_t __pyx_t_6;
PyObject *__pyx_t_7 = NULL;
char *__pyx_t_8;
char *__pyx_t_9;
char *__pyx_t_10;
char *__pyx_t_11;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("assign_item_from_object", 0);
/* "View.MemoryView":461
* """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(((PyObject *)__pyx_n_s__struct), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_struct = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":466
* cdef Py_ssize_t i
*
* if isinstance(value, tuple): # <<<<<<<<<<<<<<
* bytesvalue = struct.pack(self.view.format, *value)
* else:
*/
__pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "View.MemoryView":467
*
* if isinstance(value, tuple):
* bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<<
* else:
* bytesvalue = struct.pack(self.view.format, value)
*/
__pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
__pyx_t_3 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_bytesvalue = ((PyObject*)__pyx_t_3);
__pyx_t_3 = 0;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":469
* bytesvalue = struct.pack(self.view.format, *value)
* else:
* bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<<
*
* for i, c in enumerate(bytesvalue):
*/
__pyx_t_3 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(__pyx_v_value);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
__Pyx_GIVEREF(__pyx_v_value);
__pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_bytesvalue = ((PyObject*)__pyx_t_5);
__pyx_t_5 = 0;
}
__pyx_L3:;
/* "View.MemoryView":471
* bytesvalue = struct.pack(self.view.format, value)
*
* for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
* itemp[i] = c
*
*/
__pyx_t_6 = 0;
if (unlikely(((PyObject *)__pyx_v_bytesvalue) == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_INCREF(((PyObject *)__pyx_v_bytesvalue));
__pyx_t_7 = __pyx_v_bytesvalue;
__pyx_t_9 = PyBytes_AS_STRING(__pyx_t_7);
__pyx_t_10 = (__pyx_t_9 + PyBytes_GET_SIZE(__pyx_t_7));
for (__pyx_t_11 = __pyx_t_9; __pyx_t_11 < __pyx_t_10; __pyx_t_11++) {
__pyx_t_8 = __pyx_t_11;
__pyx_v_c = (__pyx_t_8[0]);
/* "View.MemoryView":472
*
* for i, c in enumerate(bytesvalue):
* itemp[i] = c # <<<<<<<<<<<<<<
*
* @cname('getbuffer')
*/
__pyx_v_i = __pyx_t_6;
/* "View.MemoryView":471
* bytesvalue = struct.pack(self.view.format, value)
*
* for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
* itemp[i] = c
*
*/
__pyx_t_6 = (__pyx_t_6 + 1);
/* "View.MemoryView":472
*
* for i, c in enumerate(bytesvalue):
* itemp[i] = c # <<<<<<<<<<<<<<
*
* @cname('getbuffer')
*/
(__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
}
__Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(((PyObject *)__pyx_t_7));
__Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_struct);
__Pyx_XDECREF(__pyx_v_bytesvalue);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":475
*
* @cname('getbuffer')
* def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
* if flags & PyBUF_STRIDES:
* info.shape = self.view.shape
*/
static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__getbuffer__", 0);
if (__pyx_v_info != NULL) {
__pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
__Pyx_GIVEREF(__pyx_v_info->obj);
}
/* "View.MemoryView":476
* @cname('getbuffer')
* def __getbuffer__(self, Py_buffer *info, int flags):
* if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
* info.shape = self.view.shape
* else:
*/
__pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
if (__pyx_t_1) {
/* "View.MemoryView":477
* def __getbuffer__(self, Py_buffer *info, int flags):
* if flags & PyBUF_STRIDES:
* info.shape = self.view.shape # <<<<<<<<<<<<<<
* else:
* info.shape = NULL
*/
__pyx_v_info->shape = __pyx_v_self->view.shape;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":479
* info.shape = self.view.shape
* else:
* info.shape = NULL # <<<<<<<<<<<<<<
*
* if flags & PyBUF_STRIDES:
*/
__pyx_v_info->shape = NULL;
}
__pyx_L3:;
/* "View.MemoryView":481
* info.shape = NULL
*
* if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
* info.strides = self.view.strides
* else:
*/
__pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
if (__pyx_t_1) {
/* "View.MemoryView":482
*
* if flags & PyBUF_STRIDES:
* info.strides = self.view.strides # <<<<<<<<<<<<<<
* else:
* info.strides = NULL
*/
__pyx_v_info->strides = __pyx_v_self->view.strides;
goto __pyx_L4;
}
/*else*/ {
/* "View.MemoryView":484
* info.strides = self.view.strides
* else:
* info.strides = NULL # <<<<<<<<<<<<<<
*
* if flags & PyBUF_INDIRECT:
*/
__pyx_v_info->strides = NULL;
}
__pyx_L4:;
/* "View.MemoryView":486
* info.strides = NULL
*
* if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
* info.suboffsets = self.view.suboffsets
* else:
*/
__pyx_t_1 = (__pyx_v_flags & PyBUF_INDIRECT);
if (__pyx_t_1) {
/* "View.MemoryView":487
*
* if flags & PyBUF_INDIRECT:
* info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<<
* else:
* info.suboffsets = NULL
*/
__pyx_v_info->suboffsets = __pyx_v_self->view.suboffsets;
goto __pyx_L5;
}
/*else*/ {
/* "View.MemoryView":489
* info.suboffsets = self.view.suboffsets
* else:
* info.suboffsets = NULL # <<<<<<<<<<<<<<
*
* if flags & PyBUF_FORMAT:
*/
__pyx_v_info->suboffsets = NULL;
}
__pyx_L5:;
/* "View.MemoryView":491
* info.suboffsets = NULL
*
* if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
* info.format = self.view.format
* else:
*/
__pyx_t_1 = (__pyx_v_flags & PyBUF_FORMAT);
if (__pyx_t_1) {
/* "View.MemoryView":492
*
* if flags & PyBUF_FORMAT:
* info.format = self.view.format # <<<<<<<<<<<<<<
* else:
* info.format = NULL
*/
__pyx_v_info->format = __pyx_v_self->view.format;
goto __pyx_L6;
}
/*else*/ {
/* "View.MemoryView":494
* info.format = self.view.format
* else:
* info.format = NULL # <<<<<<<<<<<<<<
*
* info.buf = self.view.buf
*/
__pyx_v_info->format = NULL;
}
__pyx_L6:;
/* "View.MemoryView":496
* info.format = NULL
*
* info.buf = self.view.buf # <<<<<<<<<<<<<<
* info.ndim = self.view.ndim
* info.itemsize = self.view.itemsize
*/
__pyx_v_info->buf = __pyx_v_self->view.buf;
/* "View.MemoryView":497
*
* info.buf = self.view.buf
* info.ndim = self.view.ndim # <<<<<<<<<<<<<<
* info.itemsize = self.view.itemsize
* info.len = self.view.len
*/
__pyx_v_info->ndim = __pyx_v_self->view.ndim;
/* "View.MemoryView":498
* info.buf = self.view.buf
* info.ndim = self.view.ndim
* info.itemsize = self.view.itemsize # <<<<<<<<<<<<<<
* info.len = self.view.len
* info.readonly = 0
*/
__pyx_v_info->itemsize = __pyx_v_self->view.itemsize;
/* "View.MemoryView":499
* info.ndim = self.view.ndim
* info.itemsize = self.view.itemsize
* info.len = self.view.len # <<<<<<<<<<<<<<
* info.readonly = 0
* info.obj = self
*/
__pyx_v_info->len = __pyx_v_self->view.len;
/* "View.MemoryView":500
* info.itemsize = self.view.itemsize
* info.len = self.view.len
* info.readonly = 0 # <<<<<<<<<<<<<<
* info.obj = self
*
*/
__pyx_v_info->readonly = 0;
/* "View.MemoryView":501
* info.len = self.view.len
* info.readonly = 0
* info.obj = self # <<<<<<<<<<<<<<
*
* __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
*/
__Pyx_INCREF(((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
__Pyx_GOTREF(__pyx_v_info->obj);
__Pyx_DECREF(__pyx_v_info->obj);
__pyx_v_info->obj = ((PyObject *)__pyx_v_self);
__pyx_r = 0;
if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
__Pyx_GOTREF(Py_None);
__Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":508
* property T:
* @cname('__pyx_memoryview_transpose')
* def __get__(self): # <<<<<<<<<<<<<<
* cdef _memoryviewslice result = memoryview_copy(self)
* transpose_memslice(&result.from_slice)
*/
static PyObject *__pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":509
* @cname('__pyx_memoryview_transpose')
* def __get__(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_filename = __pyx_f[2]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
__pyx_t_1 = 0;
/* "View.MemoryView":510
* def __get__(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 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "View.MemoryView":511
* cdef _memoryviewslice result = memoryview_copy(self)
* transpose_memslice(&result.from_slice)
* return result # <<<<<<<<<<<<<<
*
* property base:
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_result));
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_result);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview__get__base_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":515
* property base:
* @cname('__pyx_memoryview__get__base')
* def __get__(self): # <<<<<<<<<<<<<<
* return self.obj
*
*/
static PyObject *__pyx_memoryview__get__base_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":516
* @cname('__pyx_memoryview__get__base')
* def __get__(self):
* return self.obj # <<<<<<<<<<<<<<
*
* property shape:
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->obj);
__pyx_r = __pyx_v_self->obj;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":520
* property shape:
* @cname('__pyx_memoryview_get_shape')
* def __get__(self): # <<<<<<<<<<<<<<
* return tuple([self.view.shape[i] for i in xrange(self.view.ndim)])
*
*/
static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
int __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":521
* @cname('__pyx_memoryview_get_shape')
* def __get__(self):
* return tuple([self.view.shape[i] for i in xrange(self.view.ndim)]) # <<<<<<<<<<<<<<
*
* property strides:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_v_self->view.ndim;
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
__pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->view.shape[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
__pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_r = ((PyObject *)__pyx_t_4);
__pyx_t_4 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_get_strides_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":525
* property strides:
* @cname('__pyx_memoryview_get_strides')
* def __get__(self): # <<<<<<<<<<<<<<
* if self.view.strides == NULL:
*
*/
static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
int __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":526
* @cname('__pyx_memoryview_get_strides')
* def __get__(self):
* if self.view.strides == NULL: # <<<<<<<<<<<<<<
*
* raise ValueError("Buffer view does not expose strides")
*/
__pyx_t_1 = (__pyx_v_self->view.strides == NULL);
if (__pyx_t_1) {
/* "View.MemoryView":528
* if self.view.strides == NULL:
*
* raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
*
* return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":530
* raise ValueError("Buffer view does not expose strides")
*
* return tuple([self.view.strides[i] for i in xrange(self.view.ndim)]) # <<<<<<<<<<<<<<
*
* property suboffsets:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __pyx_v_self->view.ndim;
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
__pyx_v_i = __pyx_t_4;
__pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.strides[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = ((PyObject *)__pyx_t_5);
__pyx_t_5 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_get_suboffsets(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_suboffsets(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":534
* property suboffsets:
* @cname('__pyx_memoryview_get_suboffsets')
* def __get__(self): # <<<<<<<<<<<<<<
* if self.view.suboffsets == NULL:
* return [-1] * self.view.ndim
*/
static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
int __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":535
* @cname('__pyx_memoryview_get_suboffsets')
* def __get__(self):
* if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
* return [-1] * self.view.ndim
*
*/
__pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL);
if (__pyx_t_1) {
/* "View.MemoryView":536
* def __get__(self):
* if self.view.suboffsets == NULL:
* return [-1] * self.view.ndim # <<<<<<<<<<<<<<
*
* return tuple([self.view.suboffsets[i] for i in xrange(self.view.ndim)])
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_2 = PyList_New(1 * ((__pyx_v_self->view.ndim<0) ? 0:__pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
{ Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < __pyx_v_self->view.ndim; __pyx_temp++) {
__Pyx_INCREF(__pyx_int_neg_1);
PyList_SET_ITEM(__pyx_t_2, __pyx_temp, __pyx_int_neg_1);
__Pyx_GIVEREF(__pyx_int_neg_1);
}
}
__pyx_r = ((PyObject *)__pyx_t_2);
__pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":538
* return [-1] * self.view.ndim
*
* return tuple([self.view.suboffsets[i] for i in xrange(self.view.ndim)]) # <<<<<<<<<<<<<<
*
* property ndim:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __pyx_v_self->view.ndim;
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
__pyx_v_i = __pyx_t_4;
__pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.suboffsets[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = ((PyObject *)__pyx_t_5);
__pyx_t_5 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":542
* property ndim:
* @cname('__pyx_memoryview_get_ndim')
* def __get__(self): # <<<<<<<<<<<<<<
* return self.view.ndim
*
*/
static PyObject *__pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":543
* @cname('__pyx_memoryview_get_ndim')
* def __get__(self):
* return self.view.ndim # <<<<<<<<<<<<<<
*
* property itemsize:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyInt_FromLong(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":547
* property itemsize:
* @cname('__pyx_memoryview_get_itemsize')
* def __get__(self): # <<<<<<<<<<<<<<
* return self.view.itemsize
*
*/
static PyObject *__pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":548
* @cname('__pyx_memoryview_get_itemsize')
* def __get__(self):
* return self.view.itemsize # <<<<<<<<<<<<<<
*
* property nbytes:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":552
* property nbytes:
* @cname('__pyx_memoryview_get_nbytes')
* def __get__(self): # <<<<<<<<<<<<<<
* return self.size * self.view.itemsize
*
*/
static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":553
* @cname('__pyx_memoryview_get_nbytes')
* def __get__(self):
* return self.size * self.view.itemsize # <<<<<<<<<<<<<<
*
* property size:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __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;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":557
* property size:
* @cname('__pyx_memoryview_get_size')
* def __get__(self): # <<<<<<<<<<<<<<
* if self._size is None:
* result = 1
*/
static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
PyObject *__pyx_v_result = NULL;
PyObject *__pyx_v_length = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
Py_ssize_t __pyx_t_4;
PyObject *(*__pyx_t_5)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":558
* @cname('__pyx_memoryview_get_size')
* def __get__(self):
* if self._size is None: # <<<<<<<<<<<<<<
* result = 1
*
*/
__pyx_t_1 = (__pyx_v_self->_size == Py_None);
if (__pyx_t_1) {
/* "View.MemoryView":559
* def __get__(self):
* if self._size is None:
* result = 1 # <<<<<<<<<<<<<<
*
* for length in self.shape:
*/
__Pyx_INCREF(__pyx_int_1);
__pyx_v_result = __pyx_int_1;
/* "View.MemoryView":561
* result = 1
*
* for length in self.shape: # <<<<<<<<<<<<<<
* result *= length
*
*/
__pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
__pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
} else {
__pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
for (;;) {
if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_2 = __pyx_t_5(__pyx_t_3);
if (unlikely(!__pyx_t_2)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_2);
}
__Pyx_XDECREF(__pyx_v_length);
__pyx_v_length = __pyx_t_2;
__pyx_t_2 = 0;
/* "View.MemoryView":562
*
* for length in self.shape:
* result *= length # <<<<<<<<<<<<<<
*
* self._size = result
*/
__pyx_t_2 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_v_result);
__pyx_v_result = __pyx_t_2;
__pyx_t_2 = 0;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "View.MemoryView":564
* result *= length
*
* self._size = result # <<<<<<<<<<<<<<
*
* return self._size
*/
__Pyx_INCREF(__pyx_v_result);
__Pyx_GIVEREF(__pyx_v_result);
__Pyx_GOTREF(__pyx_v_self->_size);
__Pyx_DECREF(__pyx_v_self->_size);
__pyx_v_self->_size = __pyx_v_result;
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":566
* self._size = result
*
* return self._size # <<<<<<<<<<<<<<
*
* def __len__(self):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->_size);
__pyx_r = __pyx_v_self->_size;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_result);
__Pyx_XDECREF(__pyx_v_length);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":568
* return self._size
*
* def __len__(self): # <<<<<<<<<<<<<<
* if self.view.ndim >= 1:
* return self.view.shape[0]
*/
static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__len__", 0);
/* "View.MemoryView":569
*
* def __len__(self):
* if self.view.ndim >= 1: # <<<<<<<<<<<<<<
* return self.view.shape[0]
*
*/
__pyx_t_1 = (__pyx_v_self->view.ndim >= 1);
if (__pyx_t_1) {
/* "View.MemoryView":570
* def __len__(self):
* if self.view.ndim >= 1:
* return self.view.shape[0] # <<<<<<<<<<<<<<
*
* return 0
*/
__pyx_r = (__pyx_v_self->view.shape[0]);
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":572
* return self.view.shape[0]
*
* return 0 # <<<<<<<<<<<<<<
*
* def __repr__(self):
*/
__pyx_r = 0;
goto __pyx_L0;
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":574
* return 0
*
* def __repr__(self): # <<<<<<<<<<<<<<
* return "" % (self.base.__class__.__name__,
* id(self))
*/
static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__repr__", 0);
/* "View.MemoryView":575
*
* def __repr__(self):
* return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
* id(self))
*
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "View.MemoryView":576
* def __repr__(self):
* return "" % (self.base.__class__.__name__,
* id(self)) # <<<<<<<<<<<<<<
*
* def __str__(self):
*/
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
__pyx_t_3 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_1 = 0;
__pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = ((PyObject *)__pyx_t_3);
__pyx_t_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":578
* id(self))
*
* def __str__(self): # <<<<<<<<<<<<<<
* return "" % (self.base.__class__.__name__,)
*
*/
static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
/* "View.MemoryView":579
*
* def __str__(self):
* return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_34), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":582
*
*
* def is_c_contig(self): # <<<<<<<<<<<<<<
* cdef __Pyx_memviewslice *mslice, tmp
* mslice = get_slice_from_memview(self, &tmp)
*/
static PyObject *__pyx_memoryview_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
__Pyx_memviewslice *__pyx_v_mslice;
__Pyx_memviewslice __pyx_v_tmp;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("is_c_contig", 0);
/* "View.MemoryView":584
* def is_c_contig(self):
* cdef __Pyx_memviewslice *mslice, tmp
* mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
* return slice_is_contig(mslice, 'C', self.view.ndim)
*
*/
__pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
/* "View.MemoryView":585
* cdef __Pyx_memviewslice *mslice, tmp
* mslice = get_slice_from_memview(self, &tmp)
* return slice_is_contig(mslice, 'C', self.view.ndim) # <<<<<<<<<<<<<<
*
* def is_f_contig(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig(__pyx_v_mslice, 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":587
* return slice_is_contig(mslice, 'C', self.view.ndim)
*
* def is_f_contig(self): # <<<<<<<<<<<<<<
* cdef __Pyx_memviewslice *mslice, tmp
* mslice = get_slice_from_memview(self, &tmp)
*/
static PyObject *__pyx_memoryview_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
__Pyx_memviewslice *__pyx_v_mslice;
__Pyx_memviewslice __pyx_v_tmp;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("is_f_contig", 0);
/* "View.MemoryView":589
* def is_f_contig(self):
* cdef __Pyx_memviewslice *mslice, tmp
* mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
* return slice_is_contig(mslice, 'F', self.view.ndim)
*
*/
__pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
/* "View.MemoryView":590
* cdef __Pyx_memviewslice *mslice, tmp
* mslice = get_slice_from_memview(self, &tmp)
* return slice_is_contig(mslice, 'F', self.view.ndim) # <<<<<<<<<<<<<<
*
* def copy(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig(__pyx_v_mslice, 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("copy (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":592
* return slice_is_contig(mslice, 'F', self.view.ndim)
*
* def copy(self): # <<<<<<<<<<<<<<
* cdef __Pyx_memviewslice mslice
* cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
*/
static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
__Pyx_memviewslice __pyx_v_mslice;
int __pyx_v_flags;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_memviewslice __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("copy", 0);
/* "View.MemoryView":594
* def copy(self):
* cdef __Pyx_memviewslice mslice
* cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<<
*
* slice_copy(self, &mslice)
*/
__pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
/* "View.MemoryView":596
* cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
*
* slice_copy(self, &mslice) # <<<<<<<<<<<<<<
* mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
* self.view.itemsize,
*/
__pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
/* "View.MemoryView":600
* self.view.itemsize,
* flags|PyBUF_C_CONTIGUOUS,
* self.dtype_is_object) # <<<<<<<<<<<<<<
*
* return memoryview_copy_from_slice(self, &mslice)
*/
__pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), __pyx_k__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_filename = __pyx_f[2]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_mslice = __pyx_t_1;
/* "View.MemoryView":602
* self.dtype_is_object)
*
* return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<<
*
* 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_filename = __pyx_f[2]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":604
* return memoryview_copy_from_slice(self, &mslice)
*
* def copy_fortran(self): # <<<<<<<<<<<<<<
* cdef __Pyx_memviewslice src, dst
* cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
*/
static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
__Pyx_memviewslice __pyx_v_src;
__Pyx_memviewslice __pyx_v_dst;
int __pyx_v_flags;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_memviewslice __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("copy_fortran", 0);
/* "View.MemoryView":606
* def copy_fortran(self):
* cdef __Pyx_memviewslice src, dst
* cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<<
*
* slice_copy(self, &src)
*/
__pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
/* "View.MemoryView":608
* cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
*
* slice_copy(self, &src) # <<<<<<<<<<<<<<
* dst = slice_copy_contig(&src, "fortran", self.view.ndim,
* self.view.itemsize,
*/
__pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
/* "View.MemoryView":612
* self.view.itemsize,
* flags|PyBUF_F_CONTIGUOUS,
* self.dtype_is_object) # <<<<<<<<<<<<<<
*
* return memoryview_copy_from_slice(self, &dst)
*/
__pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), __pyx_k__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_filename = __pyx_f[2]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_dst = __pyx_t_1;
/* "View.MemoryView":614
* self.dtype_is_object)
*
* return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<<
*
*
*/
__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_filename = __pyx_f[2]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":618
*
* @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
*/
static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
struct __pyx_memoryview_obj *__pyx_v_result = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
/* "View.MemoryView":619
* @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 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_o);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
__Pyx_GIVEREF(__pyx_v_o);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_1 = 0;
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
__pyx_t_2 = 0;
/* "View.MemoryView":620
* 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_v_result->typeinfo = __pyx_v_typeinfo;
/* "View.MemoryView":621
* cdef memoryview result = memoryview(o, flags, dtype_is_object)
* result.typeinfo = typeinfo
* return result # <<<<<<<<<<<<<<
*
* @cname('__pyx_memoryview_check')
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_result));
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_result);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":624
*
* @cname('__pyx_memoryview_check')
* cdef bint memoryview_check(object o): # <<<<<<<<<<<<<<
* return isinstance(o, memoryview)
*
*/
static int __pyx_memoryview_check(PyObject *__pyx_v_o) {
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
__Pyx_RefNannySetupContext("memoryview_check", 0);
/* "View.MemoryView":625
* @cname('__pyx_memoryview_check')
* cdef bint memoryview_check(object o):
* return isinstance(o, memoryview) # <<<<<<<<<<<<<<
*
* cdef tuple _unellipsify(object index, int ndim):
*/
__pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_o, __pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
goto __pyx_L0;
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":627
* return isinstance(o, memoryview)
*
* cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
* """
* Replace all ellipses with full slices and fill incomplete indices with
*/
static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
PyObject *__pyx_v_tup = NULL;
PyObject *__pyx_v_result = NULL;
PyObject *__pyx_v_have_slices = NULL;
int __pyx_v_seen_ellipsis;
CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
PyObject *__pyx_v_item = NULL;
PyObject *__pyx_v_nslices = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
Py_ssize_t __pyx_t_5;
PyObject *(*__pyx_t_6)(PyObject *);
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
Py_ssize_t __pyx_t_9;
PyObject *__pyx_t_10 = NULL;
int __pyx_t_11;
int __pyx_t_12;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_unellipsify", 0);
/* "View.MemoryView":632
* full slices.
* """
* if not isinstance(index, tuple): # <<<<<<<<<<<<<<
* tup = (index,)
* else:
*/
__pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_3 = (!__pyx_t_2);
if (__pyx_t_3) {
/* "View.MemoryView":633
* """
* if not isinstance(index, tuple):
* tup = (index,) # <<<<<<<<<<<<<<
* else:
* tup = index
*/
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_index);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_index);
__Pyx_GIVEREF(__pyx_v_index);
__pyx_v_tup = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":635
* tup = (index,)
* else:
* tup = index # <<<<<<<<<<<<<<
*
* result = []
*/
__Pyx_INCREF(__pyx_v_index);
__pyx_v_tup = __pyx_v_index;
}
__pyx_L3:;
/* "View.MemoryView":637
* tup = index
*
* result = [] # <<<<<<<<<<<<<<
* have_slices = False
* seen_ellipsis = False
*/
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_result = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":638
*
* result = []
* have_slices = False # <<<<<<<<<<<<<<
* seen_ellipsis = False
* for idx, item in enumerate(tup):
*/
__pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_have_slices = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":639
* result = []
* have_slices = False
* seen_ellipsis = False # <<<<<<<<<<<<<<
* for idx, item in enumerate(tup):
* if item is Ellipsis:
*/
__pyx_v_seen_ellipsis = 0;
/* "View.MemoryView":640
* have_slices = False
* seen_ellipsis = False
* for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
* if item is Ellipsis:
* if not seen_ellipsis:
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_t_1 = __pyx_int_0;
if (PyList_CheckExact(__pyx_v_tup) || PyTuple_CheckExact(__pyx_v_tup)) {
__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_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
}
for (;;) {
if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__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_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__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_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_7 = __pyx_t_6(__pyx_t_4);
if (unlikely(!__pyx_t_7)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_7);
}
__Pyx_XDECREF(__pyx_v_item);
__pyx_v_item = __pyx_t_7;
__pyx_t_7 = 0;
__Pyx_INCREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_v_idx);
__pyx_v_idx = __pyx_t_1;
__pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_1);
__pyx_t_1 = __pyx_t_7;
__pyx_t_7 = 0;
/* "View.MemoryView":641
* seen_ellipsis = False
* for idx, item in enumerate(tup):
* if item is Ellipsis: # <<<<<<<<<<<<<<
* if not seen_ellipsis:
* result.extend([slice(None)] * (ndim - len(tup) + 1))
*/
__pyx_t_3 = (__pyx_v_item == __pyx_builtin_Ellipsis);
if (__pyx_t_3) {
/* "View.MemoryView":642
* for idx, item in enumerate(tup):
* if item is Ellipsis:
* if not seen_ellipsis: # <<<<<<<<<<<<<<
* result.extend([slice(None)] * (ndim - len(tup) + 1))
* seen_ellipsis = True
*/
__pyx_t_3 = (!__pyx_v_seen_ellipsis);
if (__pyx_t_3) {
/* "View.MemoryView":643
* if item is Ellipsis:
* if not seen_ellipsis:
* result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
* seen_ellipsis = True
* else:
*/
__pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_9 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_10 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_9) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_9) + 1))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
{ Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_9) + 1); __pyx_temp++) {
__Pyx_INCREF(__pyx_t_8);
PyList_SET_ITEM(__pyx_t_10, __pyx_temp, __pyx_t_8);
__Pyx_GIVEREF(__pyx_t_8);
}
}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_10));
__Pyx_GIVEREF(((PyObject *)__pyx_t_10));
__pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
/* "View.MemoryView":644
* if not seen_ellipsis:
* result.extend([slice(None)] * (ndim - len(tup) + 1))
* seen_ellipsis = True # <<<<<<<<<<<<<<
* else:
* result.append(slice(None))
*/
__pyx_v_seen_ellipsis = 1;
goto __pyx_L7;
}
/*else*/ {
/* "View.MemoryView":646
* seen_ellipsis = True
* else:
* result.append(slice(None)) # <<<<<<<<<<<<<<
* have_slices = True
* else:
*/
__pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
}
__pyx_L7:;
/* "View.MemoryView":647
* else:
* result.append(slice(None))
* have_slices = True # <<<<<<<<<<<<<<
* else:
* if not isinstance(item, slice) and not PyIndex_Check(item):
*/
__pyx_t_10 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_v_have_slices);
__pyx_v_have_slices = __pyx_t_10;
__pyx_t_10 = 0;
goto __pyx_L6;
}
/*else*/ {
/* "View.MemoryView":649
* have_slices = True
* else:
* if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
* raise TypeError("Cannot index with type '%s'" % type(item))
*
*/
__pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
__Pyx_INCREF(__pyx_t_10);
__pyx_t_3 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_2 = (!__pyx_t_3);
if (__pyx_t_2) {
__pyx_t_3 = (!PyIndex_Check(__pyx_v_item));
__pyx_t_12 = __pyx_t_3;
} else {
__pyx_t_12 = __pyx_t_2;
}
if (__pyx_t_12) {
/* "View.MemoryView":650
* 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_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_37), ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_10));
__pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_10));
__Pyx_GIVEREF(((PyObject *)__pyx_t_10));
__pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
__Pyx_Raise(__pyx_t_10, 0, 0, 0);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
/* "View.MemoryView":652
* raise TypeError("Cannot index with type '%s'" % type(item))
*
* have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<<
* result.append(item)
*
*/
__pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!__pyx_t_12) {
__pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
__Pyx_INCREF(__pyx_t_10);
__pyx_t_12 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_8 = __pyx_t_10;
__pyx_t_10 = 0;
} else {
__Pyx_INCREF(__pyx_v_have_slices);
__pyx_t_8 = __pyx_v_have_slices;
}
__Pyx_DECREF(__pyx_v_have_slices);
__pyx_v_have_slices = __pyx_t_8;
__pyx_t_8 = 0;
/* "View.MemoryView":653
*
* have_slices = have_slices or isinstance(item, slice)
* result.append(item) # <<<<<<<<<<<<<<
*
* nslices = ndim - len(result)
*/
__pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L6:;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "View.MemoryView":655
* result.append(item)
*
* nslices = ndim - len(result) # <<<<<<<<<<<<<<
* if nslices:
* result.extend([slice(None)] * nslices)
*/
__pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_nslices = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":656
*
* nslices = ndim - len(result)
* if nslices: # <<<<<<<<<<<<<<
* result.extend([slice(None)] * nslices)
*
*/
__pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_nslices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_12) {
/* "View.MemoryView":657
* nslices = ndim - len(result)
* if nslices:
* result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<<
*
* return have_slices or nslices, tuple(result)
*/
__pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
{ PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_8, __pyx_v_nslices); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_temp);
__Pyx_DECREF(__pyx_t_8);
__pyx_t_8 = __pyx_temp;
}
__pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
__Pyx_GIVEREF(((PyObject *)__pyx_t_8));
__pyx_t_8 = 0;
__pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L9;
}
__pyx_L9:;
/* "View.MemoryView":659
* result.extend([slice(None)] * nslices)
*
* return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<<
*
* cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
*/
__Pyx_XDECREF(((PyObject *)__pyx_r));
__pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!__pyx_t_12) {
__Pyx_INCREF(__pyx_v_nslices);
__pyx_t_8 = __pyx_v_nslices;
} else {
__Pyx_INCREF(__pyx_v_have_slices);
__pyx_t_8 = __pyx_v_have_slices;
}
__pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
__Pyx_GIVEREF(__pyx_t_8);
PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_4));
__Pyx_GIVEREF(((PyObject *)__pyx_t_4));
__pyx_t_8 = 0;
__pyx_t_4 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_tup);
__Pyx_XDECREF(__pyx_v_result);
__Pyx_XDECREF(__pyx_v_have_slices);
__Pyx_XDECREF(__pyx_v_idx);
__Pyx_XDECREF(__pyx_v_item);
__Pyx_XDECREF(__pyx_v_nslices);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":661
* return have_slices or nslices, tuple(result)
*
* cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
* cdef int i
* for i in range(ndim):
*/
static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
int __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
/* "View.MemoryView":663
* cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
* cdef int i
* for i in range(ndim): # <<<<<<<<<<<<<<
* if suboffsets[i] >= 0:
* raise ValueError("Indirect dimensions not supported")
*/
__pyx_t_1 = __pyx_v_ndim;
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
/* "View.MemoryView":664
* cdef int i
* for i in range(ndim):
* if suboffsets[i] >= 0: # <<<<<<<<<<<<<<
* raise ValueError("Indirect dimensions not supported")
*
*/
__pyx_t_3 = ((__pyx_v_suboffsets[__pyx_v_i]) >= 0);
if (__pyx_t_3) {
/* "View.MemoryView":665
* for i in range(ndim):
* if suboffsets[i] >= 0:
* raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L5;
}
__pyx_L5:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":672
*
* @cname('__pyx_memview_slice')
* cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
* cdef int new_ndim = 0, suboffset_dim = -1, dim
* cdef bint negative_step
*/
static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
int __pyx_v_new_ndim;
int __pyx_v_suboffset_dim;
int __pyx_v_dim;
__Pyx_memviewslice __pyx_v_src;
__Pyx_memviewslice __pyx_v_dst;
__Pyx_memviewslice *__pyx_v_p_src;
struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
__Pyx_memviewslice *__pyx_v_p_dst;
int *__pyx_v_p_suboffset_dim;
Py_ssize_t __pyx_v_start;
Py_ssize_t __pyx_v_stop;
Py_ssize_t __pyx_v_step;
int __pyx_v_have_start;
int __pyx_v_have_stop;
int __pyx_v_have_step;
PyObject *__pyx_v_index = NULL;
struct __pyx_memoryview_obj *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_t_3;
Py_ssize_t __pyx_t_4;
PyObject *(*__pyx_t_5)(PyObject *);
PyObject *__pyx_t_6 = NULL;
int __pyx_t_7;
Py_ssize_t __pyx_t_8;
PyObject *__pyx_t_9 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("memview_slice", 0);
/* "View.MemoryView":673
* @cname('__pyx_memview_slice')
* cdef memoryview memview_slice(memoryview memview, object indices):
* cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<<
* cdef bint negative_step
* cdef __Pyx_memviewslice src, dst
*/
__pyx_v_new_ndim = 0;
__pyx_v_suboffset_dim = -1;
/* "View.MemoryView":680
*
*
* memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<<
*
* cdef _memoryviewslice memviewsliceobj
*/
memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)));
/* "View.MemoryView":684
* cdef _memoryviewslice memviewsliceobj
*
* assert memview.view.ndim > 0 # <<<<<<<<<<<<<<
*
* if isinstance(memview, _memoryviewslice):
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
if (unlikely(!(__pyx_v_memview->view.ndim > 0))) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "View.MemoryView":686
* assert memview.view.ndim > 0
*
* if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
* memviewsliceobj = memview
* p_src = &memviewsliceobj.from_slice
*/
__pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "View.MemoryView":687
*
* 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_filename = __pyx_f[2]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_INCREF(((PyObject *)__pyx_v_memview));
__pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview);
/* "View.MemoryView":688
* if isinstance(memview, _memoryviewslice):
* memviewsliceobj = memview
* p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<<
* else:
* slice_copy(memview, &src)
*/
__pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":690
* p_src = &memviewsliceobj.from_slice
* else:
* slice_copy(memview, &src) # <<<<<<<<<<<<<<
* p_src = &src
*
*/
__pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
/* "View.MemoryView":691
* else:
* slice_copy(memview, &src)
* p_src = &src # <<<<<<<<<<<<<<
*
*
*/
__pyx_v_p_src = (&__pyx_v_src);
}
__pyx_L3:;
/* "View.MemoryView":697
*
*
* dst.memview = p_src.memview # <<<<<<<<<<<<<<
* dst.data = p_src.data
*
*/
__pyx_v_dst.memview = __pyx_v_p_src->memview;
/* "View.MemoryView":698
*
* dst.memview = p_src.memview
* dst.data = p_src.data # <<<<<<<<<<<<<<
*
*
*/
__pyx_v_dst.data = __pyx_v_p_src->data;
/* "View.MemoryView":703
*
*
* cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<<
* cdef int *p_suboffset_dim = &suboffset_dim
* cdef Py_ssize_t start, stop, step
*/
__pyx_v_p_dst = (&__pyx_v_dst);
/* "View.MemoryView":704
*
* cdef __Pyx_memviewslice *p_dst = &dst
* cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<<
* cdef Py_ssize_t start, stop, step
* cdef bint have_start, have_stop, have_step
*/
__pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
/* "View.MemoryView":708
* cdef bint have_start, have_stop, have_step
*
* for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
* if PyIndex_Check(index):
* slice_memviewslice(
*/
__pyx_t_3 = 0;
if (PyList_CheckExact(__pyx_v_indices) || PyTuple_CheckExact(__pyx_v_indices)) {
__pyx_t_1 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
} else {
__pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
for (;;) {
if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_6 = __pyx_t_5(__pyx_t_1);
if (unlikely(!__pyx_t_6)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_6);
}
__Pyx_XDECREF(__pyx_v_index);
__pyx_v_index = __pyx_t_6;
__pyx_t_6 = 0;
__pyx_v_dim = __pyx_t_3;
__pyx_t_3 = (__pyx_t_3 + 1);
/* "View.MemoryView":709
*
* 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],
*/
__pyx_t_7 = PyIndex_Check(__pyx_v_index);
if (__pyx_t_7) {
/* "View.MemoryView":713
* 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_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "View.MemoryView":715
* index, 0, 0, # start, stop, step
* 0, 0, 0, # have_{start,stop,step}
* False) # <<<<<<<<<<<<<<
* elif index is None:
* p_dst.shape[new_ndim] = 1
*/
__pyx_t_7 = __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_8, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
/* "View.MemoryView":716
* 0, 0, 0, # have_{start,stop,step}
* False)
* elif index is None: # <<<<<<<<<<<<<<
* p_dst.shape[new_ndim] = 1
* p_dst.strides[new_ndim] = 0
*/
__pyx_t_2 = (__pyx_v_index == Py_None);
if (__pyx_t_2) {
/* "View.MemoryView":717
* False)
* elif index is None:
* p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<<
* p_dst.strides[new_ndim] = 0
* p_dst.suboffsets[new_ndim] = -1
*/
(__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
/* "View.MemoryView":718
* elif index is None:
* p_dst.shape[new_ndim] = 1
* p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<<
* p_dst.suboffsets[new_ndim] = -1
* new_ndim += 1
*/
(__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
/* "View.MemoryView":719
* p_dst.shape[new_ndim] = 1
* p_dst.strides[new_ndim] = 0
* p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<<
* new_ndim += 1
* else:
*/
(__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1;
/* "View.MemoryView":720
* p_dst.strides[new_ndim] = 0
* p_dst.suboffsets[new_ndim] = -1
* new_ndim += 1 # <<<<<<<<<<<<<<
* else:
* start = index.start or 0
*/
__pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
goto __pyx_L6;
}
/*else*/ {
/* "View.MemoryView":722
* new_ndim += 1
* else:
* start = index.start or 0 # <<<<<<<<<<<<<<
* stop = index.stop or 0
* step = index.step or 0
*/
__pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!__pyx_t_2) {
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_INCREF(__pyx_int_0);
__pyx_t_9 = __pyx_int_0;
} else {
__pyx_t_9 = __pyx_t_6;
__pyx_t_6 = 0;
}
__pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_v_start = __pyx_t_8;
/* "View.MemoryView":723
* else:
* start = index.start or 0
* stop = index.stop or 0 # <<<<<<<<<<<<<<
* step = index.step or 0
*
*/
__pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!__pyx_t_2) {
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_INCREF(__pyx_int_0);
__pyx_t_6 = __pyx_int_0;
} else {
__pyx_t_6 = __pyx_t_9;
__pyx_t_9 = 0;
}
__pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_v_stop = __pyx_t_8;
/* "View.MemoryView":724
* start = index.start or 0
* stop = index.stop or 0
* step = index.step or 0 # <<<<<<<<<<<<<<
*
* have_start = index.start is not None
*/
__pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!__pyx_t_2) {
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_INCREF(__pyx_int_0);
__pyx_t_9 = __pyx_int_0;
} else {
__pyx_t_9 = __pyx_t_6;
__pyx_t_6 = 0;
}
__pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_v_step = __pyx_t_8;
/* "View.MemoryView":726
* 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 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_2 = (__pyx_t_9 != Py_None);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_v_have_start = __pyx_t_2;
/* "View.MemoryView":727
*
* have_start = index.start is not None
* have_stop = index.stop is not None # <<<<<<<<<<<<<<
* have_step = index.step is not None
*
*/
__pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_2 = (__pyx_t_9 != Py_None);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_v_have_stop = __pyx_t_2;
/* "View.MemoryView":728
* 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 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_2 = (__pyx_t_9 != Py_None);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_v_have_step = __pyx_t_2;
/* "View.MemoryView":735
* start, stop, step,
* have_start, have_stop, have_step,
* True) # <<<<<<<<<<<<<<
* new_ndim += 1
*
*/
__pyx_t_7 = __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_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "View.MemoryView":736
* have_start, have_stop, have_step,
* True)
* new_ndim += 1 # <<<<<<<<<<<<<<
*
* if isinstance(memview, _memoryviewslice):
*/
__pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
}
__pyx_L6:;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "View.MemoryView":738
* new_ndim += 1
*
* if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
* return memoryview_fromslice(dst, new_ndim,
* memviewsliceobj.to_object_func,
*/
__pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "View.MemoryView":739
*
* if isinstance(memview, _memoryviewslice):
* return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
* memviewsliceobj.to_object_func,
* memviewsliceobj.to_dtype_func,
*/
__Pyx_XDECREF(((PyObject *)__pyx_r));
/* "View.MemoryView":740
* 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_filename = __pyx_f[2]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
/* "View.MemoryView":742
* memviewsliceobj.to_object_func,
* memviewsliceobj.to_dtype_func,
* memview.dtype_is_object) # <<<<<<<<<<<<<<
* else:
* return memoryview_fromslice(dst, new_ndim, NULL, NULL,
*/
__pyx_t_1 = __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_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
goto __pyx_L7;
}
/*else*/ {
/* "View.MemoryView":744
* memview.dtype_is_object)
* else:
* return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
* memview.dtype_is_object)
*
*/
__Pyx_XDECREF(((PyObject *)__pyx_r));
/* "View.MemoryView":745
* else:
* return memoryview_fromslice(dst, new_ndim, NULL, NULL,
* memview.dtype_is_object) # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
}
__pyx_L7:;
__pyx_r = ((struct __pyx_memoryview_obj *)Py_None); __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
__Pyx_XDECREF(__pyx_v_index);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":769
*
* @cname('__pyx_memoryview_slice_memviewslice')
* cdef int slice_memviewslice( # <<<<<<<<<<<<<<
* __Pyx_memviewslice *dst,
* Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
*/
static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
Py_ssize_t __pyx_v_new_shape;
int __pyx_v_negative_step;
int __pyx_r;
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
int __pyx_t_4;
Py_ssize_t __pyx_t_5;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* "View.MemoryView":789
* cdef bint negative_step
*
* if not is_slice: # <<<<<<<<<<<<<<
*
* if start < 0:
*/
__pyx_t_1 = (!__pyx_v_is_slice);
if (__pyx_t_1) {
/* "View.MemoryView":791
* if not is_slice:
*
* if start < 0: # <<<<<<<<<<<<<<
* start += shape
* if not 0 <= start < shape:
*/
__pyx_t_1 = (__pyx_v_start < 0);
if (__pyx_t_1) {
/* "View.MemoryView":792
*
* if start < 0:
* start += shape # <<<<<<<<<<<<<<
* if not 0 <= start < shape:
* _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
*/
__pyx_v_start = (__pyx_v_start + __pyx_v_shape);
goto __pyx_L4;
}
__pyx_L4:;
/* "View.MemoryView":793
* if start < 0:
* start += shape
* if not 0 <= start < shape: # <<<<<<<<<<<<<<
* _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
* else:
*/
__pyx_t_1 = (0 <= __pyx_v_start);
if (__pyx_t_1) {
__pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
}
__pyx_t_2 = (!__pyx_t_1);
if (__pyx_t_2) {
/* "View.MemoryView":794
* 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, __pyx_k_41, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L5;
}
__pyx_L5:;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":797
* else:
*
* negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<<
*
* if have_step and step == 0:
*/
__pyx_t_2 = (__pyx_v_have_step != 0);
if (__pyx_t_2) {
__pyx_t_1 = (__pyx_v_step < 0);
__pyx_t_4 = __pyx_t_1;
} else {
__pyx_t_4 = __pyx_t_2;
}
__pyx_v_negative_step = __pyx_t_4;
/* "View.MemoryView":799
* negative_step = have_step != 0 and step < 0
*
* if have_step and step == 0: # <<<<<<<<<<<<<<
* _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
*
*/
if (__pyx_v_have_step) {
__pyx_t_4 = (__pyx_v_step == 0);
__pyx_t_2 = __pyx_t_4;
} else {
__pyx_t_2 = __pyx_v_have_step;
}
if (__pyx_t_2) {
/* "View.MemoryView":800
*
* 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, __pyx_k_42, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
__pyx_L6:;
/* "View.MemoryView":803
*
*
* if have_start: # <<<<<<<<<<<<<<
* if start < 0:
* start += shape
*/
if (__pyx_v_have_start) {
/* "View.MemoryView":804
*
* if have_start:
* if start < 0: # <<<<<<<<<<<<<<
* start += shape
* if start < 0:
*/
__pyx_t_2 = (__pyx_v_start < 0);
if (__pyx_t_2) {
/* "View.MemoryView":805
* if have_start:
* if start < 0:
* start += shape # <<<<<<<<<<<<<<
* if start < 0:
* start = 0
*/
__pyx_v_start = (__pyx_v_start + __pyx_v_shape);
/* "View.MemoryView":806
* if start < 0:
* start += shape
* if start < 0: # <<<<<<<<<<<<<<
* start = 0
* elif start >= shape:
*/
__pyx_t_2 = (__pyx_v_start < 0);
if (__pyx_t_2) {
/* "View.MemoryView":807
* start += shape
* if start < 0:
* start = 0 # <<<<<<<<<<<<<<
* elif start >= shape:
* if negative_step:
*/
__pyx_v_start = 0;
goto __pyx_L9;
}
__pyx_L9:;
goto __pyx_L8;
}
/* "View.MemoryView":808
* if start < 0:
* start = 0
* elif start >= shape: # <<<<<<<<<<<<<<
* if negative_step:
* start = shape - 1
*/
__pyx_t_2 = (__pyx_v_start >= __pyx_v_shape);
if (__pyx_t_2) {
/* "View.MemoryView":809
* start = 0
* elif start >= shape:
* if negative_step: # <<<<<<<<<<<<<<
* start = shape - 1
* else:
*/
if (__pyx_v_negative_step) {
/* "View.MemoryView":810
* elif start >= shape:
* if negative_step:
* start = shape - 1 # <<<<<<<<<<<<<<
* else:
* start = shape
*/
__pyx_v_start = (__pyx_v_shape - 1);
goto __pyx_L10;
}
/*else*/ {
/* "View.MemoryView":812
* start = shape - 1
* else:
* start = shape # <<<<<<<<<<<<<<
* else:
* if negative_step:
*/
__pyx_v_start = __pyx_v_shape;
}
__pyx_L10:;
goto __pyx_L8;
}
__pyx_L8:;
goto __pyx_L7;
}
/*else*/ {
/* "View.MemoryView":814
* start = shape
* else:
* if negative_step: # <<<<<<<<<<<<<<
* start = shape - 1
* else:
*/
if (__pyx_v_negative_step) {
/* "View.MemoryView":815
* else:
* if negative_step:
* start = shape - 1 # <<<<<<<<<<<<<<
* else:
* start = 0
*/
__pyx_v_start = (__pyx_v_shape - 1);
goto __pyx_L11;
}
/*else*/ {
/* "View.MemoryView":817
* start = shape - 1
* else:
* start = 0 # <<<<<<<<<<<<<<
*
* if have_stop:
*/
__pyx_v_start = 0;
}
__pyx_L11:;
}
__pyx_L7:;
/* "View.MemoryView":819
* start = 0
*
* if have_stop: # <<<<<<<<<<<<<<
* if stop < 0:
* stop += shape
*/
if (__pyx_v_have_stop) {
/* "View.MemoryView":820
*
* if have_stop:
* if stop < 0: # <<<<<<<<<<<<<<
* stop += shape
* if stop < 0:
*/
__pyx_t_2 = (__pyx_v_stop < 0);
if (__pyx_t_2) {
/* "View.MemoryView":821
* if have_stop:
* if stop < 0:
* stop += shape # <<<<<<<<<<<<<<
* if stop < 0:
* stop = 0
*/
__pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
/* "View.MemoryView":822
* if stop < 0:
* stop += shape
* if stop < 0: # <<<<<<<<<<<<<<
* stop = 0
* elif stop > shape:
*/
__pyx_t_2 = (__pyx_v_stop < 0);
if (__pyx_t_2) {
/* "View.MemoryView":823
* stop += shape
* if stop < 0:
* stop = 0 # <<<<<<<<<<<<<<
* elif stop > shape:
* stop = shape
*/
__pyx_v_stop = 0;
goto __pyx_L14;
}
__pyx_L14:;
goto __pyx_L13;
}
/* "View.MemoryView":824
* if stop < 0:
* stop = 0
* elif stop > shape: # <<<<<<<<<<<<<<
* stop = shape
* else:
*/
__pyx_t_2 = (__pyx_v_stop > __pyx_v_shape);
if (__pyx_t_2) {
/* "View.MemoryView":825
* stop = 0
* elif stop > shape:
* stop = shape # <<<<<<<<<<<<<<
* else:
* if negative_step:
*/
__pyx_v_stop = __pyx_v_shape;
goto __pyx_L13;
}
__pyx_L13:;
goto __pyx_L12;
}
/*else*/ {
/* "View.MemoryView":827
* stop = shape
* else:
* if negative_step: # <<<<<<<<<<<<<<
* stop = -1
* else:
*/
if (__pyx_v_negative_step) {
/* "View.MemoryView":828
* else:
* if negative_step:
* stop = -1 # <<<<<<<<<<<<<<
* else:
* stop = shape
*/
__pyx_v_stop = -1;
goto __pyx_L15;
}
/*else*/ {
/* "View.MemoryView":830
* stop = -1
* else:
* stop = shape # <<<<<<<<<<<<<<
*
* if not have_step:
*/
__pyx_v_stop = __pyx_v_shape;
}
__pyx_L15:;
}
__pyx_L12:;
/* "View.MemoryView":832
* stop = shape
*
* if not have_step: # <<<<<<<<<<<<<<
* step = 1
*
*/
__pyx_t_2 = (!__pyx_v_have_step);
if (__pyx_t_2) {
/* "View.MemoryView":833
*
* if not have_step:
* step = 1 # <<<<<<<<<<<<<<
*
*
*/
__pyx_v_step = 1;
goto __pyx_L16;
}
__pyx_L16:;
/* "View.MemoryView":837
*
* with cython.cdivision(True):
* new_shape = (stop - start) // step # <<<<<<<<<<<<<<
*
* if (stop - start) % step:
*/
__pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
/* "View.MemoryView":839
* new_shape = (stop - start) // step
*
* if (stop - start) % step: # <<<<<<<<<<<<<<
* new_shape += 1
*
*/
__pyx_t_5 = ((__pyx_v_stop - __pyx_v_start) % __pyx_v_step);
if (__pyx_t_5) {
/* "View.MemoryView":840
*
* if (stop - start) % step:
* new_shape += 1 # <<<<<<<<<<<<<<
*
* if new_shape < 0:
*/
__pyx_v_new_shape = (__pyx_v_new_shape + 1);
goto __pyx_L17;
}
__pyx_L17:;
/* "View.MemoryView":842
* new_shape += 1
*
* if new_shape < 0: # <<<<<<<<<<<<<<
* new_shape = 0
*
*/
__pyx_t_2 = (__pyx_v_new_shape < 0);
if (__pyx_t_2) {
/* "View.MemoryView":843
*
* if new_shape < 0:
* new_shape = 0 # <<<<<<<<<<<<<<
*
*
*/
__pyx_v_new_shape = 0;
goto __pyx_L18;
}
__pyx_L18:;
/* "View.MemoryView":846
*
*
* dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<<
* dst.shape[new_ndim] = new_shape
* dst.suboffsets[new_ndim] = suboffset
*/
(__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
/* "View.MemoryView":847
*
* dst.strides[new_ndim] = stride * step
* dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<<
* dst.suboffsets[new_ndim] = suboffset
*
*/
(__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
/* "View.MemoryView":848
* dst.strides[new_ndim] = stride * step
* dst.shape[new_ndim] = new_shape
* dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<<
*
*
*/
(__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
}
__pyx_L3:;
/* "View.MemoryView":851
*
*
* if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
* dst.data += start * stride
* else:
*/
__pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0);
if (__pyx_t_2) {
/* "View.MemoryView":852
*
* if suboffset_dim[0] < 0:
* dst.data += start * stride # <<<<<<<<<<<<<<
* else:
* dst.suboffsets[suboffset_dim[0]] += start * stride
*/
__pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
goto __pyx_L19;
}
/*else*/ {
/* "View.MemoryView":854
* dst.data += start * stride
* else:
* dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<<
*
* if suboffset >= 0:
*/
__pyx_t_3 = (__pyx_v_suboffset_dim[0]);
(__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
}
__pyx_L19:;
/* "View.MemoryView":856
* dst.suboffsets[suboffset_dim[0]] += start * stride
*
* if suboffset >= 0: # <<<<<<<<<<<<<<
* if not is_slice:
* if new_ndim == 0:
*/
__pyx_t_2 = (__pyx_v_suboffset >= 0);
if (__pyx_t_2) {
/* "View.MemoryView":857
*
* if suboffset >= 0:
* if not is_slice: # <<<<<<<<<<<<<<
* if new_ndim == 0:
* dst.data = ( dst.data)[0] + suboffset
*/
__pyx_t_2 = (!__pyx_v_is_slice);
if (__pyx_t_2) {
/* "View.MemoryView":858
* if suboffset >= 0:
* if not is_slice:
* if new_ndim == 0: # <<<<<<<<<<<<<<
* dst.data = ( dst.data)[0] + suboffset
* else:
*/
__pyx_t_2 = (__pyx_v_new_ndim == 0);
if (__pyx_t_2) {
/* "View.MemoryView":859
* if not is_slice:
* if new_ndim == 0:
* dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<<
* else:
* _err_dim(IndexError, "All dimensions preceding dimension %d "
*/
__pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
goto __pyx_L22;
}
/*else*/ {
/* "View.MemoryView":862
* 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, __pyx_k_43, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L22:;
goto __pyx_L21;
}
/*else*/ {
/* "View.MemoryView":864
* "must be indexed and not sliced", dim)
* else:
* suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<<
*
* return 0
*/
(__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
}
__pyx_L21:;
goto __pyx_L20;
}
__pyx_L20:;
/* "View.MemoryView":866
* suboffset_dim[0] = new_ndim
*
* return 0 # <<<<<<<<<<<<<<
*
*
*/
__pyx_r = 0;
goto __pyx_L0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
{
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
__Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
}
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* "View.MemoryView":872
*
* @cname('__pyx_pybuffer_index')
* cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
* int dim) except NULL:
* cdef Py_ssize_t shape, stride, suboffset = -1
*/
static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, int __pyx_v_dim) {
Py_ssize_t __pyx_v_shape;
Py_ssize_t __pyx_v_stride;
Py_ssize_t __pyx_v_suboffset;
Py_ssize_t __pyx_v_itemsize;
char *__pyx_v_resultp;
char *__pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("pybuffer_index", 0);
/* "View.MemoryView":874
* cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
* int dim) except NULL:
* cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<<
* cdef Py_ssize_t itemsize = view.itemsize
* cdef char *resultp
*/
__pyx_v_suboffset = -1;
/* "View.MemoryView":875
* int dim) except NULL:
* cdef Py_ssize_t shape, stride, suboffset = -1
* cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<<
* cdef char *resultp
*
*/
__pyx_v_itemsize = __pyx_v_view->itemsize;
/* "View.MemoryView":878
* cdef char *resultp
*
* if view.ndim == 0: # <<<<<<<<<<<<<<
* shape = view.len / itemsize
* stride = itemsize
*/
__pyx_t_1 = (__pyx_v_view->ndim == 0);
if (__pyx_t_1) {
/* "View.MemoryView":879
*
* if view.ndim == 0:
* shape = view.len / itemsize # <<<<<<<<<<<<<<
* stride = itemsize
* else:
*/
if (unlikely(__pyx_v_itemsize == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
PyErr_Format(PyExc_OverflowError, "value too large to perform division");
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
/* "View.MemoryView":880
* if view.ndim == 0:
* shape = view.len / itemsize
* stride = itemsize # <<<<<<<<<<<<<<
* else:
* shape = view.shape[dim]
*/
__pyx_v_stride = __pyx_v_itemsize;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":882
* stride = itemsize
* else:
* shape = view.shape[dim] # <<<<<<<<<<<<<<
* stride = view.strides[dim]
* if view.suboffsets != NULL:
*/
__pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
/* "View.MemoryView":883
* else:
* shape = view.shape[dim]
* stride = view.strides[dim] # <<<<<<<<<<<<<<
* if view.suboffsets != NULL:
* suboffset = view.suboffsets[dim]
*/
__pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
/* "View.MemoryView":884
* shape = view.shape[dim]
* stride = view.strides[dim]
* if view.suboffsets != NULL: # <<<<<<<<<<<<<<
* suboffset = view.suboffsets[dim]
*
*/
__pyx_t_1 = (__pyx_v_view->suboffsets != NULL);
if (__pyx_t_1) {
/* "View.MemoryView":885
* stride = view.strides[dim]
* if view.suboffsets != NULL:
* suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<<
*
* if index < 0:
*/
__pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
goto __pyx_L4;
}
__pyx_L4:;
}
__pyx_L3:;
/* "View.MemoryView":887
* suboffset = view.suboffsets[dim]
*
* if index < 0: # <<<<<<<<<<<<<<
* index += view.shape[dim]
* if index < 0:
*/
__pyx_t_1 = (__pyx_v_index < 0);
if (__pyx_t_1) {
/* "View.MemoryView":888
*
* if index < 0:
* index += view.shape[dim] # <<<<<<<<<<<<<<
* if index < 0:
* raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
*/
__pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
/* "View.MemoryView":889
* if index < 0:
* index += view.shape[dim]
* if index < 0: # <<<<<<<<<<<<<<
* raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
*
*/
__pyx_t_1 = (__pyx_v_index < 0);
if (__pyx_t_1) {
/* "View.MemoryView":890
* index += view.shape[dim]
* if index < 0:
* raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
*
* if index >= shape:
*/
__pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
__pyx_L6:;
goto __pyx_L5;
}
__pyx_L5:;
/* "View.MemoryView":892
* raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
*
* if index >= shape: # <<<<<<<<<<<<<<
* raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
*
*/
__pyx_t_1 = (__pyx_v_index >= __pyx_v_shape);
if (__pyx_t_1) {
/* "View.MemoryView":893
*
* if index >= shape:
* raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
*
* resultp = bufp + index * stride
*/
__pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
/* "View.MemoryView":895
* raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
*
* resultp = bufp + index * stride # <<<<<<<<<<<<<<
* if suboffset >= 0:
* resultp = ( resultp)[0] + suboffset
*/
__pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
/* "View.MemoryView":896
*
* resultp = bufp + index * stride
* if suboffset >= 0: # <<<<<<<<<<<<<<
* resultp = ( resultp)[0] + suboffset
*
*/
__pyx_t_1 = (__pyx_v_suboffset >= 0);
if (__pyx_t_1) {
/* "View.MemoryView":897
* resultp = bufp + index * stride
* if suboffset >= 0:
* resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<<
*
* return resultp
*/
__pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
goto __pyx_L8;
}
__pyx_L8:;
/* "View.MemoryView":899
* resultp = ( resultp)[0] + suboffset
*
* return resultp # <<<<<<<<<<<<<<
*
*
*/
__pyx_r = __pyx_v_resultp;
goto __pyx_L0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":905
*
* @cname('__pyx_memslice_transpose')
* cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
* cdef int ndim = memslice.memview.view.ndim
*
*/
static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
int __pyx_v_ndim;
Py_ssize_t *__pyx_v_shape;
Py_ssize_t *__pyx_v_strides;
int __pyx_v_i;
int __pyx_v_j;
int __pyx_r;
long __pyx_t_1;
int __pyx_t_2;
Py_ssize_t __pyx_t_3;
Py_ssize_t __pyx_t_4;
int __pyx_t_5;
int __pyx_t_6;
int __pyx_t_7;
int __pyx_t_8;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* "View.MemoryView":906
* @cname('__pyx_memslice_transpose')
* cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
* cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<<
*
* cdef Py_ssize_t *shape = memslice.shape
*/
__pyx_v_ndim = __pyx_v_memslice->memview->view.ndim;
/* "View.MemoryView":908
* cdef int ndim = memslice.memview.view.ndim
*
* cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<<
* cdef Py_ssize_t *strides = memslice.strides
*
*/
__pyx_v_shape = __pyx_v_memslice->shape;
/* "View.MemoryView":909
*
* cdef Py_ssize_t *shape = memslice.shape
* cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<<
*
*
*/
__pyx_v_strides = __pyx_v_memslice->strides;
/* "View.MemoryView":913
*
* cdef int i, j
* for i in range(ndim / 2): # <<<<<<<<<<<<<<
* j = ndim - 1 - i
* strides[i], strides[j] = strides[j], strides[i]
*/
__pyx_t_1 = __Pyx_div_long(__pyx_v_ndim, 2);
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
/* "View.MemoryView":914
* cdef int i, j
* for i in range(ndim / 2):
* j = ndim - 1 - i # <<<<<<<<<<<<<<
* strides[i], strides[j] = strides[j], strides[i]
* shape[i], shape[j] = shape[j], shape[i]
*/
__pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
/* "View.MemoryView":915
* for i in range(ndim / 2):
* j = ndim - 1 - i
* strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<<
* shape[i], shape[j] = shape[j], shape[i]
*
*/
__pyx_t_3 = (__pyx_v_strides[__pyx_v_j]);
__pyx_t_4 = (__pyx_v_strides[__pyx_v_i]);
(__pyx_v_strides[__pyx_v_i]) = __pyx_t_3;
(__pyx_v_strides[__pyx_v_j]) = __pyx_t_4;
/* "View.MemoryView":916
* j = ndim - 1 - i
* strides[i], strides[j] = strides[j], strides[i]
* shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<<
*
* if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
*/
__pyx_t_4 = (__pyx_v_shape[__pyx_v_j]);
__pyx_t_3 = (__pyx_v_shape[__pyx_v_i]);
(__pyx_v_shape[__pyx_v_i]) = __pyx_t_4;
(__pyx_v_shape[__pyx_v_j]) = __pyx_t_3;
/* "View.MemoryView":918
* shape[i], shape[j] = shape[j], shape[i]
*
* if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
* _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
*
*/
__pyx_t_5 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
if (!__pyx_t_5) {
__pyx_t_6 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
__pyx_t_7 = __pyx_t_6;
} else {
__pyx_t_7 = __pyx_t_5;
}
if (__pyx_t_7) {
/* "View.MemoryView":919
*
* if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
* _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<<
*
* return 1
*/
__pyx_t_8 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_45); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L5;
}
__pyx_L5:;
}
/* "View.MemoryView":921
* _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
*
* return 1 # <<<<<<<<<<<<<<
*
*
*/
__pyx_r = 1;
goto __pyx_L0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
{
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
__Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
}
__pyx_r = 0;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
}
/* "View.MemoryView":938
* cdef int (*to_dtype_func)(char *, object) except 0
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
*
*/
static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
/* "View.MemoryView":939
*
* def __dealloc__(self):
* __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<<
*
* cdef convert_item_to_object(self, char *itemp):
*/
__PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
__Pyx_RefNannyFinishContext();
}
/* "View.MemoryView":941
* __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
*
* cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
* if self.to_object_func != NULL:
* return self.to_object_func(itemp)
*/
static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("convert_item_to_object", 0);
/* "View.MemoryView":942
*
* cdef convert_item_to_object(self, char *itemp):
* if self.to_object_func != NULL: # <<<<<<<<<<<<<<
* return self.to_object_func(itemp)
* else:
*/
__pyx_t_1 = (__pyx_v_self->to_object_func != NULL);
if (__pyx_t_1) {
/* "View.MemoryView":943
* cdef convert_item_to_object(self, char *itemp):
* if self.to_object_func != NULL:
* return self.to_object_func(itemp) # <<<<<<<<<<<<<<
* else:
* 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_filename = __pyx_f[2]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":945
* return self.to_object_func(itemp)
* else:
* return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<<
*
* cdef assign_item_from_object(self, char *itemp, object value):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_2 = __pyx_vtabptr_memoryview->convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
}
__pyx_L3:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":947
* return memoryview.convert_item_to_object(self, itemp)
*
* cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
* if self.to_dtype_func != NULL:
* self.to_dtype_func(itemp, value)
*/
static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("assign_item_from_object", 0);
/* "View.MemoryView":948
*
* cdef assign_item_from_object(self, char *itemp, object value):
* if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
* self.to_dtype_func(itemp, value)
* else:
*/
__pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL);
if (__pyx_t_1) {
/* "View.MemoryView":949
* 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 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":951
* self.to_dtype_func(itemp, value)
* else:
* memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<<
*
* property base:
*/
__pyx_t_3 = __pyx_vtabptr_memoryview->assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__pyx_L3:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":955
* property base:
* @cname('__pyx_memoryviewslice__get__base')
* def __get__(self): # <<<<<<<<<<<<<<
* return self.from_object
*
*/
static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":956
* @cname('__pyx_memoryviewslice__get__base')
* def __get__(self):
* return self.from_object # <<<<<<<<<<<<<<
*
* __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->from_object);
__pyx_r = __pyx_v_self->from_object;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":962
*
* @cname('__pyx_memoryview_fromslice')
* cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
* int ndim,
* object (*to_object_func)(char *),
*/
static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
int __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_t_4;
int __pyx_t_5;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("memoryview_fromslice", 0);
/* "View.MemoryView":971
* cdef int i
*
* if memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
* return None
*
*/
__pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None);
if (__pyx_t_1) {
/* "View.MemoryView":972
*
* if memviewslice.memview == Py_None:
* return None # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(Py_None);
__pyx_r = Py_None;
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":977
*
*
* 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_filename = __pyx_f[2]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryviewslice_type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
__pyx_t_2 = 0;
/* "View.MemoryView":979
* result = _memoryviewslice(None, 0, dtype_is_object)
*
* result.from_slice = memviewslice # <<<<<<<<<<<<<<
* __PYX_INC_MEMVIEW(&memviewslice, 1)
*
*/
__pyx_v_result->from_slice = __pyx_v_memviewslice;
/* "View.MemoryView":980
*
* result.from_slice = memviewslice
* __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<<
*
* result.from_object = ( memviewslice.memview).base
*/
__PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
/* "View.MemoryView":982
* __PYX_INC_MEMVIEW(&memviewslice, 1)
*
* result.from_object = ( memviewslice.memview).base # <<<<<<<<<<<<<<
* result.typeinfo = memviewslice.memview.typeinfo
*
*/
__pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__Pyx_GOTREF(__pyx_v_result->from_object);
__Pyx_DECREF(__pyx_v_result->from_object);
__pyx_v_result->from_object = __pyx_t_2;
__pyx_t_2 = 0;
/* "View.MemoryView":983
*
* result.from_object = ( memviewslice.memview).base
* result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<<
*
* result.view = memviewslice.memview.view
*/
__pyx_v_result->__pyx_base.typeinfo = __pyx_v_memviewslice.memview->typeinfo;
/* "View.MemoryView":985
* result.typeinfo = memviewslice.memview.typeinfo
*
* result.view = memviewslice.memview.view # <<<<<<<<<<<<<<
* result.view.buf = memviewslice.data
* result.view.ndim = ndim
*/
__pyx_v_result->__pyx_base.view = __pyx_v_memviewslice.memview->view;
/* "View.MemoryView":986
*
* result.view = memviewslice.memview.view
* result.view.buf = memviewslice.data # <<<<<<<<<<<<<<
* result.view.ndim = ndim
* (<__pyx_buffer *> &result.view).obj = Py_None
*/
__pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
/* "View.MemoryView":987
* result.view = memviewslice.memview.view
* result.view.buf = memviewslice.data
* result.view.ndim = ndim # <<<<<<<<<<<<<<
* (<__pyx_buffer *> &result.view).obj = Py_None
* Py_INCREF(Py_None)
*/
__pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
/* "View.MemoryView":988
* result.view.buf = memviewslice.data
* result.view.ndim = ndim
* (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<<
* Py_INCREF(Py_None)
*
*/
((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
/* "View.MemoryView":989
* result.view.ndim = ndim
* (<__pyx_buffer *> &result.view).obj = Py_None
* Py_INCREF(Py_None) # <<<<<<<<<<<<<<
*
* result.flags = PyBUF_RECORDS
*/
Py_INCREF(Py_None);
/* "View.MemoryView":991
* Py_INCREF(Py_None)
*
* result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<<
*
* result.view.shape = result.from_slice.shape
*/
__pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
/* "View.MemoryView":993
* result.flags = PyBUF_RECORDS
*
* result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<<
* result.view.strides = result.from_slice.strides
* result.view.suboffsets = result.from_slice.suboffsets
*/
__pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
/* "View.MemoryView":994
*
* result.view.shape = result.from_slice.shape
* result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<<
* result.view.suboffsets = result.from_slice.suboffsets
*
*/
__pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
/* "View.MemoryView":995
* result.view.shape = result.from_slice.shape
* result.view.strides = result.from_slice.strides
* result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<<
*
* result.view.len = result.view.itemsize
*/
__pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
/* "View.MemoryView":997
* result.view.suboffsets = result.from_slice.suboffsets
*
* result.view.len = result.view.itemsize # <<<<<<<<<<<<<<
* for i in range(ndim):
* result.view.len *= result.view.shape[i]
*/
__pyx_v_result->__pyx_base.view.len = __pyx_v_result->__pyx_base.view.itemsize;
/* "View.MemoryView":998
*
* result.view.len = result.view.itemsize
* for i in range(ndim): # <<<<<<<<<<<<<<
* result.view.len *= result.view.shape[i]
*
*/
__pyx_t_4 = __pyx_v_ndim;
for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
__pyx_v_i = __pyx_t_5;
/* "View.MemoryView":999
* result.view.len = result.view.itemsize
* for i in range(ndim):
* result.view.len *= result.view.shape[i] # <<<<<<<<<<<<<<
*
* result.to_object_func = to_object_func
*/
__pyx_v_result->__pyx_base.view.len = (__pyx_v_result->__pyx_base.view.len * (__pyx_v_result->__pyx_base.view.shape[__pyx_v_i]));
}
/* "View.MemoryView":1001
* result.view.len *= result.view.shape[i]
*
* result.to_object_func = to_object_func # <<<<<<<<<<<<<<
* result.to_dtype_func = to_dtype_func
*
*/
__pyx_v_result->to_object_func = __pyx_v_to_object_func;
/* "View.MemoryView":1002
*
* result.to_object_func = to_object_func
* result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<<
*
* return result
*/
__pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
/* "View.MemoryView":1004
* result.to_dtype_func = to_dtype_func
*
* return result # <<<<<<<<<<<<<<
*
* @cname('__pyx_memoryview_get_slice_from_memoryview')
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_result));
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_result);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":1007
*
* @cname('__pyx_memoryview_get_slice_from_memoryview')
* cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
* __Pyx_memviewslice *mslice):
* cdef _memoryviewslice obj
*/
static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
__Pyx_memviewslice *__pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_slice_from_memview", 0);
/* "View.MemoryView":1010
* __Pyx_memviewslice *mslice):
* cdef _memoryviewslice obj
* if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
* obj = memview
* return &obj.from_slice
*/
__pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "View.MemoryView":1011
* 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_filename = __pyx_f[2]; __pyx_lineno = 1011; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_INCREF(((PyObject *)__pyx_v_memview));
__pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview);
/* "View.MemoryView":1012
* if isinstance(memview, _memoryviewslice):
* obj = memview
* return &obj.from_slice # <<<<<<<<<<<<<<
* else:
* slice_copy(memview, mslice)
*/
__pyx_r = (&__pyx_v_obj->from_slice);
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":1014
* return &obj.from_slice
* else:
* slice_copy(memview, mslice) # <<<<<<<<<<<<<<
* return mslice
*
*/
__pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
/* "View.MemoryView":1015
* else:
* slice_copy(memview, mslice)
* return mslice # <<<<<<<<<<<<<<
*
* @cname('__pyx_memoryview_slice_copy')
*/
__pyx_r = __pyx_v_mslice;
goto __pyx_L0;
}
__pyx_L3:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_WriteUnraisable("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_obj);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":1018
*
* @cname('__pyx_memoryview_slice_copy')
* cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
* cdef int dim
* cdef Py_ssize_t *shape, *strides, *suboffsets
*/
static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
int __pyx_v_dim;
Py_ssize_t *__pyx_v_shape;
Py_ssize_t *__pyx_v_strides;
Py_ssize_t *__pyx_v_suboffsets;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
__Pyx_RefNannySetupContext("slice_copy", 0);
/* "View.MemoryView":1022
* cdef Py_ssize_t *shape, *strides, *suboffsets
*
* shape = memview.view.shape # <<<<<<<<<<<<<<
* strides = memview.view.strides
* suboffsets = memview.view.suboffsets
*/
__pyx_v_shape = __pyx_v_memview->view.shape;
/* "View.MemoryView":1023
*
* shape = memview.view.shape
* strides = memview.view.strides # <<<<<<<<<<<<<<
* suboffsets = memview.view.suboffsets
*
*/
__pyx_v_strides = __pyx_v_memview->view.strides;
/* "View.MemoryView":1024
* shape = memview.view.shape
* strides = memview.view.strides
* suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<<
*
* dst.memview = <__pyx_memoryview *> memview
*/
__pyx_v_suboffsets = __pyx_v_memview->view.suboffsets;
/* "View.MemoryView":1026
* suboffsets = memview.view.suboffsets
*
* dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<<
* dst.data = memview.view.buf
*
*/
__pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
/* "View.MemoryView":1027
*
* dst.memview = <__pyx_memoryview *> memview
* dst.data = memview.view.buf # <<<<<<<<<<<<<<
*
* for dim in range(memview.view.ndim):
*/
__pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
/* "View.MemoryView":1029
* dst.data = memview.view.buf
*
* for dim in range(memview.view.ndim): # <<<<<<<<<<<<<<
* dst.shape[dim] = shape[dim]
* dst.strides[dim] = strides[dim]
*/
__pyx_t_1 = __pyx_v_memview->view.ndim;
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_dim = __pyx_t_2;
/* "View.MemoryView":1030
*
* for dim in range(memview.view.ndim):
* dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<<
* dst.strides[dim] = strides[dim]
* if suboffsets == NULL:
*/
(__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
/* "View.MemoryView":1031
* for dim in range(memview.view.ndim):
* dst.shape[dim] = shape[dim]
* dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<<
* if suboffsets == NULL:
* dst.suboffsets[dim] = -1
*/
(__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
/* "View.MemoryView":1032
* dst.shape[dim] = shape[dim]
* dst.strides[dim] = strides[dim]
* if suboffsets == NULL: # <<<<<<<<<<<<<<
* dst.suboffsets[dim] = -1
* else:
*/
__pyx_t_3 = (__pyx_v_suboffsets == NULL);
if (__pyx_t_3) {
/* "View.MemoryView":1033
* dst.strides[dim] = strides[dim]
* if suboffsets == NULL:
* dst.suboffsets[dim] = -1 # <<<<<<<<<<<<<<
* else:
* dst.suboffsets[dim] = suboffsets[dim]
*/
(__pyx_v_dst->suboffsets[__pyx_v_dim]) = -1;
goto __pyx_L5;
}
/*else*/ {
/* "View.MemoryView":1035
* dst.suboffsets[dim] = -1
* else:
* dst.suboffsets[dim] = suboffsets[dim] # <<<<<<<<<<<<<<
*
* @cname('__pyx_memoryview_copy_object')
*/
(__pyx_v_dst->suboffsets[__pyx_v_dim]) = (__pyx_v_suboffsets[__pyx_v_dim]);
}
__pyx_L5:;
}
__Pyx_RefNannyFinishContext();
}
/* "View.MemoryView":1038
*
* @cname('__pyx_memoryview_copy_object')
* cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
* "Create a new memoryview object"
* cdef __Pyx_memviewslice memviewslice
*/
static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
__Pyx_memviewslice __pyx_v_memviewslice;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("memoryview_copy", 0);
/* "View.MemoryView":1041
* "Create a new memoryview object"
* cdef __Pyx_memviewslice memviewslice
* slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<<
* return memoryview_copy_from_slice(memview, &memviewslice)
*
*/
__pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
/* "View.MemoryView":1042
* cdef __Pyx_memviewslice memviewslice
* slice_copy(memview, &memviewslice)
* return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<<
*
* @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_filename = __pyx_f[2]; __pyx_lineno = 1042; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":1045
*
* @cname('__pyx_memoryview_copy_object_from_slice')
* cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
* """
* Create a new memoryview object from a given memoryview object and slice.
*/
static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
PyObject *(*__pyx_v_to_object_func)(char *);
int (*__pyx_v_to_dtype_func)(char *, PyObject *);
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
/* "View.MemoryView":1052
* cdef int (*to_dtype_func)(char *, object) except 0
*
* if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
* to_object_func = (<_memoryviewslice> memview).to_object_func
* to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
*/
__pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "View.MemoryView":1053
*
* if isinstance(memview, _memoryviewslice):
* to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<<
* to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
* else:
*/
__pyx_v_to_object_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
/* "View.MemoryView":1054
* if isinstance(memview, _memoryviewslice):
* to_object_func = (<_memoryviewslice> memview).to_object_func
* to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<<
* else:
* to_object_func = NULL
*/
__pyx_v_to_dtype_func = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":1056
* to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
* else:
* to_object_func = NULL # <<<<<<<<<<<<<<
* to_dtype_func = NULL
*
*/
__pyx_v_to_object_func = NULL;
/* "View.MemoryView":1057
* else:
* to_object_func = NULL
* to_dtype_func = NULL # <<<<<<<<<<<<<<
*
* return memoryview_fromslice(memviewslice[0], memview.view.ndim,
*/
__pyx_v_to_dtype_func = NULL;
}
__pyx_L3:;
/* "View.MemoryView":1059
* to_dtype_func = NULL
*
* return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<<
* to_object_func, to_dtype_func,
* memview.dtype_is_object)
*/
__Pyx_XDECREF(__pyx_r);
/* "View.MemoryView":1061
* return memoryview_fromslice(memviewslice[0], memview.view.ndim,
* to_object_func, to_dtype_func,
* memview.dtype_is_object) # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_1 = __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_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":1067
*
*
* cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
* if arg < 0:
* return -arg
*/
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":1068
*
* cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
* if arg < 0: # <<<<<<<<<<<<<<
* return -arg
* else:
*/
__pyx_t_1 = (__pyx_v_arg < 0);
if (__pyx_t_1) {
/* "View.MemoryView":1069
* cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
* if arg < 0:
* return -arg # <<<<<<<<<<<<<<
* else:
* return arg
*/
__pyx_r = (-__pyx_v_arg);
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":1071
* return -arg
* else:
* return arg # <<<<<<<<<<<<<<
*
* @cname('__pyx_get_best_slice_order')
*/
__pyx_r = __pyx_v_arg;
goto __pyx_L0;
}
__pyx_L3:;
__pyx_r = 0;
__pyx_L0:;
return __pyx_r;
}
/* "View.MemoryView":1074
*
* @cname('__pyx_get_best_slice_order')
* cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
* """
* Figure out the best memory access order for a given slice.
*/
static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
int __pyx_v_i;
Py_ssize_t __pyx_v_c_stride;
Py_ssize_t __pyx_v_f_stride;
char __pyx_r;
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
/* "View.MemoryView":1079
* """
* cdef int i
* cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<<
* cdef Py_ssize_t f_stride = 0
*
*/
__pyx_v_c_stride = 0;
/* "View.MemoryView":1080
* cdef int i
* cdef Py_ssize_t c_stride = 0
* cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<<
*
* for i in range(ndim - 1, -1, -1):
*/
__pyx_v_f_stride = 0;
/* "View.MemoryView":1082
* cdef Py_ssize_t f_stride = 0
*
* for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
* if mslice.shape[i] > 1:
* c_stride = mslice.strides[i]
*/
for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
__pyx_v_i = __pyx_t_1;
/* "View.MemoryView":1083
*
* for i in range(ndim - 1, -1, -1):
* if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
* c_stride = mslice.strides[i]
* break
*/
__pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
if (__pyx_t_2) {
/* "View.MemoryView":1084
* for i in range(ndim - 1, -1, -1):
* if mslice.shape[i] > 1:
* c_stride = mslice.strides[i] # <<<<<<<<<<<<<<
* break
*
*/
__pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
/* "View.MemoryView":1085
* if mslice.shape[i] > 1:
* c_stride = mslice.strides[i]
* break # <<<<<<<<<<<<<<
*
* for i in range(ndim):
*/
goto __pyx_L4_break;
goto __pyx_L5;
}
__pyx_L5:;
}
__pyx_L4_break:;
/* "View.MemoryView":1087
* break
*
* for i in range(ndim): # <<<<<<<<<<<<<<
* if mslice.shape[i] > 1:
* f_stride = mslice.strides[i]
*/
__pyx_t_1 = __pyx_v_ndim;
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_1; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
/* "View.MemoryView":1088
*
* for i in range(ndim):
* if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
* f_stride = mslice.strides[i]
* break
*/
__pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
if (__pyx_t_2) {
/* "View.MemoryView":1089
* for i in range(ndim):
* if mslice.shape[i] > 1:
* f_stride = mslice.strides[i] # <<<<<<<<<<<<<<
* break
*
*/
__pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
/* "View.MemoryView":1090
* if mslice.shape[i] > 1:
* f_stride = mslice.strides[i]
* break # <<<<<<<<<<<<<<
*
* if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
*/
goto __pyx_L7_break;
goto __pyx_L8;
}
__pyx_L8:;
}
__pyx_L7_break:;
/* "View.MemoryView":1092
* break
*
* if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
* return 'C'
* else:
*/
__pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride));
if (__pyx_t_2) {
/* "View.MemoryView":1093
*
* if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
* return 'C' # <<<<<<<<<<<<<<
* else:
* return 'F'
*/
__pyx_r = 'C';
goto __pyx_L0;
goto __pyx_L9;
}
/*else*/ {
/* "View.MemoryView":1095
* return 'C'
* else:
* return 'F' # <<<<<<<<<<<<<<
*
* @cython.cdivision(True)
*/
__pyx_r = 'F';
goto __pyx_L0;
}
__pyx_L9:;
__pyx_r = 0;
__pyx_L0:;
return __pyx_r;
}
/* "View.MemoryView":1098
*
* @cython.cdivision(True)
* cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
* char *dst_data, Py_ssize_t *dst_strides,
* Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
*/
static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
CYTHON_UNUSED Py_ssize_t __pyx_v_i;
CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
Py_ssize_t __pyx_v_dst_extent;
Py_ssize_t __pyx_v_src_stride;
Py_ssize_t __pyx_v_dst_stride;
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
int __pyx_t_4;
Py_ssize_t __pyx_t_5;
Py_ssize_t __pyx_t_6;
/* "View.MemoryView":1105
*
* cdef Py_ssize_t i
* 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]
*/
__pyx_v_src_extent = (__pyx_v_src_shape[0]);
/* "View.MemoryView":1106
* cdef Py_ssize_t i
* 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]
* cdef Py_ssize_t dst_stride = dst_strides[0]
*/
__pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
/* "View.MemoryView":1107
* 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] # <<<<<<<<<<<<<<
* cdef Py_ssize_t dst_stride = dst_strides[0]
*
*/
__pyx_v_src_stride = (__pyx_v_src_strides[0]);
/* "View.MemoryView":1108
* 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] # <<<<<<<<<<<<<<
*
* if ndim == 1:
*/
__pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
/* "View.MemoryView":1110
* cdef Py_ssize_t dst_stride = dst_strides[0]
*
* if ndim == 1: # <<<<<<<<<<<<<<
* if (src_stride > 0 and dst_stride > 0 and
* src_stride == itemsize == dst_stride):
*/
__pyx_t_1 = (__pyx_v_ndim == 1);
if (__pyx_t_1) {
/* "View.MemoryView":1111
*
* if ndim == 1:
* if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
* src_stride == itemsize == dst_stride):
* memcpy(dst_data, src_data, itemsize * dst_extent)
*/
__pyx_t_1 = (__pyx_v_src_stride > 0);
if (__pyx_t_1) {
__pyx_t_2 = (__pyx_v_dst_stride > 0);
if (__pyx_t_2) {
/* "View.MemoryView":1112
* if ndim == 1:
* if (src_stride > 0 and dst_stride > 0 and
* src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<<
* memcpy(dst_data, src_data, itemsize * dst_extent)
* else:
*/
__pyx_t_3 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
if (__pyx_t_3) {
__pyx_t_3 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
}
__pyx_t_4 = __pyx_t_3;
} else {
__pyx_t_4 = __pyx_t_2;
}
__pyx_t_2 = __pyx_t_4;
} else {
__pyx_t_2 = __pyx_t_1;
}
if (__pyx_t_2) {
/* "View.MemoryView":1113
* if (src_stride > 0 and dst_stride > 0 and
* src_stride == itemsize == dst_stride):
* memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<<
* else:
* for i in range(dst_extent):
*/
memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent));
goto __pyx_L4;
}
/*else*/ {
/* "View.MemoryView":1115
* memcpy(dst_data, src_data, itemsize * dst_extent)
* else:
* for i in range(dst_extent): # <<<<<<<<<<<<<<
* memcpy(dst_data, src_data, itemsize)
* src_data += src_stride
*/
__pyx_t_5 = __pyx_v_dst_extent;
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
__pyx_v_i = __pyx_t_6;
/* "View.MemoryView":1116
* else:
* for i in range(dst_extent):
* memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<<
* src_data += src_stride
* dst_data += dst_stride
*/
memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize);
/* "View.MemoryView":1117
* for i in range(dst_extent):
* memcpy(dst_data, src_data, itemsize)
* src_data += src_stride # <<<<<<<<<<<<<<
* dst_data += dst_stride
* else:
*/
__pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
/* "View.MemoryView":1118
* memcpy(dst_data, src_data, itemsize)
* src_data += src_stride
* dst_data += dst_stride # <<<<<<<<<<<<<<
* else:
* for i in range(dst_extent):
*/
__pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
}
}
__pyx_L4:;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":1120
* dst_data += dst_stride
* else:
* for i in range(dst_extent): # <<<<<<<<<<<<<<
* _copy_strided_to_strided(src_data, src_strides + 1,
* dst_data, dst_strides + 1,
*/
__pyx_t_5 = __pyx_v_dst_extent;
for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
__pyx_v_i = __pyx_t_6;
/* "View.MemoryView":1124
* dst_data, dst_strides + 1,
* src_shape + 1, dst_shape + 1,
* ndim - 1, itemsize) # <<<<<<<<<<<<<<
* src_data += src_stride
* dst_data += dst_stride
*/
_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":1125
* src_shape + 1, dst_shape + 1,
* ndim - 1, itemsize)
* src_data += src_stride # <<<<<<<<<<<<<<
* dst_data += dst_stride
*
*/
__pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
/* "View.MemoryView":1126
* ndim - 1, itemsize)
* src_data += src_stride
* dst_data += dst_stride # <<<<<<<<<<<<<<
*
* cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
*/
__pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
}
}
__pyx_L3:;
}
/* "View.MemoryView":1128
* dst_data += dst_stride
*
* cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
* __Pyx_memviewslice *dst,
* int ndim, size_t itemsize) nogil:
*/
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":1132
* int ndim, size_t itemsize) nogil:
* _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides,
* src.shape, dst.shape, ndim, itemsize) # <<<<<<<<<<<<<<
*
* @cname('__pyx_memoryview_slice_get_size')
*/
_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":1135
*
* @cname('__pyx_memoryview_slice_get_size')
* cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
* "Return the size of the memory occupied by the slice in number of bytes"
* cdef int i
*/
static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
int __pyx_v_i;
Py_ssize_t __pyx_v_size;
Py_ssize_t __pyx_r;
int __pyx_t_1;
int __pyx_t_2;
/* "View.MemoryView":1138
* "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 # <<<<<<<<<<<<<<
*
* for i in range(ndim):
*/
__pyx_v_size = __pyx_v_src->memview->view.itemsize;
/* "View.MemoryView":1140
* cdef Py_ssize_t size = src.memview.view.itemsize
*
* for i in range(ndim): # <<<<<<<<<<<<<<
* size *= src.shape[i]
*
*/
__pyx_t_1 = __pyx_v_ndim;
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
/* "View.MemoryView":1141
*
* for i in range(ndim):
* size *= src.shape[i] # <<<<<<<<<<<<<<
*
* return size
*/
__pyx_v_size = (__pyx_v_size * (__pyx_v_src->shape[__pyx_v_i]));
}
/* "View.MemoryView":1143
* size *= src.shape[i]
*
* return size # <<<<<<<<<<<<<<
*
* @cname('__pyx_fill_contig_strides_array')
*/
__pyx_r = __pyx_v_size;
goto __pyx_L0;
__pyx_r = 0;
__pyx_L0:;
return __pyx_r;
}
/* "View.MemoryView":1146
*
* @cname('__pyx_fill_contig_strides_array')
* cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
* Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
* int ndim, char order) nogil:
*/
static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
int __pyx_v_idx;
Py_ssize_t __pyx_r;
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
/* "View.MemoryView":1155
* cdef int idx
*
* if order == 'F': # <<<<<<<<<<<<<<
* for idx in range(ndim):
* strides[idx] = stride
*/
__pyx_t_1 = (__pyx_v_order == 'F');
if (__pyx_t_1) {
/* "View.MemoryView":1156
*
* if order == 'F':
* for idx in range(ndim): # <<<<<<<<<<<<<<
* strides[idx] = stride
* stride = stride * shape[idx]
*/
__pyx_t_2 = __pyx_v_ndim;
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_idx = __pyx_t_3;
/* "View.MemoryView":1157
* if order == 'F':
* for idx in range(ndim):
* strides[idx] = stride # <<<<<<<<<<<<<<
* stride = stride * shape[idx]
* else:
*/
(__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
/* "View.MemoryView":1158
* for idx in range(ndim):
* strides[idx] = stride
* stride = stride * shape[idx] # <<<<<<<<<<<<<<
* else:
* for idx in range(ndim - 1, -1, -1):
*/
__pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
}
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":1160
* stride = stride * shape[idx]
* else:
* for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
* strides[idx] = stride
* stride = stride * shape[idx]
*/
for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
__pyx_v_idx = __pyx_t_2;
/* "View.MemoryView":1161
* else:
* for idx in range(ndim - 1, -1, -1):
* strides[idx] = stride # <<<<<<<<<<<<<<
* stride = stride * shape[idx]
*
*/
(__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
/* "View.MemoryView":1162
* for idx in range(ndim - 1, -1, -1):
* strides[idx] = stride
* stride = stride * shape[idx] # <<<<<<<<<<<<<<
*
* return stride
*/
__pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
}
}
__pyx_L3:;
/* "View.MemoryView":1164
* stride = stride * shape[idx]
*
* return stride # <<<<<<<<<<<<<<
*
* @cname('__pyx_memoryview_copy_data_to_temp')
*/
__pyx_r = __pyx_v_stride;
goto __pyx_L0;
__pyx_r = 0;
__pyx_L0:;
return __pyx_r;
}
/* "View.MemoryView":1167
*
* @cname('__pyx_memoryview_copy_data_to_temp')
* cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
* __Pyx_memviewslice *tmpslice,
* char order,
*/
static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
int __pyx_v_i;
void *__pyx_v_result;
size_t __pyx_v_itemsize;
size_t __pyx_v_size;
void *__pyx_r;
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* "View.MemoryView":1178
* cdef void *result
*
* cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
* cdef size_t size = slice_get_size(src, ndim)
*
*/
__pyx_v_itemsize = __pyx_v_src->memview->view.itemsize;
/* "View.MemoryView":1179
*
* cdef size_t itemsize = src.memview.view.itemsize
* cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<<
*
* result = malloc(size)
*/
__pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
/* "View.MemoryView":1181
* cdef size_t size = slice_get_size(src, ndim)
*
* result = malloc(size) # <<<<<<<<<<<<<<
* if not result:
* _err(MemoryError, NULL)
*/
__pyx_v_result = malloc(__pyx_v_size);
/* "View.MemoryView":1182
*
* result = malloc(size)
* if not result: # <<<<<<<<<<<<<<
* _err(MemoryError, NULL)
*
*/
__pyx_t_1 = (!(__pyx_v_result != 0));
if (__pyx_t_1) {
/* "View.MemoryView":1183
* result = malloc(size)
* if not result:
* _err(MemoryError, NULL) # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_2 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":1186
*
*
* tmpslice.data = result # <<<<<<<<<<<<<<
* tmpslice.memview = src.memview
* for i in range(ndim):
*/
__pyx_v_tmpslice->data = ((char *)__pyx_v_result);
/* "View.MemoryView":1187
*
* tmpslice.data = result
* tmpslice.memview = src.memview # <<<<<<<<<<<<<<
* for i in range(ndim):
* tmpslice.shape[i] = src.shape[i]
*/
__pyx_v_tmpslice->memview = __pyx_v_src->memview;
/* "View.MemoryView":1188
* tmpslice.data = result
* tmpslice.memview = src.memview
* for i in range(ndim): # <<<<<<<<<<<<<<
* tmpslice.shape[i] = src.shape[i]
* tmpslice.suboffsets[i] = -1
*/
__pyx_t_2 = __pyx_v_ndim;
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
/* "View.MemoryView":1189
* tmpslice.memview = src.memview
* for i in range(ndim):
* tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<<
* tmpslice.suboffsets[i] = -1
*
*/
(__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
/* "View.MemoryView":1190
* for i in range(ndim):
* tmpslice.shape[i] = src.shape[i]
* tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
*
* fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
*/
(__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1;
}
/* "View.MemoryView":1193
*
* fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
* ndim, order) # <<<<<<<<<<<<<<
*
*
*/
__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":1196
*
*
* for i in range(ndim): # <<<<<<<<<<<<<<
* if tmpslice.shape[i] == 1:
* tmpslice.strides[i] = 0
*/
__pyx_t_2 = __pyx_v_ndim;
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
/* "View.MemoryView":1197
*
* for i in range(ndim):
* if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
* tmpslice.strides[i] = 0
*
*/
__pyx_t_1 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1);
if (__pyx_t_1) {
/* "View.MemoryView":1198
* for i in range(ndim):
* if tmpslice.shape[i] == 1:
* tmpslice.strides[i] = 0 # <<<<<<<<<<<<<<
*
* if slice_is_contig(src, order, ndim):
*/
(__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
goto __pyx_L8;
}
__pyx_L8:;
}
/* "View.MemoryView":1200
* tmpslice.strides[i] = 0
*
* if slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
* memcpy(result, src.data, size)
* else:
*/
__pyx_t_1 = __pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim);
if (__pyx_t_1) {
/* "View.MemoryView":1201
*
* if slice_is_contig(src, order, ndim):
* memcpy(result, src.data, size) # <<<<<<<<<<<<<<
* else:
* copy_strided_to_strided(src, tmpslice, ndim, itemsize)
*/
memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size);
goto __pyx_L9;
}
/*else*/ {
/* "View.MemoryView":1203
* memcpy(result, src.data, size)
* else:
* copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<<
*
* return result
*/
copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
}
__pyx_L9:;
/* "View.MemoryView":1205
* copy_strided_to_strided(src, tmpslice, ndim, itemsize)
*
* return result # <<<<<<<<<<<<<<
*
*
*/
__pyx_r = __pyx_v_result;
goto __pyx_L0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
{
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
__Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
}
__pyx_r = NULL;
__pyx_L0:;
return __pyx_r;
}
/* "View.MemoryView":1210
*
* @cname('__pyx_memoryview_err_extents')
* 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)" %
*/
static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
__Pyx_RefNannySetupContext("_err_extents", 0);
/* "View.MemoryView":1213
* 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 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_1 = 0;
__pyx_t_2 = 0;
__pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_46), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[2]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
return __pyx_r;
}
/* "View.MemoryView":1216
*
* @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)
*
*/
static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
__Pyx_RefNannySetupContext("_err_dim", 0);
__Pyx_INCREF(__pyx_v_error);
/* "View.MemoryView":1217
* @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_1 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_t_1), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_v_error, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[2]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_error);
__Pyx_RefNannyFinishContext();
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
return __pyx_r;
}
/* "View.MemoryView":1220
*
* @cname('__pyx_memoryview_err')
* cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
* if msg != NULL:
* raise error(msg.decode('ascii'))
*/
static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
__Pyx_RefNannySetupContext("_err", 0);
__Pyx_INCREF(__pyx_v_error);
/* "View.MemoryView":1221
* @cname('__pyx_memoryview_err')
* cdef int _err(object error, char *msg) except -1 with gil:
* if msg != NULL: # <<<<<<<<<<<<<<
* raise error(msg.decode('ascii'))
* else:
*/
__pyx_t_1 = (__pyx_v_msg != NULL);
if (__pyx_t_1) {
/* "View.MemoryView":1222
* cdef int _err(object error, char *msg) except -1 with gil:
* if msg != NULL:
* raise error(msg.decode('ascii')) # <<<<<<<<<<<<<<
* else:
* raise error
*/
__pyx_t_2 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_v_error, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":1224
* raise error(msg.decode('ascii'))
* else:
* raise error # <<<<<<<<<<<<<<
*
* @cname('__pyx_memoryview_copy_contents')
*/
__Pyx_Raise(__pyx_v_error, 0, 0, 0);
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 1224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L3:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_error);
__Pyx_RefNannyFinishContext();
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
return __pyx_r;
}
/* "View.MemoryView":1227
*
* @cname('__pyx_memoryview_copy_contents')
* cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
* __Pyx_memviewslice dst,
* int src_ndim, int dst_ndim,
*/
static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) {
void *__pyx_v_tmpdata;
size_t __pyx_v_itemsize;
int __pyx_v_i;
char __pyx_v_order;
int __pyx_v_broadcasting;
int __pyx_v_direct_copy;
__Pyx_memviewslice __pyx_v_tmp;
int __pyx_v_ndim;
int __pyx_r;
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
int __pyx_t_4;
void *__pyx_t_5;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* "View.MemoryView":1235
* Check for overlapping memory and verify the shapes.
* """
* cdef void *tmpdata = NULL # <<<<<<<<<<<<<<
* cdef size_t itemsize = src.memview.view.itemsize
* cdef int i
*/
__pyx_v_tmpdata = NULL;
/* "View.MemoryView":1236
* """
* cdef void *tmpdata = NULL
* cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
* cdef int i
* cdef char order = get_best_order(&src, src_ndim)
*/
__pyx_v_itemsize = __pyx_v_src.memview->view.itemsize;
/* "View.MemoryView":1238
* cdef size_t itemsize = src.memview.view.itemsize
* cdef int i
* cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<<
* cdef bint broadcasting = False
* cdef bint direct_copy = False
*/
__pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
/* "View.MemoryView":1239
* cdef int i
* cdef char order = get_best_order(&src, src_ndim)
* cdef bint broadcasting = False # <<<<<<<<<<<<<<
* cdef bint direct_copy = False
* cdef __Pyx_memviewslice tmp
*/
__pyx_v_broadcasting = 0;
/* "View.MemoryView":1240
* cdef char order = get_best_order(&src, src_ndim)
* cdef bint broadcasting = False
* cdef bint direct_copy = False # <<<<<<<<<<<<<<
* cdef __Pyx_memviewslice tmp
*
*/
__pyx_v_direct_copy = 0;
/* "View.MemoryView":1243
* cdef __Pyx_memviewslice tmp
*
* if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
* broadcast_leading(&src, src_ndim, dst_ndim)
* elif dst_ndim < src_ndim:
*/
__pyx_t_1 = (__pyx_v_src_ndim < __pyx_v_dst_ndim);
if (__pyx_t_1) {
/* "View.MemoryView":1244
*
* if src_ndim < dst_ndim:
* broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<<
* elif dst_ndim < src_ndim:
* broadcast_leading(&dst, dst_ndim, src_ndim)
*/
__pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
goto __pyx_L3;
}
/* "View.MemoryView":1245
* if src_ndim < dst_ndim:
* broadcast_leading(&src, src_ndim, dst_ndim)
* elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
* broadcast_leading(&dst, dst_ndim, src_ndim)
*
*/
__pyx_t_1 = (__pyx_v_dst_ndim < __pyx_v_src_ndim);
if (__pyx_t_1) {
/* "View.MemoryView":1246
* broadcast_leading(&src, src_ndim, dst_ndim)
* elif dst_ndim < src_ndim:
* broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<<
*
* cdef int ndim = max(src_ndim, dst_ndim)
*/
__pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":1248
* broadcast_leading(&dst, dst_ndim, src_ndim)
*
* cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<<
*
* for i in range(ndim):
*/
__pyx_t_2 = __pyx_v_dst_ndim;
__pyx_t_3 = __pyx_v_src_ndim;
if ((__pyx_t_2 > __pyx_t_3)) {
__pyx_t_4 = __pyx_t_2;
} else {
__pyx_t_4 = __pyx_t_3;
}
__pyx_v_ndim = __pyx_t_4;
/* "View.MemoryView":1250
* cdef int ndim = max(src_ndim, dst_ndim)
*
* for i in range(ndim): # <<<<<<<<<<<<<<
* if src.shape[i] != dst.shape[i]:
* if src.shape[i] == 1:
*/
__pyx_t_4 = __pyx_v_ndim;
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
/* "View.MemoryView":1251
*
* for i in range(ndim):
* if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
* if src.shape[i] == 1:
* broadcasting = True
*/
__pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i]));
if (__pyx_t_1) {
/* "View.MemoryView":1252
* for i in range(ndim):
* if src.shape[i] != dst.shape[i]:
* if src.shape[i] == 1: # <<<<<<<<<<<<<<
* broadcasting = True
* src.strides[i] = 0
*/
__pyx_t_1 = ((__pyx_v_src.shape[__pyx_v_i]) == 1);
if (__pyx_t_1) {
/* "View.MemoryView":1253
* if src.shape[i] != dst.shape[i]:
* if src.shape[i] == 1:
* broadcasting = True # <<<<<<<<<<<<<<
* src.strides[i] = 0
* else:
*/
__pyx_v_broadcasting = 1;
/* "View.MemoryView":1254
* if src.shape[i] == 1:
* broadcasting = True
* src.strides[i] = 0 # <<<<<<<<<<<<<<
* else:
* _err_extents(i, dst.shape[i], src.shape[i])
*/
(__pyx_v_src.strides[__pyx_v_i]) = 0;
goto __pyx_L7;
}
/*else*/ {
/* "View.MemoryView":1256
* src.strides[i] = 0
* else:
* _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<<
*
* if src.suboffsets[i] >= 0:
*/
__pyx_t_3 = __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_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L7:;
goto __pyx_L6;
}
__pyx_L6:;
/* "View.MemoryView":1258
* _err_extents(i, dst.shape[i], src.shape[i])
*
* if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
* _err_dim(ValueError, "Dimension %d is not direct", i)
*
*/
__pyx_t_1 = ((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0);
if (__pyx_t_1) {
/* "View.MemoryView":1259
*
* if src.suboffsets[i] >= 0:
* _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<<
*
* if slices_overlap(&src, &dst, ndim, itemsize):
*/
__pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, __pyx_k_47, __pyx_v_i); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
}
/* "View.MemoryView":1261
* _err_dim(ValueError, "Dimension %d is not direct", i)
*
* if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
*
* if not slice_is_contig(&src, order, ndim):
*/
__pyx_t_1 = __pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
if (__pyx_t_1) {
/* "View.MemoryView":1263
* if slices_overlap(&src, &dst, ndim, itemsize):
*
* if not slice_is_contig(&src, order, ndim): # <<<<<<<<<<<<<<
* order = get_best_order(&dst, ndim)
*
*/
__pyx_t_1 = (!__pyx_memviewslice_is_contig((&__pyx_v_src), __pyx_v_order, __pyx_v_ndim));
if (__pyx_t_1) {
/* "View.MemoryView":1264
*
* if not slice_is_contig(&src, order, ndim):
* order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<<
*
* tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
*/
__pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
goto __pyx_L10;
}
__pyx_L10:;
/* "View.MemoryView":1266
* order = get_best_order(&dst, ndim)
*
* tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<<
* src = tmp
*
*/
__pyx_t_5 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_tmpdata = __pyx_t_5;
/* "View.MemoryView":1267
*
* tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
* src = tmp # <<<<<<<<<<<<<<
*
* if not broadcasting:
*/
__pyx_v_src = __pyx_v_tmp;
goto __pyx_L9;
}
__pyx_L9:;
/* "View.MemoryView":1269
* src = tmp
*
* if not broadcasting: # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_1 = (!__pyx_v_broadcasting);
if (__pyx_t_1) {
/* "View.MemoryView":1272
*
*
* if slice_is_contig(&src, 'C', ndim): # <<<<<<<<<<<<<<
* direct_copy = slice_is_contig(&dst, 'C', ndim)
* elif slice_is_contig(&src, 'F', ndim):
*/
__pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'C', __pyx_v_ndim);
if (__pyx_t_1) {
/* "View.MemoryView":1273
*
* if slice_is_contig(&src, 'C', ndim):
* direct_copy = slice_is_contig(&dst, 'C', ndim) # <<<<<<<<<<<<<<
* elif slice_is_contig(&src, 'F', ndim):
* direct_copy = slice_is_contig(&dst, 'F', ndim)
*/
__pyx_v_direct_copy = __pyx_memviewslice_is_contig((&__pyx_v_dst), 'C', __pyx_v_ndim);
goto __pyx_L12;
}
/* "View.MemoryView":1274
* if slice_is_contig(&src, 'C', ndim):
* direct_copy = slice_is_contig(&dst, 'C', ndim)
* elif slice_is_contig(&src, 'F', ndim): # <<<<<<<<<<<<<<
* direct_copy = slice_is_contig(&dst, 'F', ndim)
*
*/
__pyx_t_1 = __pyx_memviewslice_is_contig((&__pyx_v_src), 'F', __pyx_v_ndim);
if (__pyx_t_1) {
/* "View.MemoryView":1275
* direct_copy = slice_is_contig(&dst, 'C', ndim)
* elif slice_is_contig(&src, 'F', ndim):
* direct_copy = slice_is_contig(&dst, 'F', ndim) # <<<<<<<<<<<<<<
*
* if direct_copy:
*/
__pyx_v_direct_copy = __pyx_memviewslice_is_contig((&__pyx_v_dst), 'F', __pyx_v_ndim);
goto __pyx_L12;
}
__pyx_L12:;
/* "View.MemoryView":1277
* direct_copy = slice_is_contig(&dst, 'F', ndim)
*
* if direct_copy: # <<<<<<<<<<<<<<
*
* refcount_copying(&dst, dtype_is_object, ndim, False)
*/
if (__pyx_v_direct_copy) {
/* "View.MemoryView":1279
* if direct_copy:
*
* 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)
*/
__pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
/* "View.MemoryView":1280
*
* 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)
* return 0
*/
memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim));
/* "View.MemoryView":1281
* 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) # <<<<<<<<<<<<<<
* return 0
*
*/
__pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
/* "View.MemoryView":1282
* memcpy(dst.data, src.data, slice_get_size(&src, ndim))
* refcount_copying(&dst, dtype_is_object, ndim, True)
* return 0 # <<<<<<<<<<<<<<
*
* if order == 'F' == get_best_order(&dst, ndim):
*/
__pyx_r = 0;
goto __pyx_L0;
goto __pyx_L13;
}
__pyx_L13:;
goto __pyx_L11;
}
__pyx_L11:;
/* "View.MemoryView":1284
* return 0
*
* if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_1 = (__pyx_v_order == 'F');
if (__pyx_t_1) {
__pyx_t_1 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
}
if (__pyx_t_1) {
/* "View.MemoryView":1287
*
*
* transpose_memslice(&src) # <<<<<<<<<<<<<<
* transpose_memslice(&dst)
*
*/
__pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "View.MemoryView":1288
*
* transpose_memslice(&src)
* transpose_memslice(&dst) # <<<<<<<<<<<<<<
*
* refcount_copying(&dst, dtype_is_object, ndim, False)
*/
__pyx_t_4 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_4 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L14;
}
__pyx_L14:;
/* "View.MemoryView":1290
* transpose_memslice(&dst)
*
* refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
* copy_strided_to_strided(&src, &dst, ndim, itemsize)
* refcount_copying(&dst, dtype_is_object, ndim, True)
*/
__pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
/* "View.MemoryView":1291
*
* refcount_copying(&dst, dtype_is_object, ndim, False)
* copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<<
* refcount_copying(&dst, dtype_is_object, ndim, True)
*
*/
copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
/* "View.MemoryView":1292
* refcount_copying(&dst, dtype_is_object, ndim, False)
* copy_strided_to_strided(&src, &dst, ndim, itemsize)
* refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
*
* free(tmpdata)
*/
__pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
/* "View.MemoryView":1294
* refcount_copying(&dst, dtype_is_object, ndim, True)
*
* free(tmpdata) # <<<<<<<<<<<<<<
* return 0
*
*/
free(__pyx_v_tmpdata);
/* "View.MemoryView":1295
*
* free(tmpdata)
* return 0 # <<<<<<<<<<<<<<
*
* @cname('__pyx_memoryview_broadcast_leading')
*/
__pyx_r = 0;
goto __pyx_L0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
{
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
__Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
}
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* "View.MemoryView":1298
*
* @cname('__pyx_memoryview_broadcast_leading')
* cdef void broadcast_leading(__Pyx_memviewslice *slice, # <<<<<<<<<<<<<<
* int ndim,
* int ndim_other) nogil:
*/
static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_slice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
int __pyx_v_i;
int __pyx_v_offset;
int __pyx_t_1;
int __pyx_t_2;
/* "View.MemoryView":1302
* int ndim_other) nogil:
* cdef int i
* cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<<
*
* for i in range(ndim - 1, -1, -1):
*/
__pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
/* "View.MemoryView":1304
* cdef int offset = ndim_other - ndim
*
* for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
* slice.shape[i + offset] = slice.shape[i]
* slice.strides[i + offset] = slice.strides[i]
*/
for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
__pyx_v_i = __pyx_t_1;
/* "View.MemoryView":1305
*
* for i in range(ndim - 1, -1, -1):
* slice.shape[i + offset] = slice.shape[i] # <<<<<<<<<<<<<<
* slice.strides[i + offset] = slice.strides[i]
* slice.suboffsets[i + offset] = slice.suboffsets[i]
*/
(__pyx_v_slice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_slice->shape[__pyx_v_i]);
/* "View.MemoryView":1306
* for i in range(ndim - 1, -1, -1):
* slice.shape[i + offset] = slice.shape[i]
* slice.strides[i + offset] = slice.strides[i] # <<<<<<<<<<<<<<
* slice.suboffsets[i + offset] = slice.suboffsets[i]
*
*/
(__pyx_v_slice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_slice->strides[__pyx_v_i]);
/* "View.MemoryView":1307
* slice.shape[i + offset] = slice.shape[i]
* slice.strides[i + offset] = slice.strides[i]
* slice.suboffsets[i + offset] = slice.suboffsets[i] # <<<<<<<<<<<<<<
*
* for i in range(offset):
*/
(__pyx_v_slice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_slice->suboffsets[__pyx_v_i]);
}
/* "View.MemoryView":1309
* slice.suboffsets[i + offset] = slice.suboffsets[i]
*
* for i in range(offset): # <<<<<<<<<<<<<<
* slice.shape[i] = 1
* slice.strides[i] = slice.strides[0]
*/
__pyx_t_1 = __pyx_v_offset;
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
/* "View.MemoryView":1310
*
* for i in range(offset):
* slice.shape[i] = 1 # <<<<<<<<<<<<<<
* slice.strides[i] = slice.strides[0]
* slice.suboffsets[i] = -1
*/
(__pyx_v_slice->shape[__pyx_v_i]) = 1;
/* "View.MemoryView":1311
* for i in range(offset):
* slice.shape[i] = 1
* slice.strides[i] = slice.strides[0] # <<<<<<<<<<<<<<
* slice.suboffsets[i] = -1
*
*/
(__pyx_v_slice->strides[__pyx_v_i]) = (__pyx_v_slice->strides[0]);
/* "View.MemoryView":1312
* slice.shape[i] = 1
* slice.strides[i] = slice.strides[0]
* slice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
*
*
*/
(__pyx_v_slice->suboffsets[__pyx_v_i]) = -1;
}
}
/* "View.MemoryView":1320
*
* @cname('__pyx_memoryview_refcount_copying')
* cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
* int ndim, bint inc) nogil:
*
*/
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) {
/* "View.MemoryView":1324
*
*
* if dtype_is_object: # <<<<<<<<<<<<<<
* refcount_objects_in_slice_with_gil(dst.data, dst.shape,
* dst.strides, ndim, inc)
*/
if (__pyx_v_dtype_is_object) {
/* "View.MemoryView":1326
* if dtype_is_object:
* refcount_objects_in_slice_with_gil(dst.data, dst.shape,
* dst.strides, ndim, inc) # <<<<<<<<<<<<<<
*
* @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
*/
__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);
goto __pyx_L3;
}
__pyx_L3:;
}
/* "View.MemoryView":1329
*
* @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
* cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
* Py_ssize_t *strides, int ndim,
* bint inc) with gil:
*/
static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
__Pyx_RefNannyDeclarations
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
__Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
/* "View.MemoryView":1332
* Py_ssize_t *strides, int ndim,
* bint inc) with gil:
* refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<<
*
* @cname('__pyx_memoryview_refcount_objects_in_slice')
*/
__pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
__Pyx_RefNannyFinishContext();
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
}
/* "View.MemoryView":1335
*
* @cname('__pyx_memoryview_refcount_objects_in_slice')
* cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
* Py_ssize_t *strides, int ndim, bint inc):
* cdef Py_ssize_t i
*/
static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
CYTHON_UNUSED Py_ssize_t __pyx_v_i;
__Pyx_RefNannyDeclarations
Py_ssize_t __pyx_t_1;
Py_ssize_t __pyx_t_2;
int __pyx_t_3;
__Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
/* "View.MemoryView":1339
* cdef Py_ssize_t i
*
* for i in range(shape[0]): # <<<<<<<<<<<<<<
* if ndim == 1:
* if inc:
*/
__pyx_t_1 = (__pyx_v_shape[0]);
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
/* "View.MemoryView":1340
*
* for i in range(shape[0]):
* if ndim == 1: # <<<<<<<<<<<<<<
* if inc:
* Py_INCREF(( data)[0])
*/
__pyx_t_3 = (__pyx_v_ndim == 1);
if (__pyx_t_3) {
/* "View.MemoryView":1341
* for i in range(shape[0]):
* if ndim == 1:
* if inc: # <<<<<<<<<<<<<<
* Py_INCREF(( data)[0])
* else:
*/
if (__pyx_v_inc) {
/* "View.MemoryView":1342
* if ndim == 1:
* if inc:
* Py_INCREF(( data)[0]) # <<<<<<<<<<<<<<
* else:
* Py_DECREF(( data)[0])
*/
Py_INCREF((((PyObject **)__pyx_v_data)[0]));
goto __pyx_L6;
}
/*else*/ {
/* "View.MemoryView":1344
* Py_INCREF(( data)[0])
* else:
* Py_DECREF(( data)[0]) # <<<<<<<<<<<<<<
* else:
* refcount_objects_in_slice(data, shape + 1, strides + 1,
*/
Py_DECREF((((PyObject **)__pyx_v_data)[0]));
}
__pyx_L6:;
goto __pyx_L5;
}
/*else*/ {
/* "View.MemoryView":1347
* else:
* refcount_objects_in_slice(data, shape + 1, strides + 1,
* ndim - 1, inc) # <<<<<<<<<<<<<<
*
* data += strides[0]
*/
__pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
}
__pyx_L5:;
/* "View.MemoryView":1349
* ndim - 1, inc)
*
* data += strides[0] # <<<<<<<<<<<<<<
*
*
*/
__pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
}
__Pyx_RefNannyFinishContext();
}
/* "View.MemoryView":1355
*
* @cname('__pyx_memoryview_slice_assign_scalar')
* cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
* size_t itemsize, void *item,
* bint dtype_is_object) nogil:
*/
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":1358
* size_t itemsize, void *item,
* bint dtype_is_object) nogil:
* refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
* _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
* itemsize, item)
*/
__pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
/* "View.MemoryView":1360
* refcount_copying(dst, dtype_is_object, ndim, False)
* _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
* itemsize, item) # <<<<<<<<<<<<<<
* refcount_copying(dst, dtype_is_object, ndim, True)
*
*/
__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":1361
* _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
* itemsize, item)
* refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
*
*
*/
__pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
}
/* "View.MemoryView":1365
*
* @cname('__pyx_memoryview__slice_assign_scalar')
* cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
* Py_ssize_t *strides, int ndim,
* size_t itemsize, void *item) nogil:
*/
static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) {
CYTHON_UNUSED Py_ssize_t __pyx_v_i;
Py_ssize_t __pyx_v_stride;
Py_ssize_t __pyx_v_extent;
int __pyx_t_1;
Py_ssize_t __pyx_t_2;
Py_ssize_t __pyx_t_3;
/* "View.MemoryView":1369
* size_t itemsize, void *item) nogil:
* cdef Py_ssize_t i
* cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<<
* cdef Py_ssize_t extent = shape[0]
*
*/
__pyx_v_stride = (__pyx_v_strides[0]);
/* "View.MemoryView":1370
* cdef Py_ssize_t i
* cdef Py_ssize_t stride = strides[0]
* cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<<
*
* if ndim == 1:
*/
__pyx_v_extent = (__pyx_v_shape[0]);
/* "View.MemoryView":1372
* cdef Py_ssize_t extent = shape[0]
*
* if ndim == 1: # <<<<<<<<<<<<<<
* for i in range(extent):
* memcpy(data, item, itemsize)
*/
__pyx_t_1 = (__pyx_v_ndim == 1);
if (__pyx_t_1) {
/* "View.MemoryView":1373
*
* if ndim == 1:
* for i in range(extent): # <<<<<<<<<<<<<<
* memcpy(data, item, itemsize)
* data += stride
*/
__pyx_t_2 = __pyx_v_extent;
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
/* "View.MemoryView":1374
* if ndim == 1:
* for i in range(extent):
* memcpy(data, item, itemsize) # <<<<<<<<<<<<<<
* data += stride
* else:
*/
memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize);
/* "View.MemoryView":1375
* for i in range(extent):
* memcpy(data, item, itemsize)
* data += stride # <<<<<<<<<<<<<<
* else:
* for i in range(extent):
*/
__pyx_v_data = (__pyx_v_data + __pyx_v_stride);
}
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":1377
* data += stride
* else:
* for i in range(extent): # <<<<<<<<<<<<<<
* _slice_assign_scalar(data, shape + 1, strides + 1,
* ndim - 1, itemsize, item)
*/
__pyx_t_2 = __pyx_v_extent;
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
/* "View.MemoryView":1379
* for i in range(extent):
* _slice_assign_scalar(data, shape + 1, strides + 1,
* ndim - 1, itemsize, item) # <<<<<<<<<<<<<<
* data += stride
*
*/
__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":1380
* _slice_assign_scalar(data, shape + 1, strides + 1,
* ndim - 1, itemsize, item)
* data += stride # <<<<<<<<<<<<<<
*
*
*/
__pyx_v_data = (__pyx_v_data + __pyx_v_stride);
}
}
__pyx_L3:;
}
static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
struct __pyx_array_obj *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
p = ((struct __pyx_array_obj *)o);
p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
if (__pyx_array___cinit__(o, a, k) < 0) {
Py_DECREF(o); o = 0;
}
return o;
}
static void __pyx_tp_dealloc_array(PyObject *o) {
struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
__pyx_array___dealloc__(o);
if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
Py_CLEAR(p->mode);
Py_CLEAR(p->_format);
(*Py_TYPE(o)->tp_free)(o);
}
static int __pyx_tp_traverse_array(PyObject *o, visitproc v, void *a) {
int e;
struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
if (p->mode) {
e = (*v)(p->mode, a); if (e) return e;
}
if (p->_format) {
e = (*v)(p->_format, a); if (e) return e;
}
return 0;
}
static int __pyx_tp_clear_array(PyObject *o) {
struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
PyObject* tmp;
tmp = ((PyObject*)p->mode);
p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->_format);
p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
PyObject *r;
PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
Py_DECREF(x);
return r;
}
static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
if (v) {
return __pyx_array___setitem__(o, i, v);
}
else {
PyErr_Format(PyExc_NotImplementedError,
"Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
return -1;
}
}
static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
PyObject *v = PyObject_GenericGetAttr(o, n);
if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
PyErr_Clear();
v = __pyx_array___getattr__(o, n);
}
return v;
}
static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
return get_memview(o);
}
static PyMethodDef __pyx_methods_array[] = {
{__Pyx_NAMESTR("__getattr__"), (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, __Pyx_DOCSTR(0)},
{0, 0, 0, 0}
};
static struct PyGetSetDef __pyx_getsets_array[] = {
{(char *)"memview", __pyx_getprop___pyx_array_memview, 0, 0, 0},
{0, 0, 0, 0, 0}
};
static PyNumberMethods __pyx_tp_as_number_array = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
#if PY_MAJOR_VERSION < 3
0, /*nb_divide*/
#endif
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
#if PY_MAJOR_VERSION < 3
0, /*nb_coerce*/
#endif
0, /*nb_int*/
#if PY_MAJOR_VERSION < 3
0, /*nb_long*/
#else
0, /*reserved*/
#endif
0, /*nb_float*/
#if PY_MAJOR_VERSION < 3
0, /*nb_oct*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*nb_hex*/
#endif
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
#if PY_MAJOR_VERSION < 3
0, /*nb_inplace_divide*/
#endif
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
0, /*nb_inplace_lshift*/
0, /*nb_inplace_rshift*/
0, /*nb_inplace_and*/
0, /*nb_inplace_xor*/
0, /*nb_inplace_or*/
0, /*nb_floor_divide*/
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
#if PY_VERSION_HEX >= 0x02050000
0, /*nb_index*/
#endif
};
static PySequenceMethods __pyx_tp_as_sequence_array = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
__pyx_sq_item_array, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
static PyMappingMethods __pyx_tp_as_mapping_array = {
0, /*mp_length*/
__pyx_array___getitem__, /*mp_subscript*/
__pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
};
static PyBufferProcs __pyx_tp_as_buffer_array = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getwritebuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getsegcount*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getcharbuffer*/
#endif
#if PY_VERSION_HEX >= 0x02060000
__pyx_array_getbuffer, /*bf_getbuffer*/
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /*bf_releasebuffer*/
#endif
};
static PyTypeObject __pyx_type___pyx_array = {
PyVarObject_HEAD_INIT(0, 0)
__Pyx_NAMESTR("cogent.align._pairwise_pogs.array"), /*tp_name*/
sizeof(struct __pyx_array_obj), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_array, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#else
0, /*reserved*/
#endif
0, /*tp_repr*/
&__pyx_tp_as_number_array, /*tp_as_number*/
&__pyx_tp_as_sequence_array, /*tp_as_sequence*/
&__pyx_tp_as_mapping_array, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
__pyx_tp_getattro_array, /*tp_getattro*/
0, /*tp_setattro*/
&__pyx_tp_as_buffer_array, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_array, /*tp_traverse*/
__pyx_tp_clear_array, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_array, /*tp_methods*/
0, /*tp_members*/
__pyx_getsets_array, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_array, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
0, /*tp_mro*/
0, /*tp_cache*/
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
#if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
#endif
};
static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
struct __pyx_MemviewEnum_obj *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
p = ((struct __pyx_MemviewEnum_obj *)o);
p->name = Py_None; Py_INCREF(Py_None);
return o;
}
static void __pyx_tp_dealloc_Enum(PyObject *o) {
struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
Py_CLEAR(p->name);
(*Py_TYPE(o)->tp_free)(o);
}
static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
int e;
struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
if (p->name) {
e = (*v)(p->name, a); if (e) return e;
}
return 0;
}
static int __pyx_tp_clear_Enum(PyObject *o) {
struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
PyObject* tmp;
tmp = ((PyObject*)p->name);
p->name = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
return 0;
}
static PyMethodDef __pyx_methods_Enum[] = {
{0, 0, 0, 0}
};
static PyNumberMethods __pyx_tp_as_number_Enum = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
#if PY_MAJOR_VERSION < 3
0, /*nb_divide*/
#endif
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
#if PY_MAJOR_VERSION < 3
0, /*nb_coerce*/
#endif
0, /*nb_int*/
#if PY_MAJOR_VERSION < 3
0, /*nb_long*/
#else
0, /*reserved*/
#endif
0, /*nb_float*/
#if PY_MAJOR_VERSION < 3
0, /*nb_oct*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*nb_hex*/
#endif
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
#if PY_MAJOR_VERSION < 3
0, /*nb_inplace_divide*/
#endif
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
0, /*nb_inplace_lshift*/
0, /*nb_inplace_rshift*/
0, /*nb_inplace_and*/
0, /*nb_inplace_xor*/
0, /*nb_inplace_or*/
0, /*nb_floor_divide*/
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
#if PY_VERSION_HEX >= 0x02050000
0, /*nb_index*/
#endif
};
static PySequenceMethods __pyx_tp_as_sequence_Enum = {
0, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
0, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
static PyMappingMethods __pyx_tp_as_mapping_Enum = {
0, /*mp_length*/
0, /*mp_subscript*/
0, /*mp_ass_subscript*/
};
static PyBufferProcs __pyx_tp_as_buffer_Enum = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getwritebuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getsegcount*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getcharbuffer*/
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /*bf_getbuffer*/
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /*bf_releasebuffer*/
#endif
};
static PyTypeObject __pyx_type___pyx_MemviewEnum = {
PyVarObject_HEAD_INIT(0, 0)
__Pyx_NAMESTR("cogent.align._pairwise_pogs.Enum"), /*tp_name*/
sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_Enum, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#else
0, /*reserved*/
#endif
__pyx_MemviewEnum___repr__, /*tp_repr*/
&__pyx_tp_as_number_Enum, /*tp_as_number*/
&__pyx_tp_as_sequence_Enum, /*tp_as_sequence*/
&__pyx_tp_as_mapping_Enum, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
&__pyx_tp_as_buffer_Enum, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_Enum, /*tp_traverse*/
__pyx_tp_clear_Enum, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_Enum, /*tp_methods*/
0, /*tp_members*/
0, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
__pyx_MemviewEnum___init__, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_Enum, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
0, /*tp_mro*/
0, /*tp_cache*/
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
#if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
#endif
};
static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
struct __pyx_memoryview_obj *p;
PyObject *o = (*t->tp_alloc)(t, 0);
if (!o) return 0;
p = ((struct __pyx_memoryview_obj *)o);
p->__pyx_vtab = __pyx_vtabptr_memoryview;
p->obj = Py_None; Py_INCREF(Py_None);
p->_size = Py_None; Py_INCREF(Py_None);
p->_array_interface = Py_None; Py_INCREF(Py_None);
p->view.obj = NULL;
if (__pyx_memoryview___cinit__(o, a, k) < 0) {
Py_DECREF(o); o = 0;
}
return o;
}
static void __pyx_tp_dealloc_memoryview(PyObject *o) {
struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
__pyx_memoryview___dealloc__(o);
if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
Py_CLEAR(p->obj);
Py_CLEAR(p->_size);
Py_CLEAR(p->_array_interface);
(*Py_TYPE(o)->tp_free)(o);
}
static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
int e;
struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
if (p->obj) {
e = (*v)(p->obj, a); if (e) return e;
}
if (p->_size) {
e = (*v)(p->_size, a); if (e) return e;
}
if (p->_array_interface) {
e = (*v)(p->_array_interface, a); if (e) return e;
}
if (p->view.obj) {
e = (*v)(p->view.obj, a); if (e) return e;
}
return 0;
}
static int __pyx_tp_clear_memoryview(PyObject *o) {
struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
PyObject* tmp;
tmp = ((PyObject*)p->obj);
p->obj = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->_size);
p->_size = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
tmp = ((PyObject*)p->_array_interface);
p->_array_interface = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
Py_CLEAR(p->view.obj);
return 0;
}
static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
PyObject *r;
PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
Py_DECREF(x);
return r;
}
static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
if (v) {
return __pyx_memoryview___setitem__(o, i, v);
}
else {
PyErr_Format(PyExc_NotImplementedError,
"Subscript deletion not supported by %s", Py_TYPE(o)->tp_name);
return -1;
}
}
static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_memoryview_transpose(o);
}
static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_memoryview__get__base(o);
}
static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_memoryview_get_shape(o);
}
static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_memoryview_get_strides(o);
}
static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_memoryview_get_suboffsets(o);
}
static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_memoryview_get_ndim(o);
}
static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_memoryview_get_itemsize(o);
}
static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_memoryview_get_nbytes(o);
}
static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_memoryview_get_size(o);
}
static PyMethodDef __pyx_methods_memoryview[] = {
{__Pyx_NAMESTR("is_c_contig"), (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
{__Pyx_NAMESTR("is_f_contig"), (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, __Pyx_DOCSTR(0)},
{__Pyx_NAMESTR("copy"), (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, __Pyx_DOCSTR(0)},
{__Pyx_NAMESTR("copy_fortran"), (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, __Pyx_DOCSTR(0)},
{0, 0, 0, 0}
};
static struct PyGetSetDef __pyx_getsets_memoryview[] = {
{(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, 0, 0},
{(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, 0, 0},
{(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, 0, 0},
{(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, 0, 0},
{(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, 0, 0},
{(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, 0, 0},
{(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, 0, 0},
{(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, 0, 0},
{(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, 0, 0},
{0, 0, 0, 0, 0}
};
static PyNumberMethods __pyx_tp_as_number_memoryview = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
#if PY_MAJOR_VERSION < 3
0, /*nb_divide*/
#endif
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
#if PY_MAJOR_VERSION < 3
0, /*nb_coerce*/
#endif
0, /*nb_int*/
#if PY_MAJOR_VERSION < 3
0, /*nb_long*/
#else
0, /*reserved*/
#endif
0, /*nb_float*/
#if PY_MAJOR_VERSION < 3
0, /*nb_oct*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*nb_hex*/
#endif
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
#if PY_MAJOR_VERSION < 3
0, /*nb_inplace_divide*/
#endif
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
0, /*nb_inplace_lshift*/
0, /*nb_inplace_rshift*/
0, /*nb_inplace_and*/
0, /*nb_inplace_xor*/
0, /*nb_inplace_or*/
0, /*nb_floor_divide*/
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
#if PY_VERSION_HEX >= 0x02050000
0, /*nb_index*/
#endif
};
static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
__pyx_memoryview___len__, /*sq_length*/
0, /*sq_concat*/
0, /*sq_repeat*/
__pyx_sq_item_memoryview, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
__pyx_memoryview___len__, /*mp_length*/
__pyx_memoryview___getitem__, /*mp_subscript*/
__pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
};
static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getwritebuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getsegcount*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getcharbuffer*/
#endif
#if PY_VERSION_HEX >= 0x02060000
__pyx_memoryview_getbuffer, /*bf_getbuffer*/
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /*bf_releasebuffer*/
#endif
};
static PyTypeObject __pyx_type___pyx_memoryview = {
PyVarObject_HEAD_INIT(0, 0)
__Pyx_NAMESTR("cogent.align._pairwise_pogs.memoryview"), /*tp_name*/
sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc_memoryview, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#else
0, /*reserved*/
#endif
__pyx_memoryview___repr__, /*tp_repr*/
&__pyx_tp_as_number_memoryview, /*tp_as_number*/
&__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
&__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
__pyx_memoryview___str__, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
&__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
0, /*tp_doc*/
__pyx_tp_traverse_memoryview, /*tp_traverse*/
__pyx_tp_clear_memoryview, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods_memoryview, /*tp_methods*/
0, /*tp_members*/
__pyx_getsets_memoryview, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new_memoryview, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
0, /*tp_mro*/
0, /*tp_cache*/
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
#if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
#endif
};
static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
struct __pyx_memoryviewslice_obj *p;
PyObject *o = __pyx_tp_new_memoryview(t, a, k);
if (!o) return 0;
p = ((struct __pyx_memoryviewslice_obj *)o);
p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
p->from_object = Py_None; Py_INCREF(Py_None);
p->from_slice.memview = NULL;
return o;
}
static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
{
PyObject *etype, *eval, *etb;
PyErr_Fetch(&etype, &eval, &etb);
++Py_REFCNT(o);
__pyx_memoryviewslice___dealloc__(o);
if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
--Py_REFCNT(o);
PyErr_Restore(etype, eval, etb);
}
Py_CLEAR(p->from_object);
__pyx_tp_dealloc_memoryview(o);
}
static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
int e;
struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
if (p->from_object) {
e = (*v)(p->from_object, a); if (e) return e;
}
return 0;
}
static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
PyObject* tmp;
__pyx_tp_clear_memoryview(o);
tmp = ((PyObject*)p->from_object);
p->from_object = Py_None; Py_INCREF(Py_None);
Py_XDECREF(tmp);
__PYX_XDEC_MEMVIEW(&p->from_slice, 1);
return 0;
}
static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
return __pyx_memoryviewslice__get__base(o);
}
static PyMethodDef __pyx_methods__memoryviewslice[] = {
{0, 0, 0, 0}
};
static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
{(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, 0, 0},
{0, 0, 0, 0, 0}
};
static PyNumberMethods __pyx_tp_as_number__memoryviewslice = {
0, /*nb_add*/
0, /*nb_subtract*/
0, /*nb_multiply*/
#if PY_MAJOR_VERSION < 3
0, /*nb_divide*/
#endif
0, /*nb_remainder*/
0, /*nb_divmod*/
0, /*nb_power*/
0, /*nb_negative*/
0, /*nb_positive*/
0, /*nb_absolute*/
0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
#if PY_MAJOR_VERSION < 3
0, /*nb_coerce*/
#endif
0, /*nb_int*/
#if PY_MAJOR_VERSION < 3
0, /*nb_long*/
#else
0, /*reserved*/
#endif
0, /*nb_float*/
#if PY_MAJOR_VERSION < 3
0, /*nb_oct*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*nb_hex*/
#endif
0, /*nb_inplace_add*/
0, /*nb_inplace_subtract*/
0, /*nb_inplace_multiply*/
#if PY_MAJOR_VERSION < 3
0, /*nb_inplace_divide*/
#endif
0, /*nb_inplace_remainder*/
0, /*nb_inplace_power*/
0, /*nb_inplace_lshift*/
0, /*nb_inplace_rshift*/
0, /*nb_inplace_and*/
0, /*nb_inplace_xor*/
0, /*nb_inplace_or*/
0, /*nb_floor_divide*/
0, /*nb_true_divide*/
0, /*nb_inplace_floor_divide*/
0, /*nb_inplace_true_divide*/
#if PY_VERSION_HEX >= 0x02050000
0, /*nb_index*/
#endif
};
static PySequenceMethods __pyx_tp_as_sequence__memoryviewslice = {
#if CYTHON_COMPILING_IN_PYPY
__pyx_memoryview___len__, /*sq_length*/
#else
0, /*sq_length*/
#endif
0, /*sq_concat*/
0, /*sq_repeat*/
0, /*sq_item*/
0, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
0, /*sq_contains*/
0, /*sq_inplace_concat*/
0, /*sq_inplace_repeat*/
};
static PyMappingMethods __pyx_tp_as_mapping__memoryviewslice = {
#if CYTHON_COMPILING_IN_PYPY
__pyx_memoryview___len__, /*mp_length*/
#else
0, /*mp_length*/
#endif
#if CYTHON_COMPILING_IN_PYPY
__pyx_memoryview___getitem__, /*mp_subscript*/
#else
0, /*mp_subscript*/
#endif
0, /*mp_ass_subscript*/
};
static PyBufferProcs __pyx_tp_as_buffer__memoryviewslice = {
#if PY_MAJOR_VERSION < 3
0, /*bf_getreadbuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getwritebuffer*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getsegcount*/
#endif
#if PY_MAJOR_VERSION < 3
0, /*bf_getcharbuffer*/
#endif
#if CYTHON_COMPILING_IN_PYPY
__pyx_memoryview_getbuffer, /*bf_getbuffer*/
#else
#if PY_VERSION_HEX >= 0x02060000
0, /*bf_getbuffer*/
#endif
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /*bf_releasebuffer*/
#endif
};
static PyTypeObject __pyx_type___pyx_memoryviewslice = {
PyVarObject_HEAD_INIT(0, 0)
__Pyx_NAMESTR("cogent.align._pairwise_pogs._memoryviewslice"), /*tp_name*/
sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
0, /*tp_itemsize*/
__pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
#if PY_MAJOR_VERSION < 3
0, /*tp_compare*/
#else
0, /*reserved*/
#endif
#if CYTHON_COMPILING_IN_PYPY
__pyx_memoryview___repr__, /*tp_repr*/
#else
0, /*tp_repr*/
#endif
&__pyx_tp_as_number__memoryviewslice, /*tp_as_number*/
&__pyx_tp_as_sequence__memoryviewslice, /*tp_as_sequence*/
&__pyx_tp_as_mapping__memoryviewslice, /*tp_as_mapping*/
0, /*tp_hash*/
0, /*tp_call*/
#if CYTHON_COMPILING_IN_PYPY
__pyx_memoryview___str__, /*tp_str*/
#else
0, /*tp_str*/
#endif
0, /*tp_getattro*/
0, /*tp_setattro*/
&__pyx_tp_as_buffer__memoryviewslice, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
__Pyx_DOCSTR("Internal class for passing memoryview slices to Python"), /*tp_doc*/
__pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
__pyx_tp_clear__memoryviewslice, /*tp_clear*/
0, /*tp_richcompare*/
0, /*tp_weaklistoffset*/
0, /*tp_iter*/
0, /*tp_iternext*/
__pyx_methods__memoryviewslice, /*tp_methods*/
0, /*tp_members*/
__pyx_getsets__memoryviewslice, /*tp_getset*/
0, /*tp_base*/
0, /*tp_dict*/
0, /*tp_descr_get*/
0, /*tp_descr_set*/
0, /*tp_dictoffset*/
0, /*tp_init*/
0, /*tp_alloc*/
__pyx_tp_new__memoryviewslice, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
0, /*tp_bases*/
0, /*tp_mro*/
0, /*tp_cache*/
0, /*tp_subclasses*/
0, /*tp_weaklist*/
0, /*tp_del*/
#if PY_VERSION_HEX >= 0x02060000
0, /*tp_version_tag*/
#endif
};
static PyMethodDef __pyx_methods[] = {
{0, 0, 0, 0}
};
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
PyModuleDef_HEAD_INIT,
__Pyx_NAMESTR("_pairwise_pogs"),
0, /* m_doc */
-1, /* m_size */
__pyx_methods /* m_methods */,
NULL, /* m_reload */
NULL, /* m_traverse */
NULL, /* m_clear */
NULL /* m_free */
};
#endif
static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
{&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
{&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
{&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
{&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
{&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
{&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
{&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
{&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
{&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0},
{&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0},
{&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
{&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0},
{&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0},
{&__pyx_kp_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 0},
{&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
{&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
{&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
{&__pyx_kp_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 0},
{&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0},
{&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0},
{&__pyx_kp_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 0},
{&__pyx_kp_s_46, __pyx_k_46, sizeof(__pyx_k_46), 0, 0, 1, 0},
{&__pyx_kp_s_48, __pyx_k_48, sizeof(__pyx_k_48), 0, 0, 1, 0},
{&__pyx_kp_s_52, __pyx_k_52, sizeof(__pyx_k_52), 0, 0, 1, 0},
{&__pyx_n_s_53, __pyx_k_53, sizeof(__pyx_k_53), 0, 0, 1, 1},
{&__pyx_n_s_54, __pyx_k_54, sizeof(__pyx_k_54), 0, 0, 1, 1},
{&__pyx_n_s_55, __pyx_k_55, sizeof(__pyx_k_55), 0, 0, 1, 1},
{&__pyx_n_s_56, __pyx_k_56, sizeof(__pyx_k_56), 0, 0, 1, 1},
{&__pyx_kp_s_60, __pyx_k_60, sizeof(__pyx_k_60), 0, 0, 1, 0},
{&__pyx_kp_s_62, __pyx_k_62, sizeof(__pyx_k_62), 0, 0, 1, 0},
{&__pyx_kp_s_64, __pyx_k_64, sizeof(__pyx_k_64), 0, 0, 1, 0},
{&__pyx_kp_s_66, __pyx_k_66, sizeof(__pyx_k_66), 0, 0, 1, 0},
{&__pyx_kp_s_68, __pyx_k_68, sizeof(__pyx_k_68), 0, 0, 1, 0},
{&__pyx_kp_s__1st, __pyx_k__1st, sizeof(__pyx_k__1st), 0, 0, 1, 0},
{&__pyx_kp_s__2nd, __pyx_k__2nd, sizeof(__pyx_k__2nd), 0, 0, 1, 0},
{&__pyx_kp_s__3rd, __pyx_k__3rd, sizeof(__pyx_k__3rd), 0, 0, 1, 0},
{&__pyx_n_s__ASCII, __pyx_k__ASCII, sizeof(__pyx_k__ASCII), 0, 0, 1, 1},
{&__pyx_n_s__ArithmeticError, __pyx_k__ArithmeticError, sizeof(__pyx_k__ArithmeticError), 0, 0, 1, 1},
{&__pyx_n_s__Ellipsis, __pyx_k__Ellipsis, sizeof(__pyx_k__Ellipsis), 0, 0, 1, 1},
{&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1},
{&__pyx_n_s__MemoryError, __pyx_k__MemoryError, sizeof(__pyx_k__MemoryError), 0, 0, 1, 1},
{&__pyx_n_s__N, __pyx_k__N, sizeof(__pyx_k__N), 0, 0, 1, 1},
{&__pyx_n_b__O, __pyx_k__O, sizeof(__pyx_k__O), 0, 0, 0, 1},
{&__pyx_n_s__T, __pyx_k__T, sizeof(__pyx_k__T), 0, 0, 1, 1},
{&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1},
{&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
{&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1},
{&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
{&__pyx_n_s____name__, __pyx_k____name__, sizeof(__pyx_k____name__), 0, 0, 1, 1},
{&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1},
{&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
{&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1},
{&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1},
{&__pyx_n_s__a_count, __pyx_k__a_count, sizeof(__pyx_k__a_count), 0, 0, 1, 1},
{&__pyx_n_s__a_high, __pyx_k__a_high, sizeof(__pyx_k__a_high), 0, 0, 1, 1},
{&__pyx_n_s__a_low, __pyx_k__a_low, sizeof(__pyx_k__a_low), 0, 0, 1, 1},
{&__pyx_n_s__allocate_buffer, __pyx_k__allocate_buffer, sizeof(__pyx_k__allocate_buffer), 0, 0, 1, 1},
{&__pyx_n_s__asCombinedArray, __pyx_k__asCombinedArray, sizeof(__pyx_k__asCombinedArray), 0, 0, 1, 1},
{&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1},
{&__pyx_n_s__b_count, __pyx_k__b_count, sizeof(__pyx_k__b_count), 0, 0, 1, 1},
{&__pyx_n_s__b_high, __pyx_k__b_high, sizeof(__pyx_k__b_high), 0, 0, 1, 1},
{&__pyx_n_s__b_low, __pyx_k__b_low, sizeof(__pyx_k__b_low), 0, 0, 1, 1},
{&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1},
{&__pyx_n_s__bin, __pyx_k__bin, sizeof(__pyx_k__bin), 0, 0, 1, 1},
{&__pyx_n_s__bin_count, __pyx_k__bin_count, sizeof(__pyx_k__bin_count), 0, 0, 1, 1},
{&__pyx_n_b__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 0, 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__calc_rows, __pyx_k__calc_rows, sizeof(__pyx_k__calc_rows), 0, 0, 1, 1},
{&__pyx_n_s__current_row_index, __pyx_k__current_row_index, sizeof(__pyx_k__current_row_index), 0, 0, 1, 1},
{&__pyx_n_s__d4, __pyx_k__d4, sizeof(__pyx_k__d4), 0, 0, 1, 1},
{&__pyx_n_s__d_score, __pyx_k__d_score, sizeof(__pyx_k__d_score), 0, 0, 1, 1},
{&__pyx_n_s__decode, __pyx_k__decode, sizeof(__pyx_k__decode), 0, 0, 1, 1},
{&__pyx_n_s__dest_state, __pyx_k__dest_state, sizeof(__pyx_k__dest_state), 0, 0, 1, 1},
{&__pyx_n_s__dest_states, __pyx_k__dest_states, sizeof(__pyx_k__dest_states), 0, 0, 1, 1},
{&__pyx_n_s__dtype_is_object, __pyx_k__dtype_is_object, sizeof(__pyx_k__dtype_is_object), 0, 0, 1, 1},
{&__pyx_n_s__dx, __pyx_k__dx, sizeof(__pyx_k__dx), 0, 0, 1, 1},
{&__pyx_n_s__dy, __pyx_k__dy, sizeof(__pyx_k__dy), 0, 0, 1, 1},
{&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1},
{&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1},
{&__pyx_n_s__error, __pyx_k__error, sizeof(__pyx_k__error), 0, 0, 1, 1},
{&__pyx_n_s__exponent, __pyx_k__exponent, sizeof(__pyx_k__exponent), 0, 0, 1, 1},
{&__pyx_n_s__exponents, __pyx_k__exponents, sizeof(__pyx_k__exponents), 0, 0, 1, 1},
{&__pyx_n_s__extend, __pyx_k__extend, sizeof(__pyx_k__extend), 0, 0, 1, 1},
{&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1},
{&__pyx_n_s__fmpt, __pyx_k__fmpt, sizeof(__pyx_k__fmpt), 0, 0, 1, 1},
{&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1},
{&__pyx_n_b__fortran, __pyx_k__fortran, sizeof(__pyx_k__fortran), 0, 0, 0, 1},
{&__pyx_n_s__fortran, __pyx_k__fortran, sizeof(__pyx_k__fortran), 0, 0, 1, 1},
{&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1},
{&__pyx_n_s__i_high, __pyx_k__i_high, sizeof(__pyx_k__i_high), 0, 0, 1, 1},
{&__pyx_n_s__i_link_count, __pyx_k__i_link_count, sizeof(__pyx_k__i_link_count), 0, 0, 1, 1},
{&__pyx_n_s__i_low, __pyx_k__i_low, sizeof(__pyx_k__i_low), 0, 0, 1, 1},
{&__pyx_n_s__i_sources, __pyx_k__i_sources, sizeof(__pyx_k__i_sources), 0, 0, 1, 1},
{&__pyx_n_s__i_sources_end, __pyx_k__i_sources_end, sizeof(__pyx_k__i_sources_end), 0, 0, 1, 1},
{&__pyx_n_s__i_sources_offsets, __pyx_k__i_sources_offsets, sizeof(__pyx_k__i_sources_offsets), 0, 0, 1, 1},
{&__pyx_n_s__i_sources_start, __pyx_k__i_sources_start, sizeof(__pyx_k__i_sources_start), 0, 0, 1, 1},
{&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1},
{&__pyx_n_s__impossible, __pyx_k__impossible, sizeof(__pyx_k__impossible), 0, 0, 1, 1},
{&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1},
{&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1},
{&__pyx_n_s__j_high, __pyx_k__j_high, sizeof(__pyx_k__j_high), 0, 0, 1, 1},
{&__pyx_n_s__j_link_count, __pyx_k__j_link_count, sizeof(__pyx_k__j_link_count), 0, 0, 1, 1},
{&__pyx_n_s__j_low, __pyx_k__j_low, sizeof(__pyx_k__j_low), 0, 0, 1, 1},
{&__pyx_n_s__j_sources, __pyx_k__j_sources, sizeof(__pyx_k__j_sources), 0, 0, 1, 1},
{&__pyx_n_s__j_sources_end, __pyx_k__j_sources_end, sizeof(__pyx_k__j_sources_end), 0, 0, 1, 1},
{&__pyx_n_s__j_sources_offsets, __pyx_k__j_sources_offsets, sizeof(__pyx_k__j_sources_offsets), 0, 0, 1, 1},
{&__pyx_n_s__j_sources_start, __pyx_k__j_sources_start, sizeof(__pyx_k__j_sources_start), 0, 0, 1, 1},
{&__pyx_n_s__last_i, __pyx_k__last_i, sizeof(__pyx_k__last_i), 0, 0, 1, 1},
{&__pyx_n_s__last_j, __pyx_k__last_j, sizeof(__pyx_k__last_j), 0, 0, 1, 1},
{&__pyx_n_s__last_state, __pyx_k__last_state, sizeof(__pyx_k__last_state), 0, 0, 1, 1},
{&__pyx_n_s__local, __pyx_k__local, sizeof(__pyx_k__local), 0, 0, 1, 1},
{&__pyx_n_s__mantissa, __pyx_k__mantissa, sizeof(__pyx_k__mantissa), 0, 0, 1, 1},
{&__pyx_n_s__mantissas, __pyx_k__mantissas, sizeof(__pyx_k__mantissas), 0, 0, 1, 1},
{&__pyx_n_s__match_scores, __pyx_k__match_scores, sizeof(__pyx_k__match_scores), 0, 0, 1, 1},
{&__pyx_n_s__max_exponent, __pyx_k__max_exponent, sizeof(__pyx_k__max_exponent), 0, 0, 1, 1},
{&__pyx_n_s__max_mantissa, __pyx_k__max_mantissa, sizeof(__pyx_k__max_mantissa), 0, 0, 1, 1},
{&__pyx_n_s__max_x, __pyx_k__max_x, sizeof(__pyx_k__max_x), 0, 0, 1, 1},
{&__pyx_n_s__max_y, __pyx_k__max_y, sizeof(__pyx_k__max_y), 0, 0, 1, 1},
{&__pyx_n_s__memview, __pyx_k__memview, sizeof(__pyx_k__memview), 0, 0, 1, 1},
{&__pyx_n_s__min_prev_state, __pyx_k__min_prev_state, sizeof(__pyx_k__min_prev_state), 0, 0, 1, 1},
{&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1},
{&__pyx_n_s__msg, __pyx_k__msg, sizeof(__pyx_k__msg), 0, 0, 1, 1},
{&__pyx_n_s__name, __pyx_k__name, sizeof(__pyx_k__name), 0, 0, 1, 1},
{&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1},
{&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1},
{&__pyx_n_s__pack, __pyx_k__pack, sizeof(__pyx_k__pack), 0, 0, 1, 1},
{&__pyx_n_s__partial_sum, __pyx_k__partial_sum, sizeof(__pyx_k__partial_sum), 0, 0, 1, 1},
{&__pyx_n_s__plan, __pyx_k__plan, sizeof(__pyx_k__plan), 0, 0, 1, 1},
{&__pyx_n_s__pog1, __pyx_k__pog1, sizeof(__pyx_k__pog1), 0, 0, 1, 1},
{&__pyx_n_s__pog2, __pyx_k__pog2, sizeof(__pyx_k__pog2), 0, 0, 1, 1},
{&__pyx_n_s__pointer_a, __pyx_k__pointer_a, sizeof(__pyx_k__pointer_a), 0, 0, 1, 1},
{&__pyx_n_s__pointer_b, __pyx_k__pointer_b, sizeof(__pyx_k__pointer_b), 0, 0, 1, 1},
{&__pyx_n_s__pointer_state, __pyx_k__pointer_state, sizeof(__pyx_k__pointer_state), 0, 0, 1, 1},
{&__pyx_n_s__preds, __pyx_k__preds, sizeof(__pyx_k__preds), 0, 0, 1, 1},
{&__pyx_n_s__prev_i, __pyx_k__prev_i, sizeof(__pyx_k__prev_i), 0, 0, 1, 1},
{&__pyx_n_s__prev_j, __pyx_k__prev_j, sizeof(__pyx_k__prev_j), 0, 0, 1, 1},
{&__pyx_n_s__prev_state, __pyx_k__prev_state, sizeof(__pyx_k__prev_state), 0, 0, 1, 1},
{&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
{&__pyx_n_s__row_count, __pyx_k__row_count, sizeof(__pyx_k__row_count), 0, 0, 1, 1},
{&__pyx_n_s__row_count1, __pyx_k__row_count1, sizeof(__pyx_k__row_count1), 0, 0, 1, 1},
{&__pyx_n_s__row_length, __pyx_k__row_length, sizeof(__pyx_k__row_length), 0, 0, 1, 1},
{&__pyx_n_s__row_length1, __pyx_k__row_length1, sizeof(__pyx_k__row_length1), 0, 0, 1, 1},
{&__pyx_n_s__rows, __pyx_k__rows, sizeof(__pyx_k__rows), 0, 0, 1, 1},
{&__pyx_n_s__score, __pyx_k__score, sizeof(__pyx_k__score), 0, 0, 1, 1},
{&__pyx_n_s__seq1_index, __pyx_k__seq1_index, sizeof(__pyx_k__seq1_index), 0, 0, 1, 1},
{&__pyx_n_s__seq2_index, __pyx_k__seq2_index, sizeof(__pyx_k__seq2_index), 0, 0, 1, 1},
{&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1},
{&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
{&__pyx_n_s__source_row_index, __pyx_k__source_row_index, sizeof(__pyx_k__source_row_index), 0, 0, 1, 1},
{&__pyx_n_s__start, __pyx_k__start, sizeof(__pyx_k__start), 0, 0, 1, 1},
{&__pyx_n_s__state, __pyx_k__state, sizeof(__pyx_k__state), 0, 0, 1, 1},
{&__pyx_n_s__state_directions, __pyx_k__state_directions, sizeof(__pyx_k__state_directions), 0, 0, 1, 1},
{&__pyx_n_s__step, __pyx_k__step, sizeof(__pyx_k__step), 0, 0, 1, 1},
{&__pyx_n_s__stop, __pyx_k__stop, sizeof(__pyx_k__stop), 0, 0, 1, 1},
{&__pyx_n_s__struct, __pyx_k__struct, sizeof(__pyx_k__struct), 0, 0, 1, 1},
{&__pyx_n_s__sub_partial_sum, __pyx_k__sub_partial_sum, sizeof(__pyx_k__sub_partial_sum), 0, 0, 1, 1},
{&__pyx_n_s__tcode_s, __pyx_k__tcode_s, sizeof(__pyx_k__tcode_s), 0, 0, 1, 1},
{&__pyx_n_s__tcode_x, __pyx_k__tcode_x, sizeof(__pyx_k__tcode_x), 0, 0, 1, 1},
{&__pyx_n_s__tcode_y, __pyx_k__tcode_y, sizeof(__pyx_k__tcode_y), 0, 0, 1, 1},
{&__pyx_n_s__tmp_rows, __pyx_k__tmp_rows, sizeof(__pyx_k__tmp_rows), 0, 0, 1, 1},
{&__pyx_n_s__track, __pyx_k__track, sizeof(__pyx_k__track), 0, 0, 1, 1},
{&__pyx_n_s__track_enc, __pyx_k__track_enc, sizeof(__pyx_k__track_enc), 0, 0, 1, 1},
{&__pyx_n_s__underflows, __pyx_k__underflows, sizeof(__pyx_k__underflows), 0, 0, 1, 1},
{&__pyx_n_s__unpack, __pyx_k__unpack, sizeof(__pyx_k__unpack), 0, 0, 1, 1},
{&__pyx_n_s__use_logs, __pyx_k__use_logs, sizeof(__pyx_k__use_logs), 0, 0, 1, 1},
{&__pyx_n_s__use_scaling, __pyx_k__use_scaling, sizeof(__pyx_k__use_scaling), 0, 0, 1, 1},
{&__pyx_n_s__version_info, __pyx_k__version_info, sizeof(__pyx_k__version_info), 0, 0, 1, 1},
{&__pyx_n_s__viterbi, __pyx_k__viterbi, sizeof(__pyx_k__viterbi), 0, 0, 1, 1},
{&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1},
{&__pyx_n_s__xgap_scores, __pyx_k__xgap_scores, sizeof(__pyx_k__xgap_scores), 0, 0, 1, 1},
{&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1},
{&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1},
{&__pyx_n_s__ygap_scores, __pyx_k__ygap_scores, sizeof(__pyx_k__ygap_scores), 0, 0, 1, 1},
{0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
__pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_ArithmeticError = __Pyx_GetName(__pyx_b, __pyx_n_s__ArithmeticError); if (!__pyx_builtin_ArithmeticError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_MemoryError = __Pyx_GetName(__pyx_b, __pyx_n_s__MemoryError); if (!__pyx_builtin_MemoryError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_Ellipsis = __Pyx_GetName(__pyx_b, __pyx_n_s__Ellipsis); if (!__pyx_builtin_Ellipsis) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if PY_MAJOR_VERSION >= 3
__pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__pyx_builtin_id = __Pyx_GetName(__pyx_b, __pyx_n_s__id); if (!__pyx_builtin_id) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
return 0;
__pyx_L1_error:;
return -1;
}
static int __Pyx_InitCachedConstants(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":64
* cdef int checkArray1D(num[::1] a, dim *x) except 1:
* if a is None:
* raise ValueError('Array required, got None') # <<<<<<<<<<<<<<
* checkDim('1st', a.shape[0], x)
*
*/
__pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_4);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":69
* cdef int checkArray2D(num[:, ::1] a, dim *x, dim *y) except 1:
* if a is None:
* raise ValueError('Array required, got None') # <<<<<<<<<<<<<<
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
*/
__pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_5);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_3));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5));
__pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_6);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_s_3));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":75
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
* if a is None:
* raise ValueError('Array required, got None') # <<<<<<<<<<<<<<
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
*/
__pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_7);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_s_3));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
__pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_8);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_3));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8));
__pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_9);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_s_3));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
/* "View.MemoryView":124
*
* if not self.ndim:
* raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
*
* if self.itemsize <= 0:
*/
__pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_16);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_15));
PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_s_15));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16));
/* "View.MemoryView":127
*
* if self.itemsize <= 0:
* raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
*
* encode = getattr(format, 'encode', None)
*/
__pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_18);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_17));
PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_s_17));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18));
/* "View.MemoryView":131
* encode = getattr(format, 'encode', None)
* if encode:
* format = encode('ASCII') # <<<<<<<<<<<<<<
* self._format = format
* self.format = self._format
*/
__pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_19);
__Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_n_s__ASCII));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19));
/* "View.MemoryView":141
* free(self._shape)
* free(self._strides)
* raise MemoryError("unable to allocate shape or strides.") # <<<<<<<<<<<<<<
*
*
*/
__pyx_k_tuple_21 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_21);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_20));
PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_kp_s_20));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21));
/* "View.MemoryView":166
* decode = getattr(mode, 'decode', None)
* if decode:
* mode = decode('ASCII') # <<<<<<<<<<<<<<
* self.mode = mode
*
*/
__pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_24);
__Pyx_INCREF(((PyObject *)__pyx_n_s__ASCII));
PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_n_s__ASCII));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__ASCII));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24));
/* "View.MemoryView":174
* self.data = malloc(self.len)
* if not self.data:
* raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
*
* if self.dtype_is_object:
*/
__pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_26);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_25));
PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_s_25));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_25));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26));
/* "View.MemoryView":190
* 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_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_28);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_27));
PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_kp_s_27));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_27));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28));
/* "View.MemoryView":452
* 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_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_30);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_29));
PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_s_29));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_29));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30));
/* "View.MemoryView":528
* if self.view.strides == NULL:
*
* raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
*
* return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
*/
__pyx_k_tuple_32 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_32);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_31));
PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_kp_s_31));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_31));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32));
/* "View.MemoryView":643
* if item is Ellipsis:
* if not seen_ellipsis:
* result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
* seen_ellipsis = True
* else:
*/
__pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_35);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
/* "View.MemoryView":646
* seen_ellipsis = True
* else:
* result.append(slice(None)) # <<<<<<<<<<<<<<
* have_slices = True
* else:
*/
__pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_36);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
/* "View.MemoryView":657
* nslices = ndim - len(result)
* if nslices:
* result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<<
*
* return have_slices or nslices, tuple(result)
*/
__pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_38);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
/* "View.MemoryView":665
* for i in range(ndim):
* if suboffsets[i] >= 0:
* raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
*
*
*/
__pyx_k_tuple_40 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_40);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_39));
PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_kp_s_39));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_39));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40));
/* "cogent/align/_pairwise_pogs.pyx":14
* double log (double x)
*
* version_info = (3, 2) # <<<<<<<<<<<<<<
* __version__ = "('1', '5', '3-dev')"
*
*/
__pyx_k_tuple_49 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_49);
__Pyx_INCREF(__pyx_int_3);
PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, __pyx_int_3);
__Pyx_GIVEREF(__pyx_int_3);
__Pyx_INCREF(__pyx_int_2);
PyTuple_SET_ITEM(__pyx_k_tuple_49, 1, __pyx_int_2);
__Pyx_GIVEREF(__pyx_int_2);
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49));
/* "cogent/align/_pairwise_pogs.pyx":28
* MAX_SCALE = +10000 # or 0 if all numbers should be probabilities
*
* def fmpt(mantissa, exponent, msg=''): # <<<<<<<<<<<<<<
* return "%s * SCALE_STEP ** %s %s" % (mantissa, exponent, msg)
*
*/
__pyx_k_tuple_50 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_50);
__Pyx_INCREF(((PyObject *)__pyx_n_s__mantissa));
PyTuple_SET_ITEM(__pyx_k_tuple_50, 0, ((PyObject *)__pyx_n_s__mantissa));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__mantissa));
__Pyx_INCREF(((PyObject *)__pyx_n_s__exponent));
PyTuple_SET_ITEM(__pyx_k_tuple_50, 1, ((PyObject *)__pyx_n_s__exponent));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__exponent));
__Pyx_INCREF(((PyObject *)__pyx_n_s__msg));
PyTuple_SET_ITEM(__pyx_k_tuple_50, 2, ((PyObject *)__pyx_n_s__msg));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__msg));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50));
__pyx_k_codeobj_51 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_52, __pyx_n_s__fmpt, 28, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_51)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":33
* ctypedef unsigned char [:,:,::1] UChar3D
*
* def calc_rows(Long1D plan, Long1D seq1_index, Long1D seq2_index, # <<<<<<<<<<<<<<
* int i_low, int i_high, int j_low, int j_high, preds,
* Long2D state_directions, Double2D T,
*/
__pyx_k_tuple_57 = PyTuple_New(89); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_57);
__Pyx_INCREF(((PyObject *)__pyx_n_s__plan));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, ((PyObject *)__pyx_n_s__plan));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__plan));
__Pyx_INCREF(((PyObject *)__pyx_n_s__seq1_index));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 1, ((PyObject *)__pyx_n_s__seq1_index));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__seq1_index));
__Pyx_INCREF(((PyObject *)__pyx_n_s__seq2_index));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 2, ((PyObject *)__pyx_n_s__seq2_index));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__seq2_index));
__Pyx_INCREF(((PyObject *)__pyx_n_s__i_low));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 3, ((PyObject *)__pyx_n_s__i_low));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__i_low));
__Pyx_INCREF(((PyObject *)__pyx_n_s__i_high));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 4, ((PyObject *)__pyx_n_s__i_high));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__i_high));
__Pyx_INCREF(((PyObject *)__pyx_n_s__j_low));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 5, ((PyObject *)__pyx_n_s__j_low));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__j_low));
__Pyx_INCREF(((PyObject *)__pyx_n_s__j_high));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 6, ((PyObject *)__pyx_n_s__j_high));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__j_high));
__Pyx_INCREF(((PyObject *)__pyx_n_s__preds));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 7, ((PyObject *)__pyx_n_s__preds));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__preds));
__Pyx_INCREF(((PyObject *)__pyx_n_s__state_directions));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 8, ((PyObject *)__pyx_n_s__state_directions));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__state_directions));
__Pyx_INCREF(((PyObject *)__pyx_n_s__T));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 9, ((PyObject *)__pyx_n_s__T));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__T));
__Pyx_INCREF(((PyObject *)__pyx_n_s__xgap_scores));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 10, ((PyObject *)__pyx_n_s__xgap_scores));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__xgap_scores));
__Pyx_INCREF(((PyObject *)__pyx_n_s__ygap_scores));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 11, ((PyObject *)__pyx_n_s__ygap_scores));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__ygap_scores));
__Pyx_INCREF(((PyObject *)__pyx_n_s__match_scores));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 12, ((PyObject *)__pyx_n_s__match_scores));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__match_scores));
__Pyx_INCREF(((PyObject *)__pyx_n_s__rows));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 13, ((PyObject *)__pyx_n_s__rows));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__rows));
__Pyx_INCREF(((PyObject *)__pyx_n_s__track));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 14, ((PyObject *)__pyx_n_s__track));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__track));
__Pyx_INCREF(((PyObject *)__pyx_n_s__track_enc));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 15, ((PyObject *)__pyx_n_s__track_enc));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__track_enc));
__Pyx_INCREF(((PyObject *)__pyx_n_s__viterbi));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 16, ((PyObject *)__pyx_n_s__viterbi));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__viterbi));
__Pyx_INCREF(((PyObject *)__pyx_n_s__use_logs));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 17, ((PyObject *)__pyx_n_s__use_logs));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__use_logs));
__Pyx_INCREF(((PyObject *)__pyx_n_s__local));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 18, ((PyObject *)__pyx_n_s__local));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__local));
__Pyx_INCREF(((PyObject *)__pyx_n_s__use_scaling));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 19, ((PyObject *)__pyx_n_s__use_scaling));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__use_scaling));
__Pyx_INCREF(((PyObject *)__pyx_n_s__prev_i));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 20, ((PyObject *)__pyx_n_s__prev_i));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev_i));
__Pyx_INCREF(((PyObject *)__pyx_n_s__prev_j));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 21, ((PyObject *)__pyx_n_s__prev_j));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev_j));
__Pyx_INCREF(((PyObject *)__pyx_n_s__state));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 22, ((PyObject *)__pyx_n_s__state));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__state));
__Pyx_INCREF(((PyObject *)__pyx_n_s__prev_state));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 23, ((PyObject *)__pyx_n_s__prev_state));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__prev_state));
__Pyx_INCREF(((PyObject *)__pyx_n_s__min_prev_state));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 24, ((PyObject *)__pyx_n_s__min_prev_state));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__min_prev_state));
__Pyx_INCREF(((PyObject *)__pyx_n_s__N));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 25, ((PyObject *)__pyx_n_s__N));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__N));
__Pyx_INCREF(((PyObject *)__pyx_n_s__row_length));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 26, ((PyObject *)__pyx_n_s__row_length));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__row_length));
__Pyx_INCREF(((PyObject *)__pyx_n_s__row_length1));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 27, ((PyObject *)__pyx_n_s__row_length1));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__row_length1));
__Pyx_INCREF(((PyObject *)__pyx_n_s__row_count));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 28, ((PyObject *)__pyx_n_s__row_count));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__row_count));
__Pyx_INCREF(((PyObject *)__pyx_n_s__row_count1));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 29, ((PyObject *)__pyx_n_s__row_count1));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__row_count1));
__Pyx_INCREF(((PyObject *)__pyx_n_s__tmp_rows));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 30, ((PyObject *)__pyx_n_s__tmp_rows));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__tmp_rows));
__Pyx_INCREF(((PyObject *)__pyx_n_s__a_count));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 31, ((PyObject *)__pyx_n_s__a_count));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__a_count));
__Pyx_INCREF(((PyObject *)__pyx_n_s__b_count));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 32, ((PyObject *)__pyx_n_s__b_count));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__b_count));
__Pyx_INCREF(((PyObject *)__pyx_n_s__a));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 33, ((PyObject *)__pyx_n_s__a));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__a));
__Pyx_INCREF(((PyObject *)__pyx_n_s__b));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 34, ((PyObject *)__pyx_n_s__b));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__b));
__Pyx_INCREF(((PyObject *)__pyx_n_s__a_low));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 35, ((PyObject *)__pyx_n_s__a_low));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__a_low));
__Pyx_INCREF(((PyObject *)__pyx_n_s__a_high));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 36, ((PyObject *)__pyx_n_s__a_high));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__a_high));
__Pyx_INCREF(((PyObject *)__pyx_n_s__b_low));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 37, ((PyObject *)__pyx_n_s__b_low));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__b_low));
__Pyx_INCREF(((PyObject *)__pyx_n_s__b_high));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 38, ((PyObject *)__pyx_n_s__b_high));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__b_high));
__Pyx_INCREF(((PyObject *)__pyx_n_s__dest_states));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 39, ((PyObject *)__pyx_n_s__dest_states));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__dest_states));
__Pyx_INCREF(((PyObject *)__pyx_n_s__dest_state));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 40, ((PyObject *)__pyx_n_s__dest_state));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__dest_state));
__Pyx_INCREF(((PyObject *)__pyx_n_s__d4));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 41, ((PyObject *)__pyx_n_s__d4));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__d4));
__Pyx_INCREF(((PyObject *)__pyx_n_s__j));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 42, ((PyObject *)__pyx_n_s__j));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__j));
__Pyx_INCREF(((PyObject *)__pyx_n_s__i));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 43, ((PyObject *)__pyx_n_s__i));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
__Pyx_INCREF(((PyObject *)__pyx_n_s__last_i));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 44, ((PyObject *)__pyx_n_s__last_i));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__last_i));
__Pyx_INCREF(((PyObject *)__pyx_n_s__last_j));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 45, ((PyObject *)__pyx_n_s__last_j));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__last_j));
__Pyx_INCREF(((PyObject *)__pyx_n_s__last_state));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 46, ((PyObject *)__pyx_n_s__last_state));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__last_state));
__Pyx_INCREF(((PyObject *)__pyx_n_s__bin));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 47, ((PyObject *)__pyx_n_s__bin));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin));
__Pyx_INCREF(((PyObject *)__pyx_n_s__x));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 48, ((PyObject *)__pyx_n_s__x));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__x));
__Pyx_INCREF(((PyObject *)__pyx_n_s__y));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 49, ((PyObject *)__pyx_n_s__y));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__y));
__Pyx_INCREF(((PyObject *)__pyx_n_s__bin_count));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 50, ((PyObject *)__pyx_n_s__bin_count));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__bin_count));
__Pyx_INCREF(((PyObject *)__pyx_n_s__max_x));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 51, ((PyObject *)__pyx_n_s__max_x));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__max_x));
__Pyx_INCREF(((PyObject *)__pyx_n_s__max_y));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 52, ((PyObject *)__pyx_n_s__max_y));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__max_y));
__Pyx_INCREF(((PyObject *)__pyx_n_s__current_row_index));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 53, ((PyObject *)__pyx_n_s__current_row_index));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__current_row_index));
__Pyx_INCREF(((PyObject *)__pyx_n_s__source_row_index));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 54, ((PyObject *)__pyx_n_s__source_row_index));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__source_row_index));
__Pyx_INCREF(((PyObject *)__pyx_n_s_54));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 55, ((PyObject *)__pyx_n_s_54));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s_54));
__Pyx_INCREF(((PyObject *)__pyx_n_s__i_link_count));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 56, ((PyObject *)__pyx_n_s__i_link_count));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__i_link_count));
__Pyx_INCREF(((PyObject *)__pyx_n_s__j_link_count));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 57, ((PyObject *)__pyx_n_s__j_link_count));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__j_link_count));
__Pyx_INCREF(((PyObject *)__pyx_n_s__dx));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 58, ((PyObject *)__pyx_n_s__dx));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__dx));
__Pyx_INCREF(((PyObject *)__pyx_n_s__dy));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 59, ((PyObject *)__pyx_n_s__dy));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__dy));
__Pyx_INCREF(((PyObject *)__pyx_n_s__tcode_x));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 60, ((PyObject *)__pyx_n_s__tcode_x));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__tcode_x));
__Pyx_INCREF(((PyObject *)__pyx_n_s__tcode_y));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 61, ((PyObject *)__pyx_n_s__tcode_y));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__tcode_y));
__Pyx_INCREF(((PyObject *)__pyx_n_s__tcode_s));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 62, ((PyObject *)__pyx_n_s__tcode_s));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__tcode_s));
__Pyx_INCREF(((PyObject *)__pyx_n_s__d_score));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 63, ((PyObject *)__pyx_n_s__d_score));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__d_score));
__Pyx_INCREF(((PyObject *)__pyx_n_s__mantissa));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 64, ((PyObject *)__pyx_n_s__mantissa));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__mantissa));
__Pyx_INCREF(((PyObject *)__pyx_n_s__partial_sum));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 65, ((PyObject *)__pyx_n_s__partial_sum));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__partial_sum));
__Pyx_INCREF(((PyObject *)__pyx_n_s__sub_partial_sum));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 66, ((PyObject *)__pyx_n_s__sub_partial_sum));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__sub_partial_sum));
__Pyx_INCREF(((PyObject *)__pyx_n_s__max_mantissa));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 67, ((PyObject *)__pyx_n_s__max_mantissa));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__max_mantissa));
__Pyx_INCREF(((PyObject *)__pyx_n_s_55));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 68, ((PyObject *)__pyx_n_s_55));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s_55));
__Pyx_INCREF(((PyObject *)__pyx_n_s__exponent));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 69, ((PyObject *)__pyx_n_s__exponent));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__exponent));
__Pyx_INCREF(((PyObject *)__pyx_n_s__max_exponent));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 70, ((PyObject *)__pyx_n_s__max_exponent));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__max_exponent));
__Pyx_INCREF(((PyObject *)__pyx_n_s_56));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 71, ((PyObject *)__pyx_n_s_56));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s_56));
__Pyx_INCREF(((PyObject *)__pyx_n_s__mantissas));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 72, ((PyObject *)__pyx_n_s__mantissas));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__mantissas));
__Pyx_INCREF(((PyObject *)__pyx_n_s__exponents));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 73, ((PyObject *)__pyx_n_s__exponents));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__exponents));
__Pyx_INCREF(((PyObject *)__pyx_n_s__pointer_a));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 74, ((PyObject *)__pyx_n_s__pointer_a));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__pointer_a));
__Pyx_INCREF(((PyObject *)__pyx_n_s__pointer_b));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 75, ((PyObject *)__pyx_n_s__pointer_b));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__pointer_b));
__Pyx_INCREF(((PyObject *)__pyx_n_s__pointer_state));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 76, ((PyObject *)__pyx_n_s__pointer_state));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__pointer_state));
__Pyx_INCREF(((PyObject *)__pyx_n_s__i_sources));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 77, ((PyObject *)__pyx_n_s__i_sources));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__i_sources));
__Pyx_INCREF(((PyObject *)__pyx_n_s__i_sources_offsets));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 78, ((PyObject *)__pyx_n_s__i_sources_offsets));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__i_sources_offsets));
__Pyx_INCREF(((PyObject *)__pyx_n_s__j_sources));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 79, ((PyObject *)__pyx_n_s__j_sources));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__j_sources));
__Pyx_INCREF(((PyObject *)__pyx_n_s__j_sources_offsets));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 80, ((PyObject *)__pyx_n_s__j_sources_offsets));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__j_sources_offsets));
__Pyx_INCREF(((PyObject *)__pyx_n_s__i_sources_start));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 81, ((PyObject *)__pyx_n_s__i_sources_start));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__i_sources_start));
__Pyx_INCREF(((PyObject *)__pyx_n_s__i_sources_end));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 82, ((PyObject *)__pyx_n_s__i_sources_end));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__i_sources_end));
__Pyx_INCREF(((PyObject *)__pyx_n_s__j_sources_start));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 83, ((PyObject *)__pyx_n_s__j_sources_start));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__j_sources_start));
__Pyx_INCREF(((PyObject *)__pyx_n_s__j_sources_end));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 84, ((PyObject *)__pyx_n_s__j_sources_end));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__j_sources_end));
__Pyx_INCREF(((PyObject *)__pyx_n_s__pog1));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 85, ((PyObject *)__pyx_n_s__pog1));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__pog1));
__Pyx_INCREF(((PyObject *)__pyx_n_s__pog2));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 86, ((PyObject *)__pyx_n_s__pog2));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__pog2));
__Pyx_INCREF(((PyObject *)__pyx_n_s__impossible));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 87, ((PyObject *)__pyx_n_s__impossible));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__impossible));
__Pyx_INCREF(((PyObject *)__pyx_n_s__score));
PyTuple_SET_ITEM(__pyx_k_tuple_57, 88, ((PyObject *)__pyx_n_s__score));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__score));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57));
__pyx_k_codeobj_58 = (PyObject*)__Pyx_PyCode_New(20, 0, 89, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_52, __pyx_n_s__calc_rows, 33, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_58)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "View.MemoryView":282
* return self.name
*
* cdef generic = Enum("") # <<<<<<<<<<<<<<
* cdef strided = Enum("") # default
* cdef indirect = Enum("")
*/
__pyx_k_tuple_61 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_61);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_60));
PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_kp_s_60));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_60));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61));
/* "View.MemoryView":283
*
* cdef generic = Enum("")
* cdef strided = Enum("") # default # <<<<<<<<<<<<<<
* cdef indirect = Enum("")
*
*/
__pyx_k_tuple_63 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_63);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_62));
PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, ((PyObject *)__pyx_kp_s_62));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_62));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63));
/* "View.MemoryView":284
* cdef generic = Enum("")
* cdef strided = Enum("") # default
* cdef indirect = Enum("") # <<<<<<<<<<<<<<
*
*
*/
__pyx_k_tuple_65 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_65);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_64));
PyTuple_SET_ITEM(__pyx_k_tuple_65, 0, ((PyObject *)__pyx_kp_s_64));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_64));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65));
/* "View.MemoryView":287
*
*
* cdef contiguous = Enum("") # <<<<<<<<<<<<<<
* cdef indirect_contiguous = Enum("")
*
*/
__pyx_k_tuple_67 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_67);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_66));
PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, ((PyObject *)__pyx_kp_s_66));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_66));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67));
/* "View.MemoryView":288
*
* cdef contiguous = Enum("")
* cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<<
*
*
*/
__pyx_k_tuple_69 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_k_tuple_69);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_68));
PyTuple_SET_ITEM(__pyx_k_tuple_69, 0, ((PyObject *)__pyx_kp_s_68));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_68));
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69));
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
__Pyx_RefNannyFinishContext();
return -1;
}
static int __Pyx_InitGlobals(void) {
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
return 0;
__pyx_L1_error:;
return -1;
}
#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_pairwise_pogs(void); /*proto*/
PyMODINIT_FUNC init_pairwise_pogs(void)
#else
PyMODINIT_FUNC PyInit__pairwise_pogs(void); /*proto*/
PyMODINIT_FUNC PyInit__pairwise_pogs(void)
#endif
{
PyObject *__pyx_t_1 = NULL;
__Pyx_RefNannyDeclarations
#if CYTHON_REFNANNY
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
if (!__Pyx_RefNanny) {
PyErr_Clear();
__Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
if (!__Pyx_RefNanny)
Py_FatalError("failed to import 'refnanny' module");
}
#endif
__Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__pairwise_pogs(void)", 0);
if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#ifdef __Pyx_CyFunction_USED
if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_FusedFunction_USED
if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
#ifdef __Pyx_Generator_USED
if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
/*--- Library function declarations ---*/
/*--- Threads initialization code ---*/
#if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
#ifdef WITH_THREAD /* Python build with threading support? */
PyEval_InitThreads();
#endif
#endif
/*--- Module creation code ---*/
#if PY_MAJOR_VERSION < 3
__pyx_m = Py_InitModule4(__Pyx_NAMESTR("_pairwise_pogs"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
#else
__pyx_m = PyModule_Create(&__pyx_moduledef);
#endif
if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#if CYTHON_COMPILING_IN_PYPY
Py_INCREF(__pyx_b);
#endif
if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
/*--- Initialize various global constants etc. ---*/
if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_module_is_main_cogent__align___pairwise_pogs) {
if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
}
/*--- Builtin init code ---*/
if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Constants init code ---*/
if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/*--- Global init code ---*/
generic = Py_None; Py_INCREF(Py_None);
strided = Py_None; Py_INCREF(Py_None);
indirect = Py_None; Py_INCREF(Py_None);
contiguous = Py_None; Py_INCREF(Py_None);
indirect_contiguous = Py_None; Py_INCREF(Py_None);
/*--- Variable export code ---*/
/*--- Function export code ---*/
/*--- Type init code ---*/
if (PyType_Ready(&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetAttrString(__pyx_m, "array", (PyObject *)&__pyx_type___pyx_array) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_array_type = &__pyx_type___pyx_array;
if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetAttrString(__pyx_m, "Enum", (PyObject *)&__pyx_type___pyx_MemviewEnum) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __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;
__pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
__pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
__pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
__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_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetAttrString(__pyx_m, "memoryview", (PyObject *)&__pyx_type___pyx_memoryview) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__Pyx_SetAttrString(__pyx_m, "_memoryviewslice", (PyObject *)&__pyx_type___pyx_memoryviewslice) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
/*--- Type import code ---*/
/*--- Variable import code ---*/
/*--- Function import code ---*/
/*--- Execution code ---*/
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":13
* #
*
* __version__ = "('1', '5', '3-dev')" # <<<<<<<<<<<<<<
*
* cdef extern from "limits.h":
*/
if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_48)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":14
* double log (double x)
*
* version_info = (3, 2) # <<<<<<<<<<<<<<
* __version__ = "('1', '5', '3-dev')"
*
*/
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__version_info, ((PyObject *)__pyx_k_tuple_49)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":15
*
* version_info = (3, 2)
* __version__ = "('1', '5', '3-dev')" # <<<<<<<<<<<<<<
*
* cdef double SCALE_STEP, MIN_FLOAT_VALUE
*/
if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_48)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_pogs.pyx":18
*
* cdef double SCALE_STEP, MIN_FLOAT_VALUE
* SCALE_STEP = 2.0**50 # <<<<<<<<<<<<<<
* MIN_FLOAT_VALUE = 1.0 / SCALE_STEP
*
*/
__pyx_v_6cogent_5align_14_pairwise_pogs_SCALE_STEP = pow(2.0, 50.0);
/* "cogent/align/_pairwise_pogs.pyx":19
* cdef double SCALE_STEP, MIN_FLOAT_VALUE
* SCALE_STEP = 2.0**50
* MIN_FLOAT_VALUE = 1.0 / SCALE_STEP # <<<<<<<<<<<<<<
*
* cdef int MAX_XCOUNT
*/
if (unlikely(__pyx_v_6cogent_5align_14_pairwise_pogs_SCALE_STEP == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "float division");
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_6cogent_5align_14_pairwise_pogs_MIN_FLOAT_VALUE = (1.0 / __pyx_v_6cogent_5align_14_pairwise_pogs_SCALE_STEP);
/* "cogent/align/_pairwise_pogs.pyx":22
*
* cdef int MAX_XCOUNT
* MAX_XCOUNT = 256 # <<<<<<<<<<<<<<
*
* cdef long MIN_SCALE, MAX_SCALE
*/
__pyx_v_6cogent_5align_14_pairwise_pogs_MAX_XCOUNT = 256;
/* "cogent/align/_pairwise_pogs.pyx":25
*
* cdef long MIN_SCALE, MAX_SCALE
* MIN_SCALE = -10000 # <<<<<<<<<<<<<<
* MAX_SCALE = +10000 # or 0 if all numbers should be probabilities
*
*/
__pyx_v_6cogent_5align_14_pairwise_pogs_MIN_SCALE = -10000;
/* "cogent/align/_pairwise_pogs.pyx":26
* cdef long MIN_SCALE, MAX_SCALE
* MIN_SCALE = -10000
* MAX_SCALE = +10000 # or 0 if all numbers should be probabilities # <<<<<<<<<<<<<<
*
* def fmpt(mantissa, exponent, msg=''):
*/
__pyx_v_6cogent_5align_14_pairwise_pogs_MAX_SCALE = 10000;
/* "cogent/align/_pairwise_pogs.pyx":28
* MAX_SCALE = +10000 # or 0 if all numbers should be probabilities
*
* def fmpt(mantissa, exponent, msg=''): # <<<<<<<<<<<<<<
* return "%s * SCALE_STEP ** %s %s" % (mantissa, exponent, msg)
*
*/
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6cogent_5align_14_pairwise_pogs_1fmpt, NULL, __pyx_n_s_53); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fmpt, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "cogent/align/_pairwise_pogs.pyx":33
* ctypedef unsigned char [:,:,::1] UChar3D
*
* def calc_rows(Long1D plan, Long1D seq1_index, Long1D seq2_index, # <<<<<<<<<<<<<<
* int i_low, int i_high, int j_low, int j_high, preds,
* Long2D state_directions, Double2D T,
*/
__pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6cogent_5align_14_pairwise_pogs_3calc_rows, NULL, __pyx_n_s_53); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetAttr(__pyx_m, __pyx_n_s__calc_rows, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "cogent/align/_pairwise_pogs.pyx":1
* #cython: boundscheck=False # <<<<<<<<<<<<<<
* #cython: wraparound=False
*
*/
__pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
/* "View.MemoryView":207
* 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)), __pyx_k_59); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_array_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
PyType_Modified(__pyx_array_type);
/* "View.MemoryView":282
* return self.name
*
* cdef generic = Enum("") # <<<<<<<<<<<<<<
* cdef strided = Enum("") # default
* cdef indirect = Enum("")
*/
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_61), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XGOTREF(generic);
__Pyx_DECREF(generic);
__Pyx_GIVEREF(__pyx_t_1);
generic = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":283
*
* cdef generic = Enum("")
* cdef strided = Enum("") # default # <<<<<<<<<<<<<<
* cdef indirect = Enum("")
*
*/
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_63), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XGOTREF(strided);
__Pyx_DECREF(strided);
__Pyx_GIVEREF(__pyx_t_1);
strided = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":284
* cdef generic = Enum("")
* cdef strided = Enum("") # default
* cdef indirect = Enum("") # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_65), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XGOTREF(indirect);
__Pyx_DECREF(indirect);
__Pyx_GIVEREF(__pyx_t_1);
indirect = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":287
*
*
* cdef contiguous = Enum("") # <<<<<<<<<<<<<<
* cdef indirect_contiguous = Enum("")
*
*/
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_67), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XGOTREF(contiguous);
__Pyx_DECREF(contiguous);
__Pyx_GIVEREF(__pyx_t_1);
contiguous = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":288
*
* cdef contiguous = Enum("")
* cdef indirect_contiguous = Enum("") # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_1 = PyObject_Call(((PyObject *)((PyObject *)__pyx_MemviewEnum_type)), ((PyObject *)__pyx_k_tuple_69), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_XGOTREF(indirect_contiguous);
__Pyx_DECREF(indirect_contiguous);
__Pyx_GIVEREF(__pyx_t_1);
indirect_contiguous = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":503
* info.obj = self
*
* __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_59); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_memoryview_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
PyType_Modified(__pyx_memoryview_type);
/* "View.MemoryView":958
* return self.from_object
*
* __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), __pyx_k_59); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyDict_SetItem(__pyx_memoryviewslice_type->tp_dict, __pyx_n_s____pyx_getbuffer, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
PyType_Modified(__pyx_memoryviewslice_type);
/* "View.MemoryView":1365
*
* @cname('__pyx_memoryview__slice_assign_scalar')
* cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
* Py_ssize_t *strides, int ndim,
* size_t itemsize, void *item) nogil:
*/
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
if (__pyx_m) {
__Pyx_AddTraceback("init cogent.align._pairwise_pogs", __pyx_clineno, __pyx_lineno, __pyx_filename);
Py_DECREF(__pyx_m); __pyx_m = 0;
} else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_ImportError, "init cogent.align._pairwise_pogs");
}
__pyx_L0:;
__Pyx_RefNannyFinishContext();
#if PY_MAJOR_VERSION < 3
return;
#else
return __pyx_m;
#endif
}
/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
PyObject *m = NULL, *p = NULL;
void *r = NULL;
m = PyImport_ImportModule((char *)modname);
if (!m) goto end;
p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
if (!p) goto end;
r = PyLong_AsVoidPtr(p);
end:
Py_XDECREF(p);
Py_XDECREF(m);
return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
PyObject *result;
result = PyObject_GetAttr(dict, name);
if (!result) {
if (dict != __pyx_b) {
PyErr_Clear();
result = PyObject_GetAttr(__pyx_b, name);
}
if (!result) {
PyErr_SetObject(PyExc_NameError, name);
}
}
return result;
}
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
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);
#else
PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
PyThreadState *tstate = PyThreadState_GET();
*type = tstate->curexc_type;
*value = tstate->curexc_value;
*tb = tstate->curexc_traceback;
tstate->curexc_type = 0;
tstate->curexc_value = 0;
tstate->curexc_traceback = 0;
#else
PyErr_Fetch(type, value, tb);
#endif
}
#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
CYTHON_UNUSED PyObject *cause) {
Py_XINCREF(type);
if (!value || value == Py_None)
value = NULL;
else
Py_INCREF(value);
if (!tb || tb == Py_None)
tb = NULL;
else {
Py_INCREF(tb);
if (!PyTraceBack_Check(tb)) {
PyErr_SetString(PyExc_TypeError,
"raise: arg 3 must be a traceback or None");
goto raise_error;
}
}
#if PY_VERSION_HEX < 0x02050000
if (PyClass_Check(type)) {
#else
if (PyType_Check(type)) {
#endif
#if CYTHON_COMPILING_IN_PYPY
if (!value) {
Py_INCREF(Py_None);
value = Py_None;
}
#endif
PyErr_NormalizeException(&type, &value, &tb);
} else {
if (value) {
PyErr_SetString(PyExc_TypeError,
"instance exception may not have a separate value");
goto raise_error;
}
value = type;
#if PY_VERSION_HEX < 0x02050000
if (PyInstance_Check(type)) {
type = (PyObject*) ((PyInstanceObject*)type)->in_class;
Py_INCREF(type);
}
else {
type = 0;
PyErr_SetString(PyExc_TypeError,
"raise: exception must be an old-style class or instance");
goto raise_error;
}
#else
type = (PyObject*) Py_TYPE(type);
Py_INCREF(type);
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
PyErr_SetString(PyExc_TypeError,
"raise: exception class must be a subclass of BaseException");
goto raise_error;
}
#endif
}
__Pyx_ErrRestore(type, value, tb);
return;
raise_error:
Py_XDECREF(value);
Py_XDECREF(type);
Py_XDECREF(tb);
return;
}
#else /* Python 3+ */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
PyObject* owned_instance = NULL;
if (tb == Py_None) {
tb = 0;
} else if (tb && !PyTraceBack_Check(tb)) {
PyErr_SetString(PyExc_TypeError,
"raise: arg 3 must be a traceback or None");
goto bad;
}
if (value == Py_None)
value = 0;
if (PyExceptionInstance_Check(type)) {
if (value) {
PyErr_SetString(PyExc_TypeError,
"instance exception may not have a separate value");
goto bad;
}
value = type;
type = (PyObject*) Py_TYPE(value);
} else if (PyExceptionClass_Check(type)) {
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 = PyEval_CallObject(type, args);
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 && cause != Py_None) {
PyObject *fixed_cause;
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) {
PyThreadState *tstate = PyThreadState_GET();
PyObject* tmp_tb = tstate->curexc_traceback;
if (tb != tmp_tb) {
Py_INCREF(tb);
tstate->curexc_traceback = tb;
Py_XDECREF(tmp_tb);
}
}
bad:
Py_XDECREF(owned_instance);
return;
}
#endif
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,
"%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)",
func_name, more_or_less, num_expected,
(num_expected == 1) ? "" : "s", num_found);
}
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
}
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,
"%s() keywords must be strings", function_name);
goto bad;
invalid_keyword:
PyErr_Format(PyExc_TypeError,
#if PY_MAJOR_VERSION < 3
"%s() got an unexpected keyword argument '%s'",
function_name, PyString_AsString(key));
#else
"%s() got an unexpected keyword argument '%U'",
function_name, key);
#endif
bad:
return -1;
}
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);
}
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
PyErr_Format(PyExc_ValueError,
"need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack",
index, (index == 1) ? "" : "s");
}
static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
PyThreadState *tstate = PyThreadState_GET();
PyObject* exc_type = tstate->curexc_type;
if (unlikely(exc_type)) {
if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
PyObject *exc_value, *exc_tb;
exc_value = tstate->curexc_value;
exc_tb = tstate->curexc_traceback;
tstate->curexc_type = 0;
tstate->curexc_value = 0;
tstate->curexc_traceback = 0;
Py_DECREF(exc_type);
Py_XDECREF(exc_value);
Py_XDECREF(exc_tb);
return 0;
} else {
return -1;
}
}
return 0;
#else
if (unlikely(PyErr_Occurred())) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
PyErr_Clear();
return 0;
} else {
return -1;
}
}
return 0;
#endif
}
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
if (unlikely(retval)) {
Py_DECREF(retval);
__Pyx_RaiseTooManyValuesError(expected);
return -1;
} else {
return __Pyx_IterFinish();
}
return 0;
}
static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
unsigned int n = 1;
return *(unsigned char*)(&n) != 0;
}
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
__Pyx_BufFmt_StackElem* stack,
__Pyx_TypeInfo* type) {
stack[0].field = &ctx->root;
stack[0].parent_offset = 0;
ctx->root.type = type;
ctx->root.name = "buffer dtype";
ctx->root.offset = 0;
ctx->head = stack;
ctx->head->field = &ctx->root;
ctx->fmt_offset = 0;
ctx->head->parent_offset = 0;
ctx->new_packmode = '@';
ctx->enc_packmode = '@';
ctx->new_count = 1;
ctx->enc_count = 0;
ctx->enc_type = 0;
ctx->is_complex = 0;
ctx->is_valid_array = 0;
ctx->struct_alignment = 0;
while (type->typegroup == 'S') {
++ctx->head;
ctx->head->field = type->fields;
ctx->head->parent_offset = 0;
type = type->fields->type;
}
}
static int __Pyx_BufFmt_ParseNumber(const char** ts) {
int count;
const char* t = *ts;
if (*t < '0' || *t > '9') {
return -1;
} else {
count = *t++ - '0';
while (*t >= '0' && *t < '9') {
count *= 10;
count += *t++ - '0';
}
}
*ts = t;
return count;
}
static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
int number = __Pyx_BufFmt_ParseNumber(ts);
if (number == -1) /* First char was not a digit */
PyErr_Format(PyExc_ValueError,\
"Does not understand character buffer dtype format string ('%c')", **ts);
return number;
}
static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
PyErr_Format(PyExc_ValueError,
"Unexpected format string character: '%c'", ch);
}
static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
switch (ch) {
case 'c': return "'char'";
case 'b': return "'signed char'";
case 'B': return "'unsigned char'";
case 'h': return "'short'";
case 'H': return "'unsigned short'";
case 'i': return "'int'";
case 'I': return "'unsigned int'";
case 'l': return "'long'";
case 'L': return "'unsigned long'";
case 'q': return "'long long'";
case 'Q': return "'unsigned long long'";
case 'f': return (is_complex ? "'complex float'" : "'float'");
case 'd': return (is_complex ? "'complex double'" : "'double'");
case 'g': return (is_complex ? "'complex long double'" : "'long double'");
case 'T': return "a struct";
case 'O': return "Python object";
case 'P': return "a pointer";
case 's': case 'p': return "a string";
case 0: return "end";
default: return "unparseable format string";
}
}
static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
switch (ch) {
case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
case 'h': case 'H': return 2;
case 'i': case 'I': case 'l': case 'L': return 4;
case 'q': case 'Q': return 8;
case 'f': return (is_complex ? 8 : 4);
case 'd': return (is_complex ? 16 : 8);
case 'g': {
PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
return 0;
}
case 'O': case 'P': return sizeof(void*);
default:
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
return 0;
}
}
static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
switch (ch) {
case 'c': case 'b': case 'B': case 's': case 'p': return 1;
case 'h': case 'H': return sizeof(short);
case 'i': case 'I': return sizeof(int);
case 'l': case 'L': return sizeof(long);
#ifdef HAVE_LONG_LONG
case 'q': case 'Q': return sizeof(PY_LONG_LONG);
#endif
case 'f': return sizeof(float) * (is_complex ? 2 : 1);
case 'd': return sizeof(double) * (is_complex ? 2 : 1);
case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
case 'O': case 'P': return sizeof(void*);
default: {
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
return 0;
}
}
}
typedef struct { char c; short x; } __Pyx_st_short;
typedef struct { char c; int x; } __Pyx_st_int;
typedef struct { char c; long x; } __Pyx_st_long;
typedef struct { char c; float x; } __Pyx_st_float;
typedef struct { char c; double x; } __Pyx_st_double;
typedef struct { char c; long double x; } __Pyx_st_longdouble;
typedef struct { char c; void *x; } __Pyx_st_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
switch (ch) {
case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
#endif
case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
default:
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
return 0;
}
}
/* These are for computing the padding at the end of the struct to align
on the first member of the struct. This will probably the same as above,
but we don't have any guarantees.
*/
typedef struct { short x; char c; } __Pyx_pad_short;
typedef struct { int x; char c; } __Pyx_pad_int;
typedef struct { long x; char c; } __Pyx_pad_long;
typedef struct { float x; char c; } __Pyx_pad_float;
typedef struct { double x; char c; } __Pyx_pad_double;
typedef struct { long double x; char c; } __Pyx_pad_longdouble;
typedef struct { void *x; char c; } __Pyx_pad_void_p;
#ifdef HAVE_LONG_LONG
typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
#endif
static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
switch (ch) {
case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
#ifdef HAVE_LONG_LONG
case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
#endif
case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
default:
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
return 0;
}
}
static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
switch (ch) {
case 'c':
return 'H';
case 'b': case 'h': case 'i':
case 'l': case 'q': case 's': case 'p':
return 'I';
case 'B': case 'H': case 'I': case 'L': case 'Q':
return 'U';
case 'f': case 'd': case 'g':
return (is_complex ? 'C' : 'R');
case 'O':
return 'O';
case 'P':
return 'P';
default: {
__Pyx_BufFmt_RaiseUnexpectedChar(ch);
return 0;
}
}
}
static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
if (ctx->head == NULL || ctx->head->field == &ctx->root) {
const char* expected;
const char* quote;
if (ctx->head == NULL) {
expected = "end";
quote = "";
} else {
expected = ctx->head->field->type->name;
quote = "'";
}
PyErr_Format(PyExc_ValueError,
"Buffer dtype mismatch, expected %s%s%s but got %s",
quote, expected, quote,
__Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
} else {
__Pyx_StructField* field = ctx->head->field;
__Pyx_StructField* parent = (ctx->head - 1)->field;
PyErr_Format(PyExc_ValueError,
"Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
parent->type->name, field->name);
}
}
static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
char group;
size_t size, offset, arraysize = 1;
if (ctx->enc_type == 0) return 0;
if (ctx->head->field->type->arraysize[0]) {
int i, ndim = 0;
if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
ctx->is_valid_array = ctx->head->field->type->ndim == 1;
ndim = 1;
if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
PyErr_Format(PyExc_ValueError,
"Expected a dimension of size %zu, got %zu",
ctx->head->field->type->arraysize[0], ctx->enc_count);
return -1;
}
}
if (!ctx->is_valid_array) {
PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
ctx->head->field->type->ndim, ndim);
return -1;
}
for (i = 0; i < ctx->head->field->type->ndim; i++) {
arraysize *= ctx->head->field->type->arraysize[i];
}
ctx->is_valid_array = 0;
ctx->enc_count = 1;
}
group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
do {
__Pyx_StructField* field = ctx->head->field;
__Pyx_TypeInfo* type = field->type;
if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
} else {
size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
}
if (ctx->enc_packmode == '@') {
size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
size_t align_mod_offset;
if (align_at == 0) return -1;
align_mod_offset = ctx->fmt_offset % align_at;
if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
if (ctx->struct_alignment == 0)
ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
ctx->is_complex);
}
if (type->size != size || type->typegroup != group) {
if (type->typegroup == 'C' && type->fields != NULL) {
size_t parent_offset = ctx->head->parent_offset + field->offset;
++ctx->head;
ctx->head->field = type->fields;
ctx->head->parent_offset = parent_offset;
continue;
}
if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
} else {
__Pyx_BufFmt_RaiseExpected(ctx);
return -1;
}
}
offset = ctx->head->parent_offset + field->offset;
if (ctx->fmt_offset != offset) {
PyErr_Format(PyExc_ValueError,
"Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
(Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
return -1;
}
ctx->fmt_offset += size;
if (arraysize)
ctx->fmt_offset += (arraysize - 1) * size;
--ctx->enc_count; /* Consume from buffer string */
while (1) {
if (field == &ctx->root) {
ctx->head = NULL;
if (ctx->enc_count != 0) {
__Pyx_BufFmt_RaiseExpected(ctx);
return -1;
}
break; /* breaks both loops as ctx->enc_count == 0 */
}
ctx->head->field = ++field;
if (field->type == NULL) {
--ctx->head;
field = ctx->head->field;
continue;
} else if (field->type->typegroup == 'S') {
size_t parent_offset = ctx->head->parent_offset + field->offset;
if (field->type->fields->type == NULL) continue; /* empty struct */
field = field->type->fields;
++ctx->head;
ctx->head->field = field;
ctx->head->parent_offset = parent_offset;
break;
} else {
break;
}
}
} while (ctx->enc_count);
ctx->enc_type = 0;
ctx->is_complex = 0;
return 0;
}
static CYTHON_INLINE PyObject *
__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
{
const char *ts = *tsp;
int i = 0, number;
int ndim = ctx->head->field->type->ndim;
;
++ts;
if (ctx->new_count != 1) {
PyErr_SetString(PyExc_ValueError,
"Cannot handle repeated arrays in format string");
return NULL;
}
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
while (*ts && *ts != ')') {
if (isspace(*ts))
continue;
number = __Pyx_BufFmt_ExpectNumber(&ts);
if (number == -1) return NULL;
if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
return PyErr_Format(PyExc_ValueError,
"Expected a dimension of size %zu, got %d",
ctx->head->field->type->arraysize[i], number);
if (*ts != ',' && *ts != ')')
return PyErr_Format(PyExc_ValueError,
"Expected a comma in format string, got '%c'", *ts);
if (*ts == ',') ts++;
i++;
}
if (i != ndim)
return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
ctx->head->field->type->ndim, i);
if (!*ts) {
PyErr_SetString(PyExc_ValueError,
"Unexpected end of format string, expected ')'");
return NULL;
}
ctx->is_valid_array = 1;
ctx->new_count = 1;
*tsp = ++ts;
return Py_None;
}
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
int got_Z = 0;
while (1) {
switch(*ts) {
case 0:
if (ctx->enc_type != 0 && ctx->head == NULL) {
__Pyx_BufFmt_RaiseExpected(ctx);
return NULL;
}
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
if (ctx->head != NULL) {
__Pyx_BufFmt_RaiseExpected(ctx);
return NULL;
}
return ts;
case ' ':
case 10:
case 13:
++ts;
break;
case '<':
if (!__Pyx_IsLittleEndian()) {
PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
return NULL;
}
ctx->new_packmode = '=';
++ts;
break;
case '>':
case '!':
if (__Pyx_IsLittleEndian()) {
PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
return NULL;
}
ctx->new_packmode = '=';
++ts;
break;
case '=':
case '@':
case '^':
ctx->new_packmode = *ts++;
break;
case 'T': /* substruct */
{
const char* ts_after_sub;
size_t i, struct_count = ctx->new_count;
size_t struct_alignment = ctx->struct_alignment;
ctx->new_count = 1;
++ts;
if (*ts != '{') {
PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
return NULL;
}
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
ctx->enc_type = 0; /* Erase processed last struct element */
ctx->enc_count = 0;
ctx->struct_alignment = 0;
++ts;
ts_after_sub = ts;
for (i = 0; i != struct_count; ++i) {
ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
if (!ts_after_sub) return NULL;
}
ts = ts_after_sub;
if (struct_alignment) ctx->struct_alignment = struct_alignment;
}
break;
case '}': /* end of substruct; either repeat or move on */
{
size_t alignment = ctx->struct_alignment;
++ts;
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
ctx->enc_type = 0; /* Erase processed last struct element */
if (alignment && ctx->fmt_offset % alignment) {
ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
}
}
return ts;
case 'x':
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
ctx->fmt_offset += ctx->new_count;
ctx->new_count = 1;
ctx->enc_count = 0;
ctx->enc_type = 0;
ctx->enc_packmode = ctx->new_packmode;
++ts;
break;
case 'Z':
got_Z = 1;
++ts;
if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
__Pyx_BufFmt_RaiseUnexpectedChar('Z');
return NULL;
} /* fall through */
case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
case 'l': case 'L': case 'q': case 'Q':
case 'f': case 'd': case 'g':
case 'O': case 's': case 'p':
if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
ctx->enc_packmode == ctx->new_packmode) {
ctx->enc_count += ctx->new_count;
} else {
if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
ctx->enc_count = ctx->new_count;
ctx->enc_packmode = ctx->new_packmode;
ctx->enc_type = *ts;
ctx->is_complex = got_Z;
}
++ts;
ctx->new_count = 1;
got_Z = 0;
break;
case ':':
++ts;
while(*ts != ':') ++ts;
++ts;
break;
case '(':
if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
break;
default:
{
int number = __Pyx_BufFmt_ExpectNumber(&ts);
if (number == -1) return NULL;
ctx->new_count = (size_t)number;
}
}
}
}
static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
buf->buf = NULL;
buf->obj = NULL;
buf->strides = __Pyx_zeros;
buf->shape = __Pyx_zeros;
buf->suboffsets = __Pyx_minusones;
}
static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
int nd, int cast, __Pyx_BufFmt_StackElem* stack)
{
if (obj == Py_None || obj == NULL) {
__Pyx_ZeroBuffer(buf);
return 0;
}
buf->buf = NULL;
if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
if (buf->ndim != nd) {
PyErr_Format(PyExc_ValueError,
"Buffer has wrong number of dimensions (expected %d, got %d)",
nd, buf->ndim);
goto fail;
}
if (!cast) {
__Pyx_BufFmt_Context ctx;
__Pyx_BufFmt_Init(&ctx, stack, dtype);
if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
}
if ((unsigned)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" : "",
dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
goto fail;
}
if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
return 0;
fail:;
__Pyx_ZeroBuffer(buf);
return -1;
}
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
if (info->buf == NULL) return;
if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
__Pyx_ReleaseBuffer(info);
}
static int
__pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
{
int i;
if (!a || !b)
return 0;
if (a == b)
return 1;
if (a->size != b->size || a->typegroup != b->typegroup ||
a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
if (a->typegroup == 'H' || b->typegroup == 'H') {
return a->size == b->size;
} else {
return 0;
}
}
if (a->ndim) {
for (i = 0; i < a->ndim; i++)
if (a->arraysize[i] != b->arraysize[i])
return 0;
}
if (a->typegroup == 'S') {
if (a->flags != b->flags)
return 0;
if (a->fields || b->fields) {
if (!(a->fields && b->fields))
return 0;
for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
__Pyx_StructField *field_a = a->fields + i;
__Pyx_StructField *field_b = b->fields + i;
if (field_a->offset != field_b->offset ||
!__pyx_typeinfo_cmp(field_a->type, field_b->type))
return 0;
}
return !a->fields[i].type && !b->fields[i].type;
}
}
return 1;
}
static int __Pyx_ValidateAndInit_memviewslice(
int *axes_specs,
int c_or_f_flag,
int buf_flags,
int ndim,
__Pyx_TypeInfo *dtype,
__Pyx_BufFmt_StackElem stack[],
__Pyx_memviewslice *memviewslice,
PyObject *original_obj)
{
struct __pyx_memoryview_obj *memview, *new_memview;
__Pyx_RefNannyDeclarations
Py_buffer *buf;
int i, spec = 0, retval = -1;
__Pyx_BufFmt_Context ctx;
int from_memoryview = __pyx_memoryview_check(original_obj);
__Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
original_obj)->typeinfo)) {
memview = (struct __pyx_memoryview_obj *) original_obj;
new_memview = NULL;
} else {
memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
original_obj, buf_flags, 0, dtype);
new_memview = memview;
if (unlikely(!memview))
goto fail;
}
buf = &memview->view;
if (buf->ndim != ndim) {
PyErr_Format(PyExc_ValueError,
"Buffer has wrong number of dimensions (expected %d, got %d)",
ndim, buf->ndim);
goto fail;
}
if (new_memview) {
__Pyx_BufFmt_Init(&ctx, stack, dtype);
if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
}
if ((unsigned)buf->itemsize != dtype->size) {
PyErr_Format(PyExc_ValueError,
"Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
"does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
buf->itemsize,
(buf->itemsize > 1) ? "s" : "",
dtype->name,
dtype->size,
(dtype->size > 1) ? "s" : "");
goto fail;
}
for (i = 0; i < ndim; i++) {
spec = axes_specs[i];
if (buf->strides) {
if (spec & __Pyx_MEMVIEW_CONTIG) {
if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
if (buf->strides[i] != sizeof(void *)) {
PyErr_Format(PyExc_ValueError,
"Buffer is not indirectly contiguous in dimension %d.", i);
goto fail;
}
} else if (buf->strides[i] != buf->itemsize) {
PyErr_SetString(PyExc_ValueError,
"Buffer and memoryview are not contiguous in the same dimension.");
goto fail;
}
}
if (spec & __Pyx_MEMVIEW_FOLLOW) {
Py_ssize_t stride = buf->strides[i];
if (stride < 0)
stride = -stride;
if (stride < buf->itemsize) {
PyErr_SetString(PyExc_ValueError,
"Buffer and memoryview are not contiguous in the same dimension.");
goto fail;
}
}
} else {
if (spec & __Pyx_MEMVIEW_CONTIG && i != ndim - 1) {
PyErr_Format(PyExc_ValueError,
"C-contiguous buffer is not contiguous in "
"dimension %d", i);
goto fail;
} else if (spec & (__Pyx_MEMVIEW_PTR)) {
PyErr_Format(PyExc_ValueError,
"C-contiguous buffer is not indirect in "
"dimension %d", i);
goto fail;
} else if (buf->suboffsets) {
PyErr_SetString(PyExc_ValueError,
"Buffer exposes suboffsets but no strides");
goto fail;
}
}
/* Todo: without PyBUF_INDIRECT we may not have suboffset information, i.e., the
ptr may not be set to NULL but may be uninitialized? */
if (spec & __Pyx_MEMVIEW_DIRECT) {
if (buf->suboffsets && buf->suboffsets[i] >= 0) {
PyErr_Format(PyExc_ValueError,
"Buffer not compatible with direct access in dimension %d.", i);
goto fail;
}
}
if (spec & __Pyx_MEMVIEW_PTR) {
if (!buf->suboffsets || (buf->suboffsets && buf->suboffsets[i] < 0)) {
PyErr_Format(PyExc_ValueError,
"Buffer is not indirectly accessisble in dimension %d.", i);
goto fail;
}
}
}
if (buf->strides) {
if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
Py_ssize_t stride = 1;
for (i=0; iitemsize != buf->strides[i]) {
PyErr_SetString(PyExc_ValueError,
"Buffer not fortran contiguous.");
goto fail;
}
stride = stride * buf->shape[i];
}
} else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
Py_ssize_t stride = 1;
for (i = ndim-1; i>-1; i--) {
if(stride * buf->itemsize != buf->strides[i]) {
PyErr_SetString(PyExc_ValueError,
"Buffer not C contiguous.");
goto fail;
}
stride = stride * buf->shape[i];
}
}
}
if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
new_memview != NULL) == -1)) {
goto fail;
}
retval = 0;
goto no_fail;
fail:
Py_XDECREF(new_memview);
retval = -1;
no_fail:
__Pyx_RefNannyFinishContext();
return retval;
}
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;
}
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;
}
static CYTHON_INLINE void __pyx_fatalerror(const char *fmt, ...) {
va_list vargs;
char msg[200];
va_start(vargs, fmt);
#ifdef HAVE_STDARG_PROTOTYPES
va_start(vargs, fmt);
#else
va_start(vargs);
#endif
vsnprintf(msg, 200, fmt, vargs);
Py_FatalError(msg);
va_end(vargs);
}
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; /* allow uninitialized memoryview assignment */
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;
}
}
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
const char *name, int exact)
{
if (!type) {
PyErr_Format(PyExc_SystemError, "Missing type object");
return 0;
}
if (none_allowed && obj == Py_None) return 1;
else if (exact) {
if (Py_TYPE(obj) == type) return 1;
}
else {
if (PyObject_TypeCheck(obj, type)) return 1;
}
PyErr_Format(PyExc_TypeError,
"Argument '%s' has incorrect type (expected %s, got %s)",
name, type->tp_name, Py_TYPE(obj)->tp_name);
return 0;
}
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
PyObject *r = PyObject_GetAttr(o, n);
if (!r) {
if (!PyErr_ExceptionMatches(PyExc_AttributeError))
goto bad;
PyErr_Clear();
r = d;
Py_INCREF(d);
}
return r;
bad:
return NULL;
}
static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
Py_ssize_t q = a / b;
Py_ssize_t r = a - q*b;
q -= ((r != 0) & ((r ^ b) < 0));
return q;
}
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
if (s1 == s2) {
return (equals == Py_EQ);
} else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
#if CYTHON_PEP393_ENABLED
if ((PyUnicode_READY(s1) < 0) || (PyUnicode_READY(s2) < 0))
return -1;
if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) {
return (equals == Py_NE);
} else if (PyUnicode_GET_LENGTH(s1) == 1) {
Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0);
Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0);
return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
#else
if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
return (equals == Py_NE);
} else if (PyUnicode_GET_SIZE(s1) == 1) {
Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0];
Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0];
return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
#endif
} else {
int result = PyUnicode_Compare(s1, s2);
if ((result == -1) && unlikely(PyErr_Occurred()))
return -1;
return (equals == Py_EQ) ? (result == 0) : (result != 0);
}
} else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
return (equals == Py_NE);
} else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
return (equals == Py_NE);
} else {
int result;
PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
if (!py_result)
return -1;
result = __Pyx_PyObject_IsTrue(py_result);
Py_DECREF(py_result);
return result;
}
#endif
}
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)) {
Py_ssize_t length;
if (unlikely((start < 0) | (stop < 0))) {
length = strlen(cstring);
if (start < 0) {
start += length;
if (start < 0)
start = 0;
}
if (stop < 0)
stop += length;
}
length = stop - start;
if (unlikely(length <= 0))
return PyUnicode_FromUnicode(NULL, 0);
cstring += start;
if (decode_func) {
return decode_func(cstring, length, errors);
} else {
return PyUnicode_Decode(cstring, length, encoding, errors);
}
}
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
}
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
if (unlikely(!type)) {
PyErr_Format(PyExc_SystemError, "Missing type object");
return 0;
}
if (likely(PyObject_TypeCheck(obj, type)))
return 1;
PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
Py_TYPE(obj)->tp_name, type->tp_name);
return 0;
}
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
local_type = tstate->curexc_type;
local_value = tstate->curexc_value;
local_tb = tstate->curexc_traceback;
tstate->curexc_type = 0;
tstate->curexc_value = 0;
tstate->curexc_traceback = 0;
#else
PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON
if (unlikely(tstate->curexc_type))
#else
if (unlikely(PyErr_Occurred()))
#endif
goto bad;
#if PY_MAJOR_VERSION >= 3
if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
goto bad;
#endif
Py_INCREF(local_type);
Py_INCREF(local_value);
Py_INCREF(local_tb);
*type = local_type;
*value = local_value;
*tb = local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
tmp_type = tstate->exc_type;
tmp_value = tstate->exc_value;
tmp_tb = tstate->exc_traceback;
tstate->exc_type = local_type;
tstate->exc_value = local_value;
tstate->exc_traceback = local_tb;
/* Make sure tstate is in a consistent state when we XDECREF
these objects (DECREF may run arbitrary code). */
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
#else
PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
return 0;
bad:
*type = 0;
*value = 0;
*tb = 0;
Py_XDECREF(local_type);
Py_XDECREF(local_value);
Py_XDECREF(local_tb);
return -1;
}
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}
static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
long q = a / b;
long r = a - q*b;
q -= ((r != 0) & ((r ^ b) < 0));
return q;
}
#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
CYTHON_UNUSED PyObject *getbuffer_cobj;
#if PY_VERSION_HEX >= 0x02060000
if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
#endif
if (PyObject_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
if (PyObject_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
#if PY_VERSION_HEX < 0x02060000
if (obj->ob_type->tp_dict &&
(getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
"__pyx_getbuffer"))) {
getbufferproc func;
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)");
#else
func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj);
#endif
Py_DECREF(getbuffer_cobj);
if (!func)
goto fail;
return func(obj, view, flags);
} else {
PyErr_Clear();
}
#endif
PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
#if PY_VERSION_HEX < 0x02060000
fail:
#endif
return -1;
}
static void __Pyx_ReleaseBuffer(Py_buffer *view) {
PyObject *obj = view->obj;
CYTHON_UNUSED PyObject *releasebuffer_cobj;
if (!obj) return;
#if PY_VERSION_HEX >= 0x02060000
if (PyObject_CheckBuffer(obj)) {
PyBuffer_Release(view);
return;
}
#endif
#if PY_VERSION_HEX < 0x02060000
if (obj->ob_type->tp_dict &&
(releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict,
"__pyx_releasebuffer"))) {
releasebufferproc func;
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)");
#else
func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj);
#endif
Py_DECREF(releasebuffer_cobj);
if (!func)
goto fail;
func(obj, view);
return;
} else {
PyErr_Clear();
}
#endif
goto nofail;
#if PY_VERSION_HEX < 0x02060000
fail:
#endif
PyErr_WriteUnraisable(obj);
nofail:
Py_DECREF(obj);
view->obj = NULL;
}
#endif /* PY_MAJOR_VERSION < 3 */
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_long(PyObject *obj) {
__Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_BufFmt_StackElem stack[1];
int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
int retcode;
if (obj == Py_None) {
result.memview = (struct __pyx_memoryview_obj *) Py_None;
return result;
}
retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
(PyBUF_C_CONTIGUOUS | PyBUF_FORMAT | PyBUF_WRITABLE), 1,
&__Pyx_TypeInfo_long, stack,
&result, obj);
if (unlikely(retcode == -1))
goto __pyx_fail;
return result;
__pyx_fail:
result.memview = NULL;
result.data = NULL;
return result;
}
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(PyObject *obj) {
__Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_BufFmt_StackElem stack[1];
int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
int retcode;
if (obj == Py_None) {
result.memview = (struct __pyx_memoryview_obj *) Py_None;
return result;
}
retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
(PyBUF_C_CONTIGUOUS | PyBUF_FORMAT | PyBUF_WRITABLE), 2,
&__Pyx_TypeInfo_long, stack,
&result, obj);
if (unlikely(retcode == -1))
goto __pyx_fail;
return result;
__pyx_fail:
result.memview = NULL;
result.data = NULL;
return result;
}
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(PyObject *obj) {
__Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_BufFmt_StackElem stack[1];
int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
int retcode;
if (obj == Py_None) {
result.memview = (struct __pyx_memoryview_obj *) Py_None;
return result;
}
retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
(PyBUF_C_CONTIGUOUS | PyBUF_FORMAT | PyBUF_WRITABLE), 2,
&__Pyx_TypeInfo_double, stack,
&result, obj);
if (unlikely(retcode == -1))
goto __pyx_fail;
return result;
__pyx_fail:
result.memview = NULL;
result.data = NULL;
return result;
}
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(PyObject *obj) {
__Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_BufFmt_StackElem stack[1];
int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
int retcode;
if (obj == Py_None) {
result.memview = (struct __pyx_memoryview_obj *) Py_None;
return result;
}
retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
(PyBUF_C_CONTIGUOUS | PyBUF_FORMAT | PyBUF_WRITABLE), 3,
&__Pyx_TypeInfo_double, stack,
&result, obj);
if (unlikely(retcode == -1))
goto __pyx_fail;
return result;
__pyx_fail:
result.memview = NULL;
result.data = NULL;
return result;
}
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(PyObject *obj) {
__Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_BufFmt_StackElem stack[1];
int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
int retcode;
if (obj == Py_None) {
result.memview = (struct __pyx_memoryview_obj *) Py_None;
return result;
}
retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
(PyBUF_C_CONTIGUOUS | PyBUF_FORMAT | PyBUF_WRITABLE), 3,
&__Pyx_TypeInfo_unsigned_char, stack,
&result, obj);
if (unlikely(retcode == -1))
goto __pyx_fail;
return result;
__pyx_fail:
result.memview = NULL;
result.data = NULL;
return result;
}
static int
__pyx_memviewslice_is_contig(const __Pyx_memviewslice *mvs,
char order, int ndim)
{
int i, index, step, start;
Py_ssize_t itemsize = mvs->memview->view.itemsize;
if (order == 'F') {
step = 1;
start = 0;
} else {
step = -1;
start = ndim - 1;
}
for (i = 0; i < ndim; i++) {
index = start + step * i;
if (mvs->suboffsets[index] >= 0 || mvs->strides[index] != itemsize)
return 0;
itemsize *= mvs->shape[index];
}
return 1;
}
static void
__pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
void **out_start, void **out_end,
int ndim, size_t itemsize)
{
char *start, *end;
int i;
start = end = slice->data;
for (i = 0; i < ndim; i++) {
Py_ssize_t stride = slice->strides[i];
Py_ssize_t extent = slice->shape[i];
if (extent == 0) {
*out_start = *out_end = start;
return;
} else {
if (stride > 0)
end += stride * (extent - 1);
else
start += stride * (extent - 1);
}
}
*out_start = start;
*out_end = end + itemsize;
}
static int
__pyx_slices_overlap(__Pyx_memviewslice *slice1,
__Pyx_memviewslice *slice2,
int ndim, size_t itemsize)
{
void *start1, *end1, *start2, *end2;
__pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
__pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
return (start1 < end2) && (start2 < end1);
}
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,
int dtype_is_object)
{
__Pyx_RefNannyDeclarations
int i;
__Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
Py_buffer *buf = &from_memview->view;
PyObject *shape_tuple = NULL;
PyObject *temp_int = NULL;
struct __pyx_array_obj *array_obj = NULL;
struct __pyx_memoryview_obj *memview_obj = NULL;
__Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
for (i = 0; i < ndim; i++) {
if (from_mvs->suboffsets[i] >= 0) {
PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
"indirect dimensions (axis %d)", i);
goto fail;
}
}
shape_tuple = PyTuple_New(ndim);
if (unlikely(!shape_tuple)) {
goto fail;
}
__Pyx_GOTREF(shape_tuple);
for(i = 0; i < ndim; i++) {
temp_int = PyInt_FromLong(from_mvs->shape[i]);
if(unlikely(!temp_int)) {
goto fail;
} else {
PyTuple_SET_ITEM(shape_tuple, i, temp_int);
temp_int = NULL;
}
}
array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
if (unlikely(!array_obj)) {
goto fail;
}
__Pyx_GOTREF(array_obj);
memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
(PyObject *) array_obj, contig_flag,
dtype_is_object,
from_mvs->memview->typeinfo);
if (unlikely(!memview_obj))
goto fail;
if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
goto fail;
if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
dtype_is_object) < 0))
goto fail;
goto no_fail;
fail:
__Pyx_XDECREF(new_mvs.memview);
new_mvs.memview = NULL;
new_mvs.data = NULL;
no_fail:
__Pyx_XDECREF(shape_tuple);
__Pyx_XDECREF(temp_int);
__Pyx_XDECREF(array_obj);
__Pyx_RefNannyFinishContext();
return new_mvs;
}
static CYTHON_INLINE PyObject *
__pyx_capsule_create(void *p, const char *sig)
{
PyObject *cobj;
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0)
cobj = PyCapsule_New(p, sig, NULL);
#else
cobj = PyCObject_FromVoidPtr(p, NULL);
#endif
return cobj;
}
static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
PyThreadState *tstate = PyThreadState_GET();
*type = tstate->exc_type;
*value = tstate->exc_value;
*tb = tstate->exc_traceback;
Py_XINCREF(*type);
Py_XINCREF(*value);
Py_XINCREF(*tb);
#else
PyErr_GetExcInfo(type, value, tb);
#endif
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
PyObject *tmp_type, *tmp_value, *tmp_tb;
PyThreadState *tstate = PyThreadState_GET();
tmp_type = tstate->exc_type;
tmp_value = tstate->exc_value;
tmp_tb = tstate->exc_traceback;
tstate->exc_type = type;
tstate->exc_value = value;
tstate->exc_traceback = tb;
Py_XDECREF(tmp_type);
Py_XDECREF(tmp_value);
Py_XDECREF(tmp_tb);
#else
PyErr_SetExcInfo(type, value, tb);
#endif
}
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
PyObject *py_import = 0;
PyObject *empty_list = 0;
PyObject *module = 0;
PyObject *global_dict = 0;
PyObject *empty_dict = 0;
PyObject *list;
py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
if (!py_import)
goto bad;
if (from_list)
list = from_list;
else {
empty_list = PyList_New(0);
if (!empty_list)
goto bad;
list = empty_list;
}
global_dict = PyModule_GetDict(__pyx_m);
if (!global_dict)
goto bad;
empty_dict = PyDict_New();
if (!empty_dict)
goto bad;
#if PY_VERSION_HEX >= 0x02050000
{
#if PY_MAJOR_VERSION >= 3
if (level == -1) {
if (strchr(__Pyx_MODULE_NAME, '.')) {
/* try package relative import first */
PyObject *py_level = PyInt_FromLong(1);
if (!py_level)
goto bad;
module = PyObject_CallFunctionObjArgs(py_import,
name, global_dict, empty_dict, list, py_level, NULL);
Py_DECREF(py_level);
if (!module) {
if (!PyErr_ExceptionMatches(PyExc_ImportError))
goto bad;
PyErr_Clear();
}
}
level = 0; /* try absolute import on failure */
}
#endif
if (!module) {
PyObject *py_level = PyInt_FromLong(level);
if (!py_level)
goto bad;
module = PyObject_CallFunctionObjArgs(py_import,
name, global_dict, empty_dict, list, py_level, NULL);
Py_DECREF(py_level);
}
}
#else
if (level>0) {
PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
goto bad;
}
module = PyObject_CallFunctionObjArgs(py_import,
name, global_dict, empty_dict, list, NULL);
#endif
bad:
Py_XDECREF(empty_list);
Py_XDECREF(py_import);
Py_XDECREF(empty_dict);
return module;
}
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(unsigned char) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(unsigned char)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to unsigned char" :
"value too large to convert to unsigned char");
}
return (unsigned char)-1;
}
return (unsigned char)val;
}
return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(unsigned short) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(unsigned short)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to unsigned short" :
"value too large to convert to unsigned short");
}
return (unsigned short)-1;
}
return (unsigned short)val;
}
return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(unsigned int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(unsigned int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to unsigned int" :
"value too large to convert to unsigned int");
}
return (unsigned int)-1;
}
return (unsigned int)val;
}
return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
const char neg_one = (char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(char) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(char)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to char" :
"value too large to convert to char");
}
return (char)-1;
}
return (char)val;
}
return (char)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
const short neg_one = (short)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(short) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(short)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to short" :
"value too large to convert to short");
}
return (short)-1;
}
return (short)val;
}
return (short)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
const int neg_one = (int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to int" :
"value too large to convert to int");
}
return (int)-1;
}
return (int)val;
}
return (int)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
const signed char neg_one = (signed char)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(signed char) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(signed char)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to signed char" :
"value too large to convert to signed char");
}
return (signed char)-1;
}
return (signed char)val;
}
return (signed char)__Pyx_PyInt_AsSignedLong(x);
}
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
const signed short neg_one = (signed short)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(signed short) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(signed short)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to signed short" :
"value too large to convert to signed short");
}
return (signed short)-1;
}
return (signed short)val;
}
return (signed short)__Pyx_PyInt_AsSignedLong(x);
}
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
const signed int neg_one = (signed int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(signed int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(signed int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to signed int" :
"value too large to convert to signed int");
}
return (signed int)-1;
}
return (signed int)val;
}
return (signed int)__Pyx_PyInt_AsSignedLong(x);
}
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
const int neg_one = (int)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
if (sizeof(int) < sizeof(long)) {
long val = __Pyx_PyInt_AsLong(x);
if (unlikely(val != (long)(int)val)) {
if (!unlikely(val == -1 && PyErr_Occurred())) {
PyErr_SetString(PyExc_OverflowError,
(is_unsigned && unlikely(val < 0)) ?
"can't convert negative value to int" :
"value too large to convert to int");
}
return (int)-1;
}
return (int)val;
}
return (int)__Pyx_PyInt_AsLong(x);
}
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned long");
return (unsigned long)-1;
}
return (unsigned long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned long");
return (unsigned long)-1;
}
return (unsigned long)PyLong_AsUnsignedLong(x);
} else {
return (unsigned long)PyLong_AsLong(x);
}
} else {
unsigned long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (unsigned long)-1;
val = __Pyx_PyInt_AsUnsignedLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned PY_LONG_LONG");
return (unsigned PY_LONG_LONG)-1;
}
return (unsigned PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to unsigned PY_LONG_LONG");
return (unsigned PY_LONG_LONG)-1;
}
return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
unsigned PY_LONG_LONG val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (unsigned PY_LONG_LONG)-1;
val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
const long neg_one = (long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to long");
return (long)-1;
}
return (long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to long");
return (long)-1;
}
return (long)PyLong_AsUnsignedLong(x);
} else {
return (long)PyLong_AsLong(x);
}
} else {
long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (long)-1;
val = __Pyx_PyInt_AsLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to PY_LONG_LONG");
return (PY_LONG_LONG)-1;
}
return (PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to PY_LONG_LONG");
return (PY_LONG_LONG)-1;
}
return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
return (PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
PY_LONG_LONG val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (PY_LONG_LONG)-1;
val = __Pyx_PyInt_AsLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
const signed long neg_one = (signed long)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed long");
return (signed long)-1;
}
return (signed long)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed long");
return (signed long)-1;
}
return (signed long)PyLong_AsUnsignedLong(x);
} else {
return (signed long)PyLong_AsLong(x);
}
} else {
signed long val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (signed long)-1;
val = __Pyx_PyInt_AsSignedLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
if (likely(PyInt_Check(x))) {
long val = PyInt_AS_LONG(x);
if (is_unsigned && unlikely(val < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed PY_LONG_LONG");
return (signed PY_LONG_LONG)-1;
}
return (signed PY_LONG_LONG)val;
} else
#endif
if (likely(PyLong_Check(x))) {
if (is_unsigned) {
if (unlikely(Py_SIZE(x) < 0)) {
PyErr_SetString(PyExc_OverflowError,
"can't convert negative value to signed PY_LONG_LONG");
return (signed PY_LONG_LONG)-1;
}
return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
} else {
return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
}
} else {
signed PY_LONG_LONG val;
PyObject *tmp = __Pyx_PyNumber_Int(x);
if (!tmp) return (signed PY_LONG_LONG)-1;
val = __Pyx_PyInt_AsSignedLongLong(tmp);
Py_DECREF(tmp);
return val;
}
}
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_long(PyObject *obj) {
__Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
__Pyx_BufFmt_StackElem stack[1];
int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
int retcode;
if (obj == Py_None) {
result.memview = (struct __pyx_memoryview_obj *) Py_None;
return result;
}
retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
(PyBUF_C_CONTIGUOUS | PyBUF_FORMAT | PyBUF_WRITABLE), 3,
&__Pyx_TypeInfo_long, stack,
&result, obj);
if (unlikely(retcode == -1))
goto __pyx_fail;
return result;
__pyx_fail:
result.memview = NULL;
result.data = NULL;
return result;
}
static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) {
PyObject *old_exc, *old_val, *old_tb;
PyObject *ctx;
__Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
#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);
}
}
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());
if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
char message[200];
PyOS_snprintf(message, sizeof(message),
"compiletime version %s of module '%.100s' "
"does not match runtime version %s",
ctversion, __Pyx_MODULE_NAME, rtversion);
#if PY_VERSION_HEX < 0x02050000
return PyErr_Warn(NULL, message);
#else
return PyErr_WarnEx(NULL, message, 1);
#endif
}
return 0;
}
static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
if (!ob)
goto bad;
if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
goto bad;
Py_DECREF(ob);
return 0;
bad:
Py_XDECREF(ob);
return -1;
}
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;
}
while (start < end) {
mid = (start + end) / 2;
if (code_line < entries[mid].code_line) {
end = mid;
} else if (code_line > entries[mid].code_line) {
start = mid + 1;
} else {
return mid;
}
}
if (code_line <= entries[mid].code_line) {
return mid;
} else {
return mid + 1;
}
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
PyCodeObject* code_object;
int pos;
if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
return NULL;
}
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
return NULL;
}
code_object = __pyx_code_cache.entries[pos].code_object;
Py_INCREF(code_object);
return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
int pos, i;
__Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
if (unlikely(!code_line)) {
return;
}
if (unlikely(!entries)) {
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
if (likely(entries)) {
__pyx_code_cache.entries = entries;
__pyx_code_cache.max_count = 64;
__pyx_code_cache.count = 1;
entries[0].code_line = code_line;
entries[0].code_object = code_object;
Py_INCREF(code_object);
}
return;
}
pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
PyCodeObject* tmp = entries[pos].code_object;
entries[pos].code_object = code_object;
Py_DECREF(tmp);
return;
}
if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
int new_max = __pyx_code_cache.max_count + 64;
entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
__pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
if (unlikely(!entries)) {
return;
}
__pyx_code_cache.entries = entries;
__pyx_code_cache.max_count = new_max;
}
for (i=__pyx_code_cache.count; i>pos; i--) {
entries[i] = entries[i-1];
}
entries[pos].code_line = code_line;
entries[pos].code_object = code_object;
__pyx_code_cache.count++;
Py_INCREF(code_object);
}
#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
const char *funcname, int c_line,
int py_line, const char *filename) {
PyCodeObject *py_code = 0;
PyObject *py_srcfile = 0;
PyObject *py_funcname = 0;
#if PY_MAJOR_VERSION < 3
py_srcfile = PyString_FromString(filename);
#else
py_srcfile = PyUnicode_FromString(filename);
#endif
if (!py_srcfile) goto bad;
if (c_line) {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
#else
py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
#endif
}
else {
#if PY_MAJOR_VERSION < 3
py_funcname = PyString_FromString(funcname);
#else
py_funcname = PyUnicode_FromString(funcname);
#endif
}
if (!py_funcname) goto bad;
py_code = __Pyx_PyCode_New(
0, /*int argcount,*/
0, /*int kwonlyargcount,*/
0, /*int nlocals,*/
0, /*int stacksize,*/
0, /*int flags,*/
__pyx_empty_bytes, /*PyObject *code,*/
__pyx_empty_tuple, /*PyObject *consts,*/
__pyx_empty_tuple, /*PyObject *names,*/
__pyx_empty_tuple, /*PyObject *varnames,*/
__pyx_empty_tuple, /*PyObject *freevars,*/
__pyx_empty_tuple, /*PyObject *cellvars,*/
py_srcfile, /*PyObject *filename,*/
py_funcname, /*PyObject *name,*/
py_line, /*int firstlineno,*/
__pyx_empty_bytes /*PyObject *lnotab*/
);
Py_DECREF(py_srcfile);
Py_DECREF(py_funcname);
return py_code;
bad:
Py_XDECREF(py_srcfile);
Py_XDECREF(py_funcname);
return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename) {
PyCodeObject *py_code = 0;
PyObject *py_globals = 0;
PyFrameObject *py_frame = 0;
py_code = __pyx_find_code_object(c_line ? c_line : py_line);
if (!py_code) {
py_code = __Pyx_CreateCodeObjectForTraceback(
funcname, c_line, py_line, filename);
if (!py_code) goto bad;
__pyx_insert_code_object(c_line ? c_line : py_line, py_code);
}
py_globals = PyModule_GetDict(__pyx_m);
if (!py_globals) goto bad;
py_frame = PyFrame_New(
PyThreadState_GET(), /*PyThreadState *tstate,*/
py_code, /*PyCodeObject *code,*/
py_globals, /*PyObject *globals,*/
0 /*PyObject *locals*/
);
if (!py_frame) goto bad;
py_frame->f_lineno = py_line;
PyTraceBack_Here(py_frame);
bad:
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
}
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
while (t->p) {
#if PY_MAJOR_VERSION < 3
if (t->is_unicode) {
*t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
} else if (t->intern) {
*t->p = PyString_InternFromString(t->s);
} else {
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
}
#else /* Python 3+ has unicode identifiers */
if (t->is_unicode | t->is_str) {
if (t->intern) {
*t->p = PyUnicode_InternFromString(t->s);
} else if (t->encoding) {
*t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
} else {
*t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
}
} else {
*t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
}
#endif
if (!*t->p)
return -1;
++t;
}
return 0;
}
/* Type Conversion Functions */
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
int is_true = x == Py_True;
if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
PyNumberMethods *m;
const char *name = NULL;
PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
if (PyInt_Check(x) || PyLong_Check(x))
#else
if (PyLong_Check(x))
#endif
return Py_INCREF(x), x;
m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
if (m && m->nb_int) {
name = "int";
res = PyNumber_Int(x);
}
else if (m && m->nb_long) {
name = "long";
res = PyNumber_Long(x);
}
#else
if (m && m->nb_int) {
name = "int";
res = PyNumber_Long(x);
}
#endif
if (res) {
#if PY_VERSION_HEX < 0x03000000
if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
if (!PyLong_Check(res)) {
#endif
PyErr_Format(PyExc_TypeError,
"__%s__ returned non-%s (type %.200s)",
name, name, Py_TYPE(res)->tp_name);
Py_DECREF(res);
return NULL;
}
}
else if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError,
"an integer is required");
}
return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
Py_ssize_t ival;
PyObject* x = PyNumber_Index(b);
if (!x) return -1;
ival = PyInt_AsSsize_t(x);
Py_DECREF(x);
return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
if (ival <= LONG_MAX)
return PyInt_FromLong((long)ival);
else {
unsigned char *bytes = (unsigned char *) &ival;
int one = 1; int little = (int)*(unsigned char*)&one;
return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
}
#else
return PyInt_FromSize_t(ival);
#endif
}
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
return (size_t)-1;
} else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
PyErr_SetString(PyExc_OverflowError,
"value too large to convert to size_t");
return (size_t)-1;
}
return (size_t)val;
}
#endif /* Py_PYTHON_H */
pycogent-1.9/cogent/align/_pairwise_pogs.pyx 0000664 0000000 0000000 00000033453 12730143670 0021353 0 ustar 00root root 0000000 0000000 #cython: boundscheck=False
#cython: wraparound=False
include "../../include/numerical_pyrex.pyx"
cdef extern from "Python.h":
PyErr_Occurred()
int PyErr_CheckSignals()
double Py_HUGE_VAL
cdef extern from "math.h":
double log (double x)
version_info = (3, 2)
__version__ = "('1', '9')"
cdef double SCALE_STEP, MIN_FLOAT_VALUE
SCALE_STEP = 2.0**50
MIN_FLOAT_VALUE = 1.0 / SCALE_STEP
cdef int MAX_XCOUNT
MAX_XCOUNT = 256
cdef long MIN_SCALE, MAX_SCALE
MIN_SCALE = -10000
MAX_SCALE = +10000 # or 0 if all numbers should be probabilities
def fmpt(mantissa, exponent, msg=''):
return "%s * SCALE_STEP ** %s %s" % (mantissa, exponent, msg)
ctypedef unsigned char [:,:,::1] UChar3D
def calc_rows(Long1D plan, Long1D seq1_index, Long1D seq2_index,
int i_low, int i_high, int j_low, int j_high, preds,
Long2D state_directions, Double2D T,
Double2D xgap_scores, Double2D ygap_scores, Double3D match_scores,
rows, UChar3D track, track_enc, int viterbi, int use_logs=0, int local=False,
int use_scaling=True):
"""The ultimate in 2D Pyrex dynamic programming - Forward or Viterbi
algorithm, with doubles or with slower but practically unoverflowable
(double, long) GMP-like numbers. Viterbi is also available in the ever
popular addition-of-logs version. All this with any possible pair HMM
transition matrix.
One time to use something faster than this is when the inputs are sequences
rather than alignments. This code expects alignments (which can be single
sequences) represented as POGs (ie: DAGs).
Limitations
- HMM states must be in a sensible order: M and X, then Y, then END.
"""
# These are array lengths/indicies and so could be Py_ssize_t
cdef int prev_i, prev_j, state, prev_state, min_prev_state, N
cdef int row_length, row_length1, row_count, row_count1, tmp_rows
cdef int a_count, b_count, a, b, a_low, a_high, b_low, b_high
cdef int dest_states, dest_state, d4, j, i
cdef int last_i, last_j, last_state
cdef int bin, x, y, bin_count, max_x, max_y
cdef int current_row_index, source_row_index
cdef int source_row_index_cache[256] # MAX_XCOUNT
cdef int i_link_count, j_link_count
cdef int dx, dy
cdef int tcode_x, tcode_y, tcode_s
cdef double d_score, mantissa, partial_sum, sub_partial_sum, max_mantissa, overall_max_mantissa
cdef long exponent, max_exponent, overall_max_exponent
cdef Double3D mantissas
cdef Long3D exponents
cdef long pointer_a, pointer_b, pointer_state
cdef Long1D i_sources, i_sources_offsets
cdef Long1D j_sources, j_sources_offsets
cdef long i_sources_start, i_sources_end
cdef long j_sources_start, j_sources_end
assert not (use_logs and not viterbi)
assert not (use_logs and use_scaling)
assert not (local and not viterbi)
N = 0
checkArray2D(T, &N, &N)
row_length = 0
row_count = 0
checkArray1D(plan, &row_count)
dest_states = 0
d4 = 4
# Array of (state, bin, dx, dy) tuples describing the HMM states.
checkArray2D(state_directions, &dest_states, &d4)
checkArray1D(seq1_index, &row_count)
checkArray1D(seq2_index, &row_length)
max_x = max_y = bin_count = 0
checkArray3D(match_scores, &bin_count, &max_x, &max_y)
checkArray2D(xgap_scores, &bin_count, &max_x)
checkArray2D(ygap_scores, &bin_count, &max_y)
for i from 0 <= i < row_count:
assert 0 <= seq1_index[i] < max_x
for j from 0 <= j < row_length:
assert 0 <= seq2_index[j] < max_y
assert j_low >= 0 and j_high > j_low and j_high <= row_length
(pog1, pog2) = preds
(j_sources, j_sources_offsets) = pog2.asCombinedArray()
j_link_count = 0
checkArray1D(j_sources, &j_link_count)
row_length1 = row_length + 1
checkArray1D(j_sources_offsets, &row_length1)
(i_sources, i_sources_offsets) = pog1.asCombinedArray()
i_link_count = 0
checkArray1D(i_sources, &i_link_count)
row_count1 = row_count + 1
checkArray1D(i_sources_offsets, &row_count1)
(mantissas, exponents) = rows
tmp_rows = 0
checkArray3D(mantissas, &tmp_rows, &row_length, &N)
if use_scaling:
checkArray3D(exponents, &tmp_rows, &row_length, &N)
cdef double impossible
if use_logs:
impossible = log(0.0) # -inf
else:
impossible = 0.0
if viterbi and track is not None and track_enc is not None:
checkArray3D(track, &row_count, &row_length, &N)
(tcode_x, tcode_y, tcode_s) = track_enc
else:
track = None
tcode_x = tcode_y = tcode_s = 0
# For local
overall_max_exponent = MIN_SCALE
overall_max_mantissa = impossible
last_i = last_j = last_state = -1
for i from i_low <= i < i_high:
x = seq1_index[i]
if PyErr_CheckSignals():
raise PyErr_Occurred()
i_sources_start = i_sources_offsets[i]
i_sources_end = i_sources_offsets[i+1]
current_row_index = plan[i]
source_row_index_cache[0] = current_row_index
a_count = i_sources_end-i_sources_start
for a from 0 <= a < a_count:
prev_i = i_sources[a+i_sources_start]
source_row_index_cache[a+1] = plan[prev_i]
if i == 0:
mantissas[current_row_index, 0, 0] = (0.0 if use_logs else 1.0)
if use_scaling:
exponents[current_row_index, 0, 0] = 0
else:
mantissas[current_row_index, 0, 0] = impossible
if use_scaling:
exponents[current_row_index, 0, 0] = MIN_SCALE
j_sources_end = j_sources_offsets[j_low]
for j from j_low <= j < j_high:
j_sources_start = j_sources_end
j_sources_end = j_sources_offsets[j+1]
for dest_state from 0 <= dest_state < dest_states:
state = state_directions[dest_state, 0]
bin = state_directions[dest_state, 1]
dx = state_directions[dest_state, 2]
dy = state_directions[dest_state, 3]
max_mantissa = impossible
max_exponent = MIN_SCALE
partial_sum = 0.0
pointer_state = N # ie ERROR
if dx:
a_low = 1
a_high = a_count + 1
else:
a_low = 0
a_high = 1
if dy:
b_low = 1
b_high = j_sources_end - j_sources_start + 1
else:
b_low = 0
b_high = 1
if use_scaling:
sub_partial_sum = 0.0
# keep these next 9 lines same as below
for a from a_low <= a < a_high:
source_row_index = source_row_index_cache[a]
for b from b_low <= b < b_high:
if dy:
prev_j = j_sources[b-1+j_sources_start]
else:
prev_j = j
min_prev_state = (prev_j > 0)
for prev_state from min_prev_state <= prev_state < N:
exponent = exponents[source_row_index, prev_j, prev_state]
if exponent == MIN_SCALE:
continue
mantissa = mantissas[source_row_index, prev_j, prev_state]
mantissa = mantissa * T[prev_state, state]
if mantissa < MIN_FLOAT_VALUE:
if mantissa == 0.0:
continue
if mantissa < 0.0:
if T[prev_state, state] < 0.0:
raise ArithmeticError(fmpt(mantissa, exponent,
"transition is a negative probability"))
raise ArithmeticError(fmpt(mantissa, exponent,
"product is a negative probability"))
while mantissa < MIN_FLOAT_VALUE:
mantissa *= SCALE_STEP
exponent += -1
if exponent <= MIN_SCALE:
raise ArithmeticError(fmpt(mantissa, exponent,
"underflows"))
elif mantissa > 1.0:
mantissa *= MIN_FLOAT_VALUE
exponent += 1
if exponent > MAX_SCALE:
raise ArithmeticError(fmpt(mantissa, exponent,
"is unexpectedly large"))
if exponent > max_exponent:
if exponent == max_exponent + 1:
sub_partial_sum = partial_sum
else:
sub_partial_sum = 0.0
partial_sum = 0.0
max_mantissa = 0.0
max_exponent = exponent
if exponent == max_exponent:
partial_sum += mantissa
if viterbi and mantissa > max_mantissa:
max_mantissa = mantissa
pointer_state = prev_state
pointer_a = a
pointer_b = b
elif exponent == max_exponent - 1:
sub_partial_sum += mantissa
partial_sum += sub_partial_sum * MIN_FLOAT_VALUE
else:
# keep these next 9 lines same as above
for a from a_low <= a < a_high:
source_row_index = source_row_index_cache[a]
for b from b_low <= b < b_high:
if dy:
prev_j = j_sources[b-1+j_sources_start]
else:
prev_j = j
min_prev_state = (prev_j > 0)
for prev_state from min_prev_state <= prev_state < N:
mantissa = mantissas[source_row_index, prev_j, prev_state]
if use_logs:
mantissa = mantissa + T[prev_state, state]
else:
mantissa = mantissa * T[prev_state, state]
partial_sum += mantissa
if viterbi and mantissa > max_mantissa:
max_mantissa = mantissa
pointer_state = prev_state
pointer_a = a
pointer_b = b
if viterbi:
mantissa = max_mantissa
if track is not None:
track[i, j, state] = (
(pointer_a << tcode_x) |
(pointer_b << tcode_y) |
(pointer_state << tcode_s))
else:
mantissa = partial_sum
if dy:
y = seq2_index[j]
if dx:
d_score = match_scores[bin, x, y]
else:
d_score = ygap_scores[bin, y]
elif dx:
d_score = xgap_scores[bin, x]
elif use_logs:
d_score = 0.0
else:
d_score = 1.0
if use_logs:
mantissa += d_score
else:
mantissa *= d_score
mantissas[current_row_index, j, state] = mantissa
if use_scaling:
exponents[current_row_index, j, state] = max_exponent
if local and dx and dy:
if (use_scaling and max_exponent > overall_max_exponent) or (
(not use_scaling or max_exponent == overall_max_exponent) and (
mantissa > overall_max_mantissa)):
overall_max_exponent = max_exponent
overall_max_mantissa = mantissa
last_i = i
last_j = j
last_state = state
if not local:
last_i = i_high - 1
last_j = j_high - 1
last_state = state
else:
mantissa = overall_max_mantissa
max_exponent = overall_max_exponent
if use_scaling:
score = log(mantissa) + log(SCALE_STEP) * max_exponent
elif use_logs:
score = mantissa
else:
score = log(mantissa)
return ((last_i, last_j), last_state, score)
pycogent-1.9/cogent/align/_pairwise_seqs.c 0000664 0000000 0000000 00002761153 12730143670 0020767 0 ustar 00root root 0000000 0000000 /* Generated by Cython 0.17.1 on Sat Nov 3 13:26:59 2012 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
#error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
#error Cython requires Python 2.4+.
#else
#include /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
#ifndef __stdcall
#define __stdcall
#endif
#ifndef __cdecl
#define __cdecl
#endif
#ifndef __fastcall
#define __fastcall
#endif
#endif
#ifndef DL_IMPORT
#define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
#define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
#define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
#define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
#define PY_SSIZE_T_MAX INT_MAX
#define PY_SSIZE_T_MIN INT_MIN
#define PY_FORMAT_SIZE_T ""
#define CYTHON_FORMAT_SSIZE_T ""
#define PyInt_FromSsize_t(z) PyInt_FromLong(z)
#define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o)
#define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \
(PyErr_Format(PyExc_TypeError, \
"expected index value, got %.200s", Py_TYPE(o)->tp_name), \
(PyObject*)0))
#define PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && !PyComplex_Check(o))
#define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#define __PYX_BUILD_PY_SSIZE_T "i"
#else
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#endif
#if PY_VERSION_HEX < 0x02060000
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
#define PyVarObject_HEAD_INIT(type, size) \
PyObject_HEAD_INIT(type) size,
#define PyType_Modified(t)
typedef struct {
void *buf;
PyObject *obj;
Py_ssize_t len;
Py_ssize_t itemsize;
int readonly;
int ndim;
char *format;
Py_ssize_t *shape;
Py_ssize_t *strides;
Py_ssize_t *suboffsets;
void *internal;
} Py_buffer;
#define PyBUF_SIMPLE 0
#define PyBUF_WRITABLE 0x0001
#define PyBUF_FORMAT 0x0004
#define PyBUF_ND 0x0008
#define PyBUF_STRIDES (0x0010 | PyBUF_ND)
#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
#define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
#define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)
typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif
#if PY_MAJOR_VERSION < 3
#define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
#define __Pyx_BUILTIN_MODULE_NAME "builtins"
#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
#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
#define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#endif
#if PY_MAJOR_VERSION >= 3
#define Py_TPFLAGS_CHECKTYPES 0
#define Py_TPFLAGS_HAVE_INDEX 0
#endif
#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
#define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
#define CYTHON_PEP393_ENABLED 1
#define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \
0 : _PyUnicode_Ready((PyObject *)(op)))
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
#else
#define CYTHON_PEP393_ENABLED 0
#define __Pyx_PyUnicode_READY(op) (0)
#define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
#define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
#define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBaseString_Type PyUnicode_Type
#define PyStringObject PyUnicodeObject
#define PyString_Type PyUnicode_Type
#define PyString_Check PyUnicode_Check
#define PyString_CheckExact PyUnicode_CheckExact
#endif
#if PY_VERSION_HEX < 0x02060000
#define PyBytesObject PyStringObject
#define PyBytes_Type PyString_Type
#define PyBytes_Check PyString_Check
#define PyBytes_CheckExact PyString_CheckExact
#define PyBytes_FromString PyString_FromString
#define PyBytes_FromStringAndSize PyString_FromStringAndSize
#define PyBytes_FromFormat PyString_FromFormat
#define PyBytes_DecodeEscape PyString_DecodeEscape
#define PyBytes_AsString PyString_AsString
#define PyBytes_AsStringAndSize PyString_AsStringAndSize
#define PyBytes_Size PyString_Size
#define PyBytes_AS_STRING PyString_AS_STRING
#define PyBytes_GET_SIZE PyString_GET_SIZE
#define PyBytes_Repr PyString_Repr
#define PyBytes_Concat PyString_Concat
#define PyBytes_ConcatAndDel PyString_ConcatAndDel
#endif
#if PY_VERSION_HEX < 0x02060000
#define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type)
#define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
#define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
#define PyIntObject PyLongObject
#define PyInt_Type PyLong_Type
#define PyInt_Check(op) PyLong_Check(op)
#define PyInt_CheckExact(op) PyLong_CheckExact(op)
#define PyInt_FromString PyLong_FromString
#define PyInt_FromUnicode PyLong_FromUnicode
#define PyInt_FromLong PyLong_FromLong
#define PyInt_FromSize_t PyLong_FromSize_t
#define PyInt_FromSsize_t PyLong_FromSsize_t
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AS_LONG PyLong_AS_LONG
#define PyInt_AsSsize_t PyLong_AsSsize_t
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif
#if PY_MAJOR_VERSION >= 3
#define PyBoolObject PyLongObject
#endif
#if PY_VERSION_HEX < 0x03020000
typedef long Py_hash_t;
#define __Pyx_PyInt_FromHash_t PyInt_FromLong
#define __Pyx_PyInt_AsHash_t PyInt_AsLong
#else
#define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
#define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
#endif
#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
#define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
#define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
#define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
#define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
#define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
#define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
(PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
(likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
(PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif
#if PY_MAJOR_VERSION >= 3
#define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif
#if PY_VERSION_HEX < 0x02050000
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n)))
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n)))
#else
#define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n))
#define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
#define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n))
#endif
#if PY_VERSION_HEX < 0x02050000
#define __Pyx_NAMESTR(n) ((char *)(n))
#define __Pyx_DOCSTR(n) ((char *)(n))
#else
#define __Pyx_NAMESTR(n) (n)
#define __Pyx_DOCSTR(n) (n)
#endif
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
#else
#define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
#define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
#endif
#ifndef __PYX_EXTERN_C
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#endif
#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include
#define __PYX_HAVE__cogent__align___pairwise_seqs
#define __PYX_HAVE_API__cogent__align___pairwise_seqs
#include "limits.h"
#include "math.h"
#include "pythread.h"
#include "string.h"
#include "stdlib.h"
#include "stdio.h"
#include "pystate.h"
#ifdef _OPENMP
#include
#endif /* _OPENMP */
#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif
/* inline attribute */
#ifndef CYTHON_INLINE
#if defined(__GNUC__)
#define CYTHON_INLINE __inline__
#elif defined(_MSC_VER)
#define CYTHON_INLINE __inline
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define CYTHON_INLINE inline
#else
#define CYTHON_INLINE
#endif
#endif
/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
# define CYTHON_UNUSED __attribute__ ((__unused__))
# else
# define CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
/* Type Conversion Predeclarations */
#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s))
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#ifdef __GNUC__
/* Test for GCC > 2.95 */
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#else /* __GNUC__ > 2 ... */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
#define likely(x) (x)
#define unlikely(x) (x)
#endif /* __GNUC__ */
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;
static const char *__pyx_f[] = {
"numerical_pyrex.pyx",
"_pairwise_seqs.pyx",
"stringsource",
};
struct __pyx_memoryview_obj;
typedef struct {
struct __pyx_memoryview_obj *memview;
char *data;
Py_ssize_t shape[8];
Py_ssize_t strides[8];
Py_ssize_t suboffsets[8];
} __Pyx_memviewslice;
#define IS_UNSIGNED(type) (((type) -1) > 0)
struct __Pyx_StructField_;
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
typedef struct {
const char* name; /* for error messages only */
struct __Pyx_StructField_* fields;
size_t size; /* sizeof(type) */
size_t arraysize[8]; /* length of array in each dimension */
int ndim;
char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */
char is_unsigned;
int flags;
} __Pyx_TypeInfo;
typedef struct __Pyx_StructField_ {
__Pyx_TypeInfo* type;
const char* name;
size_t offset;
} __Pyx_StructField;
typedef struct {
__Pyx_StructField* field;
size_t parent_offset;
} __Pyx_BufFmt_StackElem;
typedef struct {
__Pyx_StructField root;
__Pyx_BufFmt_StackElem* head;
size_t fmt_offset;
size_t new_count, enc_count;
size_t struct_alignment;
int is_complex;
char enc_type;
char new_packmode;
char enc_packmode;
char is_valid_array;
} __Pyx_BufFmt_Context;
#include
#ifndef CYTHON_ATOMICS
#define CYTHON_ATOMICS 1
#endif
#define __pyx_atomic_int_type int
/* todo: Portland pgcc, maybe OS X's OSAtomicIncrement32,
libatomic + autotools-like distutils support? Such a pain... */
#if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 || \
(__GNUC_MINOR__ == 1 && __GNUC_PATHLEVEL >= 2))
#define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
#define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
#ifdef __PYX_DEBUG_ATOMICS
#warning "Using GNU atomics"
#endif
#elif CYTHON_ATOMICS && MSC_VER
#include
#define __pyx_atomic_int_type LONG
#define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
#define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
#ifdef __PYX_DEBUG_ATOMICS
#warning "Using MSVC atomics"
#endif
#elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
#define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
#define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
#ifdef __PYX_DEBUG_ATOMICS
#warning "Using Intel atomics"
#endif
#else
#undef CYTHON_ATOMICS
#define CYTHON_ATOMICS 0
#ifdef __PYX_DEBUG_ATOMICS
#warning "Not using atomics"
#endif
#endif
typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
#if CYTHON_ATOMICS
#define __pyx_add_acquisition_count(memview) \
__pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
#define __pyx_sub_acquisition_count(memview) \
__pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
#else
#define __pyx_add_acquisition_count(memview) \
__pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
#define __pyx_sub_acquisition_count(memview) \
__pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
#endif
/*--- Type declarations ---*/
struct __pyx_memoryview_obj;
struct __pyx_array_obj;
struct __pyx_MemviewEnum_obj;
struct __pyx_memoryviewslice_obj;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":31
* int
*
* ctypedef double[::1] Double1D # <<<<<<<<<<<<<<
* ctypedef double[:, ::1] Double2D
* ctypedef double[:, :, ::1] Double3D
*/
typedef __Pyx_memviewslice __pyx_t_6cogent_5align_14_pairwise_seqs_Double1D;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":32
*
* ctypedef double[::1] Double1D
* ctypedef double[:, ::1] Double2D # <<<<<<<<<<<<<<
* ctypedef double[:, :, ::1] Double3D
* ctypedef long[::1] Long1D
*/
typedef __Pyx_memviewslice __pyx_t_6cogent_5align_14_pairwise_seqs_Double2D;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":33
* ctypedef double[::1] Double1D
* ctypedef double[:, ::1] Double2D
* ctypedef double[:, :, ::1] Double3D # <<<<<<<<<<<<<<
* ctypedef long[::1] Long1D
* ctypedef long[:, ::1] Long2D
*/
typedef __Pyx_memviewslice __pyx_t_6cogent_5align_14_pairwise_seqs_Double3D;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":34
* ctypedef double[:, ::1] Double2D
* ctypedef double[:, :, ::1] Double3D
* ctypedef long[::1] Long1D # <<<<<<<<<<<<<<
* ctypedef long[:, ::1] Long2D
* ctypedef long[:, :, ::1] Long3D
*/
typedef __Pyx_memviewslice __pyx_t_6cogent_5align_14_pairwise_seqs_Long1D;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":35
* ctypedef double[:, :, ::1] Double3D
* ctypedef long[::1] Long1D
* ctypedef long[:, ::1] Long2D # <<<<<<<<<<<<<<
* ctypedef long[:, :, ::1] Long3D
*
*/
typedef __Pyx_memviewslice __pyx_t_6cogent_5align_14_pairwise_seqs_Long2D;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":36
* ctypedef long[::1] Long1D
* ctypedef long[:, ::1] Long2D
* ctypedef long[:, :, ::1] Long3D # <<<<<<<<<<<<<<
*
*
*/
typedef __Pyx_memviewslice __pyx_t_6cogent_5align_14_pairwise_seqs_Long3D;
/* "cogent/align/_pairwise_seqs.pyx":33
* return "%s * SCALE_STEP ** %s %s" % (mantissa, exponent, msg)
*
* ctypedef unsigned char [:,:,::1] UChar3D # <<<<<<<<<<<<<<
*
* def calc_rows(Long1D plan, Long1D seq1_index, Long1D seq2_index,
*/
typedef __Pyx_memviewslice __pyx_t_6cogent_5align_14_pairwise_seqs_UChar3D;
/* "View.MemoryView":308
*
* @cname('__pyx_memoryview')
* cdef class memoryview(object): # <<<<<<<<<<<<<<
*
* cdef object obj
*/
struct __pyx_memoryview_obj {
PyObject_HEAD
struct __pyx_vtabstruct_memoryview *__pyx_vtab;
PyObject *obj;
PyObject *_size;
PyObject *_array_interface;
PyThread_type_lock lock;
__pyx_atomic_int acquisition_count[2];
__pyx_atomic_int *acquisition_count_aligned_p;
Py_buffer view;
int flags;
int dtype_is_object;
__Pyx_TypeInfo *typeinfo;
};
/* "View.MemoryView":96
*
* @cname("__pyx_array")
* cdef class array: # <<<<<<<<<<<<<<
*
* cdef:
*/
struct __pyx_array_obj {
PyObject_HEAD
char *data;
Py_ssize_t len;
char *format;
int ndim;
Py_ssize_t *_shape;
Py_ssize_t *_strides;
Py_ssize_t itemsize;
PyObject *mode;
PyObject *_format;
void (*callback_free_data)(void *);
int free_data;
int dtype_is_object;
};
/* "View.MemoryView":275
*
* @cname('__pyx_MemviewEnum')
* cdef class Enum(object): # <<<<<<<<<<<<<<
* cdef object name
* def __init__(self, name):
*/
struct __pyx_MemviewEnum_obj {
PyObject_HEAD
PyObject *name;
};
/* "View.MemoryView":927
*
* @cname('__pyx_memoryviewslice')
* cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
* "Internal class for passing memoryview slices to Python"
*
*/
struct __pyx_memoryviewslice_obj {
struct __pyx_memoryview_obj __pyx_base;
__Pyx_memviewslice from_slice;
PyObject *from_object;
PyObject *(*to_object_func)(char *);
int (*to_dtype_func)(char *, PyObject *);
};
/* "View.MemoryView":308
*
* @cname('__pyx_memoryview')
* cdef class memoryview(object): # <<<<<<<<<<<<<<
*
* cdef object obj
*/
struct __pyx_vtabstruct_memoryview {
char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
};
static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
/* "View.MemoryView":927
*
* @cname('__pyx_memoryviewslice')
* cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
* "Internal class for passing memoryview slices to Python"
*
*/
struct __pyx_vtabstruct__memoryviewslice {
struct __pyx_vtabstruct_memoryview __pyx_base;
};
static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
#ifndef CYTHON_REFNANNY
#define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
typedef struct {
void (*INCREF)(void*, PyObject*, int);
void (*DECREF)(void*, PyObject*, int);
void (*GOTREF)(void*, PyObject*, int);
void (*GIVEREF)(void*, PyObject*, int);
void* (*SetupContext)(const char*, int, const char*);
void (*FinishContext)(void**);
} __Pyx_RefNannyAPIStruct;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
#define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
if (acquire_gil) { \
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
PyGILState_Release(__pyx_gilstate_save); \
} else { \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
}
#else
#define __Pyx_RefNannySetupContext(name, acquire_gil) \
__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
#define __Pyx_RefNannyFinishContext() \
__Pyx_RefNanny->FinishContext(&__pyx_refnanny)
#define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
#define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
#define __Pyx_RefNannyDeclarations
#define __Pyx_RefNannySetupContext(name, acquire_gil)
#define __Pyx_RefNannyFinishContext()
#define __Pyx_INCREF(r) Py_INCREF(r)
#define __Pyx_DECREF(r) Py_DECREF(r)
#define __Pyx_GOTREF(r)
#define __Pyx_GIVEREF(r)
#define __Pyx_XINCREF(r) Py_XINCREF(r)
#define __Pyx_XDECREF(r) Py_XDECREF(r)
#define __Pyx_XGOTREF(r)
#define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*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); /*proto*/
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
const char* function_name); /*proto*/
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
__Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
#define __Pyx_MEMVIEW_DIRECT 1
#define __Pyx_MEMVIEW_PTR 2
#define __Pyx_MEMVIEW_FULL 4
#define __Pyx_MEMVIEW_CONTIG 8
#define __Pyx_MEMVIEW_STRIDED 16
#define __Pyx_MEMVIEW_FOLLOW 32
#define __Pyx_IS_C_CONTIG 1
#define __Pyx_IS_F_CONTIG 2
static int __Pyx_ValidateAndInit_memviewslice(
int *axes_specs,
int c_or_f_flag,
int buf_flags,
int ndim,
__Pyx_TypeInfo *dtype,
__Pyx_BufFmt_StackElem stack[],
__Pyx_memviewslice *memviewslice,
PyObject *original_obj);
static int __Pyx_init_memviewslice(
struct __pyx_memoryview_obj *memview,
int ndim,
__Pyx_memviewslice *memviewslice,
int memview_is_new_reference);
static CYTHON_INLINE int __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
PyThread_type_lock lock);
static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
PyThread_type_lock lock);
#define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
#define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
#define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
const char *name, int exact); /*proto*/
static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); /*proto*/
static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t); /* proto */
#define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/
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));
#include
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
PyObject *r;
if (!j) return NULL;
r = PyObject_GetItem(o, j);
Py_DECREF(j);
return r;
}
#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
__Pyx_GetItemInt_List_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
PyObject *r = PyList_GET_ITEM(o, i);
Py_INCREF(r);
return r;
}
else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
Py_INCREF(r);
return r;
}
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
return PySequence_GetItem(o, i);
#endif
}
#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
__Pyx_GetItemInt_Tuple_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
PyObject *r = PyTuple_GET_ITEM(o, i);
Py_INCREF(r);
return r;
}
else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
Py_INCREF(r);
return r;
}
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
return PySequence_GetItem(o, i);
#endif
}
#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \
__Pyx_GetItemInt_Fast(o, i) : \
__Pyx_GetItemInt_Generic(o, to_py_func(i)))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) {
#if CYTHON_COMPILING_IN_CPYTHON
if (PyList_CheckExact(o)) {
Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) {
PyObject *r = PyList_GET_ITEM(o, n);
Py_INCREF(r);
return r;
}
}
else if (PyTuple_CheckExact(o)) {
Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
PyObject *r = PyTuple_GET_ITEM(o, n);
Py_INCREF(r);
return r;
}
} else { /* inlined PySequence_GetItem() */
PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
if (likely(m && m->sq_item)) {
if (unlikely(i < 0) && likely(m->sq_length)) {
Py_ssize_t l = m->sq_length(o);
if (unlikely(l < 0)) return NULL;
i += l;
}
return m->sq_item(o, i);
}
}
#else
if (PySequence_Check(o)) {
return PySequence_GetItem(o, i);
}
#endif
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}
static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
PyListObject* L = (PyListObject*) list;
Py_ssize_t len = Py_SIZE(list);
if (likely(L->allocated > len)) {
Py_INCREF(x);
PyList_SET_ITEM(list, len, x);
Py_SIZE(list) = len+1;
return 0;
}
return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif
static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_suboffsets(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
#ifndef __PYX_FORCE_INIT_THREADS
#define __PYX_FORCE_INIT_THREADS 0
#endif
static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */
static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/
typedef struct {
Py_ssize_t shape, strides, suboffsets;
} __Pyx_Buf_DimInfo;
typedef struct {
size_t refcount;
Py_buffer pybuffer;
} __Pyx_Buffer;
typedef struct {
__Pyx_Buffer *rcbuffer;
char *data;
__Pyx_Buf_DimInfo diminfo[8];
} __Pyx_LocalBuf_ND;
#if PY_MAJOR_VERSION < 3
static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
static void __Pyx_ReleaseBuffer(Py_buffer *view);
#else
#define __Pyx_GetBuffer PyObject_GetBuffer
#define __Pyx_ReleaseBuffer PyBuffer_Release
#endif
static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_long(PyObject *);
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(PyObject *);
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(PyObject *);
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(PyObject *);
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(PyObject *);
static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice *mvs,
char order, int ndim);
static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
__Pyx_memviewslice *slice2,
int ndim, size_t itemsize);
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,
int dtype_is_object);
static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_long(PyObject *);
static void __Pyx_WriteUnraisable(const char *name, int clineno,
int lineno, const char *filename); /*proto*/
static int __Pyx_check_binary_version(void);
static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
typedef struct {
int code_line;
PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
int count;
int max_count;
__Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
static void __Pyx_AddTraceback(const char *funcname, int c_line,
int py_line, const char *filename); /*proto*/
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
/* Module declarations from 'cogent.align._pairwise_seqs' */
static PyTypeObject *__pyx_array_type = 0;
static PyTypeObject *__pyx_MemviewEnum_type = 0;
static PyTypeObject *__pyx_memoryview_type = 0;
static PyTypeObject *__pyx_memoryviewslice_type = 0;
static double __pyx_v_6cogent_5align_14_pairwise_seqs_SCALE_STEP;
static double __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_FLOAT_VALUE;
static int __pyx_v_6cogent_5align_14_pairwise_seqs_MAX_XCOUNT;
static long __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_SCALE;
static long __pyx_v_6cogent_5align_14_pairwise_seqs_MAX_SCALE;
static PyObject *generic = 0;
static PyObject *strided = 0;
static PyObject *indirect = 0;
static PyObject *contiguous = 0;
static PyObject *indirect_contiguous = 0;
static int __pyx_fuse_0__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(PyObject *, Py_ssize_t, Py_ssize_t *); /*proto*/
static int __pyx_fuse_1__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(PyObject *, Py_ssize_t, long *); /*proto*/
static int __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(PyObject *, Py_ssize_t, int *); /*proto*/
static int __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray1D(__Pyx_memviewslice, int *); /*proto*/
static int __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray2D(__Pyx_memviewslice, int *, int *); /*proto*/
static int __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray2D(__Pyx_memviewslice, int *, int *); /*proto*/
static int __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray3D(__Pyx_memviewslice, int *, int *, int *); /*proto*/
static int __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray3D(__Pyx_memviewslice, int *, int *, int *); /*proto*/
static int __pyx_fuse_2_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray3D(__Pyx_memviewslice, int *, int *, int *); /*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*/
static int __pyx_memoryview_check(PyObject *); /*proto*/
static PyObject *_unellipsify(PyObject *, int); /*proto*/
static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, int); /*proto*/
static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
static __Pyx_TypeInfo __Pyx_TypeInfo_long = { "long", NULL, sizeof(long), { 0 }, 0, IS_UNSIGNED(long) ? 'U' : 'I', IS_UNSIGNED(long), 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_unsigned_char = { "unsigned char", NULL, sizeof(unsigned char), { 0 }, 0, IS_UNSIGNED(unsigned char) ? 'U' : 'I', IS_UNSIGNED(unsigned char), 0 };
#define __Pyx_MODULE_NAME "cogent.align._pairwise_seqs"
int __pyx_module_is_main_cogent__align___pairwise_seqs = 0;
/* Implementation of 'cogent.align._pairwise_seqs' */
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_ArithmeticError;
static PyObject *__pyx_builtin_MemoryError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_Ellipsis;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_xrange;
static PyObject *__pyx_builtin_id;
static PyObject *__pyx_builtin_IndexError;
static PyObject *__pyx_pf_6cogent_5align_14_pairwise_seqs_fmpt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mantissa, PyObject *__pyx_v_exponent, PyObject *__pyx_v_msg); /* proto */
static PyObject *__pyx_pf_6cogent_5align_14_pairwise_seqs_2calc_rows(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_6cogent_5align_14_pairwise_seqs_Long1D __pyx_v_plan, __pyx_t_6cogent_5align_14_pairwise_seqs_Long1D __pyx_v_seq1_index, __pyx_t_6cogent_5align_14_pairwise_seqs_Long1D __pyx_v_seq2_index, int __pyx_v_i_low, int __pyx_v_i_high, int __pyx_v_j_low, int __pyx_v_j_high, CYTHON_UNUSED PyObject *__pyx_v_preds, __pyx_t_6cogent_5align_14_pairwise_seqs_Long2D __pyx_v_state_directions, __pyx_t_6cogent_5align_14_pairwise_seqs_Double2D __pyx_v_T, __pyx_t_6cogent_5align_14_pairwise_seqs_Double2D __pyx_v_xgap_scores, __pyx_t_6cogent_5align_14_pairwise_seqs_Double2D __pyx_v_ygap_scores, __pyx_t_6cogent_5align_14_pairwise_seqs_Double3D __pyx_v_match_scores, PyObject *__pyx_v_rows, __pyx_t_6cogent_5align_14_pairwise_seqs_UChar3D __pyx_v_track, PyObject *__pyx_v_track_enc, int __pyx_v_viterbi, int __pyx_v_use_logs, int __pyx_v_local, int __pyx_v_use_scaling); /* proto */
static int __pyx_array_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 */
static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *get_memview_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
static int __pyx_MemviewEnum_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
static PyObject *__pyx_MemviewEnum_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static PyObject *__pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview__get__base_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
static char __pyx_k_1[] = "%s dimension is %s, expected %s";
static char __pyx_k_2[] = "%s dimension is %s, too big";
static char __pyx_k_3[] = "Array required, got None";
static char __pyx_k_10[] = "";
static char __pyx_k_11[] = "%s * SCALE_STEP ** %s %s";
static char __pyx_k_12[] = "transition is a negative probability";
static char __pyx_k_13[] = "product is a negative probability";
static char __pyx_k_14[] = "is unexpectedly large";
static char __pyx_k_15[] = "Empty shape tuple for cython.array";
static char __pyx_k_17[] = "itemsize <= 0 for cython.array";
static char __pyx_k_20[] = "unable to allocate shape or strides.";
static char __pyx_k_22[] = "Invalid shape in axis %d: %d.";
static char __pyx_k_23[] = "Invalid mode, expected 'c' or 'fortran', got %s";
static char __pyx_k_25[] = "unable to allocate array data.";
static char __pyx_k_27[] = "Can only create a buffer that is contiguous in memory.";
static char __pyx_k_29[] = "Unable to convert item to object";
static char __pyx_k_31[] = "Buffer view does not expose strides";
static char __pyx_k_33[] = "";
static char __pyx_k_34[] = "";
static char __pyx_k_37[] = "Cannot index with type '%s'";
static char __pyx_k_39[] = "Indirect dimensions not supported";
static char __pyx_k_41[] = "Index out of bounds (axis %d)";
static char __pyx_k_42[] = "Step may not be zero (axis %d)";
static char __pyx_k_43[] = "All dimensions preceding dimension %d must be indexed and not sliced";
static char __pyx_k_44[] = "Out of bounds on buffer access (axis %d)";
static char __pyx_k_45[] = "Cannot transpose memoryview with indirect dimensions";
static char __pyx_k_46[] = "got differing extents in dimension %d (got %d and %d)";
static char __pyx_k_47[] = "Dimension %d is not direct";
static char __pyx_k_48[] = "('1', '5', '3-dev')";
static char __pyx_k_52[] = "/Users/maxwell/Documents/Work/Cogent/cogent/align/_pairwise_seqs.pyx";
static char __pyx_k_53[] = "cogent.align._pairwise_seqs";
static char __pyx_k_54[] = "overall_max_mantissa";
static char __pyx_k_55[] = "overall_max_exponent";
static char __pyx_k_58[] = "getbuffer(obj, view, flags)";
static char __pyx_k_59[] = "";
static char __pyx_k_61[] = "";
static char __pyx_k_63[] = "";
static char __pyx_k_65[] = "";
static char __pyx_k_67[] = "";
static char __pyx_k__N[] = "N";
static char __pyx_k__O[] = "O";
static char __pyx_k__T[] = "T";
static char __pyx_k__a[] = "a";
static char __pyx_k__b[] = "b";
static char __pyx_k__c[] = "c";
static char __pyx_k__i[] = "i";
static char __pyx_k__j[] = "j";
static char __pyx_k__x[] = "x";
static char __pyx_k__y[] = "y";
static char __pyx_k__d4[] = "d4";
static char __pyx_k__dx[] = "dx";
static char __pyx_k__dy[] = "dy";
static char __pyx_k__id[] = "id";
static char __pyx_k__1st[] = "1st";
static char __pyx_k__2nd[] = "2nd";
static char __pyx_k__3rd[] = "3rd";
static char __pyx_k__bin[] = "bin";
static char __pyx_k__msg[] = "msg";
static char __pyx_k__obj[] = "obj";
static char __pyx_k__base[] = "base";
static char __pyx_k__fmpt[] = "fmpt";
static char __pyx_k__mode[] = "mode";
static char __pyx_k__name[] = "name";
static char __pyx_k__ndim[] = "ndim";
static char __pyx_k__pack[] = "pack";
static char __pyx_k__plan[] = "plan";
static char __pyx_k__rows[] = "rows";
static char __pyx_k__size[] = "size";
static char __pyx_k__step[] = "step";
static char __pyx_k__stop[] = "stop";
static char __pyx_k__ASCII[] = "ASCII";
static char __pyx_k__a_low[] = "a_low";
static char __pyx_k__b_low[] = "b_low";
static char __pyx_k__error[] = "error";
static char __pyx_k__flags[] = "flags";
static char __pyx_k__i_low[] = "i_low";
static char __pyx_k__j_low[] = "j_low";
static char __pyx_k__local[] = "local";
static char __pyx_k__max_x[] = "max_x";
static char __pyx_k__max_y[] = "max_y";
static char __pyx_k__preds[] = "preds";
static char __pyx_k__range[] = "range";
static char __pyx_k__score[] = "score";
static char __pyx_k__shape[] = "shape";
static char __pyx_k__start[] = "start";
static char __pyx_k__state[] = "state";
static char __pyx_k__track[] = "track";
static char __pyx_k__a_high[] = "a_high";
static char __pyx_k__b_high[] = "b_high";
static char __pyx_k__decode[] = "decode";
static char __pyx_k__encode[] = "encode";
static char __pyx_k__extend[] = "extend";
static char __pyx_k__format[] = "format";
static char __pyx_k__i_high[] = "i_high";
static char __pyx_k__j_high[] = "j_high";
static char __pyx_k__last_i[] = "last_i";
static char __pyx_k__last_j[] = "last_j";
static char __pyx_k__prev_i[] = "prev_i";
static char __pyx_k__prev_j[] = "prev_j";
static char __pyx_k__struct[] = "struct";
static char __pyx_k__unpack[] = "unpack";
static char __pyx_k__xrange[] = "xrange";
static char __pyx_k__a_count[] = "a_count";
static char __pyx_k__b_count[] = "b_count";
static char __pyx_k__d_score[] = "d_score";
static char __pyx_k__fortran[] = "fortran";
static char __pyx_k__memview[] = "memview";
static char __pyx_k__tcode_s[] = "tcode_s";
static char __pyx_k__tcode_x[] = "tcode_x";
static char __pyx_k__tcode_y[] = "tcode_y";
static char __pyx_k__viterbi[] = "viterbi";
static char __pyx_k__Ellipsis[] = "Ellipsis";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____name__[] = "__name__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__exponent[] = "exponent";
static char __pyx_k__itemsize[] = "itemsize";
static char __pyx_k__mantissa[] = "mantissa";
static char __pyx_k__source_i[] = "source_i";
static char __pyx_k__tmp_rows[] = "tmp_rows";
static char __pyx_k__use_logs[] = "use_logs";
static char __pyx_k__TypeError[] = "TypeError";
static char __pyx_k____class__[] = "__class__";
static char __pyx_k__bin_count[] = "bin_count";
static char __pyx_k__calc_rows[] = "calc_rows";
static char __pyx_k__enumerate[] = "enumerate";
static char __pyx_k__exponents[] = "exponents";
static char __pyx_k__mantissas[] = "mantissas";
static char __pyx_k__pointer_a[] = "pointer_a";
static char __pyx_k__pointer_b[] = "pointer_b";
static char __pyx_k__row_count[] = "row_count";
static char __pyx_k__track_enc[] = "track_enc";
static char __pyx_k__IndexError[] = "IndexError";
static char __pyx_k__ValueError[] = "ValueError";
static char __pyx_k__dest_state[] = "dest_state";
static char __pyx_k__impossible[] = "impossible";
static char __pyx_k__last_state[] = "last_state";
static char __pyx_k__prev_state[] = "prev_state";
static char __pyx_k__row_count1[] = "row_count1";
static char __pyx_k__row_length[] = "row_length";
static char __pyx_k__seq1_index[] = "seq1_index";
static char __pyx_k__seq2_index[] = "seq2_index";
static char __pyx_k__underflows[] = "underflows";
static char __pyx_k__MemoryError[] = "MemoryError";
static char __pyx_k____version__[] = "__version__";
static char __pyx_k__dest_states[] = "dest_states";
static char __pyx_k__partial_sum[] = "partial_sum";
static char __pyx_k__row_length1[] = "row_length1";
static char __pyx_k__use_scaling[] = "use_scaling";
static char __pyx_k__xgap_scores[] = "xgap_scores";
static char __pyx_k__ygap_scores[] = "ygap_scores";
static char __pyx_k__match_scores[] = "match_scores";
static char __pyx_k__max_exponent[] = "max_exponent";
static char __pyx_k__max_mantissa[] = "max_mantissa";
static char __pyx_k__version_info[] = "version_info";
static char __pyx_k__pointer_state[] = "pointer_state";
static char __pyx_k__min_prev_state[] = "min_prev_state";
static char __pyx_k__ArithmeticError[] = "ArithmeticError";
static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer";
static char __pyx_k__allocate_buffer[] = "allocate_buffer";
static char __pyx_k__dtype_is_object[] = "dtype_is_object";
static char __pyx_k__sub_partial_sum[] = "sub_partial_sum";
static char __pyx_k__source_row_index[] = "source_row_index";
static char __pyx_k__state_directions[] = "state_directions";
static char __pyx_k__current_row_index[] = "current_row_index";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_s_10;
static PyObject *__pyx_kp_s_11;
static PyObject *__pyx_kp_s_12;
static PyObject *__pyx_kp_s_13;
static PyObject *__pyx_kp_s_14;
static PyObject *__pyx_kp_s_15;
static PyObject *__pyx_kp_s_17;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_kp_s_20;
static PyObject *__pyx_kp_s_22;
static PyObject *__pyx_kp_s_23;
static PyObject *__pyx_kp_s_25;
static PyObject *__pyx_kp_s_27;
static PyObject *__pyx_kp_s_29;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_31;
static PyObject *__pyx_kp_s_33;
static PyObject *__pyx_kp_s_34;
static PyObject *__pyx_kp_s_37;
static PyObject *__pyx_kp_s_39;
static PyObject *__pyx_kp_s_44;
static PyObject *__pyx_kp_s_46;
static PyObject *__pyx_kp_s_48;
static PyObject *__pyx_kp_s_52;
static PyObject *__pyx_n_s_53;
static PyObject *__pyx_n_s_54;
static PyObject *__pyx_n_s_55;
static PyObject *__pyx_kp_s_59;
static PyObject *__pyx_kp_s_61;
static PyObject *__pyx_kp_s_63;
static PyObject *__pyx_kp_s_65;
static PyObject *__pyx_kp_s_67;
static PyObject *__pyx_kp_s__1st;
static PyObject *__pyx_kp_s__2nd;
static PyObject *__pyx_kp_s__3rd;
static PyObject *__pyx_n_s__ASCII;
static PyObject *__pyx_n_s__ArithmeticError;
static PyObject *__pyx_n_s__Ellipsis;
static PyObject *__pyx_n_s__IndexError;
static PyObject *__pyx_n_s__MemoryError;
static PyObject *__pyx_n_s__N;
static PyObject *__pyx_n_b__O;
static PyObject *__pyx_n_s__T;
static PyObject *__pyx_n_s__TypeError;
static PyObject *__pyx_n_s__ValueError;
static PyObject *__pyx_n_s____class__;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____name__;
static PyObject *__pyx_n_s____pyx_getbuffer;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s____version__;
static PyObject *__pyx_n_s__a;
static PyObject *__pyx_n_s__a_count;
static PyObject *__pyx_n_s__a_high;
static PyObject *__pyx_n_s__a_low;
static PyObject *__pyx_n_s__allocate_buffer;
static PyObject *__pyx_n_s__b;
static PyObject *__pyx_n_s__b_count;
static PyObject *__pyx_n_s__b_high;
static PyObject *__pyx_n_s__b_low;
static PyObject *__pyx_n_s__base;
static PyObject *__pyx_n_s__bin;
static PyObject *__pyx_n_s__bin_count;
static PyObject *__pyx_n_b__c;
static PyObject *__pyx_n_s__c;
static PyObject *__pyx_n_u__c;
static PyObject *__pyx_n_s__calc_rows;
static PyObject *__pyx_n_s__current_row_index;
static PyObject *__pyx_n_s__d4;
static PyObject *__pyx_n_s__d_score;
static PyObject *__pyx_n_s__decode;
static PyObject *__pyx_n_s__dest_state;
static PyObject *__pyx_n_s__dest_states;
static PyObject *__pyx_n_s__dtype_is_object;
static PyObject *__pyx_n_s__dx;
static PyObject *__pyx_n_s__dy;
static PyObject *__pyx_n_s__encode;
static PyObject *__pyx_n_s__enumerate;
static PyObject *__pyx_n_s__error;
static PyObject *__pyx_n_s__exponent;
static PyObject *__pyx_n_s__exponents;
static PyObject *__pyx_n_s__extend;
static PyObject *__pyx_n_s__flags;
static PyObject *__pyx_n_s__fmpt;
static PyObject *__pyx_n_s__format;
static PyObject *__pyx_n_b__fortran;
static PyObject *__pyx_n_s__fortran;
static PyObject *__pyx_n_s__i;
static PyObject *__pyx_n_s__i_high;
static PyObject *__pyx_n_s__i_low;
static PyObject *__pyx_n_s__id;
static PyObject *__pyx_n_s__impossible;
static PyObject *__pyx_n_s__itemsize;
static PyObject *__pyx_n_s__j;
static PyObject *__pyx_n_s__j_high;
static PyObject *__pyx_n_s__j_low;
static PyObject *__pyx_n_s__last_i;
static PyObject *__pyx_n_s__last_j;
static PyObject *__pyx_n_s__last_state;
static PyObject *__pyx_n_s__local;
static PyObject *__pyx_n_s__mantissa;
static PyObject *__pyx_n_s__mantissas;
static PyObject *__pyx_n_s__match_scores;
static PyObject *__pyx_n_s__max_exponent;
static PyObject *__pyx_n_s__max_mantissa;
static PyObject *__pyx_n_s__max_x;
static PyObject *__pyx_n_s__max_y;
static PyObject *__pyx_n_s__memview;
static PyObject *__pyx_n_s__min_prev_state;
static PyObject *__pyx_n_s__mode;
static PyObject *__pyx_n_s__msg;
static PyObject *__pyx_n_s__name;
static PyObject *__pyx_n_s__ndim;
static PyObject *__pyx_n_s__obj;
static PyObject *__pyx_n_s__pack;
static PyObject *__pyx_n_s__partial_sum;
static PyObject *__pyx_n_s__plan;
static PyObject *__pyx_n_s__pointer_a;
static PyObject *__pyx_n_s__pointer_b;
static PyObject *__pyx_n_s__pointer_state;
static PyObject *__pyx_n_s__preds;
static PyObject *__pyx_n_s__prev_i;
static PyObject *__pyx_n_s__prev_j;
static PyObject *__pyx_n_s__prev_state;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__row_count;
static PyObject *__pyx_n_s__row_count1;
static PyObject *__pyx_n_s__row_length;
static PyObject *__pyx_n_s__row_length1;
static PyObject *__pyx_n_s__rows;
static PyObject *__pyx_n_s__score;
static PyObject *__pyx_n_s__seq1_index;
static PyObject *__pyx_n_s__seq2_index;
static PyObject *__pyx_n_s__shape;
static PyObject *__pyx_n_s__size;
static PyObject *__pyx_n_s__source_i;
static PyObject *__pyx_n_s__source_row_index;
static PyObject *__pyx_n_s__start;
static PyObject *__pyx_n_s__state;
static PyObject *__pyx_n_s__state_directions;
static PyObject *__pyx_n_s__step;
static PyObject *__pyx_n_s__stop;
static PyObject *__pyx_n_s__struct;
static PyObject *__pyx_n_s__sub_partial_sum;
static PyObject *__pyx_n_s__tcode_s;
static PyObject *__pyx_n_s__tcode_x;
static PyObject *__pyx_n_s__tcode_y;
static PyObject *__pyx_n_s__tmp_rows;
static PyObject *__pyx_n_s__track;
static PyObject *__pyx_n_s__track_enc;
static PyObject *__pyx_n_s__underflows;
static PyObject *__pyx_n_s__unpack;
static PyObject *__pyx_n_s__use_logs;
static PyObject *__pyx_n_s__use_scaling;
static PyObject *__pyx_n_s__version_info;
static PyObject *__pyx_n_s__viterbi;
static PyObject *__pyx_n_s__x;
static PyObject *__pyx_n_s__xgap_scores;
static PyObject *__pyx_n_s__xrange;
static PyObject *__pyx_n_s__y;
static PyObject *__pyx_n_s__ygap_scores;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_k_tuple_4;
static PyObject *__pyx_k_tuple_5;
static PyObject *__pyx_k_tuple_6;
static PyObject *__pyx_k_tuple_7;
static PyObject *__pyx_k_tuple_8;
static PyObject *__pyx_k_tuple_9;
static PyObject *__pyx_k_tuple_16;
static PyObject *__pyx_k_tuple_18;
static PyObject *__pyx_k_tuple_19;
static PyObject *__pyx_k_tuple_21;
static PyObject *__pyx_k_tuple_24;
static PyObject *__pyx_k_tuple_26;
static PyObject *__pyx_k_tuple_28;
static PyObject *__pyx_k_tuple_30;
static PyObject *__pyx_k_tuple_32;
static PyObject *__pyx_k_tuple_35;
static PyObject *__pyx_k_tuple_36;
static PyObject *__pyx_k_tuple_38;
static PyObject *__pyx_k_tuple_40;
static PyObject *__pyx_k_tuple_49;
static PyObject *__pyx_k_tuple_50;
static PyObject *__pyx_k_tuple_56;
static PyObject *__pyx_k_tuple_60;
static PyObject *__pyx_k_tuple_62;
static PyObject *__pyx_k_tuple_64;
static PyObject *__pyx_k_tuple_66;
static PyObject *__pyx_k_tuple_68;
static PyObject *__pyx_k_codeobj_51;
static PyObject *__pyx_k_codeobj_57;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":39
*
*
* cdef int checkDim(dimension, Py_ssize_t val, dim *var) except 1: # <<<<<<<<<<<<<<
* if var[0] == 0:
* # Length unspecified, take it from the provided array
*/
static int __pyx_fuse_0__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(PyObject *__pyx_v_dimension, Py_ssize_t __pyx_v_val, Py_ssize_t *__pyx_v_var) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_0checkDim", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":40
*
* cdef int checkDim(dimension, Py_ssize_t val, dim *var) except 1:
* if var[0] == 0: # <<<<<<<<<<<<<<
* # Length unspecified, take it from the provided array
* if dim is int:
*/
__pyx_t_1 = ((__pyx_v_var[0]) == 0);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":51
* var[0] = val
* else:
* var[0] = val # <<<<<<<<<<<<<<
*
* elif var[0] != val:
*/
(__pyx_v_var[0]) = __pyx_v_val;
goto __pyx_L3;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":53
* var[0] = val
*
* elif var[0] != val: # <<<<<<<<<<<<<<
* # Length already specified, but not the same
* raise ValueError("%s dimension is %s, expected %s" %
*/
__pyx_t_1 = ((__pyx_v_var[0]) != __pyx_v_val);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":56
* # Length already specified, but not the same
* raise ValueError("%s dimension is %s, expected %s" %
* (dimension, val, var[0])) # <<<<<<<<<<<<<<
* else:
* # Length matches what was expected
*/
__pyx_t_2 = PyInt_FromSsize_t(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyInt_FromSsize_t((__pyx_v_var[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_dimension);
__Pyx_GIVEREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_2 = 0;
__pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
/*else*/ {
}
__pyx_L3:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("cogent.align._pairwise_seqs.checkDim", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":39
*
*
* cdef int checkDim(dimension, Py_ssize_t val, dim *var) except 1: # <<<<<<<<<<<<<<
* if var[0] == 0:
* # Length unspecified, take it from the provided array
*/
static int __pyx_fuse_1__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(PyObject *__pyx_v_dimension, Py_ssize_t __pyx_v_val, long *__pyx_v_var) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_1checkDim", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":40
*
* cdef int checkDim(dimension, Py_ssize_t val, dim *var) except 1:
* if var[0] == 0: # <<<<<<<<<<<<<<
* # Length unspecified, take it from the provided array
* if dim is int:
*/
__pyx_t_1 = ((__pyx_v_var[0]) == 0);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":47
* var[0] = val
* elif dim is long:
* if val > LONG_MAX: # <<<<<<<<<<<<<<
* raise ValueError("%s dimension is %s, too big" % (dimension, val))
* var[0] = val
*/
__pyx_t_1 = (__pyx_v_val > LONG_MAX);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":48
* elif dim is long:
* if val > LONG_MAX:
* raise ValueError("%s dimension is %s, too big" % (dimension, val)) # <<<<<<<<<<<<<<
* var[0] = val
* else:
*/
__pyx_t_2 = PyInt_FromSsize_t(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_dimension);
__Pyx_GIVEREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
__pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L4;
}
__pyx_L4:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":49
* if val > LONG_MAX:
* raise ValueError("%s dimension is %s, too big" % (dimension, val))
* var[0] = val # <<<<<<<<<<<<<<
* else:
* var[0] = val
*/
(__pyx_v_var[0]) = ((long)__pyx_v_val);
goto __pyx_L3;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":53
* var[0] = val
*
* elif var[0] != val: # <<<<<<<<<<<<<<
* # Length already specified, but not the same
* raise ValueError("%s dimension is %s, expected %s" %
*/
__pyx_t_1 = ((__pyx_v_var[0]) != __pyx_v_val);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":56
* # Length already specified, but not the same
* raise ValueError("%s dimension is %s, expected %s" %
* (dimension, val, var[0])) # <<<<<<<<<<<<<<
* else:
* # Length matches what was expected
*/
__pyx_t_2 = PyInt_FromSsize_t(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyInt_FromLong((__pyx_v_var[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_dimension);
__Pyx_GIVEREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_2 = 0;
__pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
/*else*/ {
}
__pyx_L3:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("cogent.align._pairwise_seqs.checkDim", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":39
*
*
* cdef int checkDim(dimension, Py_ssize_t val, dim *var) except 1: # <<<<<<<<<<<<<<
* if var[0] == 0:
* # Length unspecified, take it from the provided array
*/
static int __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(PyObject *__pyx_v_dimension, Py_ssize_t __pyx_v_val, int *__pyx_v_var) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_2checkDim", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":40
*
* cdef int checkDim(dimension, Py_ssize_t val, dim *var) except 1:
* if var[0] == 0: # <<<<<<<<<<<<<<
* # Length unspecified, take it from the provided array
* if dim is int:
*/
__pyx_t_1 = ((__pyx_v_var[0]) == 0);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":43
* # Length unspecified, take it from the provided array
* if dim is int:
* if val > INT_MAX: # <<<<<<<<<<<<<<
* raise ValueError("%s dimension is %s, too big" % (dimension, val))
* var[0] = val
*/
__pyx_t_1 = (__pyx_v_val > INT_MAX);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":44
* if dim is int:
* if val > INT_MAX:
* raise ValueError("%s dimension is %s, too big" % (dimension, val)) # <<<<<<<<<<<<<<
* var[0] = val
* elif dim is long:
*/
__pyx_t_2 = PyInt_FromSsize_t(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_dimension);
__Pyx_GIVEREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
__pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L4;
}
__pyx_L4:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":45
* if val > INT_MAX:
* raise ValueError("%s dimension is %s, too big" % (dimension, val))
* var[0] = val # <<<<<<<<<<<<<<
* elif dim is long:
* if val > LONG_MAX:
*/
(__pyx_v_var[0]) = ((int)__pyx_v_val);
goto __pyx_L3;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":53
* var[0] = val
*
* elif var[0] != val: # <<<<<<<<<<<<<<
* # Length already specified, but not the same
* raise ValueError("%s dimension is %s, expected %s" %
*/
__pyx_t_1 = ((__pyx_v_var[0]) != __pyx_v_val);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":56
* # Length already specified, but not the same
* raise ValueError("%s dimension is %s, expected %s" %
* (dimension, val, var[0])) # <<<<<<<<<<<<<<
* else:
* # Length matches what was expected
*/
__pyx_t_2 = PyInt_FromSsize_t(__pyx_v_val); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyInt_FromLong((__pyx_v_var[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_dimension);
__Pyx_GIVEREF(__pyx_v_dimension);
PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_2 = 0;
__pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
/*else*/ {
}
__pyx_L3:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("cogent.align._pairwise_seqs.checkDim", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":62
*
*
* cdef int checkArray1D(num[::1] a, dim *x) except 1: # <<<<<<<<<<<<<<
* if a is None:
* raise ValueError('Array required, got None')
*/
static int __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray1D(__Pyx_memviewslice __pyx_v_a, int *__pyx_v_x) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_1_2checkArray1D", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":63
*
* cdef int checkArray1D(num[::1] a, dim *x) except 1:
* if a is None: # <<<<<<<<<<<<<<
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
*/
__pyx_t_1 = (((PyObject *) __pyx_v_a.memview) == Py_None);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":64
* cdef int checkArray1D(num[::1] a, dim *x) except 1:
* if a is None:
* raise ValueError('Array required, got None') # <<<<<<<<<<<<<<
* checkDim('1st', a.shape[0], x)
*
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":65
* if a is None:
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x) # <<<<<<<<<<<<<<
*
* cdef int checkArray2D(num[:, ::1] a, dim *x, dim *y) except 1:
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__1st);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(__pyx_t_2, (__pyx_v_a.shape[0]), __pyx_v_x); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cogent.align._pairwise_seqs.checkArray1D", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":67
* checkDim('1st', a.shape[0], x)
*
* cdef int checkArray2D(num[:, ::1] a, dim *x, dim *y) except 1: # <<<<<<<<<<<<<<
* if a is None:
* raise ValueError('Array required, got None')
*/
static int __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray2D(__Pyx_memviewslice __pyx_v_a, int *__pyx_v_x, int *__pyx_v_y) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_0_2checkArray2D", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":68
*
* cdef int checkArray2D(num[:, ::1] a, dim *x, dim *y) except 1:
* if a is None: # <<<<<<<<<<<<<<
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
*/
__pyx_t_1 = (((PyObject *) __pyx_v_a.memview) == Py_None);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":69
* cdef int checkArray2D(num[:, ::1] a, dim *x, dim *y) except 1:
* if a is None:
* raise ValueError('Array required, got None') # <<<<<<<<<<<<<<
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":70
* if a is None:
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x) # <<<<<<<<<<<<<<
* checkDim('2nd', a.shape[1], y)
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__1st);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(__pyx_t_2, (__pyx_v_a.shape[0]), __pyx_v_x); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":71
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y) # <<<<<<<<<<<<<<
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__2nd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(__pyx_t_2, (__pyx_v_a.shape[1]), __pyx_v_y); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cogent.align._pairwise_seqs.checkArray2D", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":67
* checkDim('1st', a.shape[0], x)
*
* cdef int checkArray2D(num[:, ::1] a, dim *x, dim *y) except 1: # <<<<<<<<<<<<<<
* if a is None:
* raise ValueError('Array required, got None')
*/
static int __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray2D(__Pyx_memviewslice __pyx_v_a, int *__pyx_v_x, int *__pyx_v_y) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_1_2checkArray2D", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":68
*
* cdef int checkArray2D(num[:, ::1] a, dim *x, dim *y) except 1:
* if a is None: # <<<<<<<<<<<<<<
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
*/
__pyx_t_1 = (((PyObject *) __pyx_v_a.memview) == Py_None);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":69
* cdef int checkArray2D(num[:, ::1] a, dim *x, dim *y) except 1:
* if a is None:
* raise ValueError('Array required, got None') # <<<<<<<<<<<<<<
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":70
* if a is None:
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x) # <<<<<<<<<<<<<<
* checkDim('2nd', a.shape[1], y)
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__1st);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(__pyx_t_2, (__pyx_v_a.shape[0]), __pyx_v_x); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":71
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y) # <<<<<<<<<<<<<<
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__2nd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(__pyx_t_2, (__pyx_v_a.shape[1]), __pyx_v_y); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cogent.align._pairwise_seqs.checkArray2D", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":73
* checkDim('2nd', a.shape[1], y)
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1: # <<<<<<<<<<<<<<
* if a is None:
* raise ValueError('Array required, got None')
*/
static int __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray3D(__Pyx_memviewslice __pyx_v_a, int *__pyx_v_x, int *__pyx_v_y, int *__pyx_v_z) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_0_2checkArray3D", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":74
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
* if a is None: # <<<<<<<<<<<<<<
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
*/
__pyx_t_1 = (((PyObject *) __pyx_v_a.memview) == Py_None);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":75
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
* if a is None:
* raise ValueError('Array required, got None') # <<<<<<<<<<<<<<
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":76
* if a is None:
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x) # <<<<<<<<<<<<<<
* checkDim('2nd', a.shape[1], y)
* checkDim('3rd', a.shape[2], z)
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__1st);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(__pyx_t_2, (__pyx_v_a.shape[0]), __pyx_v_x); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":77
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y) # <<<<<<<<<<<<<<
* checkDim('3rd', a.shape[2], z)
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__2nd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(__pyx_t_2, (__pyx_v_a.shape[1]), __pyx_v_y); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":78
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
* checkDim('3rd', a.shape[2], z) # <<<<<<<<<<<<<<
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__3rd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(__pyx_t_2, (__pyx_v_a.shape[2]), __pyx_v_z); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cogent.align._pairwise_seqs.checkArray3D", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":73
* checkDim('2nd', a.shape[1], y)
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1: # <<<<<<<<<<<<<<
* if a is None:
* raise ValueError('Array required, got None')
*/
static int __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray3D(__Pyx_memviewslice __pyx_v_a, int *__pyx_v_x, int *__pyx_v_y, int *__pyx_v_z) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_1_2checkArray3D", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":74
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
* if a is None: # <<<<<<<<<<<<<<
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
*/
__pyx_t_1 = (((PyObject *) __pyx_v_a.memview) == Py_None);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":75
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
* if a is None:
* raise ValueError('Array required, got None') # <<<<<<<<<<<<<<
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":76
* if a is None:
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x) # <<<<<<<<<<<<<<
* checkDim('2nd', a.shape[1], y)
* checkDim('3rd', a.shape[2], z)
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__1st);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(__pyx_t_2, (__pyx_v_a.shape[0]), __pyx_v_x); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":77
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y) # <<<<<<<<<<<<<<
* checkDim('3rd', a.shape[2], z)
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__2nd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(__pyx_t_2, (__pyx_v_a.shape[1]), __pyx_v_y); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":78
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
* checkDim('3rd', a.shape[2], z) # <<<<<<<<<<<<<<
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__3rd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(__pyx_t_2, (__pyx_v_a.shape[2]), __pyx_v_z); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cogent.align._pairwise_seqs.checkArray3D", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":73
* checkDim('2nd', a.shape[1], y)
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1: # <<<<<<<<<<<<<<
* if a is None:
* raise ValueError('Array required, got None')
*/
static int __pyx_fuse_2_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray3D(__Pyx_memviewslice __pyx_v_a, int *__pyx_v_x, int *__pyx_v_y, int *__pyx_v_z) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__pyx_fuse_2_2checkArray3D", 0);
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":74
*
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
* if a is None: # <<<<<<<<<<<<<<
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
*/
__pyx_t_1 = (((PyObject *) __pyx_v_a.memview) == Py_None);
if (__pyx_t_1) {
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":75
* cdef int checkArray3D(num[:, :, ::1] a, dim *x, dim *y, dim *z) except 1:
* if a is None:
* raise ValueError('Array required, got None') # <<<<<<<<<<<<<<
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":76
* if a is None:
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x) # <<<<<<<<<<<<<<
* checkDim('2nd', a.shape[1], y)
* checkDim('3rd', a.shape[2], z)
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__1st);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(__pyx_t_2, (__pyx_v_a.shape[0]), __pyx_v_x); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":77
* raise ValueError('Array required, got None')
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y) # <<<<<<<<<<<<<<
* checkDim('3rd', a.shape[2], z)
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__2nd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(__pyx_t_2, (__pyx_v_a.shape[1]), __pyx_v_y); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "/Users/maxwell/Documents/Work/Cogent/cogent/align/../../include/numerical_pyrex.pyx":78
* checkDim('1st', a.shape[0], x)
* checkDim('2nd', a.shape[1], y)
* checkDim('3rd', a.shape[2], z) # <<<<<<<<<<<<<<
*
*/
__pyx_t_2 = ((PyObject *)__pyx_kp_s__3rd);
__Pyx_INCREF(__pyx_t_2);
__pyx_t_3 = __pyx_fuse_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkDim(__pyx_t_2, (__pyx_v_a.shape[2]), __pyx_v_z); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cogent.align._pairwise_seqs.checkArray3D", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6cogent_5align_14_pairwise_seqs_1fmpt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_6cogent_5align_14_pairwise_seqs_1fmpt = {__Pyx_NAMESTR("fmpt"), (PyCFunction)__pyx_pw_6cogent_5align_14_pairwise_seqs_1fmpt, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_6cogent_5align_14_pairwise_seqs_1fmpt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_mantissa = 0;
PyObject *__pyx_v_exponent = 0;
PyObject *__pyx_v_msg = 0;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("fmpt (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mantissa,&__pyx_n_s__exponent,&__pyx_n_s__msg,0};
PyObject* values[3] = {0,0,0};
values[2] = ((PyObject *)__pyx_kp_s_10);
if (unlikely(__pyx_kwds)) {
Py_ssize_t kw_args;
const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
switch (pos_args) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mantissa)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exponent)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("fmpt", 0, 2, 3, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__msg);
if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fmpt") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_mantissa = values[0];
__pyx_v_exponent = values[1];
__pyx_v_msg = values[2];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("fmpt", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cogent.align._pairwise_seqs.fmpt", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6cogent_5align_14_pairwise_seqs_fmpt(__pyx_self, __pyx_v_mantissa, __pyx_v_exponent, __pyx_v_msg);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "cogent/align/_pairwise_seqs.pyx":30
* MAX_SCALE = +10000 # or 0 if all numbers should be probabilities
*
* def fmpt(mantissa, exponent, msg=''): # <<<<<<<<<<<<<<
* return "%s * SCALE_STEP ** %s %s" % (mantissa, exponent, msg)
*
*/
static PyObject *__pyx_pf_6cogent_5align_14_pairwise_seqs_fmpt(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mantissa, PyObject *__pyx_v_exponent, PyObject *__pyx_v_msg) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("fmpt", 0);
/* "cogent/align/_pairwise_seqs.pyx":31
*
* def fmpt(mantissa, exponent, msg=''):
* return "%s * SCALE_STEP ** %s %s" % (mantissa, exponent, msg) # <<<<<<<<<<<<<<
*
* ctypedef unsigned char [:,:,::1] UChar3D
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_mantissa);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_mantissa);
__Pyx_GIVEREF(__pyx_v_mantissa);
__Pyx_INCREF(__pyx_v_exponent);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_exponent);
__Pyx_GIVEREF(__pyx_v_exponent);
__Pyx_INCREF(__pyx_v_msg);
PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_msg);
__Pyx_GIVEREF(__pyx_v_msg);
__pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_r = ((PyObject *)__pyx_t_2);
__pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("cogent.align._pairwise_seqs.fmpt", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_6cogent_5align_14_pairwise_seqs_3calc_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cogent_5align_14_pairwise_seqs_2calc_rows[] = "The faster, sequence only (no POG) version. Forward or Viterbi \n algorithm, with doubles or with slower but practically unoverflowable \n (double, long) GMP-like numbers. Viterbi is also available in the ever \n popular addition-of-logs version. All this with any possible pair HMM \n transition matrix.\n \n Limitations\n - HMM states must be in a sensible order: M and X, then Y, then END.\n ";
static PyMethodDef __pyx_mdef_6cogent_5align_14_pairwise_seqs_3calc_rows = {__Pyx_NAMESTR("calc_rows"), (PyCFunction)__pyx_pw_6cogent_5align_14_pairwise_seqs_3calc_rows, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6cogent_5align_14_pairwise_seqs_2calc_rows)};
static PyObject *__pyx_pw_6cogent_5align_14_pairwise_seqs_3calc_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
__pyx_t_6cogent_5align_14_pairwise_seqs_Long1D __pyx_v_plan = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_seqs_Long1D __pyx_v_seq1_index = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_seqs_Long1D __pyx_v_seq2_index = { 0, 0, { 0 }, { 0 }, { 0 } };
int __pyx_v_i_low;
int __pyx_v_i_high;
int __pyx_v_j_low;
int __pyx_v_j_high;
CYTHON_UNUSED PyObject *__pyx_v_preds = 0;
__pyx_t_6cogent_5align_14_pairwise_seqs_Long2D __pyx_v_state_directions = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_seqs_Double2D __pyx_v_T = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_seqs_Double2D __pyx_v_xgap_scores = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_seqs_Double2D __pyx_v_ygap_scores = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_seqs_Double3D __pyx_v_match_scores = { 0, 0, { 0 }, { 0 }, { 0 } };
PyObject *__pyx_v_rows = 0;
__pyx_t_6cogent_5align_14_pairwise_seqs_UChar3D __pyx_v_track = { 0, 0, { 0 }, { 0 }, { 0 } };
PyObject *__pyx_v_track_enc = 0;
int __pyx_v_viterbi;
int __pyx_v_use_logs;
int __pyx_v_local;
int __pyx_v_use_scaling;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("calc_rows (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__plan,&__pyx_n_s__seq1_index,&__pyx_n_s__seq2_index,&__pyx_n_s__i_low,&__pyx_n_s__i_high,&__pyx_n_s__j_low,&__pyx_n_s__j_high,&__pyx_n_s__preds,&__pyx_n_s__state_directions,&__pyx_n_s__T,&__pyx_n_s__xgap_scores,&__pyx_n_s__ygap_scores,&__pyx_n_s__match_scores,&__pyx_n_s__rows,&__pyx_n_s__track,&__pyx_n_s__track_enc,&__pyx_n_s__viterbi,&__pyx_n_s__use_logs,&__pyx_n_s__local,&__pyx_n_s__use_scaling,0};
PyObject* values[20] = {0,0,0,0,0,0,0,0,0,0,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 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__plan)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seq1_index)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 1); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seq2_index)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 2); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_low)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 3); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 4:
if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i_high)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 4); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 5:
if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j_low)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 5); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 6:
if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j_high)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 6); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 7:
if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__preds)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 7); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 8:
if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__state_directions)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 8); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 9:
if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__T)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 9); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 10:
if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xgap_scores)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 10); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 11:
if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ygap_scores)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 11); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 12:
if (likely((values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__match_scores)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 12); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 13:
if (likely((values[13] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rows)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 13); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 14:
if (likely((values[14] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__track)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 14); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 15:
if (likely((values[15] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__track_enc)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 15); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 16:
if (likely((values[16] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__viterbi)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, 16); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 17:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_logs);
if (value) { values[17] = value; kw_args--; }
}
case 18:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__local);
if (value) { values[18] = value; kw_args--; }
}
case 19:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__use_scaling);
if (value) { values[19] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calc_rows") < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_plan = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[0]); if (unlikely(!__pyx_v_plan.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_seq1_index = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[1]); if (unlikely(!__pyx_v_seq1_index.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_seq2_index = __Pyx_PyObject_to_MemoryviewSlice_dc_long(values[2]); if (unlikely(!__pyx_v_seq2_index.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_i_low = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_i_low == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_i_high = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_i_high == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_j_low = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_j_low == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_j_high = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_j_high == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_preds = values[7];
__pyx_v_state_directions = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long(values[8]); if (unlikely(!__pyx_v_state_directions.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_T = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[9]); if (unlikely(!__pyx_v_T.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_xgap_scores = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[10]); if (unlikely(!__pyx_v_xgap_scores.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_ygap_scores = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(values[11]); if (unlikely(!__pyx_v_ygap_scores.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_match_scores = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(values[12]); if (unlikely(!__pyx_v_match_scores.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_rows = values[13];
__pyx_v_track = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(values[14]); if (unlikely(!__pyx_v_track.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_v_track_enc = values[15];
__pyx_v_viterbi = __Pyx_PyInt_AsInt(values[16]); if (unlikely((__pyx_v_viterbi == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
if (values[17]) {
__pyx_v_use_logs = __Pyx_PyInt_AsInt(values[17]); if (unlikely((__pyx_v_use_logs == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
__pyx_v_use_logs = ((int)0);
}
if (values[18]) {
__pyx_v_local = __Pyx_PyInt_AsInt(values[18]); if (unlikely((__pyx_v_local == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
/* "cogent/align/_pairwise_seqs.pyx":39
* Long2D state_directions, Double2D T,
* Double2D xgap_scores, Double2D ygap_scores, Double3D match_scores,
* rows, UChar3D track, track_enc, int viterbi, int use_logs=0, int local=False, # <<<<<<<<<<<<<<
* int use_scaling=True):
*
*/
__pyx_v_local = ((int)0);
}
if (values[19]) {
__pyx_v_use_scaling = __Pyx_PyInt_AsInt(values[19]); if (unlikely((__pyx_v_use_scaling == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
/* "cogent/align/_pairwise_seqs.pyx":40
* Double2D xgap_scores, Double2D ygap_scores, Double3D match_scores,
* rows, UChar3D track, track_enc, int viterbi, int use_logs=0, int local=False,
* int use_scaling=True): # <<<<<<<<<<<<<<
*
* """The faster, sequence only (no POG) version. Forward or Viterbi
*/
__pyx_v_use_scaling = ((int)1);
}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("calc_rows", 0, 17, 20, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("cogent.align._pairwise_seqs.calc_rows", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_6cogent_5align_14_pairwise_seqs_2calc_rows(__pyx_self, __pyx_v_plan, __pyx_v_seq1_index, __pyx_v_seq2_index, __pyx_v_i_low, __pyx_v_i_high, __pyx_v_j_low, __pyx_v_j_high, __pyx_v_preds, __pyx_v_state_directions, __pyx_v_T, __pyx_v_xgap_scores, __pyx_v_ygap_scores, __pyx_v_match_scores, __pyx_v_rows, __pyx_v_track, __pyx_v_track_enc, __pyx_v_viterbi, __pyx_v_use_logs, __pyx_v_local, __pyx_v_use_scaling);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "cogent/align/_pairwise_seqs.pyx":35
* ctypedef unsigned char [:,:,::1] UChar3D
*
* def calc_rows(Long1D plan, Long1D seq1_index, Long1D seq2_index, # <<<<<<<<<<<<<<
* int i_low, int i_high, int j_low, int j_high, preds,
* Long2D state_directions, Double2D T,
*/
static PyObject *__pyx_pf_6cogent_5align_14_pairwise_seqs_2calc_rows(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_6cogent_5align_14_pairwise_seqs_Long1D __pyx_v_plan, __pyx_t_6cogent_5align_14_pairwise_seqs_Long1D __pyx_v_seq1_index, __pyx_t_6cogent_5align_14_pairwise_seqs_Long1D __pyx_v_seq2_index, int __pyx_v_i_low, int __pyx_v_i_high, int __pyx_v_j_low, int __pyx_v_j_high, CYTHON_UNUSED PyObject *__pyx_v_preds, __pyx_t_6cogent_5align_14_pairwise_seqs_Long2D __pyx_v_state_directions, __pyx_t_6cogent_5align_14_pairwise_seqs_Double2D __pyx_v_T, __pyx_t_6cogent_5align_14_pairwise_seqs_Double2D __pyx_v_xgap_scores, __pyx_t_6cogent_5align_14_pairwise_seqs_Double2D __pyx_v_ygap_scores, __pyx_t_6cogent_5align_14_pairwise_seqs_Double3D __pyx_v_match_scores, PyObject *__pyx_v_rows, __pyx_t_6cogent_5align_14_pairwise_seqs_UChar3D __pyx_v_track, PyObject *__pyx_v_track_enc, int __pyx_v_viterbi, int __pyx_v_use_logs, int __pyx_v_local, int __pyx_v_use_scaling) {
int __pyx_v_prev_j;
int __pyx_v_state;
int __pyx_v_prev_state;
int __pyx_v_min_prev_state;
int __pyx_v_N;
int __pyx_v_row_length;
int __pyx_v_row_count;
int __pyx_v_tmp_rows;
int __pyx_v_a;
int __pyx_v_b;
int __pyx_v_dest_states;
int __pyx_v_dest_state;
int __pyx_v_d4;
int __pyx_v_j;
int __pyx_v_i;
int __pyx_v_last_i;
int __pyx_v_last_j;
int __pyx_v_last_state;
int __pyx_v_bin;
int __pyx_v_x;
int __pyx_v_y;
int __pyx_v_bin_count;
int __pyx_v_max_x;
int __pyx_v_max_y;
int __pyx_v_current_row_index;
int __pyx_v_source_row_index;
int __pyx_v_source_i;
int __pyx_v_dx;
int __pyx_v_dy;
int __pyx_v_tcode_x;
int __pyx_v_tcode_y;
int __pyx_v_tcode_s;
double __pyx_v_d_score;
double __pyx_v_mantissa;
double __pyx_v_partial_sum;
double __pyx_v_sub_partial_sum;
double __pyx_v_max_mantissa;
double __pyx_v_overall_max_mantissa;
long __pyx_v_exponent;
long __pyx_v_max_exponent;
long __pyx_v_overall_max_exponent;
__pyx_t_6cogent_5align_14_pairwise_seqs_Double3D __pyx_v_mantissas = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_seqs_Long3D __pyx_v_exponents = { 0, 0, { 0 }, { 0 }, { 0 } };
long __pyx_v_pointer_a;
long __pyx_v_pointer_b;
long __pyx_v_pointer_state;
double __pyx_v_impossible;
double __pyx_v_score;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
int __pyx_t_4;
long __pyx_t_5;
int __pyx_t_6;
int __pyx_t_7;
int __pyx_t_8;
PyObject *__pyx_t_9 = NULL;
PyObject *__pyx_t_10 = NULL;
PyObject *__pyx_t_11 = NULL;
PyObject *(*__pyx_t_12)(PyObject *);
__pyx_t_6cogent_5align_14_pairwise_seqs_Double3D __pyx_t_13 = { 0, 0, { 0 }, { 0 }, { 0 } };
__pyx_t_6cogent_5align_14_pairwise_seqs_Long3D __pyx_t_14 = { 0, 0, { 0 }, { 0 }, { 0 } };
PyObject *__pyx_t_15 = NULL;
int __pyx_t_16;
int __pyx_t_17;
__pyx_t_6cogent_5align_14_pairwise_seqs_UChar3D __pyx_t_18 = { 0, 0, { 0 }, { 0 }, { 0 } };
int __pyx_t_19;
int __pyx_t_20;
int __pyx_t_21;
Py_ssize_t __pyx_t_22;
int __pyx_t_23;
Py_ssize_t __pyx_t_24;
int __pyx_t_25;
Py_ssize_t __pyx_t_26;
int __pyx_t_27;
Py_ssize_t __pyx_t_28;
int __pyx_t_29;
Py_ssize_t __pyx_t_30;
int __pyx_t_31;
double __pyx_t_32;
int __pyx_t_33;
int __pyx_t_34;
int __pyx_t_35;
int __pyx_t_36;
int __pyx_t_37;
int __pyx_t_38;
int __pyx_t_39;
int __pyx_t_40;
int __pyx_t_41;
int __pyx_t_42;
int __pyx_t_43;
int __pyx_t_44;
int __pyx_t_45;
int __pyx_t_46;
int __pyx_t_47;
int __pyx_t_48;
int __pyx_t_49;
int __pyx_t_50;
int __pyx_t_51;
int __pyx_t_52;
int __pyx_t_53;
int __pyx_t_54;
int __pyx_t_55;
int __pyx_t_56;
int __pyx_t_57;
int __pyx_t_58;
int __pyx_t_59;
int __pyx_t_60;
int __pyx_t_61;
int __pyx_t_62;
int __pyx_t_63;
int __pyx_t_64;
int __pyx_t_65;
int __pyx_t_66;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("calc_rows", 0);
/* "cogent/align/_pairwise_seqs.pyx":70
* cdef long pointer_a, pointer_b, pointer_state
*
* assert not (use_logs and not viterbi) # <<<<<<<<<<<<<<
* assert not (use_logs and use_scaling)
* assert not (local and not viterbi)
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
if (__pyx_v_use_logs) {
__pyx_t_1 = (!__pyx_v_viterbi);
__pyx_t_2 = __pyx_t_1;
} else {
__pyx_t_2 = __pyx_v_use_logs;
}
if (unlikely(!(!__pyx_t_2))) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "cogent/align/_pairwise_seqs.pyx":71
*
* assert not (use_logs and not viterbi)
* assert not (use_logs and use_scaling) # <<<<<<<<<<<<<<
* assert not (local and not viterbi)
*
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
if (__pyx_v_use_logs) {
__pyx_t_2 = __pyx_v_use_scaling;
} else {
__pyx_t_2 = __pyx_v_use_logs;
}
if (unlikely(!(!__pyx_t_2))) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "cogent/align/_pairwise_seqs.pyx":72
* assert not (use_logs and not viterbi)
* assert not (use_logs and use_scaling)
* assert not (local and not viterbi) # <<<<<<<<<<<<<<
*
* N = 0
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
if (__pyx_v_local) {
__pyx_t_2 = (!__pyx_v_viterbi);
__pyx_t_1 = __pyx_t_2;
} else {
__pyx_t_1 = __pyx_v_local;
}
if (unlikely(!(!__pyx_t_1))) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "cogent/align/_pairwise_seqs.pyx":74
* assert not (local and not viterbi)
*
* N = 0 # <<<<<<<<<<<<<<
* checkArray2D(T, &N, &N)
* row_length = 0
*/
__pyx_v_N = 0;
/* "cogent/align/_pairwise_seqs.pyx":75
*
* N = 0
* checkArray2D(T, &N, &N) # <<<<<<<<<<<<<<
* row_length = 0
* row_count = 0
*/
__pyx_t_3 = __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray2D(__pyx_v_T, (&__pyx_v_N), (&__pyx_v_N)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_seqs.pyx":76
* N = 0
* checkArray2D(T, &N, &N)
* row_length = 0 # <<<<<<<<<<<<<<
* row_count = 0
* checkArray1D(plan, &row_count)
*/
__pyx_v_row_length = 0;
/* "cogent/align/_pairwise_seqs.pyx":77
* checkArray2D(T, &N, &N)
* row_length = 0
* row_count = 0 # <<<<<<<<<<<<<<
* checkArray1D(plan, &row_count)
*
*/
__pyx_v_row_count = 0;
/* "cogent/align/_pairwise_seqs.pyx":78
* row_length = 0
* row_count = 0
* checkArray1D(plan, &row_count) # <<<<<<<<<<<<<<
*
* dest_states = 0
*/
__pyx_t_3 = __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray1D(__pyx_v_plan, (&__pyx_v_row_count)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_seqs.pyx":80
* checkArray1D(plan, &row_count)
*
* dest_states = 0 # <<<<<<<<<<<<<<
* d4 = 4
* # Array of (state, bin, dx, dy) tuples describing the HMM states.
*/
__pyx_v_dest_states = 0;
/* "cogent/align/_pairwise_seqs.pyx":81
*
* dest_states = 0
* d4 = 4 # <<<<<<<<<<<<<<
* # Array of (state, bin, dx, dy) tuples describing the HMM states.
* checkArray2D(state_directions, &dest_states, &d4)
*/
__pyx_v_d4 = 4;
/* "cogent/align/_pairwise_seqs.pyx":83
* d4 = 4
* # Array of (state, bin, dx, dy) tuples describing the HMM states.
* checkArray2D(state_directions, &dest_states, &d4) # <<<<<<<<<<<<<<
*
* checkArray1D(seq1_index, &row_count)
*/
__pyx_t_3 = __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray2D(__pyx_v_state_directions, (&__pyx_v_dest_states), (&__pyx_v_d4)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_seqs.pyx":85
* checkArray2D(state_directions, &dest_states, &d4)
*
* checkArray1D(seq1_index, &row_count) # <<<<<<<<<<<<<<
* checkArray1D(seq2_index, &row_length)
*
*/
__pyx_t_3 = __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray1D(__pyx_v_seq1_index, (&__pyx_v_row_count)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_seqs.pyx":86
*
* checkArray1D(seq1_index, &row_count)
* checkArray1D(seq2_index, &row_length) # <<<<<<<<<<<<<<
*
* max_x = max_y = bin_count = 0
*/
__pyx_t_3 = __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray1D(__pyx_v_seq2_index, (&__pyx_v_row_length)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_seqs.pyx":88
* checkArray1D(seq2_index, &row_length)
*
* max_x = max_y = bin_count = 0 # <<<<<<<<<<<<<<
* checkArray3D(match_scores, &bin_count, &max_x, &max_y)
* checkArray2D(xgap_scores, &bin_count, &max_x)
*/
__pyx_v_max_x = 0;
__pyx_v_max_y = 0;
__pyx_v_bin_count = 0;
/* "cogent/align/_pairwise_seqs.pyx":89
*
* max_x = max_y = bin_count = 0
* checkArray3D(match_scores, &bin_count, &max_x, &max_y) # <<<<<<<<<<<<<<
* checkArray2D(xgap_scores, &bin_count, &max_x)
* checkArray2D(ygap_scores, &bin_count, &max_y)
*/
__pyx_t_3 = __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray3D(__pyx_v_match_scores, (&__pyx_v_bin_count), (&__pyx_v_max_x), (&__pyx_v_max_y)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_seqs.pyx":90
* max_x = max_y = bin_count = 0
* checkArray3D(match_scores, &bin_count, &max_x, &max_y)
* checkArray2D(xgap_scores, &bin_count, &max_x) # <<<<<<<<<<<<<<
* checkArray2D(ygap_scores, &bin_count, &max_y)
*
*/
__pyx_t_3 = __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray2D(__pyx_v_xgap_scores, (&__pyx_v_bin_count), (&__pyx_v_max_x)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_seqs.pyx":91
* checkArray3D(match_scores, &bin_count, &max_x, &max_y)
* checkArray2D(xgap_scores, &bin_count, &max_x)
* checkArray2D(ygap_scores, &bin_count, &max_y) # <<<<<<<<<<<<<<
*
* for i from 0 <= i < row_count:
*/
__pyx_t_3 = __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray2D(__pyx_v_ygap_scores, (&__pyx_v_bin_count), (&__pyx_v_max_y)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_seqs.pyx":93
* checkArray2D(ygap_scores, &bin_count, &max_y)
*
* for i from 0 <= i < row_count: # <<<<<<<<<<<<<<
* assert 0 <= seq1_index[i] < max_x
* for j from 0 <= j < row_length:
*/
__pyx_t_3 = __pyx_v_row_count;
for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_3; __pyx_v_i++) {
/* "cogent/align/_pairwise_seqs.pyx":94
*
* for i from 0 <= i < row_count:
* assert 0 <= seq1_index[i] < max_x # <<<<<<<<<<<<<<
* for j from 0 <= j < row_length:
* assert 0 <= seq2_index[j] < max_y
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
__pyx_t_4 = __pyx_v_i;
__pyx_t_5 = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_seq1_index.data) + __pyx_t_4)) )));
__pyx_t_1 = (0 <= __pyx_t_5);
if (__pyx_t_1) {
__pyx_t_1 = (__pyx_t_5 < __pyx_v_max_x);
}
if (unlikely(!__pyx_t_1)) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
}
/* "cogent/align/_pairwise_seqs.pyx":95
* for i from 0 <= i < row_count:
* assert 0 <= seq1_index[i] < max_x
* for j from 0 <= j < row_length: # <<<<<<<<<<<<<<
* assert 0 <= seq2_index[j] < max_y
*
*/
__pyx_t_3 = __pyx_v_row_length;
for (__pyx_v_j = 0; __pyx_v_j < __pyx_t_3; __pyx_v_j++) {
/* "cogent/align/_pairwise_seqs.pyx":96
* assert 0 <= seq1_index[i] < max_x
* for j from 0 <= j < row_length:
* assert 0 <= seq2_index[j] < max_y # <<<<<<<<<<<<<<
*
* assert j_low >= 0 and j_high > j_low and j_high <= row_length
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
__pyx_t_6 = __pyx_v_j;
__pyx_t_5 = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_seq2_index.data) + __pyx_t_6)) )));
__pyx_t_1 = (0 <= __pyx_t_5);
if (__pyx_t_1) {
__pyx_t_1 = (__pyx_t_5 < __pyx_v_max_y);
}
if (unlikely(!__pyx_t_1)) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
}
/* "cogent/align/_pairwise_seqs.pyx":98
* assert 0 <= seq2_index[j] < max_y
*
* assert j_low >= 0 and j_high > j_low and j_high <= row_length # <<<<<<<<<<<<<<
*
* (mantissas, exponents) = rows
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
__pyx_t_1 = (__pyx_v_j_low >= 0);
if (__pyx_t_1) {
__pyx_t_2 = (__pyx_v_j_high > __pyx_v_j_low);
if (__pyx_t_2) {
__pyx_t_7 = (__pyx_v_j_high <= __pyx_v_row_length);
__pyx_t_8 = __pyx_t_7;
} else {
__pyx_t_8 = __pyx_t_2;
}
__pyx_t_2 = __pyx_t_8;
} else {
__pyx_t_2 = __pyx_t_1;
}
if (unlikely(!__pyx_t_2)) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "cogent/align/_pairwise_seqs.pyx":100
* assert j_low >= 0 and j_high > j_low and j_high <= row_length
*
* (mantissas, exponents) = rows # <<<<<<<<<<<<<<
* tmp_rows = 0
* checkArray3D(mantissas, &tmp_rows, &row_length, &N)
*/
if ((likely(PyTuple_CheckExact(__pyx_v_rows))) || (PyList_CheckExact(__pyx_v_rows))) {
PyObject* sequence = __pyx_v_rows;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
} else {
__pyx_t_9 = PyList_GET_ITEM(sequence, 0);
__pyx_t_10 = PyList_GET_ITEM(sequence, 1);
}
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(__pyx_t_10);
#else
__pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else
{
Py_ssize_t index = -1;
__pyx_t_11 = PyObject_GetIter(__pyx_v_rows); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_12 = Py_TYPE(__pyx_t_11)->tp_iternext;
index = 0; __pyx_t_9 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L7_unpacking_failed;
__Pyx_GOTREF(__pyx_t_9);
index = 1; __pyx_t_10 = __pyx_t_12(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L7_unpacking_failed;
__Pyx_GOTREF(__pyx_t_10);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_11), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_12 = NULL;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
goto __pyx_L8_unpacking_done;
__pyx_L7_unpacking_failed:;
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_t_12 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L8_unpacking_done:;
}
__pyx_t_13 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_double(__pyx_t_9);
if (unlikely(!__pyx_t_13.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_long(__pyx_t_10);
if (unlikely(!__pyx_t_14.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_v_mantissas = __pyx_t_13;
__pyx_t_13.memview = NULL;
__pyx_t_13.data = NULL;
__pyx_v_exponents = __pyx_t_14;
__pyx_t_14.memview = NULL;
__pyx_t_14.data = NULL;
/* "cogent/align/_pairwise_seqs.pyx":101
*
* (mantissas, exponents) = rows
* tmp_rows = 0 # <<<<<<<<<<<<<<
* checkArray3D(mantissas, &tmp_rows, &row_length, &N)
* if use_scaling:
*/
__pyx_v_tmp_rows = 0;
/* "cogent/align/_pairwise_seqs.pyx":102
* (mantissas, exponents) = rows
* tmp_rows = 0
* checkArray3D(mantissas, &tmp_rows, &row_length, &N) # <<<<<<<<<<<<<<
* if use_scaling:
* checkArray3D(exponents, &tmp_rows, &row_length, &N)
*/
__pyx_t_3 = __pyx_fuse_0_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray3D(__pyx_v_mantissas, (&__pyx_v_tmp_rows), (&__pyx_v_row_length), (&__pyx_v_N)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_seqs.pyx":103
* tmp_rows = 0
* checkArray3D(mantissas, &tmp_rows, &row_length, &N)
* if use_scaling: # <<<<<<<<<<<<<<
* checkArray3D(exponents, &tmp_rows, &row_length, &N)
*
*/
if (__pyx_v_use_scaling) {
/* "cogent/align/_pairwise_seqs.pyx":104
* checkArray3D(mantissas, &tmp_rows, &row_length, &N)
* if use_scaling:
* checkArray3D(exponents, &tmp_rows, &row_length, &N) # <<<<<<<<<<<<<<
*
* cdef double impossible
*/
__pyx_t_3 = __pyx_fuse_1_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray3D(__pyx_v_exponents, (&__pyx_v_tmp_rows), (&__pyx_v_row_length), (&__pyx_v_N)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
/* "cogent/align/_pairwise_seqs.pyx":107
*
* cdef double impossible
* if use_logs: # <<<<<<<<<<<<<<
* impossible = log(0.0) # -inf
* else:
*/
if (__pyx_v_use_logs) {
/* "cogent/align/_pairwise_seqs.pyx":108
* cdef double impossible
* if use_logs:
* impossible = log(0.0) # -inf # <<<<<<<<<<<<<<
* else:
* impossible = 0.0
*/
__pyx_v_impossible = log(0.0);
goto __pyx_L10;
}
/*else*/ {
/* "cogent/align/_pairwise_seqs.pyx":110
* impossible = log(0.0) # -inf
* else:
* impossible = 0.0 # <<<<<<<<<<<<<<
*
* if viterbi and track is not None and track_enc is not None:
*/
__pyx_v_impossible = 0.0;
}
__pyx_L10:;
/* "cogent/align/_pairwise_seqs.pyx":112
* impossible = 0.0
*
* if viterbi and track is not None and track_enc is not None: # <<<<<<<<<<<<<<
* checkArray3D(track, &row_count, &row_length, &N)
* (tcode_x, tcode_y, tcode_s) = track_enc
*/
if (__pyx_v_viterbi) {
__pyx_t_2 = (((PyObject *) __pyx_v_track.memview) != Py_None);
if (__pyx_t_2) {
__pyx_t_1 = (__pyx_v_track_enc != Py_None);
__pyx_t_8 = __pyx_t_1;
} else {
__pyx_t_8 = __pyx_t_2;
}
__pyx_t_2 = __pyx_t_8;
} else {
__pyx_t_2 = __pyx_v_viterbi;
}
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":113
*
* if viterbi and track is not None and track_enc is not None:
* checkArray3D(track, &row_count, &row_length, &N) # <<<<<<<<<<<<<<
* (tcode_x, tcode_y, tcode_s) = track_enc
* else:
*/
__pyx_t_3 = __pyx_fuse_2_2__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray3D(__pyx_v_track, (&__pyx_v_row_count), (&__pyx_v_row_length), (&__pyx_v_N)); if (unlikely(__pyx_t_3 == 1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "cogent/align/_pairwise_seqs.pyx":114
* if viterbi and track is not None and track_enc is not None:
* checkArray3D(track, &row_count, &row_length, &N)
* (tcode_x, tcode_y, tcode_s) = track_enc # <<<<<<<<<<<<<<
* else:
* track = None
*/
if ((likely(PyTuple_CheckExact(__pyx_v_track_enc))) || (PyList_CheckExact(__pyx_v_track_enc))) {
PyObject* sequence = __pyx_v_track_enc;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 3)) {
if (size > 3) __Pyx_RaiseTooManyValuesError(3);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
__pyx_t_10 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_9 = PyTuple_GET_ITEM(sequence, 1);
__pyx_t_11 = PyTuple_GET_ITEM(sequence, 2);
} else {
__pyx_t_10 = PyList_GET_ITEM(sequence, 0);
__pyx_t_9 = PyList_GET_ITEM(sequence, 1);
__pyx_t_11 = PyList_GET_ITEM(sequence, 2);
}
__Pyx_INCREF(__pyx_t_10);
__Pyx_INCREF(__pyx_t_9);
__Pyx_INCREF(__pyx_t_11);
#else
__pyx_t_10 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_11 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else
{
Py_ssize_t index = -1;
__pyx_t_15 = PyObject_GetIter(__pyx_v_track_enc); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
__pyx_t_12 = Py_TYPE(__pyx_t_15)->tp_iternext;
index = 0; __pyx_t_10 = __pyx_t_12(__pyx_t_15); if (unlikely(!__pyx_t_10)) goto __pyx_L12_unpacking_failed;
__Pyx_GOTREF(__pyx_t_10);
index = 1; __pyx_t_9 = __pyx_t_12(__pyx_t_15); if (unlikely(!__pyx_t_9)) goto __pyx_L12_unpacking_failed;
__Pyx_GOTREF(__pyx_t_9);
index = 2; __pyx_t_11 = __pyx_t_12(__pyx_t_15); if (unlikely(!__pyx_t_11)) goto __pyx_L12_unpacking_failed;
__Pyx_GOTREF(__pyx_t_11);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_12(__pyx_t_15), 3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_12 = NULL;
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
goto __pyx_L13_unpacking_done;
__pyx_L12_unpacking_failed:;
__Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__pyx_t_12 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L13_unpacking_done:;
}
__pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_10); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_16 = __Pyx_PyInt_AsInt(__pyx_t_9); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_t_17 = __Pyx_PyInt_AsInt(__pyx_t_11); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__pyx_v_tcode_x = __pyx_t_3;
__pyx_v_tcode_y = __pyx_t_16;
__pyx_v_tcode_s = __pyx_t_17;
goto __pyx_L11;
}
/*else*/ {
/* "cogent/align/_pairwise_seqs.pyx":116
* (tcode_x, tcode_y, tcode_s) = track_enc
* else:
* track = None # <<<<<<<<<<<<<<
* tcode_x = tcode_y = tcode_s = 0
*
*/
__pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_d_d_dc_unsigned_char(Py_None);
if (unlikely(!__pyx_t_18.memview)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__PYX_XDEC_MEMVIEW(&__pyx_v_track, 1);
__pyx_v_track = __pyx_t_18;
__pyx_t_18.memview = NULL;
__pyx_t_18.data = NULL;
/* "cogent/align/_pairwise_seqs.pyx":117
* else:
* track = None
* tcode_x = tcode_y = tcode_s = 0 # <<<<<<<<<<<<<<
*
* # For local
*/
__pyx_v_tcode_x = 0;
__pyx_v_tcode_y = 0;
__pyx_v_tcode_s = 0;
}
__pyx_L11:;
/* "cogent/align/_pairwise_seqs.pyx":120
*
* # For local
* overall_max_exponent = MIN_SCALE # <<<<<<<<<<<<<<
* overall_max_mantissa = impossible
* last_i = last_j = last_state = -1
*/
__pyx_v_overall_max_exponent = __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_SCALE;
/* "cogent/align/_pairwise_seqs.pyx":121
* # For local
* overall_max_exponent = MIN_SCALE
* overall_max_mantissa = impossible # <<<<<<<<<<<<<<
* last_i = last_j = last_state = -1
*
*/
__pyx_v_overall_max_mantissa = __pyx_v_impossible;
/* "cogent/align/_pairwise_seqs.pyx":122
* overall_max_exponent = MIN_SCALE
* overall_max_mantissa = impossible
* last_i = last_j = last_state = -1 # <<<<<<<<<<<<<<
*
* for i from i_low <= i < i_high:
*/
__pyx_v_last_i = -1;
__pyx_v_last_j = -1;
__pyx_v_last_state = -1;
/* "cogent/align/_pairwise_seqs.pyx":124
* last_i = last_j = last_state = -1
*
* for i from i_low <= i < i_high: # <<<<<<<<<<<<<<
* x = seq1_index[i]
*
*/
__pyx_t_17 = __pyx_v_i_high;
for (__pyx_v_i = __pyx_v_i_low; __pyx_v_i < __pyx_t_17; __pyx_v_i++) {
/* "cogent/align/_pairwise_seqs.pyx":125
*
* for i from i_low <= i < i_high:
* x = seq1_index[i] # <<<<<<<<<<<<<<
*
* if PyErr_CheckSignals():
*/
__pyx_t_16 = __pyx_v_i;
__pyx_v_x = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_seq1_index.data) + __pyx_t_16)) )));
/* "cogent/align/_pairwise_seqs.pyx":127
* x = seq1_index[i]
*
* if PyErr_CheckSignals(): # <<<<<<<<<<<<<<
* raise PyErr_Occurred()
*
*/
__pyx_t_3 = PyErr_CheckSignals();
if (__pyx_t_3) {
/* "cogent/align/_pairwise_seqs.pyx":128
*
* if PyErr_CheckSignals():
* raise PyErr_Occurred() # <<<<<<<<<<<<<<
*
* current_row_index = plan[i]
*/
__pyx_t_11 = PyErr_Occurred(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_Raise(__pyx_t_11, 0, 0, 0);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L16;
}
__pyx_L16:;
/* "cogent/align/_pairwise_seqs.pyx":130
* raise PyErr_Occurred()
*
* current_row_index = plan[i] # <<<<<<<<<<<<<<
*
* #for prev_state from 1 <= prev_state < N:
*/
__pyx_t_3 = __pyx_v_i;
__pyx_v_current_row_index = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_plan.data) + __pyx_t_3)) )));
/* "cogent/align/_pairwise_seqs.pyx":135
* # current_row_data[0, prev_state] = impossible
*
* for j from j_low <= j < j_high: # <<<<<<<<<<<<<<
*
* for dest_state from 0 <= dest_state < dest_states:
*/
__pyx_t_19 = __pyx_v_j_high;
for (__pyx_v_j = __pyx_v_j_low; __pyx_v_j < __pyx_t_19; __pyx_v_j++) {
/* "cogent/align/_pairwise_seqs.pyx":137
* for j from j_low <= j < j_high:
*
* for dest_state from 0 <= dest_state < dest_states: # <<<<<<<<<<<<<<
* state = state_directions[dest_state, 0]
* bin = state_directions[dest_state, 1]
*/
__pyx_t_20 = __pyx_v_dest_states;
for (__pyx_v_dest_state = 0; __pyx_v_dest_state < __pyx_t_20; __pyx_v_dest_state++) {
/* "cogent/align/_pairwise_seqs.pyx":138
*
* for dest_state from 0 <= dest_state < dest_states:
* state = state_directions[dest_state, 0] # <<<<<<<<<<<<<<
* bin = state_directions[dest_state, 1]
* dx = state_directions[dest_state, 2]
*/
__pyx_t_21 = __pyx_v_dest_state;
__pyx_t_22 = 0;
__pyx_v_state = (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_state_directions.data + __pyx_t_21 * __pyx_v_state_directions.strides[0]) )) + __pyx_t_22)) )));
/* "cogent/align/_pairwise_seqs.pyx":139
* for dest_state from 0 <= dest_state < dest_states:
* state = state_directions[dest_state, 0]
* bin = state_directions[dest_state, 1] # <<<<<<<<<<<<<<
* dx = state_directions[dest_state, 2]
* dy = state_directions[dest_state, 3]
*/
__pyx_t_23 = __pyx_v_dest_state;
__pyx_t_24 = 1;
__pyx_v_bin = (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_state_directions.data + __pyx_t_23 * __pyx_v_state_directions.strides[0]) )) + __pyx_t_24)) )));
/* "cogent/align/_pairwise_seqs.pyx":140
* state = state_directions[dest_state, 0]
* bin = state_directions[dest_state, 1]
* dx = state_directions[dest_state, 2] # <<<<<<<<<<<<<<
* dy = state_directions[dest_state, 3]
*
*/
__pyx_t_25 = __pyx_v_dest_state;
__pyx_t_26 = 2;
__pyx_v_dx = (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_state_directions.data + __pyx_t_25 * __pyx_v_state_directions.strides[0]) )) + __pyx_t_26)) )));
/* "cogent/align/_pairwise_seqs.pyx":141
* bin = state_directions[dest_state, 1]
* dx = state_directions[dest_state, 2]
* dy = state_directions[dest_state, 3] # <<<<<<<<<<<<<<
*
* max_mantissa = impossible
*/
__pyx_t_27 = __pyx_v_dest_state;
__pyx_t_28 = 3;
__pyx_v_dy = (*((long *) ( /* dim=1 */ ((char *) (((long *) ( /* dim=0 */ (__pyx_v_state_directions.data + __pyx_t_27 * __pyx_v_state_directions.strides[0]) )) + __pyx_t_28)) )));
/* "cogent/align/_pairwise_seqs.pyx":143
* dy = state_directions[dest_state, 3]
*
* max_mantissa = impossible # <<<<<<<<<<<<<<
* max_exponent = MIN_SCALE
* partial_sum = 0.0
*/
__pyx_v_max_mantissa = __pyx_v_impossible;
/* "cogent/align/_pairwise_seqs.pyx":144
*
* max_mantissa = impossible
* max_exponent = MIN_SCALE # <<<<<<<<<<<<<<
* partial_sum = 0.0
* pointer_state = N # ie ERROR
*/
__pyx_v_max_exponent = __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_SCALE;
/* "cogent/align/_pairwise_seqs.pyx":145
* max_mantissa = impossible
* max_exponent = MIN_SCALE
* partial_sum = 0.0 # <<<<<<<<<<<<<<
* pointer_state = N # ie ERROR
*
*/
__pyx_v_partial_sum = 0.0;
/* "cogent/align/_pairwise_seqs.pyx":146
* max_exponent = MIN_SCALE
* partial_sum = 0.0
* pointer_state = N # ie ERROR # <<<<<<<<<<<<<<
*
* source_i = i - dx
*/
__pyx_v_pointer_state = __pyx_v_N;
/* "cogent/align/_pairwise_seqs.pyx":148
* pointer_state = N # ie ERROR
*
* source_i = i - dx # <<<<<<<<<<<<<<
* if source_i < 0:
* continue
*/
__pyx_v_source_i = (__pyx_v_i - __pyx_v_dx);
/* "cogent/align/_pairwise_seqs.pyx":149
*
* source_i = i - dx
* if source_i < 0: # <<<<<<<<<<<<<<
* continue
* source_row_index = plan[source_i]
*/
__pyx_t_2 = (__pyx_v_source_i < 0);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":150
* source_i = i - dx
* if source_i < 0:
* continue # <<<<<<<<<<<<<<
* source_row_index = plan[source_i]
*
*/
goto __pyx_L19_continue;
goto __pyx_L21;
}
__pyx_L21:;
/* "cogent/align/_pairwise_seqs.pyx":151
* if source_i < 0:
* continue
* source_row_index = plan[source_i] # <<<<<<<<<<<<<<
*
* prev_j = j - dy
*/
__pyx_t_29 = __pyx_v_source_i;
__pyx_v_source_row_index = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_plan.data) + __pyx_t_29)) )));
/* "cogent/align/_pairwise_seqs.pyx":153
* source_row_index = plan[source_i]
*
* prev_j = j - dy # <<<<<<<<<<<<<<
* if prev_j < 0:
* continue
*/
__pyx_v_prev_j = (__pyx_v_j - __pyx_v_dy);
/* "cogent/align/_pairwise_seqs.pyx":154
*
* prev_j = j - dy
* if prev_j < 0: # <<<<<<<<<<<<<<
* continue
*
*/
__pyx_t_2 = (__pyx_v_prev_j < 0);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":155
* prev_j = j - dy
* if prev_j < 0:
* continue # <<<<<<<<<<<<<<
*
* min_prev_state = 1
*/
goto __pyx_L19_continue;
goto __pyx_L22;
}
__pyx_L22:;
/* "cogent/align/_pairwise_seqs.pyx":157
* continue
*
* min_prev_state = 1 # <<<<<<<<<<<<<<
* a = dx
* b = dy
*/
__pyx_v_min_prev_state = 1;
/* "cogent/align/_pairwise_seqs.pyx":158
*
* min_prev_state = 1
* a = dx # <<<<<<<<<<<<<<
* b = dy
*
*/
__pyx_v_a = __pyx_v_dx;
/* "cogent/align/_pairwise_seqs.pyx":159
* min_prev_state = 1
* a = dx
* b = dy # <<<<<<<<<<<<<<
*
* if (local and dx and dy) or (prev_j == 0 and source_i == 0):
*/
__pyx_v_b = __pyx_v_dy;
/* "cogent/align/_pairwise_seqs.pyx":161
* b = dy
*
* if (local and dx and dy) or (prev_j == 0 and source_i == 0): # <<<<<<<<<<<<<<
* partial_sum = max_mantissa = T[0, state]
* max_exponent = 0
*/
if (__pyx_v_local) {
if (__pyx_v_dx) {
__pyx_t_2 = __pyx_v_dy;
} else {
__pyx_t_2 = __pyx_v_dx;
}
__pyx_t_8 = __pyx_t_2;
} else {
__pyx_t_8 = __pyx_v_local;
}
if (!__pyx_t_8) {
__pyx_t_2 = (__pyx_v_prev_j == 0);
if (__pyx_t_2) {
__pyx_t_1 = (__pyx_v_source_i == 0);
__pyx_t_7 = __pyx_t_1;
} else {
__pyx_t_7 = __pyx_t_2;
}
__pyx_t_2 = __pyx_t_7;
} else {
__pyx_t_2 = __pyx_t_8;
}
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":162
*
* if (local and dx and dy) or (prev_j == 0 and source_i == 0):
* partial_sum = max_mantissa = T[0, state] # <<<<<<<<<<<<<<
* max_exponent = 0
* pointer_state = 0
*/
__pyx_t_30 = 0;
__pyx_t_31 = __pyx_v_state;
__pyx_t_32 = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_T.data + __pyx_t_30 * __pyx_v_T.strides[0]) )) + __pyx_t_31)) )));
__pyx_v_partial_sum = __pyx_t_32;
__pyx_v_max_mantissa = __pyx_t_32;
/* "cogent/align/_pairwise_seqs.pyx":163
* if (local and dx and dy) or (prev_j == 0 and source_i == 0):
* partial_sum = max_mantissa = T[0, state]
* max_exponent = 0 # <<<<<<<<<<<<<<
* pointer_state = 0
* pointer_a = a
*/
__pyx_v_max_exponent = 0;
/* "cogent/align/_pairwise_seqs.pyx":164
* partial_sum = max_mantissa = T[0, state]
* max_exponent = 0
* pointer_state = 0 # <<<<<<<<<<<<<<
* pointer_a = a
* pointer_b = b
*/
__pyx_v_pointer_state = 0;
/* "cogent/align/_pairwise_seqs.pyx":165
* max_exponent = 0
* pointer_state = 0
* pointer_a = a # <<<<<<<<<<<<<<
* pointer_b = b
*
*/
__pyx_v_pointer_a = __pyx_v_a;
/* "cogent/align/_pairwise_seqs.pyx":166
* pointer_state = 0
* pointer_a = a
* pointer_b = b # <<<<<<<<<<<<<<
*
* if use_scaling:
*/
__pyx_v_pointer_b = __pyx_v_b;
goto __pyx_L23;
}
__pyx_L23:;
/* "cogent/align/_pairwise_seqs.pyx":168
* pointer_b = b
*
* if use_scaling: # <<<<<<<<<<<<<<
* sub_partial_sum = 0.0
* for prev_state from min_prev_state <= prev_state < N:
*/
if (__pyx_v_use_scaling) {
/* "cogent/align/_pairwise_seqs.pyx":169
*
* if use_scaling:
* sub_partial_sum = 0.0 # <<<<<<<<<<<<<<
* for prev_state from min_prev_state <= prev_state < N:
* exponent = exponents[source_row_index, prev_j, prev_state]
*/
__pyx_v_sub_partial_sum = 0.0;
/* "cogent/align/_pairwise_seqs.pyx":170
* if use_scaling:
* sub_partial_sum = 0.0
* for prev_state from min_prev_state <= prev_state < N: # <<<<<<<<<<<<<<
* exponent = exponents[source_row_index, prev_j, prev_state]
* if exponent == MIN_SCALE:
*/
__pyx_t_33 = __pyx_v_N;
for (__pyx_v_prev_state = __pyx_v_min_prev_state; __pyx_v_prev_state < __pyx_t_33; __pyx_v_prev_state++) {
/* "cogent/align/_pairwise_seqs.pyx":171
* sub_partial_sum = 0.0
* for prev_state from min_prev_state <= prev_state < N:
* exponent = exponents[source_row_index, prev_j, prev_state] # <<<<<<<<<<<<<<
* if exponent == MIN_SCALE:
* continue
*/
__pyx_t_34 = __pyx_v_source_row_index;
__pyx_t_35 = __pyx_v_prev_j;
__pyx_t_36 = __pyx_v_prev_state;
__pyx_v_exponent = (*((long *) ( /* dim=2 */ ((char *) (((long *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_exponents.data + __pyx_t_34 * __pyx_v_exponents.strides[0]) ) + __pyx_t_35 * __pyx_v_exponents.strides[1]) )) + __pyx_t_36)) )));
/* "cogent/align/_pairwise_seqs.pyx":172
* for prev_state from min_prev_state <= prev_state < N:
* exponent = exponents[source_row_index, prev_j, prev_state]
* if exponent == MIN_SCALE: # <<<<<<<<<<<<<<
* continue
*
*/
__pyx_t_2 = (__pyx_v_exponent == __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_SCALE);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":173
* exponent = exponents[source_row_index, prev_j, prev_state]
* if exponent == MIN_SCALE:
* continue # <<<<<<<<<<<<<<
*
* mantissa = mantissas[source_row_index, prev_j, prev_state]
*/
goto __pyx_L25_continue;
goto __pyx_L27;
}
__pyx_L27:;
/* "cogent/align/_pairwise_seqs.pyx":175
* continue
*
* mantissa = mantissas[source_row_index, prev_j, prev_state] # <<<<<<<<<<<<<<
* mantissa = mantissa * T[prev_state, state]
*
*/
__pyx_t_37 = __pyx_v_source_row_index;
__pyx_t_38 = __pyx_v_prev_j;
__pyx_t_39 = __pyx_v_prev_state;
__pyx_v_mantissa = (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mantissas.data + __pyx_t_37 * __pyx_v_mantissas.strides[0]) ) + __pyx_t_38 * __pyx_v_mantissas.strides[1]) )) + __pyx_t_39)) )));
/* "cogent/align/_pairwise_seqs.pyx":176
*
* mantissa = mantissas[source_row_index, prev_j, prev_state]
* mantissa = mantissa * T[prev_state, state] # <<<<<<<<<<<<<<
*
* if mantissa < MIN_FLOAT_VALUE:
*/
__pyx_t_40 = __pyx_v_prev_state;
__pyx_t_41 = __pyx_v_state;
__pyx_v_mantissa = (__pyx_v_mantissa * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_T.data + __pyx_t_40 * __pyx_v_T.strides[0]) )) + __pyx_t_41)) ))));
/* "cogent/align/_pairwise_seqs.pyx":178
* mantissa = mantissa * T[prev_state, state]
*
* if mantissa < MIN_FLOAT_VALUE: # <<<<<<<<<<<<<<
* if mantissa == 0.0:
* continue
*/
__pyx_t_2 = (__pyx_v_mantissa < __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_FLOAT_VALUE);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":179
*
* if mantissa < MIN_FLOAT_VALUE:
* if mantissa == 0.0: # <<<<<<<<<<<<<<
* continue
* if mantissa < 0.0:
*/
__pyx_t_2 = (__pyx_v_mantissa == 0.0);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":180
* if mantissa < MIN_FLOAT_VALUE:
* if mantissa == 0.0:
* continue # <<<<<<<<<<<<<<
* if mantissa < 0.0:
* if T[prev_state, state] < 0.0:
*/
goto __pyx_L25_continue;
goto __pyx_L29;
}
__pyx_L29:;
/* "cogent/align/_pairwise_seqs.pyx":181
* if mantissa == 0.0:
* continue
* if mantissa < 0.0: # <<<<<<<<<<<<<<
* if T[prev_state, state] < 0.0:
* raise ArithmeticError(fmpt(mantissa, exponent,
*/
__pyx_t_2 = (__pyx_v_mantissa < 0.0);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":182
* continue
* if mantissa < 0.0:
* if T[prev_state, state] < 0.0: # <<<<<<<<<<<<<<
* raise ArithmeticError(fmpt(mantissa, exponent,
* "transition is a negative probability"))
*/
__pyx_t_42 = __pyx_v_prev_state;
__pyx_t_43 = __pyx_v_state;
__pyx_t_2 = ((*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_T.data + __pyx_t_42 * __pyx_v_T.strides[0]) )) + __pyx_t_43)) ))) < 0.0);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":183
* if mantissa < 0.0:
* if T[prev_state, state] < 0.0:
* raise ArithmeticError(fmpt(mantissa, exponent, # <<<<<<<<<<<<<<
* "transition is a negative probability"))
* raise ArithmeticError(fmpt(mantissa, exponent,
*/
__pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__fmpt); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_9 = PyFloat_FromDouble(__pyx_v_mantissa); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_10 = PyInt_FromLong(__pyx_v_exponent); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_12));
PyTuple_SET_ITEM(__pyx_t_15, 2, ((PyObject *)__pyx_kp_s_12));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12));
__pyx_t_9 = 0;
__pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
__pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
__pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_builtin_ArithmeticError, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
__Pyx_Raise(__pyx_t_10, 0, 0, 0);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L31;
}
__pyx_L31:;
/* "cogent/align/_pairwise_seqs.pyx":185
* raise ArithmeticError(fmpt(mantissa, exponent,
* "transition is a negative probability"))
* raise ArithmeticError(fmpt(mantissa, exponent, # <<<<<<<<<<<<<<
* "product is a negative probability"))
* while mantissa < MIN_FLOAT_VALUE:
*/
__pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__fmpt); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_15 = PyFloat_FromDouble(__pyx_v_mantissa); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
__pyx_t_11 = PyInt_FromLong(__pyx_v_exponent); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_15);
__Pyx_GIVEREF(__pyx_t_15);
PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_13));
PyTuple_SET_ITEM(__pyx_t_9, 2, ((PyObject *)__pyx_kp_s_13));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13));
__pyx_t_15 = 0;
__pyx_t_11 = 0;
__pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
__pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__pyx_t_11 = 0;
__pyx_t_11 = PyObject_Call(__pyx_builtin_ArithmeticError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
__Pyx_Raise(__pyx_t_11, 0, 0, 0);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L30;
}
__pyx_L30:;
/* "cogent/align/_pairwise_seqs.pyx":187
* raise ArithmeticError(fmpt(mantissa, exponent,
* "product is a negative probability"))
* while mantissa < MIN_FLOAT_VALUE: # <<<<<<<<<<<<<<
* mantissa *= SCALE_STEP
* exponent += -1
*/
while (1) {
__pyx_t_2 = (__pyx_v_mantissa < __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_FLOAT_VALUE);
if (!__pyx_t_2) break;
/* "cogent/align/_pairwise_seqs.pyx":188
* "product is a negative probability"))
* while mantissa < MIN_FLOAT_VALUE:
* mantissa *= SCALE_STEP # <<<<<<<<<<<<<<
* exponent += -1
* if exponent <= MIN_SCALE:
*/
__pyx_v_mantissa = (__pyx_v_mantissa * __pyx_v_6cogent_5align_14_pairwise_seqs_SCALE_STEP);
/* "cogent/align/_pairwise_seqs.pyx":189
* while mantissa < MIN_FLOAT_VALUE:
* mantissa *= SCALE_STEP
* exponent += -1 # <<<<<<<<<<<<<<
* if exponent <= MIN_SCALE:
* raise ArithmeticError(fmpt(mantissa, exponent,
*/
__pyx_v_exponent = (__pyx_v_exponent + -1);
/* "cogent/align/_pairwise_seqs.pyx":190
* mantissa *= SCALE_STEP
* exponent += -1
* if exponent <= MIN_SCALE: # <<<<<<<<<<<<<<
* raise ArithmeticError(fmpt(mantissa, exponent,
* "underflows"))
*/
__pyx_t_2 = (__pyx_v_exponent <= __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_SCALE);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":191
* exponent += -1
* if exponent <= MIN_SCALE:
* raise ArithmeticError(fmpt(mantissa, exponent, # <<<<<<<<<<<<<<
* "underflows"))
*
*/
__pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__fmpt); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_9 = PyFloat_FromDouble(__pyx_v_mantissa); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_10 = PyInt_FromLong(__pyx_v_exponent); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
__Pyx_INCREF(((PyObject *)__pyx_n_s__underflows));
PyTuple_SET_ITEM(__pyx_t_15, 2, ((PyObject *)__pyx_n_s__underflows));
__Pyx_GIVEREF(((PyObject *)__pyx_n_s__underflows));
__pyx_t_9 = 0;
__pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
__pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10);
__Pyx_GIVEREF(__pyx_t_10);
__pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_builtin_ArithmeticError, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0;
__Pyx_Raise(__pyx_t_10, 0, 0, 0);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L34;
}
__pyx_L34:;
}
goto __pyx_L28;
}
/* "cogent/align/_pairwise_seqs.pyx":194
* "underflows"))
*
* elif mantissa > 1.0: # <<<<<<<<<<<<<<
* mantissa *= MIN_FLOAT_VALUE
* exponent += 1
*/
__pyx_t_2 = (__pyx_v_mantissa > 1.0);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":195
*
* elif mantissa > 1.0:
* mantissa *= MIN_FLOAT_VALUE # <<<<<<<<<<<<<<
* exponent += 1
* if exponent > MAX_SCALE:
*/
__pyx_v_mantissa = (__pyx_v_mantissa * __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_FLOAT_VALUE);
/* "cogent/align/_pairwise_seqs.pyx":196
* elif mantissa > 1.0:
* mantissa *= MIN_FLOAT_VALUE
* exponent += 1 # <<<<<<<<<<<<<<
* if exponent > MAX_SCALE:
* raise ArithmeticError(fmpt(mantissa, exponent,
*/
__pyx_v_exponent = (__pyx_v_exponent + 1);
/* "cogent/align/_pairwise_seqs.pyx":197
* mantissa *= MIN_FLOAT_VALUE
* exponent += 1
* if exponent > MAX_SCALE: # <<<<<<<<<<<<<<
* raise ArithmeticError(fmpt(mantissa, exponent,
* "is unexpectedly large"))
*/
__pyx_t_2 = (__pyx_v_exponent > __pyx_v_6cogent_5align_14_pairwise_seqs_MAX_SCALE);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":198
* exponent += 1
* if exponent > MAX_SCALE:
* raise ArithmeticError(fmpt(mantissa, exponent, # <<<<<<<<<<<<<<
* "is unexpectedly large"))
*
*/
__pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__fmpt); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_15 = PyFloat_FromDouble(__pyx_v_mantissa); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
__pyx_t_11 = PyInt_FromLong(__pyx_v_exponent); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_15);
__Pyx_GIVEREF(__pyx_t_15);
PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__Pyx_INCREF(((PyObject *)__pyx_kp_s_14));
PyTuple_SET_ITEM(__pyx_t_9, 2, ((PyObject *)__pyx_kp_s_14));
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14));
__pyx_t_15 = 0;
__pyx_t_11 = 0;
__pyx_t_11 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
__pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__pyx_t_11 = 0;
__pyx_t_11 = PyObject_Call(__pyx_builtin_ArithmeticError, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0;
__Pyx_Raise(__pyx_t_11, 0, 0, 0);
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
{__pyx_filename = __pyx_f[1]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L35;
}
__pyx_L35:;
goto __pyx_L28;
}
__pyx_L28:;
/* "cogent/align/_pairwise_seqs.pyx":201
* "is unexpectedly large"))
*
* if exponent > max_exponent: # <<<<<<<<<<<<<<
* if exponent == max_exponent + 1:
* sub_partial_sum = partial_sum
*/
__pyx_t_2 = (__pyx_v_exponent > __pyx_v_max_exponent);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":202
*
* if exponent > max_exponent:
* if exponent == max_exponent + 1: # <<<<<<<<<<<<<<
* sub_partial_sum = partial_sum
* else:
*/
__pyx_t_2 = (__pyx_v_exponent == (__pyx_v_max_exponent + 1));
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":203
* if exponent > max_exponent:
* if exponent == max_exponent + 1:
* sub_partial_sum = partial_sum # <<<<<<<<<<<<<<
* else:
* sub_partial_sum = 0.0
*/
__pyx_v_sub_partial_sum = __pyx_v_partial_sum;
goto __pyx_L37;
}
/*else*/ {
/* "cogent/align/_pairwise_seqs.pyx":205
* sub_partial_sum = partial_sum
* else:
* sub_partial_sum = 0.0 # <<<<<<<<<<<<<<
* partial_sum = 0.0
* max_mantissa = 0.0
*/
__pyx_v_sub_partial_sum = 0.0;
}
__pyx_L37:;
/* "cogent/align/_pairwise_seqs.pyx":206
* else:
* sub_partial_sum = 0.0
* partial_sum = 0.0 # <<<<<<<<<<<<<<
* max_mantissa = 0.0
* max_exponent = exponent
*/
__pyx_v_partial_sum = 0.0;
/* "cogent/align/_pairwise_seqs.pyx":207
* sub_partial_sum = 0.0
* partial_sum = 0.0
* max_mantissa = 0.0 # <<<<<<<<<<<<<<
* max_exponent = exponent
*
*/
__pyx_v_max_mantissa = 0.0;
/* "cogent/align/_pairwise_seqs.pyx":208
* partial_sum = 0.0
* max_mantissa = 0.0
* max_exponent = exponent # <<<<<<<<<<<<<<
*
* if exponent == max_exponent:
*/
__pyx_v_max_exponent = __pyx_v_exponent;
goto __pyx_L36;
}
__pyx_L36:;
/* "cogent/align/_pairwise_seqs.pyx":210
* max_exponent = exponent
*
* if exponent == max_exponent: # <<<<<<<<<<<<<<
* partial_sum += mantissa
* if viterbi and mantissa > max_mantissa:
*/
__pyx_t_2 = (__pyx_v_exponent == __pyx_v_max_exponent);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":211
*
* if exponent == max_exponent:
* partial_sum += mantissa # <<<<<<<<<<<<<<
* if viterbi and mantissa > max_mantissa:
* max_mantissa = mantissa
*/
__pyx_v_partial_sum = (__pyx_v_partial_sum + __pyx_v_mantissa);
/* "cogent/align/_pairwise_seqs.pyx":212
* if exponent == max_exponent:
* partial_sum += mantissa
* if viterbi and mantissa > max_mantissa: # <<<<<<<<<<<<<<
* max_mantissa = mantissa
* pointer_state = prev_state
*/
if (__pyx_v_viterbi) {
__pyx_t_2 = (__pyx_v_mantissa > __pyx_v_max_mantissa);
__pyx_t_8 = __pyx_t_2;
} else {
__pyx_t_8 = __pyx_v_viterbi;
}
if (__pyx_t_8) {
/* "cogent/align/_pairwise_seqs.pyx":213
* partial_sum += mantissa
* if viterbi and mantissa > max_mantissa:
* max_mantissa = mantissa # <<<<<<<<<<<<<<
* pointer_state = prev_state
* pointer_a = a
*/
__pyx_v_max_mantissa = __pyx_v_mantissa;
/* "cogent/align/_pairwise_seqs.pyx":214
* if viterbi and mantissa > max_mantissa:
* max_mantissa = mantissa
* pointer_state = prev_state # <<<<<<<<<<<<<<
* pointer_a = a
* pointer_b = b
*/
__pyx_v_pointer_state = __pyx_v_prev_state;
/* "cogent/align/_pairwise_seqs.pyx":215
* max_mantissa = mantissa
* pointer_state = prev_state
* pointer_a = a # <<<<<<<<<<<<<<
* pointer_b = b
*
*/
__pyx_v_pointer_a = __pyx_v_a;
/* "cogent/align/_pairwise_seqs.pyx":216
* pointer_state = prev_state
* pointer_a = a
* pointer_b = b # <<<<<<<<<<<<<<
*
* elif exponent == max_exponent - 1:
*/
__pyx_v_pointer_b = __pyx_v_b;
goto __pyx_L39;
}
__pyx_L39:;
goto __pyx_L38;
}
/* "cogent/align/_pairwise_seqs.pyx":218
* pointer_b = b
*
* elif exponent == max_exponent - 1: # <<<<<<<<<<<<<<
* sub_partial_sum += mantissa
*
*/
__pyx_t_8 = (__pyx_v_exponent == (__pyx_v_max_exponent - 1));
if (__pyx_t_8) {
/* "cogent/align/_pairwise_seqs.pyx":219
*
* elif exponent == max_exponent - 1:
* sub_partial_sum += mantissa # <<<<<<<<<<<<<<
*
* partial_sum += sub_partial_sum * MIN_FLOAT_VALUE
*/
__pyx_v_sub_partial_sum = (__pyx_v_sub_partial_sum + __pyx_v_mantissa);
goto __pyx_L38;
}
__pyx_L38:;
__pyx_L25_continue:;
}
/* "cogent/align/_pairwise_seqs.pyx":221
* sub_partial_sum += mantissa
*
* partial_sum += sub_partial_sum * MIN_FLOAT_VALUE # <<<<<<<<<<<<<<
* else:
* for prev_state from min_prev_state <= prev_state < N:
*/
__pyx_v_partial_sum = (__pyx_v_partial_sum + (__pyx_v_sub_partial_sum * __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_FLOAT_VALUE));
goto __pyx_L24;
}
/*else*/ {
/* "cogent/align/_pairwise_seqs.pyx":223
* partial_sum += sub_partial_sum * MIN_FLOAT_VALUE
* else:
* for prev_state from min_prev_state <= prev_state < N: # <<<<<<<<<<<<<<
* mantissa = mantissas[source_row_index, prev_j, prev_state]
* if use_logs:
*/
__pyx_t_33 = __pyx_v_N;
for (__pyx_v_prev_state = __pyx_v_min_prev_state; __pyx_v_prev_state < __pyx_t_33; __pyx_v_prev_state++) {
/* "cogent/align/_pairwise_seqs.pyx":224
* else:
* for prev_state from min_prev_state <= prev_state < N:
* mantissa = mantissas[source_row_index, prev_j, prev_state] # <<<<<<<<<<<<<<
* if use_logs:
* mantissa = mantissa + T[prev_state, state]
*/
__pyx_t_44 = __pyx_v_source_row_index;
__pyx_t_45 = __pyx_v_prev_j;
__pyx_t_46 = __pyx_v_prev_state;
__pyx_v_mantissa = (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mantissas.data + __pyx_t_44 * __pyx_v_mantissas.strides[0]) ) + __pyx_t_45 * __pyx_v_mantissas.strides[1]) )) + __pyx_t_46)) )));
/* "cogent/align/_pairwise_seqs.pyx":225
* for prev_state from min_prev_state <= prev_state < N:
* mantissa = mantissas[source_row_index, prev_j, prev_state]
* if use_logs: # <<<<<<<<<<<<<<
* mantissa = mantissa + T[prev_state, state]
* else:
*/
if (__pyx_v_use_logs) {
/* "cogent/align/_pairwise_seqs.pyx":226
* mantissa = mantissas[source_row_index, prev_j, prev_state]
* if use_logs:
* mantissa = mantissa + T[prev_state, state] # <<<<<<<<<<<<<<
* else:
* mantissa = mantissa * T[prev_state, state]
*/
__pyx_t_47 = __pyx_v_prev_state;
__pyx_t_48 = __pyx_v_state;
__pyx_v_mantissa = (__pyx_v_mantissa + (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_T.data + __pyx_t_47 * __pyx_v_T.strides[0]) )) + __pyx_t_48)) ))));
goto __pyx_L42;
}
/*else*/ {
/* "cogent/align/_pairwise_seqs.pyx":228
* mantissa = mantissa + T[prev_state, state]
* else:
* mantissa = mantissa * T[prev_state, state] # <<<<<<<<<<<<<<
* partial_sum += mantissa
* if viterbi and mantissa > max_mantissa:
*/
__pyx_t_49 = __pyx_v_prev_state;
__pyx_t_50 = __pyx_v_state;
__pyx_v_mantissa = (__pyx_v_mantissa * (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_T.data + __pyx_t_49 * __pyx_v_T.strides[0]) )) + __pyx_t_50)) ))));
/* "cogent/align/_pairwise_seqs.pyx":229
* else:
* mantissa = mantissa * T[prev_state, state]
* partial_sum += mantissa # <<<<<<<<<<<<<<
* if viterbi and mantissa > max_mantissa:
* max_mantissa = mantissa
*/
__pyx_v_partial_sum = (__pyx_v_partial_sum + __pyx_v_mantissa);
}
__pyx_L42:;
/* "cogent/align/_pairwise_seqs.pyx":230
* mantissa = mantissa * T[prev_state, state]
* partial_sum += mantissa
* if viterbi and mantissa > max_mantissa: # <<<<<<<<<<<<<<
* max_mantissa = mantissa
* pointer_state = prev_state
*/
if (__pyx_v_viterbi) {
__pyx_t_8 = (__pyx_v_mantissa > __pyx_v_max_mantissa);
__pyx_t_2 = __pyx_t_8;
} else {
__pyx_t_2 = __pyx_v_viterbi;
}
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":231
* partial_sum += mantissa
* if viterbi and mantissa > max_mantissa:
* max_mantissa = mantissa # <<<<<<<<<<<<<<
* pointer_state = prev_state
* pointer_a = a
*/
__pyx_v_max_mantissa = __pyx_v_mantissa;
/* "cogent/align/_pairwise_seqs.pyx":232
* if viterbi and mantissa > max_mantissa:
* max_mantissa = mantissa
* pointer_state = prev_state # <<<<<<<<<<<<<<
* pointer_a = a
* pointer_b = b
*/
__pyx_v_pointer_state = __pyx_v_prev_state;
/* "cogent/align/_pairwise_seqs.pyx":233
* max_mantissa = mantissa
* pointer_state = prev_state
* pointer_a = a # <<<<<<<<<<<<<<
* pointer_b = b
*
*/
__pyx_v_pointer_a = __pyx_v_a;
/* "cogent/align/_pairwise_seqs.pyx":234
* pointer_state = prev_state
* pointer_a = a
* pointer_b = b # <<<<<<<<<<<<<<
*
* if viterbi:
*/
__pyx_v_pointer_b = __pyx_v_b;
goto __pyx_L43;
}
__pyx_L43:;
}
}
__pyx_L24:;
/* "cogent/align/_pairwise_seqs.pyx":236
* pointer_b = b
*
* if viterbi: # <<<<<<<<<<<<<<
* mantissa = max_mantissa
* if track is not None:
*/
if (__pyx_v_viterbi) {
/* "cogent/align/_pairwise_seqs.pyx":237
*
* if viterbi:
* mantissa = max_mantissa # <<<<<<<<<<<<<<
* if track is not None:
* track[i, j, state] = (
*/
__pyx_v_mantissa = __pyx_v_max_mantissa;
/* "cogent/align/_pairwise_seqs.pyx":238
* if viterbi:
* mantissa = max_mantissa
* if track is not None: # <<<<<<<<<<<<<<
* track[i, j, state] = (
* (pointer_a << tcode_x) |
*/
__pyx_t_2 = (((PyObject *) __pyx_v_track.memview) != Py_None);
if (__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":239
* mantissa = max_mantissa
* if track is not None:
* track[i, j, state] = ( # <<<<<<<<<<<<<<
* (pointer_a << tcode_x) |
* (pointer_b << tcode_y) |
*/
__pyx_t_33 = __pyx_v_i;
__pyx_t_51 = __pyx_v_j;
__pyx_t_52 = __pyx_v_state;
*((unsigned char *) ( /* dim=2 */ ((char *) (((unsigned char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_track.data + __pyx_t_33 * __pyx_v_track.strides[0]) ) + __pyx_t_51 * __pyx_v_track.strides[1]) )) + __pyx_t_52)) )) = (((__pyx_v_pointer_a << __pyx_v_tcode_x) | (__pyx_v_pointer_b << __pyx_v_tcode_y)) | (__pyx_v_pointer_state << __pyx_v_tcode_s));
goto __pyx_L45;
}
__pyx_L45:;
goto __pyx_L44;
}
/*else*/ {
/* "cogent/align/_pairwise_seqs.pyx":244
* (pointer_state << tcode_s))
* else:
* mantissa = partial_sum # <<<<<<<<<<<<<<
*
* if dy:
*/
__pyx_v_mantissa = __pyx_v_partial_sum;
}
__pyx_L44:;
/* "cogent/align/_pairwise_seqs.pyx":246
* mantissa = partial_sum
*
* if dy: # <<<<<<<<<<<<<<
* y = seq2_index[j]
* if dx:
*/
if (__pyx_v_dy) {
/* "cogent/align/_pairwise_seqs.pyx":247
*
* if dy:
* y = seq2_index[j] # <<<<<<<<<<<<<<
* if dx:
* d_score = match_scores[bin, x, y]
*/
__pyx_t_53 = __pyx_v_j;
__pyx_v_y = (*((long *) ( /* dim=0 */ ((char *) (((long *) __pyx_v_seq2_index.data) + __pyx_t_53)) )));
/* "cogent/align/_pairwise_seqs.pyx":248
* if dy:
* y = seq2_index[j]
* if dx: # <<<<<<<<<<<<<<
* d_score = match_scores[bin, x, y]
* else:
*/
if (__pyx_v_dx) {
/* "cogent/align/_pairwise_seqs.pyx":249
* y = seq2_index[j]
* if dx:
* d_score = match_scores[bin, x, y] # <<<<<<<<<<<<<<
* else:
* d_score = ygap_scores[bin, y]
*/
__pyx_t_54 = __pyx_v_bin;
__pyx_t_55 = __pyx_v_x;
__pyx_t_56 = __pyx_v_y;
__pyx_v_d_score = (*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_match_scores.data + __pyx_t_54 * __pyx_v_match_scores.strides[0]) ) + __pyx_t_55 * __pyx_v_match_scores.strides[1]) )) + __pyx_t_56)) )));
goto __pyx_L47;
}
/*else*/ {
/* "cogent/align/_pairwise_seqs.pyx":251
* d_score = match_scores[bin, x, y]
* else:
* d_score = ygap_scores[bin, y] # <<<<<<<<<<<<<<
* elif dx:
* d_score = xgap_scores[bin, x]
*/
__pyx_t_57 = __pyx_v_bin;
__pyx_t_58 = __pyx_v_y;
__pyx_v_d_score = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_ygap_scores.data + __pyx_t_57 * __pyx_v_ygap_scores.strides[0]) )) + __pyx_t_58)) )));
}
__pyx_L47:;
goto __pyx_L46;
}
/* "cogent/align/_pairwise_seqs.pyx":252
* else:
* d_score = ygap_scores[bin, y]
* elif dx: # <<<<<<<<<<<<<<
* d_score = xgap_scores[bin, x]
* elif use_logs:
*/
if (__pyx_v_dx) {
/* "cogent/align/_pairwise_seqs.pyx":253
* d_score = ygap_scores[bin, y]
* elif dx:
* d_score = xgap_scores[bin, x] # <<<<<<<<<<<<<<
* elif use_logs:
* d_score = 0.0
*/
__pyx_t_59 = __pyx_v_bin;
__pyx_t_60 = __pyx_v_x;
__pyx_v_d_score = (*((double *) ( /* dim=1 */ ((char *) (((double *) ( /* dim=0 */ (__pyx_v_xgap_scores.data + __pyx_t_59 * __pyx_v_xgap_scores.strides[0]) )) + __pyx_t_60)) )));
goto __pyx_L46;
}
/* "cogent/align/_pairwise_seqs.pyx":254
* elif dx:
* d_score = xgap_scores[bin, x]
* elif use_logs: # <<<<<<<<<<<<<<
* d_score = 0.0
* else:
*/
if (__pyx_v_use_logs) {
/* "cogent/align/_pairwise_seqs.pyx":255
* d_score = xgap_scores[bin, x]
* elif use_logs:
* d_score = 0.0 # <<<<<<<<<<<<<<
* else:
* d_score = 1.0
*/
__pyx_v_d_score = 0.0;
goto __pyx_L46;
}
/*else*/ {
/* "cogent/align/_pairwise_seqs.pyx":257
* d_score = 0.0
* else:
* d_score = 1.0 # <<<<<<<<<<<<<<
*
* if use_logs:
*/
__pyx_v_d_score = 1.0;
}
__pyx_L46:;
/* "cogent/align/_pairwise_seqs.pyx":259
* d_score = 1.0
*
* if use_logs: # <<<<<<<<<<<<<<
* mantissa += d_score
* else:
*/
if (__pyx_v_use_logs) {
/* "cogent/align/_pairwise_seqs.pyx":260
*
* if use_logs:
* mantissa += d_score # <<<<<<<<<<<<<<
* else:
* mantissa *= d_score
*/
__pyx_v_mantissa = (__pyx_v_mantissa + __pyx_v_d_score);
goto __pyx_L48;
}
/*else*/ {
/* "cogent/align/_pairwise_seqs.pyx":262
* mantissa += d_score
* else:
* mantissa *= d_score # <<<<<<<<<<<<<<
*
* mantissas[current_row_index, j, state] = mantissa
*/
__pyx_v_mantissa = (__pyx_v_mantissa * __pyx_v_d_score);
}
__pyx_L48:;
/* "cogent/align/_pairwise_seqs.pyx":264
* mantissa *= d_score
*
* mantissas[current_row_index, j, state] = mantissa # <<<<<<<<<<<<<<
* if use_scaling:
* exponents[current_row_index, j, state] = max_exponent
*/
__pyx_t_61 = __pyx_v_current_row_index;
__pyx_t_62 = __pyx_v_j;
__pyx_t_63 = __pyx_v_state;
*((double *) ( /* dim=2 */ ((char *) (((double *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_mantissas.data + __pyx_t_61 * __pyx_v_mantissas.strides[0]) ) + __pyx_t_62 * __pyx_v_mantissas.strides[1]) )) + __pyx_t_63)) )) = __pyx_v_mantissa;
/* "cogent/align/_pairwise_seqs.pyx":265
*
* mantissas[current_row_index, j, state] = mantissa
* if use_scaling: # <<<<<<<<<<<<<<
* exponents[current_row_index, j, state] = max_exponent
*
*/
if (__pyx_v_use_scaling) {
/* "cogent/align/_pairwise_seqs.pyx":266
* mantissas[current_row_index, j, state] = mantissa
* if use_scaling:
* exponents[current_row_index, j, state] = max_exponent # <<<<<<<<<<<<<<
*
* if local and dx and dy:
*/
__pyx_t_64 = __pyx_v_current_row_index;
__pyx_t_65 = __pyx_v_j;
__pyx_t_66 = __pyx_v_state;
*((long *) ( /* dim=2 */ ((char *) (((long *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_exponents.data + __pyx_t_64 * __pyx_v_exponents.strides[0]) ) + __pyx_t_65 * __pyx_v_exponents.strides[1]) )) + __pyx_t_66)) )) = __pyx_v_max_exponent;
goto __pyx_L49;
}
__pyx_L49:;
/* "cogent/align/_pairwise_seqs.pyx":268
* exponents[current_row_index, j, state] = max_exponent
*
* if local and dx and dy: # <<<<<<<<<<<<<<
* if (use_scaling and max_exponent > overall_max_exponent) or (
* (not use_scaling or max_exponent == overall_max_exponent) and (
*/
if (__pyx_v_local) {
if (__pyx_v_dx) {
__pyx_t_2 = __pyx_v_dy;
} else {
__pyx_t_2 = __pyx_v_dx;
}
__pyx_t_8 = __pyx_t_2;
} else {
__pyx_t_8 = __pyx_v_local;
}
if (__pyx_t_8) {
/* "cogent/align/_pairwise_seqs.pyx":269
*
* if local and dx and dy:
* if (use_scaling and max_exponent > overall_max_exponent) or ( # <<<<<<<<<<<<<<
* (not use_scaling or max_exponent == overall_max_exponent) and (
* mantissa > overall_max_mantissa)):
*/
if (__pyx_v_use_scaling) {
__pyx_t_8 = (__pyx_v_max_exponent > __pyx_v_overall_max_exponent);
__pyx_t_2 = __pyx_t_8;
} else {
__pyx_t_2 = __pyx_v_use_scaling;
}
if (!__pyx_t_2) {
/* "cogent/align/_pairwise_seqs.pyx":270
* if local and dx and dy:
* if (use_scaling and max_exponent > overall_max_exponent) or (
* (not use_scaling or max_exponent == overall_max_exponent) and ( # <<<<<<<<<<<<<<
* mantissa > overall_max_mantissa)):
* overall_max_exponent = max_exponent
*/
__pyx_t_8 = (!__pyx_v_use_scaling);
if (!__pyx_t_8) {
__pyx_t_7 = (__pyx_v_max_exponent == __pyx_v_overall_max_exponent);
__pyx_t_1 = __pyx_t_7;
} else {
__pyx_t_1 = __pyx_t_8;
}
if (__pyx_t_1) {
/* "cogent/align/_pairwise_seqs.pyx":271
* if (use_scaling and max_exponent > overall_max_exponent) or (
* (not use_scaling or max_exponent == overall_max_exponent) and (
* mantissa > overall_max_mantissa)): # <<<<<<<<<<<<<<
* overall_max_exponent = max_exponent
* overall_max_mantissa = mantissa
*/
__pyx_t_8 = (__pyx_v_mantissa > __pyx_v_overall_max_mantissa);
__pyx_t_7 = __pyx_t_8;
} else {
__pyx_t_7 = __pyx_t_1;
}
__pyx_t_1 = __pyx_t_7;
} else {
__pyx_t_1 = __pyx_t_2;
}
if (__pyx_t_1) {
/* "cogent/align/_pairwise_seqs.pyx":272
* (not use_scaling or max_exponent == overall_max_exponent) and (
* mantissa > overall_max_mantissa)):
* overall_max_exponent = max_exponent # <<<<<<<<<<<<<<
* overall_max_mantissa = mantissa
* last_i = i
*/
__pyx_v_overall_max_exponent = __pyx_v_max_exponent;
/* "cogent/align/_pairwise_seqs.pyx":273
* mantissa > overall_max_mantissa)):
* overall_max_exponent = max_exponent
* overall_max_mantissa = mantissa # <<<<<<<<<<<<<<
* last_i = i
* last_j = j
*/
__pyx_v_overall_max_mantissa = __pyx_v_mantissa;
/* "cogent/align/_pairwise_seqs.pyx":274
* overall_max_exponent = max_exponent
* overall_max_mantissa = mantissa
* last_i = i # <<<<<<<<<<<<<<
* last_j = j
* last_state = state
*/
__pyx_v_last_i = __pyx_v_i;
/* "cogent/align/_pairwise_seqs.pyx":275
* overall_max_mantissa = mantissa
* last_i = i
* last_j = j # <<<<<<<<<<<<<<
* last_state = state
* if not local:
*/
__pyx_v_last_j = __pyx_v_j;
/* "cogent/align/_pairwise_seqs.pyx":276
* last_i = i
* last_j = j
* last_state = state # <<<<<<<<<<<<<<
* if not local:
* last_i = i_high - 1
*/
__pyx_v_last_state = __pyx_v_state;
goto __pyx_L51;
}
__pyx_L51:;
goto __pyx_L50;
}
__pyx_L50:;
__pyx_L19_continue:;
}
}
}
/* "cogent/align/_pairwise_seqs.pyx":277
* last_j = j
* last_state = state
* if not local: # <<<<<<<<<<<<<<
* last_i = i_high - 1
* last_j = j_high - 1
*/
__pyx_t_1 = (!__pyx_v_local);
if (__pyx_t_1) {
/* "cogent/align/_pairwise_seqs.pyx":278
* last_state = state
* if not local:
* last_i = i_high - 1 # <<<<<<<<<<<<<<
* last_j = j_high - 1
* last_state = state
*/
__pyx_v_last_i = (__pyx_v_i_high - 1);
/* "cogent/align/_pairwise_seqs.pyx":279
* if not local:
* last_i = i_high - 1
* last_j = j_high - 1 # <<<<<<<<<<<<<<
* last_state = state
* else:
*/
__pyx_v_last_j = (__pyx_v_j_high - 1);
/* "cogent/align/_pairwise_seqs.pyx":280
* last_i = i_high - 1
* last_j = j_high - 1
* last_state = state # <<<<<<<<<<<<<<
* else:
* mantissa = overall_max_mantissa
*/
__pyx_v_last_state = __pyx_v_state;
goto __pyx_L52;
}
/*else*/ {
/* "cogent/align/_pairwise_seqs.pyx":282
* last_state = state
* else:
* mantissa = overall_max_mantissa # <<<<<<<<<<<<<<
* max_exponent = overall_max_exponent
*
*/
__pyx_v_mantissa = __pyx_v_overall_max_mantissa;
/* "cogent/align/_pairwise_seqs.pyx":283
* else:
* mantissa = overall_max_mantissa
* max_exponent = overall_max_exponent # <<<<<<<<<<<<<<
*
* if use_scaling:
*/
__pyx_v_max_exponent = __pyx_v_overall_max_exponent;
}
__pyx_L52:;
/* "cogent/align/_pairwise_seqs.pyx":285
* max_exponent = overall_max_exponent
*
* if use_scaling: # <<<<<<<<<<<<<<
* score = log(mantissa) + log(SCALE_STEP) * max_exponent
* elif use_logs:
*/
if (__pyx_v_use_scaling) {
/* "cogent/align/_pairwise_seqs.pyx":286
*
* if use_scaling:
* score = log(mantissa) + log(SCALE_STEP) * max_exponent # <<<<<<<<<<<<<<
* elif use_logs:
* score = mantissa
*/
__pyx_v_score = (log(__pyx_v_mantissa) + (log(__pyx_v_6cogent_5align_14_pairwise_seqs_SCALE_STEP) * __pyx_v_max_exponent));
goto __pyx_L53;
}
/* "cogent/align/_pairwise_seqs.pyx":287
* if use_scaling:
* score = log(mantissa) + log(SCALE_STEP) * max_exponent
* elif use_logs: # <<<<<<<<<<<<<<
* score = mantissa
* else:
*/
if (__pyx_v_use_logs) {
/* "cogent/align/_pairwise_seqs.pyx":288
* score = log(mantissa) + log(SCALE_STEP) * max_exponent
* elif use_logs:
* score = mantissa # <<<<<<<<<<<<<<
* else:
* score = log(mantissa)
*/
__pyx_v_score = __pyx_v_mantissa;
goto __pyx_L53;
}
/*else*/ {
/* "cogent/align/_pairwise_seqs.pyx":290
* score = mantissa
* else:
* score = log(mantissa) # <<<<<<<<<<<<<<
* return ((last_i, last_j), last_state, score)
*/
__pyx_v_score = log(__pyx_v_mantissa);
}
__pyx_L53:;
/* "cogent/align/_pairwise_seqs.pyx":291
* else:
* score = log(mantissa)
* return ((last_i, last_j), last_state, score) # <<<<<<<<<<<<<<
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_11 = PyInt_FromLong(__pyx_v_last_i); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_9 = PyInt_FromLong(__pyx_v_last_j); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
__pyx_t_11 = 0;
__pyx_t_9 = 0;
__pyx_t_9 = PyInt_FromLong(__pyx_v_last_state); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_11 = PyFloat_FromDouble(__pyx_v_score); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_11);
__pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_15);
PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_t_10));
__Pyx_GIVEREF(((PyObject *)__pyx_t_10));
PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_9);
__Pyx_GIVEREF(__pyx_t_9);
PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_11);
__Pyx_GIVEREF(__pyx_t_11);
__pyx_t_10 = 0;
__pyx_t_9 = 0;
__pyx_t_11 = 0;
__pyx_r = ((PyObject *)__pyx_t_15);
__pyx_t_15 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_9);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_11);
__PYX_XDEC_MEMVIEW(&__pyx_t_13, 1);
__PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
__Pyx_XDECREF(__pyx_t_15);
__PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
__Pyx_AddTraceback("cogent.align._pairwise_seqs.calc_rows", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__PYX_XDEC_MEMVIEW(&__pyx_v_mantissas, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_exponents, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_plan, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_seq1_index, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_seq2_index, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_state_directions, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_T, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_xgap_scores, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_ygap_scores, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_match_scores, 1);
__PYX_XDEC_MEMVIEW(&__pyx_v_track, 1);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_shape = 0;
Py_ssize_t __pyx_v_itemsize;
PyObject *__pyx_v_format = 0;
PyObject *__pyx_v_mode = 0;
int __pyx_v_allocate_buffer;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__shape,&__pyx_n_s__itemsize,&__pyx_n_s__format,&__pyx_n_s__mode,&__pyx_n_s__allocate_buffer,0};
PyObject* values[5] = {0,0,0,0,0};
values[3] = ((PyObject *)__pyx_n_u__c);
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);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shape)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__itemsize)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__format)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 3:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode);
if (value) { values[3] = value; kw_args--; }
}
case 4:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__allocate_buffer);
if (value) { values[4] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__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_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
/* "View.MemoryView":114
*
* def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
* mode=u"c", bint allocate_buffer=True): # <<<<<<<<<<<<<<
*
* cdef int idx
*/
__pyx_v_allocate_buffer = ((int)1);
}
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
PyErr_Format(PyExc_TypeError, "Argument 'format' must not be None"); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_r = __pyx_array_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);
goto __pyx_L0;
__pyx_L1_error:;
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":113
* cdef bint dtype_is_object
*
* def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
* mode=u"c", bint allocate_buffer=True):
*
*/
static int __pyx_array_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) {
int __pyx_v_idx;
Py_ssize_t __pyx_v_i;
PyObject **__pyx_v_p;
PyObject *__pyx_v_encode = NULL;
PyObject *__pyx_v_dim = NULL;
char __pyx_v_order;
PyObject *__pyx_v_decode = NULL;
int __pyx_r;
__Pyx_RefNannyDeclarations
Py_ssize_t __pyx_t_1;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
char *__pyx_t_6;
int __pyx_t_7;
int __pyx_t_8;
int __pyx_t_9;
Py_ssize_t __pyx_t_10;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
__Pyx_INCREF(__pyx_v_format);
__Pyx_INCREF(__pyx_v_mode);
/* "View.MemoryView":120
* cdef PyObject **p
*
* self.ndim = len(shape) # <<<<<<<<<<<<<<
* self.itemsize = itemsize
*
*/
if (unlikely(((PyObject *)__pyx_v_shape) == Py_None)) {
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = PyTuple_GET_SIZE(((PyObject *)__pyx_v_shape)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->ndim = __pyx_t_1;
/* "View.MemoryView":121
*
* self.ndim = len(shape)
* self.itemsize = itemsize # <<<<<<<<<<<<<<
*
* if not self.ndim:
*/
__pyx_v_self->itemsize = __pyx_v_itemsize;
/* "View.MemoryView":123
* self.itemsize = itemsize
*
* if not self.ndim: # <<<<<<<<<<<<<<
* raise ValueError("Empty shape tuple for cython.array")
*
*/
__pyx_t_2 = (!__pyx_v_self->ndim);
if (__pyx_t_2) {
/* "View.MemoryView":124
*
* if not self.ndim:
* raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
*
* if self.itemsize <= 0:
*/
__pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":126
* raise ValueError("Empty shape tuple for cython.array")
*
* if self.itemsize <= 0: # <<<<<<<<<<<<<<
* raise ValueError("itemsize <= 0 for cython.array")
*
*/
__pyx_t_2 = (__pyx_v_self->itemsize <= 0);
if (__pyx_t_2) {
/* "View.MemoryView":127
*
* if self.itemsize <= 0:
* raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
*
* encode = getattr(format, 'encode', None)
*/
__pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L4;
}
__pyx_L4:;
/* "View.MemoryView":129
* raise ValueError("itemsize <= 0 for cython.array")
*
* encode = getattr(format, 'encode', None) # <<<<<<<<<<<<<<
* if encode:
* format = encode('ASCII')
*/
__pyx_t_3 = ((PyObject *)__pyx_n_s__encode);
__Pyx_INCREF(__pyx_t_3);
__pyx_t_4 = Py_None;
__Pyx_INCREF(__pyx_t_4);
__pyx_t_5 = __Pyx_GetAttr3(__pyx_v_format, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_encode = __pyx_t_5;
__pyx_t_5 = 0;
/* "View.MemoryView":130
*
* encode = getattr(format, 'encode', None)
* if encode: # <<<<<<<<<<<<<<
* format = encode('ASCII')
* self._format = format
*/
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_encode); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_2) {
/* "View.MemoryView":131
* encode = getattr(format, 'encode', None)
* if encode:
* format = encode('ASCII') # <<<<<<<<<<<<<<
* self._format = format
* self.format = self._format
*/
__pyx_t_5 = PyObject_Call(__pyx_v_encode, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_v_format);
__pyx_v_format = __pyx_t_5;
__pyx_t_5 = 0;
goto __pyx_L5;
}
__pyx_L5:;
/* "View.MemoryView":132
* if encode:
* format = encode('ASCII')
* self._format = format # <<<<<<<<<<<<<<
* self.format = self._format
*
*/
if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_v_format)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_INCREF(__pyx_v_format);
__Pyx_GIVEREF(__pyx_v_format);
__Pyx_GOTREF(__pyx_v_self->_format);
__Pyx_DECREF(((PyObject *)__pyx_v_self->_format));
__pyx_v_self->_format = ((PyObject*)__pyx_v_format);
/* "View.MemoryView":133
* format = encode('ASCII')
* self._format = format
* self.format = self._format # <<<<<<<<<<<<<<
*
* self._shape = malloc(sizeof(Py_ssize_t)*self.ndim)
*/
__pyx_t_6 = PyBytes_AsString(((PyObject *)__pyx_v_self->_format)); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_self->format = __pyx_t_6;
/* "View.MemoryView":135
* self.format = self._format
*
* self._shape = malloc(sizeof(Py_ssize_t)*self.ndim) # <<<<<<<<<<<<<<
* self._strides = malloc(sizeof(Py_ssize_t)*self.ndim)
*
*/
__pyx_v_self->_shape = ((Py_ssize_t *)malloc(((sizeof(Py_ssize_t)) * __pyx_v_self->ndim)));
/* "View.MemoryView":136
*
* self._shape = malloc(sizeof(Py_ssize_t)*self.ndim)
* self._strides = malloc(sizeof(Py_ssize_t)*self.ndim) # <<<<<<<<<<<<<<
*
* if not self._shape or not self._strides:
*/
__pyx_v_self->_strides = ((Py_ssize_t *)malloc(((sizeof(Py_ssize_t)) * __pyx_v_self->ndim)));
/* "View.MemoryView":138
* self._strides = malloc(sizeof(Py_ssize_t)*self.ndim)
*
* if not self._shape or not self._strides: # <<<<<<<<<<<<<<
* free(self._shape)
* free(self._strides)
*/
__pyx_t_2 = (!(__pyx_v_self->_shape != 0));
if (!__pyx_t_2) {
__pyx_t_7 = (!(__pyx_v_self->_strides != 0));
__pyx_t_8 = __pyx_t_7;
} else {
__pyx_t_8 = __pyx_t_2;
}
if (__pyx_t_8) {
/* "View.MemoryView":139
*
* if not self._shape or not self._strides:
* free(self._shape) # <<<<<<<<<<<<<<
* free(self._strides)
* raise MemoryError("unable to allocate shape or strides.")
*/
free(__pyx_v_self->_shape);
/* "View.MemoryView":140
* if not self._shape or not self._strides:
* free(self._shape)
* free(self._strides) # <<<<<<<<<<<<<<
* raise MemoryError("unable to allocate shape or strides.")
*
*/
free(__pyx_v_self->_strides);
/* "View.MemoryView":141
* free(self._shape)
* free(self._strides)
* raise MemoryError("unable to allocate shape or strides.") # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_5 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
__pyx_L6:;
/* "View.MemoryView":144
*
*
* idx = 0 # <<<<<<<<<<<<<<
* for idx, dim in enumerate(shape):
* if dim <= 0:
*/
__pyx_v_idx = 0;
/* "View.MemoryView":145
*
* idx = 0
* for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
* if dim <= 0:
* raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
*/
__pyx_t_9 = 0;
__pyx_t_5 = ((PyObject *)__pyx_v_shape); __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
for (;;) {
if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__Pyx_XDECREF(__pyx_v_dim);
__pyx_v_dim = __pyx_t_4;
__pyx_t_4 = 0;
__pyx_v_idx = __pyx_t_9;
__pyx_t_9 = (__pyx_t_9 + 1);
/* "View.MemoryView":146
* idx = 0
* for idx, dim in enumerate(shape):
* if dim <= 0: # <<<<<<<<<<<<<<
* raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
*
*/
__pyx_t_4 = PyObject_RichCompare(__pyx_v_dim, __pyx_int_0, Py_LE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (__pyx_t_8) {
/* "View.MemoryView":147
* 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_4 = PyInt_FromLong(__pyx_v_idx); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
__Pyx_INCREF(__pyx_v_dim);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_dim);
__Pyx_GIVEREF(__pyx_v_dim);
__pyx_t_4 = 0;
__pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_22), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4));
__Pyx_GIVEREF(((PyObject *)__pyx_t_4));
__pyx_t_4 = 0;
__pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[2]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L9;
}
__pyx_L9:;
/* "View.MemoryView":149
* raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
*
* self._shape[idx] = dim # <<<<<<<<<<<<<<
* idx += 1
*
*/
__pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
(__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_t_10;
/* "View.MemoryView":150
*
* self._shape[idx] = dim
* idx += 1 # <<<<<<<<<<<<<<
*
* if mode not in ("fortran", "c"):
*/
__pyx_v_idx = (__pyx_v_idx + 1);
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "View.MemoryView":152
* idx += 1
*
* if mode not in ("fortran", "c"): # <<<<<<<<<<<<<<
* raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
*
*/
__Pyx_INCREF(__pyx_v_mode);
__pyx_t_5 = __pyx_v_mode;
__pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__fortran), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
if (((int)__pyx_t_8)) {
__pyx_t_4 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_n_s__c), Py_NE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_7 = ((int)__pyx_t_2);
} else {
__pyx_t_7 = ((int)__pyx_t_8);
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_8 = __pyx_t_7;
if (__pyx_t_8) {
/* "View.MemoryView":153
*
* if mode not in ("fortran", "c"):
* raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<<
*
* cdef char order
*/
__pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_23), __pyx_v_mode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5));
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
__pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_Raise(__pyx_t_5, 0, 0, 0);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L10;
}
__pyx_L10:;
/* "View.MemoryView":156
*
* cdef char order
* if mode == 'fortran': # <<<<<<<<<<<<<<
* order = 'F'
* else:
*/
__pyx_t_5 = PyObject_RichCompare(__pyx_v_mode, ((PyObject *)__pyx_n_s__fortran), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_8) {
/* "View.MemoryView":157
* cdef char order
* if mode == 'fortran':
* order = 'F' # <<<<<<<<<<<<<<
* else:
* order = 'C'
*/
__pyx_v_order = 'F';
goto __pyx_L11;
}
/*else*/ {
/* "View.MemoryView":159
* order = 'F'
* else:
* order = 'C' # <<<<<<<<<<<<<<
*
* self.len = fill_contig_strides_array(self._shape, self._strides,
*/
__pyx_v_order = 'C';
}
__pyx_L11:;
/* "View.MemoryView":161
* order = 'C'
*
* self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<<
* itemsize, self.ndim, order)
*
*/
__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":164
* itemsize, self.ndim, order)
*
* decode = getattr(mode, 'decode', None) # <<<<<<<<<<<<<<
* if decode:
* mode = decode('ASCII')
*/
__pyx_t_5 = ((PyObject *)__pyx_n_s__decode);
__Pyx_INCREF(__pyx_t_5);
__pyx_t_4 = Py_None;
__Pyx_INCREF(__pyx_t_4);
__pyx_t_3 = __Pyx_GetAttr3(__pyx_v_mode, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_v_decode = __pyx_t_3;
__pyx_t_3 = 0;
/* "View.MemoryView":165
*
* decode = getattr(mode, 'decode', None)
* if decode: # <<<<<<<<<<<<<<
* mode = decode('ASCII')
* self.mode = mode
*/
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_decode); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_8) {
/* "View.MemoryView":166
* decode = getattr(mode, 'decode', None)
* if decode:
* mode = decode('ASCII') # <<<<<<<<<<<<<<
* self.mode = mode
*
*/
__pyx_t_3 = PyObject_Call(__pyx_v_decode, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_v_mode);
__pyx_v_mode = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L12;
}
__pyx_L12:;
/* "View.MemoryView":167
* if decode:
* mode = decode('ASCII')
* self.mode = mode # <<<<<<<<<<<<<<
*
* self.free_data = allocate_buffer
*/
if (!(likely(PyUnicode_CheckExact(__pyx_v_mode))||((__pyx_v_mode) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected unicode, got %.200s", Py_TYPE(__pyx_v_mode)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_INCREF(__pyx_v_mode);
__Pyx_GIVEREF(__pyx_v_mode);
__Pyx_GOTREF(__pyx_v_self->mode);
__Pyx_DECREF(((PyObject *)__pyx_v_self->mode));
__pyx_v_self->mode = ((PyObject*)__pyx_v_mode);
/* "View.MemoryView":169
* self.mode = mode
*
* self.free_data = allocate_buffer # <<<<<<<<<<<<<<
* self.dtype_is_object = format == b'O'
* if allocate_buffer:
*/
__pyx_v_self->free_data = __pyx_v_allocate_buffer;
/* "View.MemoryView":170
*
* self.free_data = allocate_buffer
* self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<<
* if allocate_buffer:
* self.data = malloc(self.len)
*/
__pyx_t_3 = PyObject_RichCompare(__pyx_v_format, ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_v_self->dtype_is_object = __pyx_t_8;
/* "View.MemoryView":171
* self.free_data = allocate_buffer
* self.dtype_is_object = format == b'O'
* if allocate_buffer: # <<<<<<<<<<<<<<
* self.data = malloc(self.len)
* if not self.data:
*/
if (__pyx_v_allocate_buffer) {
/* "View.MemoryView":172
* self.dtype_is_object = format == b'O'
* if allocate_buffer:
* self.data = malloc(self.len) # <<<<<<<<<<<<<<
* if not self.data:
* raise MemoryError("unable to allocate array data.")
*/
__pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
/* "View.MemoryView":173
* if allocate_buffer:
* self.data = malloc(self.len)
* if not self.data: # <<<<<<<<<<<<<<
* raise MemoryError("unable to allocate array data.")
*
*/
__pyx_t_8 = (!(__pyx_v_self->data != 0));
if (__pyx_t_8) {
/* "View.MemoryView":174
* self.data = malloc(self.len)
* if not self.data:
* raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
*
* if self.dtype_is_object:
*/
__pyx_t_3 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L14;
}
__pyx_L14:;
/* "View.MemoryView":176
* raise MemoryError("unable to allocate array data.")
*
* if self.dtype_is_object: # <<<<<<<<<<<<<<
* p = self.data
* for i in range(self.len / itemsize):
*/
if (__pyx_v_self->dtype_is_object) {
/* "View.MemoryView":177
*
* if self.dtype_is_object:
* p = self.data # <<<<<<<<<<<<<<
* for i in range(self.len / itemsize):
* p[i] = Py_None
*/
__pyx_v_p = ((PyObject **)__pyx_v_self->data);
/* "View.MemoryView":178
* if self.dtype_is_object:
* p = self.data
* for i in range(self.len / itemsize): # <<<<<<<<<<<<<<
* p[i] = Py_None
* Py_INCREF(Py_None)
*/
if (unlikely(__pyx_v_itemsize == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
PyErr_Format(PyExc_OverflowError, "value too large to perform division");
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_1; __pyx_t_10+=1) {
__pyx_v_i = __pyx_t_10;
/* "View.MemoryView":179
* p = self.data
* for i in range(self.len / itemsize):
* p[i] = Py_None # <<<<<<<<<<<<<<
* Py_INCREF(Py_None)
*
*/
(__pyx_v_p[__pyx_v_i]) = Py_None;
/* "View.MemoryView":180
* for i in range(self.len / itemsize):
* p[i] = Py_None
* Py_INCREF(Py_None) # <<<<<<<<<<<<<<
*
* @cname('getbuffer')
*/
Py_INCREF(Py_None);
}
goto __pyx_L15;
}
__pyx_L15:;
goto __pyx_L13;
}
__pyx_L13:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_encode);
__Pyx_XDECREF(__pyx_v_dim);
__Pyx_XDECREF(__pyx_v_decode);
__Pyx_XDECREF(__pyx_v_format);
__Pyx_XDECREF(__pyx_v_mode);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
__pyx_r = __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":183
*
* @cname('getbuffer')
* def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
* cdef int bufmode = -1
* if self.mode == b"c":
*/
static int __pyx_array_getbuffer_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
int __pyx_v_bufmode;
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getbuffer__", 0);
if (__pyx_v_info != NULL) {
__pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
__Pyx_GIVEREF(__pyx_v_info->obj);
}
/* "View.MemoryView":184
* @cname('getbuffer')
* def __getbuffer__(self, Py_buffer *info, int flags):
* cdef int bufmode = -1 # <<<<<<<<<<<<<<
* if self.mode == b"c":
* bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
*/
__pyx_v_bufmode = -1;
/* "View.MemoryView":185
* def __getbuffer__(self, Py_buffer *info, int flags):
* cdef int bufmode = -1
* if self.mode == b"c": # <<<<<<<<<<<<<<
* bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
* elif self.mode == b"fortran":
*/
__pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__c), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
/* "View.MemoryView":186
* cdef int bufmode = -1
* if self.mode == b"c":
* bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
* elif self.mode == b"fortran":
* bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
*/
__pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
goto __pyx_L3;
}
/* "View.MemoryView":187
* if self.mode == b"c":
* bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
* elif self.mode == b"fortran": # <<<<<<<<<<<<<<
* bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
* if not (flags & bufmode):
*/
__pyx_t_1 = (__Pyx_PyUnicode_Equals(((PyObject *)__pyx_v_self->mode), ((PyObject *)__pyx_n_b__fortran), Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
/* "View.MemoryView":188
* bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
* elif self.mode == b"fortran":
* bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
* if not (flags & bufmode):
* raise ValueError("Can only create a buffer that is contiguous in memory.")
*/
__pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":189
* elif self.mode == b"fortran":
* 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
*/
__pyx_t_1 = (!(__pyx_v_flags & __pyx_v_bufmode));
if (__pyx_t_1) {
/* "View.MemoryView":190
* 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_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L4;
}
__pyx_L4:;
/* "View.MemoryView":191
* if not (flags & bufmode):
* raise ValueError("Can only create a buffer that is contiguous in memory.")
* info.buf = self.data # <<<<<<<<<<<<<<
* info.len = self.len
* info.ndim = self.ndim
*/
__pyx_v_info->buf = __pyx_v_self->data;
/* "View.MemoryView":192
* raise ValueError("Can only create a buffer that is contiguous in memory.")
* info.buf = self.data
* info.len = self.len # <<<<<<<<<<<<<<
* info.ndim = self.ndim
* info.shape = self._shape
*/
__pyx_v_info->len = __pyx_v_self->len;
/* "View.MemoryView":193
* info.buf = self.data
* info.len = self.len
* info.ndim = self.ndim # <<<<<<<<<<<<<<
* info.shape = self._shape
* info.strides = self._strides
*/
__pyx_v_info->ndim = __pyx_v_self->ndim;
/* "View.MemoryView":194
* info.len = self.len
* info.ndim = self.ndim
* info.shape = self._shape # <<<<<<<<<<<<<<
* info.strides = self._strides
* info.suboffsets = NULL
*/
__pyx_v_info->shape = __pyx_v_self->_shape;
/* "View.MemoryView":195
* info.ndim = self.ndim
* info.shape = self._shape
* info.strides = self._strides # <<<<<<<<<<<<<<
* info.suboffsets = NULL
* info.itemsize = self.itemsize
*/
__pyx_v_info->strides = __pyx_v_self->_strides;
/* "View.MemoryView":196
* info.shape = self._shape
* info.strides = self._strides
* info.suboffsets = NULL # <<<<<<<<<<<<<<
* info.itemsize = self.itemsize
* info.readonly = 0
*/
__pyx_v_info->suboffsets = NULL;
/* "View.MemoryView":197
* info.strides = self._strides
* info.suboffsets = NULL
* info.itemsize = self.itemsize # <<<<<<<<<<<<<<
* info.readonly = 0
*
*/
__pyx_v_info->itemsize = __pyx_v_self->itemsize;
/* "View.MemoryView":198
* info.suboffsets = NULL
* info.itemsize = self.itemsize
* info.readonly = 0 # <<<<<<<<<<<<<<
*
* if flags & PyBUF_FORMAT:
*/
__pyx_v_info->readonly = 0;
/* "View.MemoryView":200
* info.readonly = 0
*
* if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
* info.format = self.format
* else:
*/
__pyx_t_3 = (__pyx_v_flags & PyBUF_FORMAT);
if (__pyx_t_3) {
/* "View.MemoryView":201
*
* if flags & PyBUF_FORMAT:
* info.format = self.format # <<<<<<<<<<<<<<
* else:
* info.format = NULL
*/
__pyx_v_info->format = __pyx_v_self->format;
goto __pyx_L5;
}
/*else*/ {
/* "View.MemoryView":203
* info.format = self.format
* else:
* info.format = NULL # <<<<<<<<<<<<<<
*
* info.obj = self
*/
__pyx_v_info->format = NULL;
}
__pyx_L5:;
/* "View.MemoryView":205
* info.format = NULL
*
* info.obj = self # <<<<<<<<<<<<<<
*
* __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
*/
__Pyx_INCREF(((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
__Pyx_GOTREF(__pyx_v_info->obj);
__Pyx_DECREF(__pyx_v_info->obj);
__pyx_v_info->obj = ((PyObject *)__pyx_v_self);
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
__Pyx_GOTREF(__pyx_v_info->obj);
__Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
}
goto __pyx_L2;
__pyx_L0:;
if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
__Pyx_GOTREF(Py_None);
__Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
}
__pyx_L2:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_array_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
}
/* "View.MemoryView":209
* __pyx_getbuffer = capsule( &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
*
* def __dealloc__(array self): # <<<<<<<<<<<<<<
* if self.callback_free_data != NULL:
* self.callback_free_data(self.data)
*/
static void __pyx_array_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
/* "View.MemoryView":210
*
* def __dealloc__(array self):
* if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
* self.callback_free_data(self.data)
* elif self.free_data:
*/
__pyx_t_1 = (__pyx_v_self->callback_free_data != NULL);
if (__pyx_t_1) {
/* "View.MemoryView":211
* def __dealloc__(array self):
* if self.callback_free_data != NULL:
* self.callback_free_data(self.data) # <<<<<<<<<<<<<<
* elif self.free_data:
* if self.dtype_is_object:
*/
__pyx_v_self->callback_free_data(__pyx_v_self->data);
goto __pyx_L3;
}
/* "View.MemoryView":212
* if self.callback_free_data != NULL:
* self.callback_free_data(self.data)
* elif self.free_data: # <<<<<<<<<<<<<<
* if self.dtype_is_object:
* refcount_objects_in_slice(self.data, self._shape,
*/
if (__pyx_v_self->free_data) {
/* "View.MemoryView":213
* self.callback_free_data(self.data)
* elif self.free_data:
* if self.dtype_is_object: # <<<<<<<<<<<<<<
* refcount_objects_in_slice(self.data, self._shape,
* self._strides, self.ndim, False)
*/
if (__pyx_v_self->dtype_is_object) {
/* "View.MemoryView":215
* if self.dtype_is_object:
* refcount_objects_in_slice(self.data, self._shape,
* self._strides, self.ndim, False) # <<<<<<<<<<<<<<
* free(self.data)
*
*/
__pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
goto __pyx_L4;
}
__pyx_L4:;
/* "View.MemoryView":216
* refcount_objects_in_slice(self.data, self._shape,
* self._strides, self.ndim, False)
* free(self.data) # <<<<<<<<<<<<<<
*
* free(self._strides)
*/
free(__pyx_v_self->data);
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":218
* free(self.data)
*
* free(self._strides) # <<<<<<<<<<<<<<
* free(self._shape)
*
*/
free(__pyx_v_self->_strides);
/* "View.MemoryView":219
*
* free(self._strides)
* free(self._shape) # <<<<<<<<<<<<<<
*
* property memview:
*/
free(__pyx_v_self->_shape);
__Pyx_RefNannyFinishContext();
}
/* Python wrapper */
static PyObject *get_memview(PyObject *__pyx_v_self); /*proto*/
static PyObject *get_memview(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = get_memview_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":223
* property memview:
* @cname('get_memview')
* def __get__(self): # <<<<<<<<<<<<<<
*
* flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
*/
static PyObject *get_memview_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
int __pyx_v_flags;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":225
* def __get__(self):
*
* flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<<
* return memoryview(self, flags, self.dtype_is_object)
*
*/
__pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
/* "View.MemoryView":226
*
* flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
* return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_1 = 0;
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
__pyx_r = __pyx_array_MemoryView_5array_6__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":229
*
*
* def __getattr__(self, attr): # <<<<<<<<<<<<<<
* return getattr(self.memview, attr)
*
*/
static PyObject *__pyx_array_MemoryView_5array_6__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getattr__", 0);
/* "View.MemoryView":230
*
* def __getattr__(self, attr):
* return getattr(self.memview, attr) # <<<<<<<<<<<<<<
*
* def __getitem__(self, item):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __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;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
__pyx_r = __pyx_array_MemoryView_5array_8__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":232
* return getattr(self.memview, attr)
*
* def __getitem__(self, item): # <<<<<<<<<<<<<<
* return self.memview[item]
*
*/
static PyObject *__pyx_array_MemoryView_5array_8__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
/* "View.MemoryView":233
*
* def __getitem__(self, item):
* return self.memview[item] # <<<<<<<<<<<<<<
*
* def __setitem__(self, item, value):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (!__pyx_t_2) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __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;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
__pyx_r = __pyx_array_MemoryView_5array_10__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":235
* return self.memview[item]
*
* def __setitem__(self, item, value): # <<<<<<<<<<<<<<
* self.memview[item] = value
*
*/
static int __pyx_array_MemoryView_5array_10__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
/* "View.MemoryView":236
*
* def __setitem__(self, item, value):
* self.memview[item] = value # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__memview); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":240
*
* @cname("__pyx_array_new")
* cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
* char *mode, char *buf):
* cdef array result
*/
static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) {
struct __pyx_array_obj *__pyx_v_result = 0;
struct __pyx_array_obj *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("array_cwrapper", 0);
/* "View.MemoryView":244
* cdef array result
*
* if buf == NULL: # <<<<<<<<<<<<<<
* result = array(shape, itemsize, format, mode.decode('ASCII'))
* else:
*/
__pyx_t_1 = (__pyx_v_buf == NULL);
if (__pyx_t_1) {
/* "View.MemoryView":245
*
* 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_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_4 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_INCREF(((PyObject *)__pyx_v_shape));
PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_shape));
__Pyx_GIVEREF(((PyObject *)__pyx_v_shape));
PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_5, 2, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
PyTuple_SET_ITEM(__pyx_t_5, 3, ((PyObject *)__pyx_t_4));
__Pyx_GIVEREF(((PyObject *)__pyx_t_4));
__pyx_t_2 = 0;
__pyx_t_3 = 0;
__pyx_t_4 = 0;
__pyx_t_4 = PyObject_Call(((PyObject *)((PyObject *)__pyx_array_type)), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
__pyx_t_4 = 0;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":247
* 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_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_5 = PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__pyx_t_3 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)__pyx_v_shape));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_shape));
__Pyx_GIVEREF(((PyObject *)__pyx_v_shape));
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_t_5));
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_4 = 0;
__pyx_t_5 = 0;
__pyx_t_3 = 0;
__pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
/* "View.MemoryView":248
* else:
* result = array(shape, itemsize, format, mode.decode('ASCII'),
* allocate_buffer=False) # <<<<<<<<<<<<<<
* result.data = buf
*
*/
__pyx_t_5 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__allocate_buffer), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(((PyObject *)((PyObject *)__pyx_array_type)), ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
__pyx_t_5 = 0;
/* "View.MemoryView":249
* result = array(shape, itemsize, format, mode.decode('ASCII'),
* allocate_buffer=False)
* result.data = buf # <<<<<<<<<<<<<<
*
* return result
*/
__pyx_v_result->data = __pyx_v_buf;
}
__pyx_L3:;
/* "View.MemoryView":251
* result.data = buf
*
* return result # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(((PyObject *)__pyx_r));
__Pyx_INCREF(((PyObject *)__pyx_v_result));
__pyx_r = __pyx_v_result;
goto __pyx_L0;
__pyx_r = ((struct __pyx_array_obj *)Py_None); __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_result);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_name = 0;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__name,0};
PyObject* values[1] = {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 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__name)) != 0)) kw_args--;
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_filename = __pyx_f[2]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
goto __pyx_L5_argtuple_error;
} else {
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
}
__pyx_v_name = values[0];
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_MemviewEnum_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":277
* cdef class Enum(object):
* cdef object name
* def __init__(self, name): # <<<<<<<<<<<<<<
* self.name = name
* def __repr__(self):
*/
static int __pyx_MemviewEnum_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__init__", 0);
/* "View.MemoryView":278
* cdef object name
* def __init__(self, name):
* self.name = name # <<<<<<<<<<<<<<
* def __repr__(self):
* return self.name
*/
__Pyx_INCREF(__pyx_v_name);
__Pyx_GIVEREF(__pyx_v_name);
__Pyx_GOTREF(__pyx_v_self->name);
__Pyx_DECREF(__pyx_v_self->name);
__pyx_v_self->name = __pyx_v_name;
__pyx_r = 0;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
__pyx_r = __pyx_MemviewEnum_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":279
* def __init__(self, name):
* self.name = name
* def __repr__(self): # <<<<<<<<<<<<<<
* return self.name
*
*/
static PyObject *__pyx_MemviewEnum_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__repr__", 0);
/* "View.MemoryView":280
* self.name = name
* def __repr__(self):
* return self.name # <<<<<<<<<<<<<<
*
* cdef generic = Enum("")
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->name);
__pyx_r = __pyx_v_self->name;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":294
*
* @cname('__pyx_align_pointer')
* cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
* "Align pointer memory on a given boundary"
* cdef Py_intptr_t aligned_p = memory
*/
static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
Py_intptr_t __pyx_v_aligned_p;
size_t __pyx_v_offset;
void *__pyx_r;
int __pyx_t_1;
/* "View.MemoryView":296
* cdef void *align_pointer(void *memory, size_t alignment) nogil:
* "Align pointer memory on a given boundary"
* cdef Py_intptr_t aligned_p = memory # <<<<<<<<<<<<<<
* cdef size_t offset
*
*/
__pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
/* "View.MemoryView":300
*
* with cython.cdivision(True):
* offset = aligned_p % alignment # <<<<<<<<<<<<<<
*
* if offset > 0:
*/
__pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
/* "View.MemoryView":302
* offset = aligned_p % alignment
*
* if offset > 0: # <<<<<<<<<<<<<<
* aligned_p += alignment - offset
*
*/
__pyx_t_1 = (__pyx_v_offset > 0);
if (__pyx_t_1) {
/* "View.MemoryView":303
*
* if offset > 0:
* aligned_p += alignment - offset # <<<<<<<<<<<<<<
*
* return aligned_p
*/
__pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":305
* aligned_p += alignment - offset
*
* return aligned_p # <<<<<<<<<<<<<<
*
* @cname('__pyx_memoryview')
*/
__pyx_r = ((void *)__pyx_v_aligned_p);
goto __pyx_L0;
__pyx_r = 0;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
PyObject *__pyx_v_obj = 0;
int __pyx_v_flags;
int __pyx_v_dtype_is_object;
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__obj,&__pyx_n_s__flags,&__pyx_n_s__dtype_is_object,0};
PyObject* values[3] = {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 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
case 0: break;
default: goto __pyx_L5_argtuple_error;
}
kw_args = PyDict_Size(__pyx_kwds);
switch (pos_args) {
case 0:
if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__obj)) != 0)) kw_args--;
else goto __pyx_L5_argtuple_error;
case 1:
if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flags)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
case 2:
if (kw_args > 0) {
PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtype_is_object);
if (value) { values[2] = value; kw_args--; }
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
}
} else {
switch (PyTuple_GET_SIZE(__pyx_args)) {
case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
break;
default: goto __pyx_L5_argtuple_error;
}
}
__pyx_v_obj = values[0];
__pyx_v_flags = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
} else {
/* "View.MemoryView":323
* cdef __Pyx_TypeInfo *typeinfo
*
* def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
* self.obj = obj
* self.flags = flags
*/
__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_filename = __pyx_f[2]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__pyx_L3_error:;
__Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return -1;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_memoryview_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static int __pyx_memoryview_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__cinit__", 0);
/* "View.MemoryView":324
*
* def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
* self.obj = obj # <<<<<<<<<<<<<<
* self.flags = flags
* if type(self) is memoryview or obj is not None:
*/
__Pyx_INCREF(__pyx_v_obj);
__Pyx_GIVEREF(__pyx_v_obj);
__Pyx_GOTREF(__pyx_v_self->obj);
__Pyx_DECREF(__pyx_v_self->obj);
__pyx_v_self->obj = __pyx_v_obj;
/* "View.MemoryView":325
* def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
* self.obj = obj
* self.flags = flags # <<<<<<<<<<<<<<
* if type(self) is memoryview or obj is not None:
* __Pyx_GetBuffer(obj, &self.view, flags)
*/
__pyx_v_self->flags = __pyx_v_flags;
/* "View.MemoryView":326
* self.obj = obj
* 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_t_1 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)((PyObject *)__pyx_memoryview_type)));
if (!__pyx_t_1) {
__pyx_t_2 = (__pyx_v_obj != Py_None);
__pyx_t_3 = __pyx_t_2;
} else {
__pyx_t_3 = __pyx_t_1;
}
if (__pyx_t_3) {
/* "View.MemoryView":327
* 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 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "View.MemoryView":328
* 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
* Py_INCREF(Py_None)
*/
__pyx_t_3 = (((PyObject *)__pyx_v_self->view.obj) == NULL);
if (__pyx_t_3) {
/* "View.MemoryView":329
* __Pyx_GetBuffer(obj, &self.view, flags)
* if self.view.obj == NULL:
* (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<<
* Py_INCREF(Py_None)
*
*/
((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
/* "View.MemoryView":330
* if self.view.obj == NULL:
* (<__pyx_buffer *> &self.view).obj = Py_None
* Py_INCREF(Py_None) # <<<<<<<<<<<<<<
*
* self.lock = PyThread_allocate_lock()
*/
Py_INCREF(Py_None);
goto __pyx_L4;
}
__pyx_L4:;
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":332
* Py_INCREF(Py_None)
*
* self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<<
* if self.lock == NULL:
* raise MemoryError
*/
__pyx_v_self->lock = PyThread_allocate_lock();
/* "View.MemoryView":333
*
* self.lock = PyThread_allocate_lock()
* if self.lock == NULL: # <<<<<<<<<<<<<<
* raise MemoryError
*
*/
__pyx_t_3 = (__pyx_v_self->lock == NULL);
if (__pyx_t_3) {
/* "View.MemoryView":334
* self.lock = PyThread_allocate_lock()
* if self.lock == NULL:
* raise MemoryError # <<<<<<<<<<<<<<
*
* if flags & PyBUF_FORMAT:
*/
PyErr_NoMemory(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L5;
}
__pyx_L5:;
/* "View.MemoryView":336
* raise MemoryError
*
* if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
* self.dtype_is_object = self.view.format == b'O'
* else:
*/
__pyx_t_4 = (__pyx_v_flags & PyBUF_FORMAT);
if (__pyx_t_4) {
/* "View.MemoryView":337
*
* if flags & PyBUF_FORMAT:
* self.dtype_is_object = self.view.format == b'O' # <<<<<<<<<<<<<<
* else:
* self.dtype_is_object = dtype_is_object
*/
__pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_n_b__O), Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
__pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_v_self->dtype_is_object = __pyx_t_3;
goto __pyx_L6;
}
/*else*/ {
/* "View.MemoryView":339
* self.dtype_is_object = self.view.format == b'O'
* else:
* self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<<
*
* self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
*/
__pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
}
__pyx_L6:;
/* "View.MemoryView":341
* self.dtype_is_object = dtype_is_object
*
* self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<<
* &self.acquisition_count[0], sizeof(__pyx_atomic_int))
* self.typeinfo = NULL
*/
__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":343
* self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
* &self.acquisition_count[0], sizeof(__pyx_atomic_int))
* self.typeinfo = NULL # <<<<<<<<<<<<<<
*
* def __dealloc__(memoryview self):
*/
__pyx_v_self->typeinfo = NULL;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_memoryview_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
}
/* "View.MemoryView":345
* self.typeinfo = NULL
*
* def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
* if self.obj is not None:
* __Pyx_ReleaseBuffer(&self.view)
*/
static void __pyx_memoryview_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__dealloc__", 0);
/* "View.MemoryView":346
*
* def __dealloc__(memoryview self):
* if self.obj is not None: # <<<<<<<<<<<<<<
* __Pyx_ReleaseBuffer(&self.view)
*
*/
__pyx_t_1 = (__pyx_v_self->obj != Py_None);
if (__pyx_t_1) {
/* "View.MemoryView":347
* def __dealloc__(memoryview self):
* if self.obj is not None:
* __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<<
*
* if self.lock != NULL:
*/
__Pyx_ReleaseBuffer((&__pyx_v_self->view));
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":349
* __Pyx_ReleaseBuffer(&self.view)
*
* if self.lock != NULL: # <<<<<<<<<<<<<<
* PyThread_free_lock(self.lock)
*
*/
__pyx_t_1 = (__pyx_v_self->lock != NULL);
if (__pyx_t_1) {
/* "View.MemoryView":350
*
* if self.lock != NULL:
* PyThread_free_lock(self.lock) # <<<<<<<<<<<<<<
*
* cdef char *get_item_pointer(memoryview self, object index) except NULL:
*/
PyThread_free_lock(__pyx_v_self->lock);
goto __pyx_L4;
}
__pyx_L4:;
__Pyx_RefNannyFinishContext();
}
/* "View.MemoryView":352
* PyThread_free_lock(self.lock)
*
* cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
* cdef Py_ssize_t dim
* cdef char *itemp = self.view.buf
*/
static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
Py_ssize_t __pyx_v_dim;
char *__pyx_v_itemp;
PyObject *__pyx_v_idx = NULL;
char *__pyx_r;
__Pyx_RefNannyDeclarations
Py_ssize_t __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
Py_ssize_t __pyx_t_3;
PyObject *(*__pyx_t_4)(PyObject *);
PyObject *__pyx_t_5 = NULL;
Py_ssize_t __pyx_t_6;
char *__pyx_t_7;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("get_item_pointer", 0);
/* "View.MemoryView":354
* cdef char *get_item_pointer(memoryview self, object index) except NULL:
* cdef Py_ssize_t dim
* cdef char *itemp = self.view.buf # <<<<<<<<<<<<<<
*
* for dim, idx in enumerate(index):
*/
__pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
/* "View.MemoryView":356
* cdef char *itemp = self.view.buf
*
* for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
* itemp = pybuffer_index(&self.view, itemp, idx, dim)
*
*/
__pyx_t_1 = 0;
if (PyList_CheckExact(__pyx_v_index) || PyTuple_CheckExact(__pyx_v_index)) {
__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_filename = __pyx_f[2]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
}
for (;;) {
if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__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_filename = __pyx_f[2]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__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_filename = __pyx_f[2]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_5 = __pyx_t_4(__pyx_t_2);
if (unlikely(!__pyx_t_5)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_5);
}
__Pyx_XDECREF(__pyx_v_idx);
__pyx_v_idx = __pyx_t_5;
__pyx_t_5 = 0;
__pyx_v_dim = __pyx_t_1;
__pyx_t_1 = (__pyx_t_1 + 1);
/* "View.MemoryView":357
*
* 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_filename = __pyx_f[2]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __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 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_itemp = __pyx_t_7;
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "View.MemoryView":359
* itemp = pybuffer_index(&self.view, itemp, idx, dim)
*
* return itemp # <<<<<<<<<<<<<<
*
*
*/
__pyx_r = __pyx_v_itemp;
goto __pyx_L0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_idx);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":362
*
*
* def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
* if index is Ellipsis:
* return self
*/
static PyObject *__pyx_memoryview_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
PyObject *__pyx_v_have_slices = NULL;
PyObject *__pyx_v_indices = NULL;
char *__pyx_v_itemp;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *(*__pyx_t_6)(PyObject *);
char *__pyx_t_7;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__getitem__", 0);
/* "View.MemoryView":363
*
* def __getitem__(memoryview self, object index):
* if index is Ellipsis: # <<<<<<<<<<<<<<
* return self
*
*/
__pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
if (__pyx_t_1) {
/* "View.MemoryView":364
* def __getitem__(memoryview self, object index):
* if index is Ellipsis:
* return self # <<<<<<<<<<<<<<
*
* have_slices, indices = _unellipsify(index, self.view.ndim)
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_self));
__pyx_r = ((PyObject *)__pyx_v_self);
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":366
* return self
*
* have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
*
* cdef char *itemp
*/
__pyx_t_2 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (likely(PyTuple_CheckExact(__pyx_t_2))) {
PyObject* sequence = __pyx_t_2;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
__Pyx_INCREF(__pyx_t_3);
__Pyx_INCREF(__pyx_t_4);
#else
__pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
} else if (1) {
__Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
} else
{
Py_ssize_t index = -1;
__pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext;
index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L4_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed;
__Pyx_GOTREF(__pyx_t_4);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_6 = NULL;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
goto __pyx_L5_unpacking_done;
__pyx_L4_unpacking_failed:;
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_t_6 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L5_unpacking_done:;
}
__pyx_v_have_slices = __pyx_t_3;
__pyx_t_3 = 0;
__pyx_v_indices = __pyx_t_4;
__pyx_t_4 = 0;
/* "View.MemoryView":369
*
* cdef char *itemp
* if have_slices: # <<<<<<<<<<<<<<
* return memview_slice(self, indices)
* else:
*/
__pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_1) {
/* "View.MemoryView":370
* cdef char *itemp
* if have_slices:
* return memview_slice(self, indices) # <<<<<<<<<<<<<<
* else:
* itemp = self.get_item_pointer(indices)
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L6;
}
/*else*/ {
/* "View.MemoryView":372
* return memview_slice(self, indices)
* else:
* itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<<
* return self.convert_item_to_object(itemp)
*
*/
__pyx_t_7 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_7 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_itemp = __pyx_t_7;
/* "View.MemoryView":373
* else:
* itemp = self.get_item_pointer(indices)
* return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<<
*
* def __setitem__(memoryview self, object index, object value):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
}
__pyx_L6:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_have_slices);
__Pyx_XDECREF(__pyx_v_indices);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":375
* return self.convert_item_to_object(itemp)
*
* def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
* have_slices, index = _unellipsify(index, self.view.ndim)
*
*/
static int __pyx_memoryview_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
PyObject *__pyx_v_have_slices = NULL;
PyObject *__pyx_v_obj = NULL;
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *(*__pyx_t_5)(PyObject *);
int __pyx_t_6;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__setitem__", 0);
__Pyx_INCREF(__pyx_v_index);
/* "View.MemoryView":376
*
* def __setitem__(memoryview self, object index, object value):
* have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
*
* if have_slices:
*/
__pyx_t_1 = ((PyObject *)_unellipsify(__pyx_v_index, __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (likely(PyTuple_CheckExact(__pyx_t_1))) {
PyObject* sequence = __pyx_t_1;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
Py_ssize_t size = PySequence_Size(sequence);
#endif
if (unlikely(size != 2)) {
if (size > 2) __Pyx_RaiseTooManyValuesError(2);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
__pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
__Pyx_INCREF(__pyx_t_2);
__Pyx_INCREF(__pyx_t_3);
#else
__pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
} else if (1) {
__Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
} else
{
Py_ssize_t index = -1;
__pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext;
index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
__Pyx_GOTREF(__pyx_t_2);
index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
__Pyx_GOTREF(__pyx_t_3);
if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_5 = NULL;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L4_unpacking_done;
__pyx_L3_unpacking_failed:;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L4_unpacking_done:;
}
__pyx_v_have_slices = __pyx_t_2;
__pyx_t_2 = 0;
__Pyx_DECREF(__pyx_v_index);
__pyx_v_index = __pyx_t_3;
__pyx_t_3 = 0;
/* "View.MemoryView":378
* have_slices, index = _unellipsify(index, self.view.ndim)
*
* if have_slices: # <<<<<<<<<<<<<<
* obj = self.is_slice(value)
* if obj:
*/
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_6) {
/* "View.MemoryView":379
*
* if have_slices:
* obj = self.is_slice(value) # <<<<<<<<<<<<<<
* if obj:
* self.setitem_slice_assignment(self[index], obj)
*/
__pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_obj = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":380
* if have_slices:
* obj = self.is_slice(value)
* if obj: # <<<<<<<<<<<<<<
* self.setitem_slice_assignment(self[index], obj)
* else:
*/
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_6) {
/* "View.MemoryView":381
* 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_1 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (!__pyx_t_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
goto __pyx_L6;
}
/*else*/ {
/* "View.MemoryView":383
* self.setitem_slice_assignment(self[index], obj)
* else:
* self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<<
* else:
* self.setitem_indexed(index, value)
*/
__pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__pyx_L6:;
goto __pyx_L5;
}
/*else*/ {
/* "View.MemoryView":385
* self.setitem_slice_assign_scalar(self[index], value)
* else:
* self.setitem_indexed(index, value) # <<<<<<<<<<<<<<
*
* cdef is_slice(self, obj):
*/
__pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
}
__pyx_L5:;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = -1;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_have_slices);
__Pyx_XDECREF(__pyx_v_obj);
__Pyx_XDECREF(__pyx_v_index);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":387
* self.setitem_indexed(index, value)
*
* cdef is_slice(self, obj): # <<<<<<<<<<<<<<
* if not isinstance(obj, memoryview):
* try:
*/
static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
int __pyx_t_9;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("is_slice", 0);
__Pyx_INCREF(__pyx_v_obj);
/* "View.MemoryView":388
*
* cdef is_slice(self, obj):
* if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
* try:
* obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
*/
__pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_3 = (!__pyx_t_2);
if (__pyx_t_3) {
/* "View.MemoryView":389
* cdef is_slice(self, obj):
* if not isinstance(obj, memoryview):
* try: # <<<<<<<<<<<<<<
* obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
* self.dtype_is_object)
*/
{
__Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
__Pyx_XGOTREF(__pyx_t_4);
__Pyx_XGOTREF(__pyx_t_5);
__Pyx_XGOTREF(__pyx_t_6);
/*try:*/ {
/* "View.MemoryView":390
* if not isinstance(obj, memoryview):
* try:
* obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
* self.dtype_is_object)
* except TypeError:
*/
__pyx_t_1 = PyInt_FromLong((__pyx_v_self->flags | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_1);
/* "View.MemoryView":391
* try:
* obj = memoryview(obj, self.flags|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_filename = __pyx_f[2]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_INCREF(__pyx_v_obj);
PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
__Pyx_GIVEREF(__pyx_v_obj);
PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
__Pyx_GIVEREF(__pyx_t_7);
__pyx_t_1 = 0;
__pyx_t_7 = 0;
__pyx_t_7 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_v_obj);
__pyx_v_obj = __pyx_t_7;
__pyx_t_7 = 0;
}
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
goto __pyx_L11_try_end;
__pyx_L4_error:;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
/* "View.MemoryView":392
* obj = memoryview(obj, self.flags|PyBUF_ANY_CONTIGUOUS,
* self.dtype_is_object)
* except TypeError: # <<<<<<<<<<<<<<
* return None
*
*/
__pyx_t_9 = 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_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_GOTREF(__pyx_t_8);
__Pyx_GOTREF(__pyx_t_1);
/* "View.MemoryView":393
* self.dtype_is_object)
* except TypeError:
* return None # <<<<<<<<<<<<<<
*
* return obj
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(Py_None);
__pyx_r = Py_None;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L7_except_return;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L5_exception_handled;
}
__pyx_L6_except_error:;
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
goto __pyx_L1_error;
__pyx_L7_except_return:;
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
goto __pyx_L0;
__pyx_L5_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_XGIVEREF(__pyx_t_5);
__Pyx_XGIVEREF(__pyx_t_6);
__Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
__pyx_L11_try_end:;
}
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":395
* return None
*
* return obj # <<<<<<<<<<<<<<
*
* cdef setitem_slice_assignment(self, dst, src):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_obj);
__pyx_r = __pyx_v_obj;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_obj);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":397
* return obj
*
* cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
* cdef __Pyx_memviewslice dst_slice
* cdef __Pyx_memviewslice src_slice
*/
static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
__Pyx_memviewslice __pyx_v_dst_slice;
__Pyx_memviewslice __pyx_v_src_slice;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_t_4;
int __pyx_t_5;
int __pyx_t_6;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
/* "View.MemoryView":401
* 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_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = __pyx_v_src;
__Pyx_INCREF(__pyx_t_1);
/* "View.MemoryView":402
*
* 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_filename = __pyx_f[2]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_2 = __pyx_v_dst;
__Pyx_INCREF(__pyx_t_2);
/* "View.MemoryView":403
* 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_3 = PyObject_GetAttr(__pyx_v_src, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_GetAttr(__pyx_v_dst, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_1), (&__pyx_v_src_slice))[0]), (__pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_t_2), (&__pyx_v_dst_slice))[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 401; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":405
* src.ndim, dst.ndim, self.dtype_is_object)
*
* cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
* cdef int array[128]
* cdef void *tmp = NULL
*/
static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
int __pyx_v_array[128];
void *__pyx_v_tmp;
void *__pyx_v_item;
__Pyx_memviewslice __pyx_v_tmp_slice;
__Pyx_memviewslice *__pyx_v_dst_slice;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
PyObject *__pyx_t_7 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
/* "View.MemoryView":407
* cdef setitem_slice_assign_scalar(self, memoryview dst, value):
* cdef int array[128]
* cdef void *tmp = NULL # <<<<<<<<<<<<<<
* cdef void *item
*
*/
__pyx_v_tmp = NULL;
/* "View.MemoryView":411
*
* cdef __Pyx_memviewslice tmp_slice, *dst_slice
* dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<<
*
* if self.view.itemsize > sizeof(array):
*/
__pyx_v_dst_slice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));
/* "View.MemoryView":413
* dst_slice = get_slice_from_memview(dst, &tmp_slice)
*
* if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
* tmp = malloc(self.view.itemsize)
* if tmp == NULL:
*/
__pyx_t_1 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array)));
if (__pyx_t_1) {
/* "View.MemoryView":414
*
* if self.view.itemsize > sizeof(array):
* tmp = malloc(self.view.itemsize) # <<<<<<<<<<<<<<
* if tmp == NULL:
* raise MemoryError
*/
__pyx_v_tmp = malloc(__pyx_v_self->view.itemsize);
/* "View.MemoryView":415
* if self.view.itemsize > sizeof(array):
* tmp = malloc(self.view.itemsize)
* if tmp == NULL: # <<<<<<<<<<<<<<
* raise MemoryError
* item = tmp
*/
__pyx_t_1 = (__pyx_v_tmp == NULL);
if (__pyx_t_1) {
/* "View.MemoryView":416
* tmp = malloc(self.view.itemsize)
* if tmp == NULL:
* raise MemoryError # <<<<<<<<<<<<<<
* item = tmp
* else:
*/
PyErr_NoMemory(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L4;
}
__pyx_L4:;
/* "View.MemoryView":417
* if tmp == NULL:
* raise MemoryError
* item = tmp # <<<<<<<<<<<<<<
* else:
* item = array
*/
__pyx_v_item = __pyx_v_tmp;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":419
* item = tmp
* else:
* item = array # <<<<<<<<<<<<<<
*
* if self.dtype_is_object:
*/
__pyx_v_item = ((void *)__pyx_v_array);
}
__pyx_L3:;
/* "View.MemoryView":421
* item = array
*
* if self.dtype_is_object: # <<<<<<<<<<<<<<
* ( item)[0] = value
* else:
*/
if (__pyx_v_self->dtype_is_object) {
/* "View.MemoryView":422
*
* if self.dtype_is_object:
* ( item)[0] = value # <<<<<<<<<<<<<<
* else:
* try:
*/
(((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
goto __pyx_L5;
}
/*else*/ {
/* "View.MemoryView":424
* ( item)[0] = value
* else:
* try: # <<<<<<<<<<<<<<
* self.assign_item_from_object( item, value)
* except:
*/
{
__Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_4);
/*try:*/ {
/* "View.MemoryView":425
* else:
* try:
* self.assign_item_from_object( item, value) # <<<<<<<<<<<<<<
* except:
* free(tmp)
*/
__pyx_t_5 = ((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_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L13_try_end;
__pyx_L6_error:;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "View.MemoryView":426
* try:
* self.assign_item_from_object( item, value)
* except: # <<<<<<<<<<<<<<
* free(tmp)
* raise
*/
/*except:*/ {
__Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_6);
__Pyx_GOTREF(__pyx_t_7);
/* "View.MemoryView":427
* self.assign_item_from_object( item, value)
* except:
* free(tmp) # <<<<<<<<<<<<<<
* raise
*
*/
free(__pyx_v_tmp);
/* "View.MemoryView":428
* except:
* free(tmp)
* raise # <<<<<<<<<<<<<<
*
*
*/
__Pyx_GIVEREF(__pyx_t_5);
__Pyx_GIVEREF(__pyx_t_6);
__Pyx_GIVEREF(__pyx_t_7);
__Pyx_ErrRestore(__pyx_t_5, __pyx_t_6, __pyx_t_7);
__pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L7_exception_handled;
}
__pyx_L8_except_error:;
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
goto __pyx_L1_error;
__pyx_L7_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
__pyx_L13_try_end:;
}
}
__pyx_L5:;
/* "View.MemoryView":432
*
*
* 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,
*/
__pyx_t_1 = (__pyx_v_self->view.suboffsets != NULL);
if (__pyx_t_1) {
/* "View.MemoryView":433
*
* 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_7 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
goto __pyx_L16;
}
__pyx_L16:;
/* "View.MemoryView":435
* 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) # <<<<<<<<<<<<<<
* free(tmp)
*
*/
__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":436
* slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
* item, self.dtype_is_object)
* free(tmp) # <<<<<<<<<<<<<<
*
* cdef setitem_indexed(self, index, value):
*/
free(__pyx_v_tmp);
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":438
* free(tmp)
*
* cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
* cdef char *itemp = self.get_item_pointer(index)
* self.assign_item_from_object(itemp, value)
*/
static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
char *__pyx_v_itemp;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
char *__pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("setitem_indexed", 0);
/* "View.MemoryView":439
*
* 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 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_itemp = __pyx_t_1;
/* "View.MemoryView":440
* 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_filename = __pyx_f[2]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":442
* self.assign_item_from_object(itemp, value)
*
* cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
* """Only used if instantiated manually by the user, or if Cython doesn't
* know how to convert the type"""
*/
static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
PyObject *__pyx_v_struct = NULL;
PyObject *__pyx_v_bytesitem = 0;
PyObject *__pyx_v_result = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
PyObject *__pyx_t_6 = NULL;
size_t __pyx_t_7;
int __pyx_t_8;
int __pyx_t_9;
PyObject *__pyx_t_10 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("convert_item_to_object", 0);
/* "View.MemoryView":445
* """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(((PyObject *)__pyx_n_s__struct), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_struct = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":448
* cdef bytes bytesitem
*
* bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<<
* try:
* result = struct.unpack(self.view.format, bytesitem)
*/
__pyx_t_1 = PyBytes_FromStringAndSize(((const char*)__pyx_v_itemp) + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__pyx_v_bytesitem = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":449
*
* bytesitem = itemp[:self.view.itemsize]
* try: # <<<<<<<<<<<<<<
* result = struct.unpack(self.view.format, bytesitem)
* except struct.error:
*/
{
__Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
__Pyx_XGOTREF(__pyx_t_2);
__Pyx_XGOTREF(__pyx_t_3);
__Pyx_XGOTREF(__pyx_t_4);
/*try:*/ {
/* "View.MemoryView":450
* 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_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__unpack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_6);
PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_5));
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(((PyObject *)__pyx_v_bytesitem));
PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_bytesitem));
__Pyx_GIVEREF(((PyObject *)__pyx_v_bytesitem));
__pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
__pyx_v_result = __pyx_t_5;
__pyx_t_5 = 0;
}
/*else:*/ {
/* "View.MemoryView":454
* raise ValueError("Unable to convert item to object")
* else:
* if len(self.view.format) == 1: # <<<<<<<<<<<<<<
* return result[0]
* return result
*/
__pyx_t_7 = strlen(__pyx_v_self->view.format);
__pyx_t_8 = (__pyx_t_7 == 1);
if (__pyx_t_8) {
/* "View.MemoryView":455
* else:
* if len(self.view.format) == 1:
* return result[0] # <<<<<<<<<<<<<<
* return result
*
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_5 = __Pyx_GetItemInt(__pyx_v_result, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_r = __pyx_t_5;
__pyx_t_5 = 0;
goto __pyx_L6_except_return;
goto __pyx_L11;
}
__pyx_L11:;
/* "View.MemoryView":456
* if len(self.view.format) == 1:
* return result[0]
* return result # <<<<<<<<<<<<<<
*
* cdef assign_item_from_object(self, char *itemp, object value):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_result);
__pyx_r = __pyx_v_result;
goto __pyx_L6_except_return;
}
__Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
goto __pyx_L10_try_end;
__pyx_L3_error:;
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
/* "View.MemoryView":451
* try:
* result = struct.unpack(self.view.format, bytesitem)
* except struct.error: # <<<<<<<<<<<<<<
* raise ValueError("Unable to convert item to object")
* else:
*/
__pyx_t_5 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__error); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_9 = PyErr_ExceptionMatches(__pyx_t_5);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
if (__pyx_t_9) {
__Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_GOTREF(__pyx_t_6);
__Pyx_GOTREF(__pyx_t_1);
/* "View.MemoryView":452
* 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_10 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_Raise(__pyx_t_10, 0, 0, 0);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
goto __pyx_L4_exception_handled;
}
__pyx_L5_except_error:;
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
goto __pyx_L1_error;
__pyx_L6_except_return:;
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
goto __pyx_L0;
__pyx_L4_exception_handled:;
__Pyx_XGIVEREF(__pyx_t_2);
__Pyx_XGIVEREF(__pyx_t_3);
__Pyx_XGIVEREF(__pyx_t_4);
__Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
__pyx_L10_try_end:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_struct);
__Pyx_XDECREF(__pyx_v_bytesitem);
__Pyx_XDECREF(__pyx_v_result);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":458
* return result
*
* cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
* """Only used if instantiated manually by the user, or if Cython doesn't
* know how to convert the type"""
*/
static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
PyObject *__pyx_v_struct = NULL;
char __pyx_v_c;
PyObject *__pyx_v_bytesvalue = 0;
Py_ssize_t __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
PyObject *__pyx_t_4 = NULL;
PyObject *__pyx_t_5 = NULL;
Py_ssize_t __pyx_t_6;
PyObject *__pyx_t_7 = NULL;
char *__pyx_t_8;
char *__pyx_t_9;
char *__pyx_t_10;
char *__pyx_t_11;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("assign_item_from_object", 0);
/* "View.MemoryView":461
* """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(((PyObject *)__pyx_n_s__struct), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 461; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_struct = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":466
* cdef Py_ssize_t i
*
* if isinstance(value, tuple): # <<<<<<<<<<<<<<
* bytesvalue = struct.pack(self.view.format, *value)
* else:
*/
__pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_value, __pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "View.MemoryView":467
*
* if isinstance(value, tuple):
* bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<<
* else:
* bytesvalue = struct.pack(self.view.format, value)
*/
__pyx_t_1 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_3 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
__pyx_t_3 = PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_bytesvalue = ((PyObject*)__pyx_t_3);
__pyx_t_3 = 0;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":469
* bytesvalue = struct.pack(self.view.format, *value)
* else:
* bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<<
*
* for i, c in enumerate(bytesvalue):
*/
__pyx_t_3 = PyObject_GetAttr(__pyx_v_struct, __pyx_n_s__pack); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_5));
__Pyx_GIVEREF(((PyObject *)__pyx_t_5));
__Pyx_INCREF(__pyx_v_value);
PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_value);
__Pyx_GIVEREF(__pyx_v_value);
__pyx_t_5 = 0;
__pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
if (!(likely(PyBytes_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 469; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_bytesvalue = ((PyObject*)__pyx_t_5);
__pyx_t_5 = 0;
}
__pyx_L3:;
/* "View.MemoryView":471
* bytesvalue = struct.pack(self.view.format, value)
*
* for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
* itemp[i] = c
*
*/
__pyx_t_6 = 0;
if (unlikely(((PyObject *)__pyx_v_bytesvalue) == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__Pyx_INCREF(((PyObject *)__pyx_v_bytesvalue));
__pyx_t_7 = __pyx_v_bytesvalue;
__pyx_t_9 = PyBytes_AS_STRING(__pyx_t_7);
__pyx_t_10 = (__pyx_t_9 + PyBytes_GET_SIZE(__pyx_t_7));
for (__pyx_t_11 = __pyx_t_9; __pyx_t_11 < __pyx_t_10; __pyx_t_11++) {
__pyx_t_8 = __pyx_t_11;
__pyx_v_c = (__pyx_t_8[0]);
/* "View.MemoryView":472
*
* for i, c in enumerate(bytesvalue):
* itemp[i] = c # <<<<<<<<<<<<<<
*
* @cname('getbuffer')
*/
__pyx_v_i = __pyx_t_6;
/* "View.MemoryView":471
* bytesvalue = struct.pack(self.view.format, value)
*
* for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
* itemp[i] = c
*
*/
__pyx_t_6 = (__pyx_t_6 + 1);
/* "View.MemoryView":472
*
* for i, c in enumerate(bytesvalue):
* itemp[i] = c # <<<<<<<<<<<<<<
*
* @cname('getbuffer')
*/
(__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
}
__Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(((PyObject *)__pyx_t_7));
__Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_struct);
__Pyx_XDECREF(__pyx_v_bytesvalue);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":475
*
* @cname('getbuffer')
* def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
* if flags & PyBUF_STRIDES:
* info.shape = self.view.shape
*/
static int __pyx_memoryview_getbuffer_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__getbuffer__", 0);
if (__pyx_v_info != NULL) {
__pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
__Pyx_GIVEREF(__pyx_v_info->obj);
}
/* "View.MemoryView":476
* @cname('getbuffer')
* def __getbuffer__(self, Py_buffer *info, int flags):
* if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
* info.shape = self.view.shape
* else:
*/
__pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
if (__pyx_t_1) {
/* "View.MemoryView":477
* def __getbuffer__(self, Py_buffer *info, int flags):
* if flags & PyBUF_STRIDES:
* info.shape = self.view.shape # <<<<<<<<<<<<<<
* else:
* info.shape = NULL
*/
__pyx_v_info->shape = __pyx_v_self->view.shape;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":479
* info.shape = self.view.shape
* else:
* info.shape = NULL # <<<<<<<<<<<<<<
*
* if flags & PyBUF_STRIDES:
*/
__pyx_v_info->shape = NULL;
}
__pyx_L3:;
/* "View.MemoryView":481
* info.shape = NULL
*
* if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
* info.strides = self.view.strides
* else:
*/
__pyx_t_1 = (__pyx_v_flags & PyBUF_STRIDES);
if (__pyx_t_1) {
/* "View.MemoryView":482
*
* if flags & PyBUF_STRIDES:
* info.strides = self.view.strides # <<<<<<<<<<<<<<
* else:
* info.strides = NULL
*/
__pyx_v_info->strides = __pyx_v_self->view.strides;
goto __pyx_L4;
}
/*else*/ {
/* "View.MemoryView":484
* info.strides = self.view.strides
* else:
* info.strides = NULL # <<<<<<<<<<<<<<
*
* if flags & PyBUF_INDIRECT:
*/
__pyx_v_info->strides = NULL;
}
__pyx_L4:;
/* "View.MemoryView":486
* info.strides = NULL
*
* if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
* info.suboffsets = self.view.suboffsets
* else:
*/
__pyx_t_1 = (__pyx_v_flags & PyBUF_INDIRECT);
if (__pyx_t_1) {
/* "View.MemoryView":487
*
* if flags & PyBUF_INDIRECT:
* info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<<
* else:
* info.suboffsets = NULL
*/
__pyx_v_info->suboffsets = __pyx_v_self->view.suboffsets;
goto __pyx_L5;
}
/*else*/ {
/* "View.MemoryView":489
* info.suboffsets = self.view.suboffsets
* else:
* info.suboffsets = NULL # <<<<<<<<<<<<<<
*
* if flags & PyBUF_FORMAT:
*/
__pyx_v_info->suboffsets = NULL;
}
__pyx_L5:;
/* "View.MemoryView":491
* info.suboffsets = NULL
*
* if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
* info.format = self.view.format
* else:
*/
__pyx_t_1 = (__pyx_v_flags & PyBUF_FORMAT);
if (__pyx_t_1) {
/* "View.MemoryView":492
*
* if flags & PyBUF_FORMAT:
* info.format = self.view.format # <<<<<<<<<<<<<<
* else:
* info.format = NULL
*/
__pyx_v_info->format = __pyx_v_self->view.format;
goto __pyx_L6;
}
/*else*/ {
/* "View.MemoryView":494
* info.format = self.view.format
* else:
* info.format = NULL # <<<<<<<<<<<<<<
*
* info.buf = self.view.buf
*/
__pyx_v_info->format = NULL;
}
__pyx_L6:;
/* "View.MemoryView":496
* info.format = NULL
*
* info.buf = self.view.buf # <<<<<<<<<<<<<<
* info.ndim = self.view.ndim
* info.itemsize = self.view.itemsize
*/
__pyx_v_info->buf = __pyx_v_self->view.buf;
/* "View.MemoryView":497
*
* info.buf = self.view.buf
* info.ndim = self.view.ndim # <<<<<<<<<<<<<<
* info.itemsize = self.view.itemsize
* info.len = self.view.len
*/
__pyx_v_info->ndim = __pyx_v_self->view.ndim;
/* "View.MemoryView":498
* info.buf = self.view.buf
* info.ndim = self.view.ndim
* info.itemsize = self.view.itemsize # <<<<<<<<<<<<<<
* info.len = self.view.len
* info.readonly = 0
*/
__pyx_v_info->itemsize = __pyx_v_self->view.itemsize;
/* "View.MemoryView":499
* info.ndim = self.view.ndim
* info.itemsize = self.view.itemsize
* info.len = self.view.len # <<<<<<<<<<<<<<
* info.readonly = 0
* info.obj = self
*/
__pyx_v_info->len = __pyx_v_self->view.len;
/* "View.MemoryView":500
* info.itemsize = self.view.itemsize
* info.len = self.view.len
* info.readonly = 0 # <<<<<<<<<<<<<<
* info.obj = self
*
*/
__pyx_v_info->readonly = 0;
/* "View.MemoryView":501
* info.len = self.view.len
* info.readonly = 0
* info.obj = self # <<<<<<<<<<<<<<
*
* __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
*/
__Pyx_INCREF(((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
__Pyx_GOTREF(__pyx_v_info->obj);
__Pyx_DECREF(__pyx_v_info->obj);
__pyx_v_info->obj = ((PyObject *)__pyx_v_self);
__pyx_r = 0;
if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
__Pyx_GOTREF(Py_None);
__Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
}
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_transpose(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":508
* property T:
* @cname('__pyx_memoryview_transpose')
* def __get__(self): # <<<<<<<<<<<<<<
* cdef _memoryviewslice result = memoryview_copy(self)
* transpose_memslice(&result.from_slice)
*/
static PyObject *__pyx_memoryview_transpose_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":509
* @cname('__pyx_memoryview_transpose')
* def __get__(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_filename = __pyx_f[2]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
__pyx_t_1 = 0;
/* "View.MemoryView":510
* def __get__(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 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "View.MemoryView":511
* cdef _memoryviewslice result = memoryview_copy(self)
* transpose_memslice(&result.from_slice)
* return result # <<<<<<<<<<<<<<
*
* property base:
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_result));
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_result);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview__get__base(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview__get__base_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":515
* property base:
* @cname('__pyx_memoryview__get__base')
* def __get__(self): # <<<<<<<<<<<<<<
* return self.obj
*
*/
static PyObject *__pyx_memoryview__get__base_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":516
* @cname('__pyx_memoryview__get__base')
* def __get__(self):
* return self.obj # <<<<<<<<<<<<<<
*
* property shape:
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->obj);
__pyx_r = __pyx_v_self->obj;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_shape(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":520
* property shape:
* @cname('__pyx_memoryview_get_shape')
* def __get__(self): # <<<<<<<<<<<<<<
* return tuple([self.view.shape[i] for i in xrange(self.view.ndim)])
*
*/
static PyObject *__pyx_memoryview_get_shape_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
int __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":521
* @cname('__pyx_memoryview_get_shape')
* def __get__(self):
* return tuple([self.view.shape[i] for i in xrange(self.view.ndim)]) # <<<<<<<<<<<<<<
*
* property strides:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = __pyx_v_self->view.ndim;
for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
__pyx_v_i = __pyx_t_3;
__pyx_t_4 = PyInt_FromSsize_t((__pyx_v_self->view.shape[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
}
__pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
__pyx_r = ((PyObject *)__pyx_t_4);
__pyx_t_4 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_strides(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_get_strides_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":525
* property strides:
* @cname('__pyx_memoryview_get_strides')
* def __get__(self): # <<<<<<<<<<<<<<
* if self.view.strides == NULL:
*
*/
static PyObject *__pyx_memoryview_get_strides_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
int __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":526
* @cname('__pyx_memoryview_get_strides')
* def __get__(self):
* if self.view.strides == NULL: # <<<<<<<<<<<<<<
*
* raise ValueError("Buffer view does not expose strides")
*/
__pyx_t_1 = (__pyx_v_self->view.strides == NULL);
if (__pyx_t_1) {
/* "View.MemoryView":528
* if self.view.strides == NULL:
*
* raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
*
* return tuple([self.view.strides[i] for i in xrange(self.view.ndim)])
*/
__pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":530
* raise ValueError("Buffer view does not expose strides")
*
* return tuple([self.view.strides[i] for i in xrange(self.view.ndim)]) # <<<<<<<<<<<<<<
*
* property suboffsets:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __pyx_v_self->view.ndim;
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
__pyx_v_i = __pyx_t_4;
__pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.strides[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = ((PyObject *)__pyx_t_5);
__pyx_t_5 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_get_suboffsets(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_suboffsets(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":534
* property suboffsets:
* @cname('__pyx_memoryview_get_suboffsets')
* def __get__(self): # <<<<<<<<<<<<<<
* if self.view.suboffsets == NULL:
* return [-1] * self.view.ndim
*/
static PyObject *__pyx_memoryview_get_suboffsets_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
int __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_t_3;
int __pyx_t_4;
PyObject *__pyx_t_5 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":535
* @cname('__pyx_memoryview_get_suboffsets')
* def __get__(self):
* if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
* return [-1] * self.view.ndim
*
*/
__pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL);
if (__pyx_t_1) {
/* "View.MemoryView":536
* def __get__(self):
* if self.view.suboffsets == NULL:
* return [-1] * self.view.ndim # <<<<<<<<<<<<<<
*
* return tuple([self.view.suboffsets[i] for i in xrange(self.view.ndim)])
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_2 = PyList_New(1 * ((__pyx_v_self->view.ndim<0) ? 0:__pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
{ Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < __pyx_v_self->view.ndim; __pyx_temp++) {
__Pyx_INCREF(__pyx_int_neg_1);
PyList_SET_ITEM(__pyx_t_2, __pyx_temp, __pyx_int_neg_1);
__Pyx_GIVEREF(__pyx_int_neg_1);
}
}
__pyx_r = ((PyObject *)__pyx_t_2);
__pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":538
* return [-1] * self.view.ndim
*
* return tuple([self.view.suboffsets[i] for i in xrange(self.view.ndim)]) # <<<<<<<<<<<<<<
*
* property ndim:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = __pyx_v_self->view.ndim;
for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
__pyx_v_i = __pyx_t_4;
__pyx_t_5 = PyInt_FromSsize_t((__pyx_v_self->view.suboffsets[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
__pyx_t_5 = ((PyObject *)PyList_AsTuple(__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_5));
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = ((PyObject *)__pyx_t_5);
__pyx_t_5 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_ndim(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":542
* property ndim:
* @cname('__pyx_memoryview_get_ndim')
* def __get__(self): # <<<<<<<<<<<<<<
* return self.view.ndim
*
*/
static PyObject *__pyx_memoryview_get_ndim_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":543
* @cname('__pyx_memoryview_get_ndim')
* def __get__(self):
* return self.view.ndim # <<<<<<<<<<<<<<
*
* property itemsize:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyInt_FromLong(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_itemsize(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":547
* property itemsize:
* @cname('__pyx_memoryview_get_itemsize')
* def __get__(self): # <<<<<<<<<<<<<<
* return self.view.itemsize
*
*/
static PyObject *__pyx_memoryview_get_itemsize_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":548
* @cname('__pyx_memoryview_get_itemsize')
* def __get__(self):
* return self.view.itemsize # <<<<<<<<<<<<<<
*
* property nbytes:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_nbytes(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":552
* property nbytes:
* @cname('__pyx_memoryview_get_nbytes')
* def __get__(self): # <<<<<<<<<<<<<<
* return self.size * self.view.itemsize
*
*/
static PyObject *__pyx_memoryview_get_nbytes_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":553
* @cname('__pyx_memoryview_get_nbytes')
* def __get__(self):
* return self.size * self.view.itemsize # <<<<<<<<<<<<<<
*
* property size:
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __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;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview_get_size(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":557
* property size:
* @cname('__pyx_memoryview_get_size')
* def __get__(self): # <<<<<<<<<<<<<<
* if self._size is None:
* result = 1
*/
static PyObject *__pyx_memoryview_get_size_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
PyObject *__pyx_v_result = NULL;
PyObject *__pyx_v_length = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
Py_ssize_t __pyx_t_4;
PyObject *(*__pyx_t_5)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":558
* @cname('__pyx_memoryview_get_size')
* def __get__(self):
* if self._size is None: # <<<<<<<<<<<<<<
* result = 1
*
*/
__pyx_t_1 = (__pyx_v_self->_size == Py_None);
if (__pyx_t_1) {
/* "View.MemoryView":559
* def __get__(self):
* if self._size is None:
* result = 1 # <<<<<<<<<<<<<<
*
* for length in self.shape:
*/
__Pyx_INCREF(__pyx_int_1);
__pyx_v_result = __pyx_int_1;
/* "View.MemoryView":561
* result = 1
*
* for length in self.shape: # <<<<<<<<<<<<<<
* result *= length
*
*/
__pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) {
__pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
} else {
__pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext;
}
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
for (;;) {
if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) {
if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) {
if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_2 = __pyx_t_5(__pyx_t_3);
if (unlikely(!__pyx_t_2)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_2);
}
__Pyx_XDECREF(__pyx_v_length);
__pyx_v_length = __pyx_t_2;
__pyx_t_2 = 0;
/* "View.MemoryView":562
*
* for length in self.shape:
* result *= length # <<<<<<<<<<<<<<
*
* self._size = result
*/
__pyx_t_2 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_v_result);
__pyx_v_result = __pyx_t_2;
__pyx_t_2 = 0;
}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
/* "View.MemoryView":564
* result *= length
*
* self._size = result # <<<<<<<<<<<<<<
*
* return self._size
*/
__Pyx_INCREF(__pyx_v_result);
__Pyx_GIVEREF(__pyx_v_result);
__Pyx_GOTREF(__pyx_v_self->_size);
__Pyx_DECREF(__pyx_v_self->_size);
__pyx_v_self->_size = __pyx_v_result;
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":566
* self._size = result
*
* return self._size # <<<<<<<<<<<<<<
*
* def __len__(self):
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->_size);
__pyx_r = __pyx_v_self->_size;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_result);
__Pyx_XDECREF(__pyx_v_length);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":568
* return self._size
*
* def __len__(self): # <<<<<<<<<<<<<<
* if self.view.ndim >= 1:
* return self.view.shape[0]
*/
static Py_ssize_t __pyx_memoryview_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
Py_ssize_t __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
__Pyx_RefNannySetupContext("__len__", 0);
/* "View.MemoryView":569
*
* def __len__(self):
* if self.view.ndim >= 1: # <<<<<<<<<<<<<<
* return self.view.shape[0]
*
*/
__pyx_t_1 = (__pyx_v_self->view.ndim >= 1);
if (__pyx_t_1) {
/* "View.MemoryView":570
* def __len__(self):
* if self.view.ndim >= 1:
* return self.view.shape[0] # <<<<<<<<<<<<<<
*
* return 0
*/
__pyx_r = (__pyx_v_self->view.shape[0]);
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":572
* return self.view.shape[0]
*
* return 0 # <<<<<<<<<<<<<<
*
* def __repr__(self):
*/
__pyx_r = 0;
goto __pyx_L0;
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":574
* return 0
*
* def __repr__(self): # <<<<<<<<<<<<<<
* return "" % (self.base.__class__.__name__,
* id(self))
*/
static PyObject *__pyx_memoryview_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__repr__", 0);
/* "View.MemoryView":575
*
* def __repr__(self):
* return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
* id(self))
*
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
/* "View.MemoryView":576
* def __repr__(self):
* return "" % (self.base.__class__.__name__,
* id(self)) # <<<<<<<<<<<<<<
*
* def __str__(self):
*/
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_INCREF(((PyObject *)__pyx_v_self));
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_self));
__Pyx_GIVEREF(((PyObject *)__pyx_v_self));
__pyx_t_3 = PyObject_Call(__pyx_builtin_id, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_1 = 0;
__pyx_t_3 = 0;
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_33), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = ((PyObject *)__pyx_t_3);
__pyx_t_3 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":578
* id(self))
*
* def __str__(self): # <<<<<<<<<<<<<<
* return "" % (self.base.__class__.__name__,)
*
*/
static PyObject *__pyx_memoryview_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("__str__", 0);
/* "View.MemoryView":579
*
* def __str__(self):
* return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__base); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s____name__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
__pyx_t_1 = 0;
__pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_34), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
__pyx_r = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":582
*
*
* def is_c_contig(self): # <<<<<<<<<<<<<<
* cdef __Pyx_memviewslice *mslice, tmp
* mslice = get_slice_from_memview(self, &tmp)
*/
static PyObject *__pyx_memoryview_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
__Pyx_memviewslice *__pyx_v_mslice;
__Pyx_memviewslice __pyx_v_tmp;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("is_c_contig", 0);
/* "View.MemoryView":584
* def is_c_contig(self):
* cdef __Pyx_memviewslice *mslice, tmp
* mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
* return slice_is_contig(mslice, 'C', self.view.ndim)
*
*/
__pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
/* "View.MemoryView":585
* cdef __Pyx_memviewslice *mslice, tmp
* mslice = get_slice_from_memview(self, &tmp)
* return slice_is_contig(mslice, 'C', self.view.ndim) # <<<<<<<<<<<<<<
*
* def is_f_contig(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig(__pyx_v_mslice, 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":587
* return slice_is_contig(mslice, 'C', self.view.ndim)
*
* def is_f_contig(self): # <<<<<<<<<<<<<<
* cdef __Pyx_memviewslice *mslice, tmp
* mslice = get_slice_from_memview(self, &tmp)
*/
static PyObject *__pyx_memoryview_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
__Pyx_memviewslice *__pyx_v_mslice;
__Pyx_memviewslice __pyx_v_tmp;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("is_f_contig", 0);
/* "View.MemoryView":589
* def is_f_contig(self):
* cdef __Pyx_memviewslice *mslice, tmp
* mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
* return slice_is_contig(mslice, 'F', self.view.ndim)
*
*/
__pyx_v_mslice = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
/* "View.MemoryView":590
* cdef __Pyx_memviewslice *mslice, tmp
* mslice = get_slice_from_memview(self, &tmp)
* return slice_is_contig(mslice, 'F', self.view.ndim) # <<<<<<<<<<<<<<
*
* def copy(self):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig(__pyx_v_mslice, 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("copy (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":592
* return slice_is_contig(mslice, 'F', self.view.ndim)
*
* def copy(self): # <<<<<<<<<<<<<<
* cdef __Pyx_memviewslice mslice
* cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
*/
static PyObject *__pyx_memoryview_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
__Pyx_memviewslice __pyx_v_mslice;
int __pyx_v_flags;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_memviewslice __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("copy", 0);
/* "View.MemoryView":594
* def copy(self):
* cdef __Pyx_memviewslice mslice
* cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<<
*
* slice_copy(self, &mslice)
*/
__pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
/* "View.MemoryView":596
* cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
*
* slice_copy(self, &mslice) # <<<<<<<<<<<<<<
* mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
* self.view.itemsize,
*/
__pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
/* "View.MemoryView":600
* self.view.itemsize,
* flags|PyBUF_C_CONTIGUOUS,
* self.dtype_is_object) # <<<<<<<<<<<<<<
*
* return memoryview_copy_from_slice(self, &mslice)
*/
__pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), __pyx_k__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_filename = __pyx_f[2]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_mslice = __pyx_t_1;
/* "View.MemoryView":602
* self.dtype_is_object)
*
* return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<<
*
* 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_filename = __pyx_f[2]; __pyx_lineno = 602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
__pyx_r = __pyx_memoryview_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":604
* return memoryview_copy_from_slice(self, &mslice)
*
* def copy_fortran(self): # <<<<<<<<<<<<<<
* cdef __Pyx_memviewslice src, dst
* cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
*/
static PyObject *__pyx_memoryview_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
__Pyx_memviewslice __pyx_v_src;
__Pyx_memviewslice __pyx_v_dst;
int __pyx_v_flags;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_memviewslice __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("copy_fortran", 0);
/* "View.MemoryView":606
* def copy_fortran(self):
* cdef __Pyx_memviewslice src, dst
* cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<<
*
* slice_copy(self, &src)
*/
__pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
/* "View.MemoryView":608
* cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
*
* slice_copy(self, &src) # <<<<<<<<<<<<<<
* dst = slice_copy_contig(&src, "fortran", self.view.ndim,
* self.view.itemsize,
*/
__pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
/* "View.MemoryView":612
* self.view.itemsize,
* flags|PyBUF_F_CONTIGUOUS,
* self.dtype_is_object) # <<<<<<<<<<<<<<
*
* return memoryview_copy_from_slice(self, &dst)
*/
__pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), __pyx_k__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_filename = __pyx_f[2]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_v_dst = __pyx_t_1;
/* "View.MemoryView":614
* self.dtype_is_object)
*
* return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<<
*
*
*/
__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_filename = __pyx_f[2]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":618
*
* @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
*/
static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
struct __pyx_memoryview_obj *__pyx_v_result = 0;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
/* "View.MemoryView":619
* @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 = PyInt_FromLong(__pyx_v_flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_o);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
__Pyx_GIVEREF(__pyx_v_o);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
__Pyx_GIVEREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_1 = 0;
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryview_type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
__pyx_t_2 = 0;
/* "View.MemoryView":620
* 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_v_result->typeinfo = __pyx_v_typeinfo;
/* "View.MemoryView":621
* cdef memoryview result = memoryview(o, flags, dtype_is_object)
* result.typeinfo = typeinfo
* return result # <<<<<<<<<<<<<<
*
* @cname('__pyx_memoryview_check')
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(((PyObject *)__pyx_v_result));
__pyx_r = ((PyObject *)__pyx_v_result);
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_result);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":624
*
* @cname('__pyx_memoryview_check')
* cdef bint memoryview_check(object o): # <<<<<<<<<<<<<<
* return isinstance(o, memoryview)
*
*/
static int __pyx_memoryview_check(PyObject *__pyx_v_o) {
int __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
__Pyx_RefNannySetupContext("memoryview_check", 0);
/* "View.MemoryView":625
* @cname('__pyx_memoryview_check')
* cdef bint memoryview_check(object o):
* return isinstance(o, memoryview) # <<<<<<<<<<<<<<
*
* cdef tuple _unellipsify(object index, int ndim):
*/
__pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryview_type));
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_o, __pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_r = __pyx_t_2;
goto __pyx_L0;
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":627
* return isinstance(o, memoryview)
*
* cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
* """
* Replace all ellipses with full slices and fill incomplete indices with
*/
static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
PyObject *__pyx_v_tup = NULL;
PyObject *__pyx_v_result = NULL;
PyObject *__pyx_v_have_slices = NULL;
int __pyx_v_seen_ellipsis;
CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
PyObject *__pyx_v_item = NULL;
PyObject *__pyx_v_nslices = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
Py_ssize_t __pyx_t_5;
PyObject *(*__pyx_t_6)(PyObject *);
PyObject *__pyx_t_7 = NULL;
PyObject *__pyx_t_8 = NULL;
Py_ssize_t __pyx_t_9;
PyObject *__pyx_t_10 = NULL;
int __pyx_t_11;
int __pyx_t_12;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_unellipsify", 0);
/* "View.MemoryView":632
* full slices.
* """
* if not isinstance(index, tuple): # <<<<<<<<<<<<<<
* tup = (index,)
* else:
*/
__pyx_t_1 = ((PyObject *)((PyObject*)(&PyTuple_Type)));
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __Pyx_TypeCheck(__pyx_v_index, __pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__pyx_t_3 = (!__pyx_t_2);
if (__pyx_t_3) {
/* "View.MemoryView":633
* """
* if not isinstance(index, tuple):
* tup = (index,) # <<<<<<<<<<<<<<
* else:
* tup = index
*/
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__Pyx_INCREF(__pyx_v_index);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_index);
__Pyx_GIVEREF(__pyx_v_index);
__pyx_v_tup = ((PyObject *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":635
* tup = (index,)
* else:
* tup = index # <<<<<<<<<<<<<<
*
* result = []
*/
__Pyx_INCREF(__pyx_v_index);
__pyx_v_tup = __pyx_v_index;
}
__pyx_L3:;
/* "View.MemoryView":637
* tup = index
*
* result = [] # <<<<<<<<<<<<<<
* have_slices = False
* seen_ellipsis = False
*/
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_result = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":638
*
* result = []
* have_slices = False # <<<<<<<<<<<<<<
* seen_ellipsis = False
* for idx, item in enumerate(tup):
*/
__pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_have_slices = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":639
* result = []
* have_slices = False
* seen_ellipsis = False # <<<<<<<<<<<<<<
* for idx, item in enumerate(tup):
* if item is Ellipsis:
*/
__pyx_v_seen_ellipsis = 0;
/* "View.MemoryView":640
* have_slices = False
* seen_ellipsis = False
* for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
* if item is Ellipsis:
* if not seen_ellipsis:
*/
__Pyx_INCREF(__pyx_int_0);
__pyx_t_1 = __pyx_int_0;
if (PyList_CheckExact(__pyx_v_tup) || PyTuple_CheckExact(__pyx_v_tup)) {
__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_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
}
for (;;) {
if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__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_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__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_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_7 = __pyx_t_6(__pyx_t_4);
if (unlikely(!__pyx_t_7)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_7);
}
__Pyx_XDECREF(__pyx_v_item);
__pyx_v_item = __pyx_t_7;
__pyx_t_7 = 0;
__Pyx_INCREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_v_idx);
__pyx_v_idx = __pyx_t_1;
__pyx_t_7 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__Pyx_DECREF(__pyx_t_1);
__pyx_t_1 = __pyx_t_7;
__pyx_t_7 = 0;
/* "View.MemoryView":641
* seen_ellipsis = False
* for idx, item in enumerate(tup):
* if item is Ellipsis: # <<<<<<<<<<<<<<
* if not seen_ellipsis:
* result.extend([slice(None)] * (ndim - len(tup) + 1))
*/
__pyx_t_3 = (__pyx_v_item == __pyx_builtin_Ellipsis);
if (__pyx_t_3) {
/* "View.MemoryView":642
* for idx, item in enumerate(tup):
* if item is Ellipsis:
* if not seen_ellipsis: # <<<<<<<<<<<<<<
* result.extend([slice(None)] * (ndim - len(tup) + 1))
* seen_ellipsis = True
*/
__pyx_t_3 = (!__pyx_v_seen_ellipsis);
if (__pyx_t_3) {
/* "View.MemoryView":643
* if item is Ellipsis:
* if not seen_ellipsis:
* result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
* seen_ellipsis = True
* else:
*/
__pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_7);
__pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__pyx_t_9 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_10 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_9) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_9) + 1))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
{ Py_ssize_t __pyx_temp;
for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_9) + 1); __pyx_temp++) {
__Pyx_INCREF(__pyx_t_8);
PyList_SET_ITEM(__pyx_t_10, __pyx_temp, __pyx_t_8);
__Pyx_GIVEREF(__pyx_t_8);
}
}
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
__pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_10));
__Pyx_GIVEREF(((PyObject *)__pyx_t_10));
__pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
/* "View.MemoryView":644
* if not seen_ellipsis:
* result.extend([slice(None)] * (ndim - len(tup) + 1))
* seen_ellipsis = True # <<<<<<<<<<<<<<
* else:
* result.append(slice(None))
*/
__pyx_v_seen_ellipsis = 1;
goto __pyx_L7;
}
/*else*/ {
/* "View.MemoryView":646
* seen_ellipsis = True
* else:
* result.append(slice(None)) # <<<<<<<<<<<<<<
* have_slices = True
* else:
*/
__pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_36), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_t_10); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
}
__pyx_L7:;
/* "View.MemoryView":647
* else:
* result.append(slice(None))
* have_slices = True # <<<<<<<<<<<<<<
* else:
* if not isinstance(item, slice) and not PyIndex_Check(item):
*/
__pyx_t_10 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(__pyx_v_have_slices);
__pyx_v_have_slices = __pyx_t_10;
__pyx_t_10 = 0;
goto __pyx_L6;
}
/*else*/ {
/* "View.MemoryView":649
* have_slices = True
* else:
* if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
* raise TypeError("Cannot index with type '%s'" % type(item))
*
*/
__pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
__Pyx_INCREF(__pyx_t_10);
__pyx_t_3 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_2 = (!__pyx_t_3);
if (__pyx_t_2) {
__pyx_t_3 = (!PyIndex_Check(__pyx_v_item));
__pyx_t_12 = __pyx_t_3;
} else {
__pyx_t_12 = __pyx_t_2;
}
if (__pyx_t_12) {
/* "View.MemoryView":650
* 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_10 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_37), ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_10));
__pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_t_10));
__Pyx_GIVEREF(((PyObject *)__pyx_t_10));
__pyx_t_10 = 0;
__pyx_t_10 = PyObject_Call(__pyx_builtin_TypeError, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
__Pyx_Raise(__pyx_t_10, 0, 0, 0);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L8;
}
__pyx_L8:;
/* "View.MemoryView":652
* raise TypeError("Cannot index with type '%s'" % type(item))
*
* have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<<
* result.append(item)
*
*/
__pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!__pyx_t_12) {
__pyx_t_10 = ((PyObject *)((PyObject*)(&PySlice_Type)));
__Pyx_INCREF(__pyx_t_10);
__pyx_t_12 = __Pyx_TypeCheck(__pyx_v_item, __pyx_t_10);
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
__pyx_t_10 = __Pyx_PyBool_FromLong(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_10);
__pyx_t_8 = __pyx_t_10;
__pyx_t_10 = 0;
} else {
__Pyx_INCREF(__pyx_v_have_slices);
__pyx_t_8 = __pyx_v_have_slices;
}
__Pyx_DECREF(__pyx_v_have_slices);
__pyx_v_have_slices = __pyx_t_8;
__pyx_t_8 = 0;
/* "View.MemoryView":653
*
* have_slices = have_slices or isinstance(item, slice)
* result.append(item) # <<<<<<<<<<<<<<
*
* nslices = ndim - len(result)
*/
__pyx_t_11 = PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L6:;
}
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "View.MemoryView":655
* result.append(item)
*
* nslices = ndim - len(result) # <<<<<<<<<<<<<<
* if nslices:
* result.extend([slice(None)] * nslices)
*/
__pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_result)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_t_1 = PyInt_FromSsize_t((__pyx_v_ndim - __pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_v_nslices = __pyx_t_1;
__pyx_t_1 = 0;
/* "View.MemoryView":656
*
* nslices = ndim - len(result)
* if nslices: # <<<<<<<<<<<<<<
* result.extend([slice(None)] * nslices)
*
*/
__pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_nslices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 656; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (__pyx_t_12) {
/* "View.MemoryView":657
* nslices = ndim - len(result)
* if nslices:
* result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<<
*
* return have_slices or nslices, tuple(result)
*/
__pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__extend); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_k_tuple_38), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
__pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
PyList_SET_ITEM(__pyx_t_8, 0, __pyx_t_4);
__Pyx_GIVEREF(__pyx_t_4);
{ PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_8, __pyx_v_nslices); if (unlikely(!__pyx_temp)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_temp);
__Pyx_DECREF(__pyx_t_8);
__pyx_t_8 = __pyx_temp;
}
__pyx_t_4 = 0;
__pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
__Pyx_GIVEREF(((PyObject *)__pyx_t_8));
__pyx_t_8 = 0;
__pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_8);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
goto __pyx_L9;
}
__pyx_L9:;
/* "View.MemoryView":659
* result.extend([slice(None)] * nslices)
*
* return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<<
*
* cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
*/
__Pyx_XDECREF(((PyObject *)__pyx_r));
__pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!__pyx_t_12) {
__Pyx_INCREF(__pyx_v_nslices);
__pyx_t_8 = __pyx_v_nslices;
} else {
__Pyx_INCREF(__pyx_v_have_slices);
__pyx_t_8 = __pyx_v_have_slices;
}
__pyx_t_4 = ((PyObject *)PyList_AsTuple(__pyx_v_result)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_4));
__pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8);
__Pyx_GIVEREF(__pyx_t_8);
PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_4));
__Pyx_GIVEREF(((PyObject *)__pyx_t_4));
__pyx_t_8 = 0;
__pyx_t_4 = 0;
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
__pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_4);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_tup);
__Pyx_XDECREF(__pyx_v_result);
__Pyx_XDECREF(__pyx_v_have_slices);
__Pyx_XDECREF(__pyx_v_idx);
__Pyx_XDECREF(__pyx_v_item);
__Pyx_XDECREF(__pyx_v_nslices);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":661
* return have_slices or nslices, tuple(result)
*
* cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
* cdef int i
* for i in range(ndim):
*/
static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
int __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
PyObject *__pyx_t_4 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
/* "View.MemoryView":663
* cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
* cdef int i
* for i in range(ndim): # <<<<<<<<<<<<<<
* if suboffsets[i] >= 0:
* raise ValueError("Indirect dimensions not supported")
*/
__pyx_t_1 = __pyx_v_ndim;
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
/* "View.MemoryView":664
* cdef int i
* for i in range(ndim):
* if suboffsets[i] >= 0: # <<<<<<<<<<<<<<
* raise ValueError("Indirect dimensions not supported")
*
*/
__pyx_t_3 = ((__pyx_v_suboffsets[__pyx_v_i]) >= 0);
if (__pyx_t_3) {
/* "View.MemoryView":665
* for i in range(ndim):
* if suboffsets[i] >= 0:
* raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L5;
}
__pyx_L5:;
}
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_4);
__Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":672
*
* @cname('__pyx_memview_slice')
* cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
* cdef int new_ndim = 0, suboffset_dim = -1, dim
* cdef bint negative_step
*/
static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
int __pyx_v_new_ndim;
int __pyx_v_suboffset_dim;
int __pyx_v_dim;
__Pyx_memviewslice __pyx_v_src;
__Pyx_memviewslice __pyx_v_dst;
__Pyx_memviewslice *__pyx_v_p_src;
struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
__Pyx_memviewslice *__pyx_v_p_dst;
int *__pyx_v_p_suboffset_dim;
Py_ssize_t __pyx_v_start;
Py_ssize_t __pyx_v_stop;
Py_ssize_t __pyx_v_step;
int __pyx_v_have_start;
int __pyx_v_have_stop;
int __pyx_v_have_step;
PyObject *__pyx_v_index = NULL;
struct __pyx_memoryview_obj *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_t_3;
Py_ssize_t __pyx_t_4;
PyObject *(*__pyx_t_5)(PyObject *);
PyObject *__pyx_t_6 = NULL;
int __pyx_t_7;
Py_ssize_t __pyx_t_8;
PyObject *__pyx_t_9 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("memview_slice", 0);
/* "View.MemoryView":673
* @cname('__pyx_memview_slice')
* cdef memoryview memview_slice(memoryview memview, object indices):
* cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<<
* cdef bint negative_step
* cdef __Pyx_memviewslice src, dst
*/
__pyx_v_new_ndim = 0;
__pyx_v_suboffset_dim = -1;
/* "View.MemoryView":680
*
*
* memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<<
*
* cdef _memoryviewslice memviewsliceobj
*/
memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst)));
/* "View.MemoryView":684
* cdef _memoryviewslice memviewsliceobj
*
* assert memview.view.ndim > 0 # <<<<<<<<<<<<<<
*
* if isinstance(memview, _memoryviewslice):
*/
#ifndef CYTHON_WITHOUT_ASSERTIONS
if (unlikely(!(__pyx_v_memview->view.ndim > 0))) {
PyErr_SetNone(PyExc_AssertionError);
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#endif
/* "View.MemoryView":686
* assert memview.view.ndim > 0
*
* if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
* memviewsliceobj = memview
* p_src = &memviewsliceobj.from_slice
*/
__pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "View.MemoryView":687
*
* 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_filename = __pyx_f[2]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_INCREF(((PyObject *)__pyx_v_memview));
__pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview);
/* "View.MemoryView":688
* if isinstance(memview, _memoryviewslice):
* memviewsliceobj = memview
* p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<<
* else:
* slice_copy(memview, &src)
*/
__pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":690
* p_src = &memviewsliceobj.from_slice
* else:
* slice_copy(memview, &src) # <<<<<<<<<<<<<<
* p_src = &src
*
*/
__pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
/* "View.MemoryView":691
* else:
* slice_copy(memview, &src)
* p_src = &src # <<<<<<<<<<<<<<
*
*
*/
__pyx_v_p_src = (&__pyx_v_src);
}
__pyx_L3:;
/* "View.MemoryView":697
*
*
* dst.memview = p_src.memview # <<<<<<<<<<<<<<
* dst.data = p_src.data
*
*/
__pyx_v_dst.memview = __pyx_v_p_src->memview;
/* "View.MemoryView":698
*
* dst.memview = p_src.memview
* dst.data = p_src.data # <<<<<<<<<<<<<<
*
*
*/
__pyx_v_dst.data = __pyx_v_p_src->data;
/* "View.MemoryView":703
*
*
* cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<<
* cdef int *p_suboffset_dim = &suboffset_dim
* cdef Py_ssize_t start, stop, step
*/
__pyx_v_p_dst = (&__pyx_v_dst);
/* "View.MemoryView":704
*
* cdef __Pyx_memviewslice *p_dst = &dst
* cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<<
* cdef Py_ssize_t start, stop, step
* cdef bint have_start, have_stop, have_step
*/
__pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
/* "View.MemoryView":708
* cdef bint have_start, have_stop, have_step
*
* for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
* if PyIndex_Check(index):
* slice_memviewslice(
*/
__pyx_t_3 = 0;
if (PyList_CheckExact(__pyx_v_indices) || PyTuple_CheckExact(__pyx_v_indices)) {
__pyx_t_1 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
__pyx_t_5 = NULL;
} else {
__pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
__pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext;
}
for (;;) {
if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_1)) {
if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_6 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_1)) {
if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
#if CYTHON_COMPILING_IN_CPYTHON
__pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
__pyx_t_6 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
__pyx_t_6 = __pyx_t_5(__pyx_t_1);
if (unlikely(!__pyx_t_6)) {
if (PyErr_Occurred()) {
if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
else {__pyx_filename = __pyx_f[2]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
__Pyx_GOTREF(__pyx_t_6);
}
__Pyx_XDECREF(__pyx_v_index);
__pyx_v_index = __pyx_t_6;
__pyx_t_6 = 0;
__pyx_v_dim = __pyx_t_3;
__pyx_t_3 = (__pyx_t_3 + 1);
/* "View.MemoryView":709
*
* 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],
*/
__pyx_t_7 = PyIndex_Check(__pyx_v_index);
if (__pyx_t_7) {
/* "View.MemoryView":713
* 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_8 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "View.MemoryView":715
* index, 0, 0, # start, stop, step
* 0, 0, 0, # have_{start,stop,step}
* False) # <<<<<<<<<<<<<<
* elif index is None:
* p_dst.shape[new_ndim] = 1
*/
__pyx_t_7 = __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_8, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 710; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
/* "View.MemoryView":716
* 0, 0, 0, # have_{start,stop,step}
* False)
* elif index is None: # <<<<<<<<<<<<<<
* p_dst.shape[new_ndim] = 1
* p_dst.strides[new_ndim] = 0
*/
__pyx_t_2 = (__pyx_v_index == Py_None);
if (__pyx_t_2) {
/* "View.MemoryView":717
* False)
* elif index is None:
* p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<<
* p_dst.strides[new_ndim] = 0
* p_dst.suboffsets[new_ndim] = -1
*/
(__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
/* "View.MemoryView":718
* elif index is None:
* p_dst.shape[new_ndim] = 1
* p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<<
* p_dst.suboffsets[new_ndim] = -1
* new_ndim += 1
*/
(__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
/* "View.MemoryView":719
* p_dst.shape[new_ndim] = 1
* p_dst.strides[new_ndim] = 0
* p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<<
* new_ndim += 1
* else:
*/
(__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1;
/* "View.MemoryView":720
* p_dst.strides[new_ndim] = 0
* p_dst.suboffsets[new_ndim] = -1
* new_ndim += 1 # <<<<<<<<<<<<<<
* else:
* start = index.start or 0
*/
__pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
goto __pyx_L6;
}
/*else*/ {
/* "View.MemoryView":722
* new_ndim += 1
* else:
* start = index.start or 0 # <<<<<<<<<<<<<<
* stop = index.stop or 0
* step = index.step or 0
*/
__pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!__pyx_t_2) {
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_INCREF(__pyx_int_0);
__pyx_t_9 = __pyx_int_0;
} else {
__pyx_t_9 = __pyx_t_6;
__pyx_t_6 = 0;
}
__pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_v_start = __pyx_t_8;
/* "View.MemoryView":723
* else:
* start = index.start or 0
* stop = index.stop or 0 # <<<<<<<<<<<<<<
* step = index.step or 0
*
*/
__pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!__pyx_t_2) {
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__Pyx_INCREF(__pyx_int_0);
__pyx_t_6 = __pyx_int_0;
} else {
__pyx_t_6 = __pyx_t_9;
__pyx_t_9 = 0;
}
__pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__pyx_v_stop = __pyx_t_8;
/* "View.MemoryView":724
* start = index.start or 0
* stop = index.stop or 0
* step = index.step or 0 # <<<<<<<<<<<<<<
*
* have_start = index.start is not None
*/
__pyx_t_6 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_6);
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
if (!__pyx_t_2) {
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_INCREF(__pyx_int_0);
__pyx_t_9 = __pyx_int_0;
} else {
__pyx_t_9 = __pyx_t_6;
__pyx_t_6 = 0;
}
__pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 724; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_v_step = __pyx_t_8;
/* "View.MemoryView":726
* 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 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__start); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 726; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_2 = (__pyx_t_9 != Py_None);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_v_have_start = __pyx_t_2;
/* "View.MemoryView":727
*
* have_start = index.start is not None
* have_stop = index.stop is not None # <<<<<<<<<<<<<<
* have_step = index.step is not None
*
*/
__pyx_t_9 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__stop); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 727; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_2 = (__pyx_t_9 != Py_None);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_v_have_stop = __pyx_t_2;
/* "View.MemoryView":728
* 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 = PyObject_GetAttr(__pyx_v_index, __pyx_n_s__step); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_9);
__pyx_t_2 = (__pyx_t_9 != Py_None);
__Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
__pyx_v_have_step = __pyx_t_2;
/* "View.MemoryView":735
* start, stop, step,
* have_start, have_stop, have_step,
* True) # <<<<<<<<<<<<<<
* new_ndim += 1
*
*/
__pyx_t_7 = __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_7 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
/* "View.MemoryView":736
* have_start, have_stop, have_step,
* True)
* new_ndim += 1 # <<<<<<<<<<<<<<
*
* if isinstance(memview, _memoryviewslice):
*/
__pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
}
__pyx_L6:;
}
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "View.MemoryView":738
* new_ndim += 1
*
* if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
* return memoryview_fromslice(dst, new_ndim,
* memviewsliceobj.to_object_func,
*/
__pyx_t_1 = ((PyObject *)((PyObject *)__pyx_memoryviewslice_type));
__Pyx_INCREF(__pyx_t_1);
__pyx_t_2 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
if (__pyx_t_2) {
/* "View.MemoryView":739
*
* if isinstance(memview, _memoryviewslice):
* return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
* memviewsliceobj.to_object_func,
* memviewsliceobj.to_dtype_func,
*/
__Pyx_XDECREF(((PyObject *)__pyx_r));
/* "View.MemoryView":740
* 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_filename = __pyx_f[2]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
/* "View.MemoryView":742
* memviewsliceobj.to_object_func,
* memviewsliceobj.to_dtype_func,
* memview.dtype_is_object) # <<<<<<<<<<<<<<
* else:
* return memoryview_fromslice(dst, new_ndim, NULL, NULL,
*/
__pyx_t_1 = __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_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
goto __pyx_L7;
}
/*else*/ {
/* "View.MemoryView":744
* memview.dtype_is_object)
* else:
* return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
* memview.dtype_is_object)
*
*/
__Pyx_XDECREF(((PyObject *)__pyx_r));
/* "View.MemoryView":745
* else:
* return memoryview_fromslice(dst, new_ndim, NULL, NULL,
* memview.dtype_is_object) # <<<<<<<<<<<<<<
*
*
*/
__pyx_t_1 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_1);
if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryview_type))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_1);
__pyx_t_1 = 0;
goto __pyx_L0;
}
__pyx_L7:;
__pyx_r = ((struct __pyx_memoryview_obj *)Py_None); __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
__Pyx_XDECREF(__pyx_v_index);
__Pyx_XGIVEREF((PyObject *)__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":769
*
* @cname('__pyx_memoryview_slice_memviewslice')
* cdef int slice_memviewslice( # <<<<<<<<<<<<<<
* __Pyx_memviewslice *dst,
* Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
*/
static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
Py_ssize_t __pyx_v_new_shape;
int __pyx_v_negative_step;
int __pyx_r;
int __pyx_t_1;
int __pyx_t_2;
int __pyx_t_3;
int __pyx_t_4;
Py_ssize_t __pyx_t_5;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* "View.MemoryView":789
* cdef bint negative_step
*
* if not is_slice: # <<<<<<<<<<<<<<
*
* if start < 0:
*/
__pyx_t_1 = (!__pyx_v_is_slice);
if (__pyx_t_1) {
/* "View.MemoryView":791
* if not is_slice:
*
* if start < 0: # <<<<<<<<<<<<<<
* start += shape
* if not 0 <= start < shape:
*/
__pyx_t_1 = (__pyx_v_start < 0);
if (__pyx_t_1) {
/* "View.MemoryView":792
*
* if start < 0:
* start += shape # <<<<<<<<<<<<<<
* if not 0 <= start < shape:
* _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
*/
__pyx_v_start = (__pyx_v_start + __pyx_v_shape);
goto __pyx_L4;
}
__pyx_L4:;
/* "View.MemoryView":793
* if start < 0:
* start += shape
* if not 0 <= start < shape: # <<<<<<<<<<<<<<
* _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
* else:
*/
__pyx_t_1 = (0 <= __pyx_v_start);
if (__pyx_t_1) {
__pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
}
__pyx_t_2 = (!__pyx_t_1);
if (__pyx_t_2) {
/* "View.MemoryView":794
* 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, __pyx_k_41, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L5;
}
__pyx_L5:;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":797
* else:
*
* negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<<
*
* if have_step and step == 0:
*/
__pyx_t_2 = (__pyx_v_have_step != 0);
if (__pyx_t_2) {
__pyx_t_1 = (__pyx_v_step < 0);
__pyx_t_4 = __pyx_t_1;
} else {
__pyx_t_4 = __pyx_t_2;
}
__pyx_v_negative_step = __pyx_t_4;
/* "View.MemoryView":799
* negative_step = have_step != 0 and step < 0
*
* if have_step and step == 0: # <<<<<<<<<<<<<<
* _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
*
*/
if (__pyx_v_have_step) {
__pyx_t_4 = (__pyx_v_step == 0);
__pyx_t_2 = __pyx_t_4;
} else {
__pyx_t_2 = __pyx_v_have_step;
}
if (__pyx_t_2) {
/* "View.MemoryView":800
*
* 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, __pyx_k_42, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
__pyx_L6:;
/* "View.MemoryView":803
*
*
* if have_start: # <<<<<<<<<<<<<<
* if start < 0:
* start += shape
*/
if (__pyx_v_have_start) {
/* "View.MemoryView":804
*
* if have_start:
* if start < 0: # <<<<<<<<<<<<<<
* start += shape
* if start < 0:
*/
__pyx_t_2 = (__pyx_v_start < 0);
if (__pyx_t_2) {
/* "View.MemoryView":805
* if have_start:
* if start < 0:
* start += shape # <<<<<<<<<<<<<<
* if start < 0:
* start = 0
*/
__pyx_v_start = (__pyx_v_start + __pyx_v_shape);
/* "View.MemoryView":806
* if start < 0:
* start += shape
* if start < 0: # <<<<<<<<<<<<<<
* start = 0
* elif start >= shape:
*/
__pyx_t_2 = (__pyx_v_start < 0);
if (__pyx_t_2) {
/* "View.MemoryView":807
* start += shape
* if start < 0:
* start = 0 # <<<<<<<<<<<<<<
* elif start >= shape:
* if negative_step:
*/
__pyx_v_start = 0;
goto __pyx_L9;
}
__pyx_L9:;
goto __pyx_L8;
}
/* "View.MemoryView":808
* if start < 0:
* start = 0
* elif start >= shape: # <<<<<<<<<<<<<<
* if negative_step:
* start = shape - 1
*/
__pyx_t_2 = (__pyx_v_start >= __pyx_v_shape);
if (__pyx_t_2) {
/* "View.MemoryView":809
* start = 0
* elif start >= shape:
* if negative_step: # <<<<<<<<<<<<<<
* start = shape - 1
* else:
*/
if (__pyx_v_negative_step) {
/* "View.MemoryView":810
* elif start >= shape:
* if negative_step:
* start = shape - 1 # <<<<<<<<<<<<<<
* else:
* start = shape
*/
__pyx_v_start = (__pyx_v_shape - 1);
goto __pyx_L10;
}
/*else*/ {
/* "View.MemoryView":812
* start = shape - 1
* else:
* start = shape # <<<<<<<<<<<<<<
* else:
* if negative_step:
*/
__pyx_v_start = __pyx_v_shape;
}
__pyx_L10:;
goto __pyx_L8;
}
__pyx_L8:;
goto __pyx_L7;
}
/*else*/ {
/* "View.MemoryView":814
* start = shape
* else:
* if negative_step: # <<<<<<<<<<<<<<
* start = shape - 1
* else:
*/
if (__pyx_v_negative_step) {
/* "View.MemoryView":815
* else:
* if negative_step:
* start = shape - 1 # <<<<<<<<<<<<<<
* else:
* start = 0
*/
__pyx_v_start = (__pyx_v_shape - 1);
goto __pyx_L11;
}
/*else*/ {
/* "View.MemoryView":817
* start = shape - 1
* else:
* start = 0 # <<<<<<<<<<<<<<
*
* if have_stop:
*/
__pyx_v_start = 0;
}
__pyx_L11:;
}
__pyx_L7:;
/* "View.MemoryView":819
* start = 0
*
* if have_stop: # <<<<<<<<<<<<<<
* if stop < 0:
* stop += shape
*/
if (__pyx_v_have_stop) {
/* "View.MemoryView":820
*
* if have_stop:
* if stop < 0: # <<<<<<<<<<<<<<
* stop += shape
* if stop < 0:
*/
__pyx_t_2 = (__pyx_v_stop < 0);
if (__pyx_t_2) {
/* "View.MemoryView":821
* if have_stop:
* if stop < 0:
* stop += shape # <<<<<<<<<<<<<<
* if stop < 0:
* stop = 0
*/
__pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
/* "View.MemoryView":822
* if stop < 0:
* stop += shape
* if stop < 0: # <<<<<<<<<<<<<<
* stop = 0
* elif stop > shape:
*/
__pyx_t_2 = (__pyx_v_stop < 0);
if (__pyx_t_2) {
/* "View.MemoryView":823
* stop += shape
* if stop < 0:
* stop = 0 # <<<<<<<<<<<<<<
* elif stop > shape:
* stop = shape
*/
__pyx_v_stop = 0;
goto __pyx_L14;
}
__pyx_L14:;
goto __pyx_L13;
}
/* "View.MemoryView":824
* if stop < 0:
* stop = 0
* elif stop > shape: # <<<<<<<<<<<<<<
* stop = shape
* else:
*/
__pyx_t_2 = (__pyx_v_stop > __pyx_v_shape);
if (__pyx_t_2) {
/* "View.MemoryView":825
* stop = 0
* elif stop > shape:
* stop = shape # <<<<<<<<<<<<<<
* else:
* if negative_step:
*/
__pyx_v_stop = __pyx_v_shape;
goto __pyx_L13;
}
__pyx_L13:;
goto __pyx_L12;
}
/*else*/ {
/* "View.MemoryView":827
* stop = shape
* else:
* if negative_step: # <<<<<<<<<<<<<<
* stop = -1
* else:
*/
if (__pyx_v_negative_step) {
/* "View.MemoryView":828
* else:
* if negative_step:
* stop = -1 # <<<<<<<<<<<<<<
* else:
* stop = shape
*/
__pyx_v_stop = -1;
goto __pyx_L15;
}
/*else*/ {
/* "View.MemoryView":830
* stop = -1
* else:
* stop = shape # <<<<<<<<<<<<<<
*
* if not have_step:
*/
__pyx_v_stop = __pyx_v_shape;
}
__pyx_L15:;
}
__pyx_L12:;
/* "View.MemoryView":832
* stop = shape
*
* if not have_step: # <<<<<<<<<<<<<<
* step = 1
*
*/
__pyx_t_2 = (!__pyx_v_have_step);
if (__pyx_t_2) {
/* "View.MemoryView":833
*
* if not have_step:
* step = 1 # <<<<<<<<<<<<<<
*
*
*/
__pyx_v_step = 1;
goto __pyx_L16;
}
__pyx_L16:;
/* "View.MemoryView":837
*
* with cython.cdivision(True):
* new_shape = (stop - start) // step # <<<<<<<<<<<<<<
*
* if (stop - start) % step:
*/
__pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
/* "View.MemoryView":839
* new_shape = (stop - start) // step
*
* if (stop - start) % step: # <<<<<<<<<<<<<<
* new_shape += 1
*
*/
__pyx_t_5 = ((__pyx_v_stop - __pyx_v_start) % __pyx_v_step);
if (__pyx_t_5) {
/* "View.MemoryView":840
*
* if (stop - start) % step:
* new_shape += 1 # <<<<<<<<<<<<<<
*
* if new_shape < 0:
*/
__pyx_v_new_shape = (__pyx_v_new_shape + 1);
goto __pyx_L17;
}
__pyx_L17:;
/* "View.MemoryView":842
* new_shape += 1
*
* if new_shape < 0: # <<<<<<<<<<<<<<
* new_shape = 0
*
*/
__pyx_t_2 = (__pyx_v_new_shape < 0);
if (__pyx_t_2) {
/* "View.MemoryView":843
*
* if new_shape < 0:
* new_shape = 0 # <<<<<<<<<<<<<<
*
*
*/
__pyx_v_new_shape = 0;
goto __pyx_L18;
}
__pyx_L18:;
/* "View.MemoryView":846
*
*
* dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<<
* dst.shape[new_ndim] = new_shape
* dst.suboffsets[new_ndim] = suboffset
*/
(__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
/* "View.MemoryView":847
*
* dst.strides[new_ndim] = stride * step
* dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<<
* dst.suboffsets[new_ndim] = suboffset
*
*/
(__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
/* "View.MemoryView":848
* dst.strides[new_ndim] = stride * step
* dst.shape[new_ndim] = new_shape
* dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<<
*
*
*/
(__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
}
__pyx_L3:;
/* "View.MemoryView":851
*
*
* if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
* dst.data += start * stride
* else:
*/
__pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0);
if (__pyx_t_2) {
/* "View.MemoryView":852
*
* if suboffset_dim[0] < 0:
* dst.data += start * stride # <<<<<<<<<<<<<<
* else:
* dst.suboffsets[suboffset_dim[0]] += start * stride
*/
__pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
goto __pyx_L19;
}
/*else*/ {
/* "View.MemoryView":854
* dst.data += start * stride
* else:
* dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<<
*
* if suboffset >= 0:
*/
__pyx_t_3 = (__pyx_v_suboffset_dim[0]);
(__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
}
__pyx_L19:;
/* "View.MemoryView":856
* dst.suboffsets[suboffset_dim[0]] += start * stride
*
* if suboffset >= 0: # <<<<<<<<<<<<<<
* if not is_slice:
* if new_ndim == 0:
*/
__pyx_t_2 = (__pyx_v_suboffset >= 0);
if (__pyx_t_2) {
/* "View.MemoryView":857
*
* if suboffset >= 0:
* if not is_slice: # <<<<<<<<<<<<<<
* if new_ndim == 0:
* dst.data = ( dst.data)[0] + suboffset
*/
__pyx_t_2 = (!__pyx_v_is_slice);
if (__pyx_t_2) {
/* "View.MemoryView":858
* if suboffset >= 0:
* if not is_slice:
* if new_ndim == 0: # <<<<<<<<<<<<<<
* dst.data = ( dst.data)[0] + suboffset
* else:
*/
__pyx_t_2 = (__pyx_v_new_ndim == 0);
if (__pyx_t_2) {
/* "View.MemoryView":859
* if not is_slice:
* if new_ndim == 0:
* dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<<
* else:
* _err_dim(IndexError, "All dimensions preceding dimension %d "
*/
__pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
goto __pyx_L22;
}
/*else*/ {
/* "View.MemoryView":862
* 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, __pyx_k_43, __pyx_v_dim); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_L22:;
goto __pyx_L21;
}
/*else*/ {
/* "View.MemoryView":864
* "must be indexed and not sliced", dim)
* else:
* suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<<
*
* return 0
*/
(__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
}
__pyx_L21:;
goto __pyx_L20;
}
__pyx_L20:;
/* "View.MemoryView":866
* suboffset_dim[0] = new_ndim
*
* return 0 # <<<<<<<<<<<<<<
*
*
*/
__pyx_r = 0;
goto __pyx_L0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
{
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
__Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
}
__pyx_r = -1;
__pyx_L0:;
return __pyx_r;
}
/* "View.MemoryView":872
*
* @cname('__pyx_pybuffer_index')
* cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
* int dim) except NULL:
* cdef Py_ssize_t shape, stride, suboffset = -1
*/
static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, int __pyx_v_dim) {
Py_ssize_t __pyx_v_shape;
Py_ssize_t __pyx_v_stride;
Py_ssize_t __pyx_v_suboffset;
Py_ssize_t __pyx_v_itemsize;
char *__pyx_v_resultp;
char *__pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("pybuffer_index", 0);
/* "View.MemoryView":874
* cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
* int dim) except NULL:
* cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<<
* cdef Py_ssize_t itemsize = view.itemsize
* cdef char *resultp
*/
__pyx_v_suboffset = -1;
/* "View.MemoryView":875
* int dim) except NULL:
* cdef Py_ssize_t shape, stride, suboffset = -1
* cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<<
* cdef char *resultp
*
*/
__pyx_v_itemsize = __pyx_v_view->itemsize;
/* "View.MemoryView":878
* cdef char *resultp
*
* if view.ndim == 0: # <<<<<<<<<<<<<<
* shape = view.len / itemsize
* stride = itemsize
*/
__pyx_t_1 = (__pyx_v_view->ndim == 0);
if (__pyx_t_1) {
/* "View.MemoryView":879
*
* if view.ndim == 0:
* shape = view.len / itemsize # <<<<<<<<<<<<<<
* stride = itemsize
* else:
*/
if (unlikely(__pyx_v_itemsize == 0)) {
PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero");
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_itemsize == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
PyErr_Format(PyExc_OverflowError, "value too large to perform division");
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
__pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
/* "View.MemoryView":880
* if view.ndim == 0:
* shape = view.len / itemsize
* stride = itemsize # <<<<<<<<<<<<<<
* else:
* shape = view.shape[dim]
*/
__pyx_v_stride = __pyx_v_itemsize;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":882
* stride = itemsize
* else:
* shape = view.shape[dim] # <<<<<<<<<<<<<<
* stride = view.strides[dim]
* if view.suboffsets != NULL:
*/
__pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
/* "View.MemoryView":883
* else:
* shape = view.shape[dim]
* stride = view.strides[dim] # <<<<<<<<<<<<<<
* if view.suboffsets != NULL:
* suboffset = view.suboffsets[dim]
*/
__pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
/* "View.MemoryView":884
* shape = view.shape[dim]
* stride = view.strides[dim]
* if view.suboffsets != NULL: # <<<<<<<<<<<<<<
* suboffset = view.suboffsets[dim]
*
*/
__pyx_t_1 = (__pyx_v_view->suboffsets != NULL);
if (__pyx_t_1) {
/* "View.MemoryView":885
* stride = view.strides[dim]
* if view.suboffsets != NULL:
* suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<<
*
* if index < 0:
*/
__pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
goto __pyx_L4;
}
__pyx_L4:;
}
__pyx_L3:;
/* "View.MemoryView":887
* suboffset = view.suboffsets[dim]
*
* if index < 0: # <<<<<<<<<<<<<<
* index += view.shape[dim]
* if index < 0:
*/
__pyx_t_1 = (__pyx_v_index < 0);
if (__pyx_t_1) {
/* "View.MemoryView":888
*
* if index < 0:
* index += view.shape[dim] # <<<<<<<<<<<<<<
* if index < 0:
* raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
*/
__pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
/* "View.MemoryView":889
* if index < 0:
* index += view.shape[dim]
* if index < 0: # <<<<<<<<<<<<<<
* raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
*
*/
__pyx_t_1 = (__pyx_v_index < 0);
if (__pyx_t_1) {
/* "View.MemoryView":890
* index += view.shape[dim]
* if index < 0:
* raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
*
* if index >= shape:
*/
__pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_3));
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3));
__Pyx_GIVEREF(((PyObject *)__pyx_t_3));
__pyx_t_3 = 0;
__pyx_t_3 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[2]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L6;
}
__pyx_L6:;
goto __pyx_L5;
}
__pyx_L5:;
/* "View.MemoryView":892
* raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
*
* if index >= shape: # <<<<<<<<<<<<<<
* raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
*
*/
__pyx_t_1 = (__pyx_v_index >= __pyx_v_shape);
if (__pyx_t_1) {
/* "View.MemoryView":893
*
* if index >= shape:
* raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
*
* resultp = bufp + index * stride
*/
__pyx_t_3 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_44), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_2));
__Pyx_GIVEREF(((PyObject *)__pyx_t_2));
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L7;
}
__pyx_L7:;
/* "View.MemoryView":895
* raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
*
* resultp = bufp + index * stride # <<<<<<<<<<<<<<
* if suboffset >= 0:
* resultp = ( resultp)[0] + suboffset
*/
__pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
/* "View.MemoryView":896
*
* resultp = bufp + index * stride
* if suboffset >= 0: # <<<<<<<<<<<<<<
* resultp = ( resultp)[0] + suboffset
*
*/
__pyx_t_1 = (__pyx_v_suboffset >= 0);
if (__pyx_t_1) {
/* "View.MemoryView":897
* resultp = bufp + index * stride
* if suboffset >= 0:
* resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<<
*
* return resultp
*/
__pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
goto __pyx_L8;
}
__pyx_L8:;
/* "View.MemoryView":899
* resultp = ( resultp)[0] + suboffset
*
* return resultp # <<<<<<<<<<<<<<
*
*
*/
__pyx_r = __pyx_v_resultp;
goto __pyx_L0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":905
*
* @cname('__pyx_memslice_transpose')
* cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
* cdef int ndim = memslice.memview.view.ndim
*
*/
static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
int __pyx_v_ndim;
Py_ssize_t *__pyx_v_shape;
Py_ssize_t *__pyx_v_strides;
int __pyx_v_i;
int __pyx_v_j;
int __pyx_r;
long __pyx_t_1;
int __pyx_t_2;
Py_ssize_t __pyx_t_3;
Py_ssize_t __pyx_t_4;
int __pyx_t_5;
int __pyx_t_6;
int __pyx_t_7;
int __pyx_t_8;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
/* "View.MemoryView":906
* @cname('__pyx_memslice_transpose')
* cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
* cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<<
*
* cdef Py_ssize_t *shape = memslice.shape
*/
__pyx_v_ndim = __pyx_v_memslice->memview->view.ndim;
/* "View.MemoryView":908
* cdef int ndim = memslice.memview.view.ndim
*
* cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<<
* cdef Py_ssize_t *strides = memslice.strides
*
*/
__pyx_v_shape = __pyx_v_memslice->shape;
/* "View.MemoryView":909
*
* cdef Py_ssize_t *shape = memslice.shape
* cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<<
*
*
*/
__pyx_v_strides = __pyx_v_memslice->strides;
/* "View.MemoryView":913
*
* cdef int i, j
* for i in range(ndim / 2): # <<<<<<<<<<<<<<
* j = ndim - 1 - i
* strides[i], strides[j] = strides[j], strides[i]
*/
__pyx_t_1 = __Pyx_div_long(__pyx_v_ndim, 2);
for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
__pyx_v_i = __pyx_t_2;
/* "View.MemoryView":914
* cdef int i, j
* for i in range(ndim / 2):
* j = ndim - 1 - i # <<<<<<<<<<<<<<
* strides[i], strides[j] = strides[j], strides[i]
* shape[i], shape[j] = shape[j], shape[i]
*/
__pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
/* "View.MemoryView":915
* for i in range(ndim / 2):
* j = ndim - 1 - i
* strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<<
* shape[i], shape[j] = shape[j], shape[i]
*
*/
__pyx_t_3 = (__pyx_v_strides[__pyx_v_j]);
__pyx_t_4 = (__pyx_v_strides[__pyx_v_i]);
(__pyx_v_strides[__pyx_v_i]) = __pyx_t_3;
(__pyx_v_strides[__pyx_v_j]) = __pyx_t_4;
/* "View.MemoryView":916
* j = ndim - 1 - i
* strides[i], strides[j] = strides[j], strides[i]
* shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<<
*
* if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
*/
__pyx_t_4 = (__pyx_v_shape[__pyx_v_j]);
__pyx_t_3 = (__pyx_v_shape[__pyx_v_i]);
(__pyx_v_shape[__pyx_v_i]) = __pyx_t_4;
(__pyx_v_shape[__pyx_v_j]) = __pyx_t_3;
/* "View.MemoryView":918
* shape[i], shape[j] = shape[j], shape[i]
*
* if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
* _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
*
*/
__pyx_t_5 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
if (!__pyx_t_5) {
__pyx_t_6 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
__pyx_t_7 = __pyx_t_6;
} else {
__pyx_t_7 = __pyx_t_5;
}
if (__pyx_t_7) {
/* "View.MemoryView":919
*
* if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
* _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<<
*
* return 1
*/
__pyx_t_8 = __pyx_memoryview_err(__pyx_builtin_ValueError, __pyx_k_45); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 919; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L5;
}
__pyx_L5:;
}
/* "View.MemoryView":921
* _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
*
* return 1 # <<<<<<<<<<<<<<
*
*
*/
__pyx_r = 1;
goto __pyx_L0;
__pyx_r = 0;
goto __pyx_L0;
__pyx_L1_error:;
{
#ifdef WITH_THREAD
PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
#endif
__Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
#ifdef WITH_THREAD
PyGILState_Release(__pyx_gilstate_save);
#endif
}
__pyx_r = 0;
__pyx_L0:;
return __pyx_r;
}
/* Python wrapper */
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
__pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
}
/* "View.MemoryView":938
* cdef int (*to_dtype_func)(char *, object) except 0
*
* def __dealloc__(self): # <<<<<<<<<<<<<<
* __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
*
*/
static void __pyx_memoryviewslice_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__dealloc__", 0);
/* "View.MemoryView":939
*
* def __dealloc__(self):
* __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<<
*
* cdef convert_item_to_object(self, char *itemp):
*/
__PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
__Pyx_RefNannyFinishContext();
}
/* "View.MemoryView":941
* __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
*
* cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
* if self.to_object_func != NULL:
* return self.to_object_func(itemp)
*/
static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("convert_item_to_object", 0);
/* "View.MemoryView":942
*
* cdef convert_item_to_object(self, char *itemp):
* if self.to_object_func != NULL: # <<<<<<<<<<<<<<
* return self.to_object_func(itemp)
* else:
*/
__pyx_t_1 = (__pyx_v_self->to_object_func != NULL);
if (__pyx_t_1) {
/* "View.MemoryView":943
* cdef convert_item_to_object(self, char *itemp):
* if self.to_object_func != NULL:
* return self.to_object_func(itemp) # <<<<<<<<<<<<<<
* else:
* 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_filename = __pyx_f[2]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":945
* return self.to_object_func(itemp)
* else:
* return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<<
*
* cdef assign_item_from_object(self, char *itemp, object value):
*/
__Pyx_XDECREF(__pyx_r);
__pyx_t_2 = __pyx_vtabptr_memoryview->convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_r = __pyx_t_2;
__pyx_t_2 = 0;
goto __pyx_L0;
}
__pyx_L3:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_2);
__Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":947
* return memoryview.convert_item_to_object(self, itemp)
*
* cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
* if self.to_dtype_func != NULL:
* self.to_dtype_func(itemp, value)
*/
static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
int __pyx_t_2;
PyObject *__pyx_t_3 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("assign_item_from_object", 0);
/* "View.MemoryView":948
*
* cdef assign_item_from_object(self, char *itemp, object value):
* if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
* self.to_dtype_func(itemp, value)
* else:
*/
__pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL);
if (__pyx_t_1) {
/* "View.MemoryView":949
* 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 == 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
goto __pyx_L3;
}
/*else*/ {
/* "View.MemoryView":951
* self.to_dtype_func(itemp, value)
* else:
* memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<<
*
* property base:
*/
__pyx_t_3 = __pyx_vtabptr_memoryview->assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
__pyx_L3:;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_memoryviewslice__get__base(PyObject *__pyx_v_self) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
__pyx_r = __pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":955
* property base:
* @cname('__pyx_memoryviewslice__get__base')
* def __get__(self): # <<<<<<<<<<<<<<
* return self.from_object
*
*/
static PyObject *__pyx_memoryviewslice__get__base_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__get__", 0);
/* "View.MemoryView":956
* @cname('__pyx_memoryviewslice__get__base')
* def __get__(self):
* return self.from_object # <<<<<<<<<<<<<<
*
* __pyx_getbuffer = capsule( &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(__pyx_v_self->from_object);
__pyx_r = __pyx_v_self->from_object;
goto __pyx_L0;
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* "View.MemoryView":962
*
* @cname('__pyx_memoryview_fromslice')
* cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
* int ndim,
* object (*to_object_func)(char *),
*/
static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
int __pyx_v_i;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
PyObject *__pyx_t_3 = NULL;
int __pyx_t_4;
int __pyx_t_5;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("memoryview_fromslice", 0);
/* "View.MemoryView":971
* cdef int i
*
* if memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
* return None
*
*/
__pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None);
if (__pyx_t_1) {
/* "View.MemoryView":972
*
* if memviewslice.memview == Py_None:
* return None # <<<<<<<<<<<<<<
*
*
*/
__Pyx_XDECREF(__pyx_r);
__Pyx_INCREF(Py_None);
__pyx_r = Py_None;
goto __pyx_L0;
goto __pyx_L3;
}
__pyx_L3:;
/* "View.MemoryView":977
*
*
* 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_filename = __pyx_f[2]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(Py_None);
PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
__Pyx_GIVEREF(Py_None);
__Pyx_INCREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
__Pyx_GIVEREF(__pyx_int_0);
PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__pyx_t_2 = 0;
__pyx_t_2 = PyObject_Call(((PyObject *)((PyObject *)__pyx_memoryviewslice_type)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
__pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
__pyx_t_2 = 0;
/* "View.MemoryView":979
* result = _memoryviewslice(None, 0, dtype_is_object)
*
* result.from_slice = memviewslice # <<<<<<<<<<<<<<
* __PYX_INC_MEMVIEW(&memviewslice, 1)
*
*/
__pyx_v_result->from_slice = __pyx_v_memviewslice;
/* "View.MemoryView":980
*
* result.from_slice = memviewslice
* __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<<
*
* result.from_object = ( memviewslice.memview).base
*/
__PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
/* "View.MemoryView":982
* __PYX_INC_MEMVIEW(&memviewslice, 1)
*
* result.from_object = ( memviewslice.memview).base # <<<<<<<<<<<<<<
* result.typeinfo = memviewslice.memview.typeinfo
*
*/
__pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s__base); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 982; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_GIVEREF(__pyx_t_2);
__Pyx_GOTREF(__pyx_v_result->from_object);
__Pyx_DECREF(__pyx_v_result->from_object);
__pyx_v_result->from_object = __pyx_t_2;
__pyx_t_2 = 0;
/* "View.MemoryView":983
*
* result.from_object = ( memviewslice.memview).base
* result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<<
*
* result.view = memviewslice.memview.view
*/
__pyx_v_result->__pyx_base.typeinfo = __pyx_v_memviewslice.memview->typeinfo;
/* "View.MemoryView":985
* result.typeinfo = memviewslice.memview.typeinfo
*
* result.view = memviewslice.memview.view # <<<<<<<<<<<<<<
* result.view.buf = memviewslice.data
* result.view.ndim = ndim
*/
__pyx_v_result->__pyx_base.view = __pyx_v_memviewslice.memview->view;
/* "View.MemoryView":986
*
* result.view = memviewslice.memview.view
* result.view.buf = memviewslice.data # <<<<<<<<<<<<<<
* result.view.ndim = ndim
* (<__pyx_buffer *> &result.view).obj = Py_None
*/
__pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
/* "View.MemoryView":987
* result.view = memviewslice.memview.view
* result.view.buf = memviewslice.data
* result.view.ndim = ndim # <<<<<<<<<<<<<<
* (<__pyx_buffer *> &result.view).obj = Py_None
* Py_INCREF(Py_None)
*/
__pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
/* "View.MemoryView":988
* result.view.buf = memviewslice.data
* result.view.ndim = ndim
* (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<<
* Py_INCREF(Py_None)
*
*/
((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
/* "View.MemoryView":989
* result.view.ndim = ndim
* (<__pyx_buffer *> &result.view).obj = Py_None
* Py_INCREF(Py_None) # <<<<<<<<<<<<<<
*
* result.flags = PyBUF_RECORDS
*/
Py_INCREF(Py_None);
/* "View.MemoryView":991
* Py_INCREF(Py_None)
*
* result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<<
*
* result.view.shape =