diff --git a/README.md b/README.md index 5bbc00ca..4930daf3 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Linguist defines the list of all languages known to GitHub in a [yaml file](http Most languages are detected by their file extension. This is the fastest and most common situation. -For disambiguating between files with common extensions, we use a [bayesian classifier](https://github.com/github/linguist/blob/master/lib/linguist/classifier.rb). For an example, this helps us tell the difference between `.h` files which could be either C, C++, or Obj-C. +For disambiguating between files with common extensions, we use a [Bayesian classifier](https://github.com/github/linguist/blob/master/lib/linguist/classifier.rb). For an example, this helps us tell the difference between `.h` files which could be either C, C++, or Obj-C. In the actual GitHub app we deal with `Grit::Blob` objects. For testing, there is a simple `FileBlob` API. @@ -27,7 +27,7 @@ See [lib/linguist/language.rb](https://github.com/github/linguist/blob/master/li The actual syntax highlighting is handled by our Pygments wrapper, [pygments.rb](https://github.com/tmm1/pygments.rb). It also provides a [Lexer abstraction](https://github.com/tmm1/pygments.rb/blob/master/lib/pygments/lexer.rb) that determines which highlighter should be used on a file. -We typically run on a prerelease version of Pygments, [pygments.rb](https://github.com/tmm1/pygments.rb), to get early access to new lexers. The [languages.yml](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml) file is a dump of the lexers we have available on our server. +We typically run on a pre-release version of Pygments, [pygments.rb](https://github.com/tmm1/pygments.rb), to get early access to new lexers. The [languages.yml](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml) file is a dump of the lexers we have available on our server. ### Stats @@ -88,6 +88,6 @@ Almost all bug fixes or new language additions should come with some additional ### Testing -Sometimes getting the tests running can be too much work, especially if you don't have much Ruby experience. Its okay, be lazy and let our build bot [Travis](http://travis-ci.org/#!/github/linguist) run the tests for you. Just open a pull request and the bot will start cranking away. +Sometimes getting the tests running can be too much work, especially if you don't have much Ruby experience. It's okay, be lazy and let our build bot [Travis](http://travis-ci.org/#!/github/linguist) run the tests for you. Just open a pull request and the bot will start cranking away. -Heres our current build status, which is hopefully green: [![Build Status](https://secure.travis-ci.org/github/linguist.png?branch=master)](http://travis-ci.org/github/linguist) +Here's our current build status, which is hopefully green: [![Build Status](https://secure.travis-ci.org/github/linguist.png?branch=master)](http://travis-ci.org/github/linguist) diff --git a/github-linguist.gemspec b/github-linguist.gemspec index 1192b23e..252592be 100644 --- a/github-linguist.gemspec +++ b/github-linguist.gemspec @@ -1,17 +1,18 @@ Gem::Specification.new do |s| s.name = 'github-linguist' - s.version = '2.4.0' + s.version = '2.6.8' s.summary = "GitHub Language detection" - s.authors = "GitHub" + s.authors = "GitHub" + s.homepage = "https://github.com/github/linguist" s.files = Dir['lib/**/*'] s.executables << 'linguist' s.add_dependency 'charlock_holmes', '~> 0.6.6' - s.add_dependency 'escape_utils', '~> 0.2.3' + s.add_dependency 'escape_utils', '~> 0.3.1' s.add_dependency 'mime-types', '~> 1.19' - s.add_dependency 'pygments.rb', '~> 0.3.7' + s.add_dependency 'pygments.rb', '~> 0.4.2' s.add_development_dependency 'mocha' s.add_development_dependency 'json' s.add_development_dependency 'rake' diff --git a/lib/linguist/blob_helper.rb b/lib/linguist/blob_helper.rb index d7f56de5..85080b2b 100644 --- a/lib/linguist/blob_helper.rb +++ b/lib/linguist/blob_helper.rb @@ -58,6 +58,15 @@ module Linguist _mime_type ? _mime_type.binary? : false end + # Internal: Is the blob binary according to its mime type, + # overriding it if we have better data from the languages.yml + # database. + # + # Return true or false + def likely_binary? + binary_mime_type? and not Language.find_by_filename(name) + end + # Public: Get the Content-Type header value # # This value is used when serving raw blobs. @@ -139,7 +148,14 @@ module Linguist # # Return true or false def image? - ['.png', '.jpg', '.jpeg', '.gif'].include?(extname) + ['.png', '.jpg', '.jpeg', '.gif'].include?(extname.downcase) + end + + # Public: Is the blob a supported 3D model format? + # + # Return true or false + def solid? + extname.downcase == '.stl' end MEGABYTE = 1024 * 1024 @@ -251,7 +267,7 @@ module Linguist # Public: Is the blob a generated file? # - # Generated source code is supressed in diffs and is ignored by + # Generated source code is suppressed in diffs and is ignored by # language statistics. # # May load Blob#data @@ -266,7 +282,7 @@ module Linguist # Excluded: # - Files over 0.1MB # - Non-text files - # - Langauges marked as not searchable + # - Languages marked as not searchable # - Generated source files # # Please add additional test coverage to diff --git a/lib/linguist/classifier.rb b/lib/linguist/classifier.rb index ce92af30..6761e3d4 100644 --- a/lib/linguist/classifier.rb +++ b/lib/linguist/classifier.rb @@ -40,7 +40,7 @@ module Linguist # Public: Guess language of data. # - # db - Hash of classifer tokens database. + # db - Hash of classifier tokens database. # data - Array of tokens or String data to analyze. # languages - Array of language name Strings to restrict to. # @@ -85,7 +85,7 @@ module Linguist scores.sort { |a, b| b[1] <=> a[1] }.map { |score| [score[0], score[1]] } end - # Internal: Probably of set of tokens in a language occuring - P(D | C) + # Internal: Probably of set of tokens in a language occurring - P(D | C) # # tokens - Array of String tokens. # language - Language to check. @@ -97,7 +97,7 @@ module Linguist end end - # Internal: Probably of token in language occuring - P(F | C) + # Internal: Probably of token in language occurring - P(F | C) # # token - String token. # language - Language to check. @@ -111,7 +111,7 @@ module Linguist end end - # Internal: Probably of a language occuring - P(C) + # Internal: Probably of a language occurring - P(C) # # language - Language to check. # diff --git a/lib/linguist/generated.rb b/lib/linguist/generated.rb index 25d36e4e..5cecc640 100644 --- a/lib/linguist/generated.rb +++ b/lib/linguist/generated.rb @@ -43,7 +43,7 @@ module Linguist # Internal: Is the blob a generated file? # - # Generated source code is supressed in diffs and is ignored by + # Generated source code is suppressed in diffs and is ignored by # language statistics. # # Please add additional test coverage to @@ -86,7 +86,7 @@ module Linguist # Internal: Is the blob of JS generated by CoffeeScript? # - # CoffeScript is meant to output JS that would be difficult to + # CoffeeScript is meant to output JS that would be difficult to # tell if it was generated or not. Look for a number of patterns # output by the CS compiler. # diff --git a/lib/linguist/language.rb b/lib/linguist/language.rb index 36db0380..54fc4698 100644 --- a/lib/linguist/language.rb +++ b/lib/linguist/language.rb @@ -73,7 +73,7 @@ module Linguist # # Returns Language or nil. def self.detect(name, data, mode = nil) - # A bit of an elegant hack. If the file is exectable but extensionless, + # A bit of an elegant hack. If the file is executable but extensionless, # append a "magic" extension so it can be classified with other # languages that have shebang scripts. if File.extname(name).empty? && mode && (mode.to_i(8) & 05) == 05 @@ -329,7 +329,7 @@ module Linguist # Deprecated: Get primary extension # - # Defaults to the first extension but can be overriden + # Defaults to the first extension but can be overridden # in the languages.yml. # # The primary extension can not be nil. Tests should verify this. diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 740fd5ba..59c5faa4 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1,12 +1,10 @@ # Defines all Languages known to GitHub. # # All languages have an associated lexer for syntax highlighting. It -# defaults to name.downcase, which covers most cases. Make sure the -# lexer exists in lexers.yml. This is a list of available in our -# version of pygments. +# defaults to name.downcase, which covers most cases. # # type - Either data, programming, markup, or nil -# lexer - An explicit lexer String (defaults to name.downcase) +# lexer - An explicit lexer String (defaults to name) # aliases - An Array of additional aliases (implicitly # includes name.downcase) # ace_mode - A String name of Ace Mode (if available) @@ -26,6 +24,11 @@ # # Please keep this list alphabetized. +ABAP: + type: programming + lexer: ABAP + primary_extension: .abap + ASP: type: programming color: "#6a40fd" @@ -109,6 +112,15 @@ AutoHotkey: - ahk primary_extension: .ahk +Awk: + type: programming + lexer: Awk + primary_extension: .awk + extensions: + - .gawk + - .mawk + - .nawk + Batchfile: type: programming group: Shell @@ -186,6 +198,11 @@ C2hs Haskell: - c2hs primary_extension: .chs +CLIPS: + type: programming + lexer: Text only + primary_extension: .clp + CMake: primary_extension: .cmake extensions: @@ -224,6 +241,8 @@ CoffeeScript: primary_extension: .coffee extensions: - ._coffee + - .cson + - .iced filenames: - Cakefile @@ -246,6 +265,7 @@ Common Lisp: - lisp primary_extension: .lisp extensions: + - .asd - .lsp - .ny @@ -285,6 +305,13 @@ D-ObjDump: lexer: d-objdump primary_extension: .d-objdump +DOT: + type: programming + lexer: Text only + primary_extension: .dot + extensions: + - .gv + Darcs Patch: search_term: dpatch aliases: @@ -302,6 +329,7 @@ Delphi: color: "#b0ce4e" primary_extension: .pas extensions: + - .dfm - .lpr DCPU-16 ASM: @@ -429,8 +457,7 @@ Forth: color: "#341708" lexer: Text only extensions: - - .forth - - .fth + - .4th GAS: type: programming @@ -521,7 +548,9 @@ HTML+ERB: - erb primary_extension: .erb extensions: + - .erb.deface - .html.erb + - .html.erb.deface HTML+PHP: type: markup @@ -536,6 +565,9 @@ Haml: group: HTML type: markup primary_extension: .haml + extensions: + - .haml.deface + - .html.haml.deface Handlebars: type: markup @@ -598,8 +630,6 @@ Java: ace_mode: java color: "#b07219" primary_extension: .java - extensions: - - .pde Java Server Pages: group: Java @@ -651,11 +681,6 @@ Lasso: ace_mode: lasso color: "#2584c3" primary_extension: .lasso - extensions: - - .inc - - .las - - .lasso9 - - .ldml Less: type: markup @@ -670,6 +695,17 @@ LilyPond: extensions: - .ily +Literate CoffeeScript: + type: programming + group: CoffeeScript + lexer: Text only + ace_mode: markdown + wrap: true + search_term: litcoffee + aliases: + - litcoffee + primary_extension: .litcoffee + Literate Haskell: type: programming group: Haskell @@ -690,6 +726,14 @@ LiveScript: filenames: - Slakefile +Logos: + type: programming + primary_extension: .xm + extensions: + - .x + - .xi + - .xmi + Logtalk: type: programming primary_extension: .lgt @@ -701,7 +745,6 @@ Lua: primary_extension: .lua extensions: - .nse - - .pd_lua Makefile: aliases: @@ -746,6 +789,9 @@ Max: - maxmsp search_term: max/msp primary_extension: .mxt + extensions: + - .maxhelp + - .maxpat MiniD: # Legacy searchable: false @@ -762,6 +808,11 @@ Mirah: - .mir - .mirah +Monkey: + type: programming + lexer: Monkey + primary_extension: .monkey + Moocode: lexer: MOOCode primary_extension: .moo @@ -773,6 +824,9 @@ MoonScript: Myghty: primary_extension: .myt +NSIS: + primary_extension: .nsi + Nemerle: type: programming color: "#0d3c6e" @@ -813,6 +867,7 @@ OCaml: color: "#3be133" primary_extension: .ml extensions: + - .eliomi - .mli - .mll - .mly @@ -846,8 +901,6 @@ Omgrofl: primary_extension: .omgrofl color: "#cabbff" lexer: Text only - extensions: - - .omgrofl Opa: type: programming @@ -858,6 +911,8 @@ OpenCL: group: C lexer: C primary_extension: .cl + extensions: + - .opencl OpenEdge ABL: type: programming @@ -918,6 +973,20 @@ Perl: - .pod - .psgi +Pike: + type: programming + color: "#066ab2" + lexer: C + primary_extension: .pike + extensions: + - .pmod + +PogoScript: + type: programming + color: "#d80074" + lexer: Text only + primary_extension: .pogo + PowerShell: type: programming ace_mode: powershell @@ -925,6 +994,12 @@ PowerShell: - posh primary_extension: .ps1 +Processing: + type: programming + lexer: Java + color: "#2779ab" + primary_extension: .pde + Prolog: type: programming color: "#74283c" @@ -953,6 +1028,7 @@ Python: color: "#3581ba" primary_extension: .py extensions: + - .gyp - .pyw - .wsgi - .xpy @@ -986,6 +1062,12 @@ Racket: - .rktd - .rktl +Ragel in Ruby Host: + type: programming + lexer: Ragel in Ruby Host + color: "#ff9c2e" + primary_extension: .rl + Raw token data: search_term: raw aliases: @@ -1004,6 +1086,13 @@ Rebol: Redcode: primary_extension: .cw +Rouge: + type: programming + lexer: Clojure + ace_mode: clojure + color: "#cc0088" + primary_extension: .rg + Ruby: type: programming ace_mode: ruby @@ -1037,7 +1126,6 @@ Ruby: Rust: type: programming color: "#dea584" - lexer: Text only primary_extension: .rs SCSS: @@ -1097,6 +1185,8 @@ Shell: - bash - zsh primary_extension: .sh + extensions: + - .tmux Smalltalk: type: programming @@ -1119,6 +1209,15 @@ SuperCollider: lexer: Text only primary_extension: .sc +TOML: + type: data + primary_extension: .toml + +TXL: + type: programming + lexer: Text only + primary_extension: .txl + Tcl: type: programming color: "#e4cc98" @@ -1170,6 +1269,14 @@ Twig: lexer: HTML+Django/Jinja primary_extension: .twig +TypeScript: + type: programming + color: "#31859c" + lexer: Text only + aliases: + - ts + primary_extension: .ts + VHDL: type: programming lexer: vhdl @@ -1188,6 +1295,10 @@ Verilog: lexer: verilog color: "#848bf3" primary_extension: .v + extensions: + - .sv + - .svh + - .vh VimL: type: programming @@ -1217,21 +1328,29 @@ XML: aliases: - rss - xsd - - xsl - wsdl primary_extension: .xml extensions: - .ccxml + - .dita + - .ditamap + - .ditaval - .glade - .grxml - .kml - .mxml - .plist + - .pt - .rdf - .rss - .scxml - .svg - .ui + - .tmCommand + - .tmLanguage + - .tmPreferences + - .tmSnippet + - .tml - .vxml - .wsdl - .wxi @@ -1241,12 +1360,19 @@ XML: - .xlf - .xliff - .xsd - - .xsl - .xul + - .zcml filenames: - .classpath - .project +XProc: + type: programming + lexer: XML + primary_extension: .xpl + extensions: + - .xproc + XQuery: type: programming color: "#2700e2" @@ -1260,9 +1386,16 @@ XS: primary_extension: .xs XSLT: - type: markup - group: XML + type: programming + aliases: + - xsl primary_extension: .xslt + extensions: + - .xsl + +Xtend: + type: programming + primary_extension: .xtend YAML: type: markup @@ -1279,6 +1412,19 @@ eC: extensions: - .eh +edn: + type: data + lexer: Clojure + ace_mode: clojure + color: "#db5855" + primary_extension: .edn + +fish: + type: programming + group: Shell + lexer: Text only + primary_extension: .fish + mupad: lexer: MuPAD primary_extension: .mu diff --git a/lib/linguist/md5.rb b/lib/linguist/md5.rb index 0b43fd8a..4853aa80 100644 --- a/lib/linguist/md5.rb +++ b/lib/linguist/md5.rb @@ -4,7 +4,7 @@ module Linguist module MD5 # Public: Create deep nested digest of value object. # - # Useful for object comparsion. + # Useful for object comparison. # # obj - Object to digest. # diff --git a/lib/linguist/repository.rb b/lib/linguist/repository.rb index 20b59700..5c1ffdaf 100644 --- a/lib/linguist/repository.rb +++ b/lib/linguist/repository.rb @@ -67,8 +67,8 @@ module Linguist return if @computed_stats @enum.each do |blob| - # Skip binary file extensions - next if blob.binary_mime_type? + # Skip files that are likely binary + next if blob.likely_binary? # Skip vendored or generated blobs next if blob.vendored? || blob.generated? || blob.language.nil? diff --git a/lib/linguist/samples.json b/lib/linguist/samples.json index 9d552a05..ce3d5e89 100644 --- a/lib/linguist/samples.json +++ b/lib/linguist/samples.json @@ -1,5 +1,8 @@ { "extnames": { + "ABAP": [ + ".abap" + ], "Apex": [ ".cls" ], @@ -12,6 +15,9 @@ "AutoHotkey": [ ".ahk" ], + "Awk": [ + ".awk" + ], "C": [ ".c", ".h" @@ -50,6 +56,10 @@ "Emacs Lisp": [ ".el" ], + "Forth": [ + ".forth", + ".fth" + ], "GAS": [ ".s" ], @@ -77,6 +87,11 @@ "Ioke": [ ".ik" ], + "JSON": [ + ".json", + ".maxhelp", + ".maxpat" + ], "Java": [ ".java" ], @@ -84,20 +99,36 @@ ".js", ".script!" ], - "JSON": [ - ".json", - ".maxhelp", - ".maxpat" - ], "Julia": [ ".jl" ], "Kotlin": [ ".kt" ], + "Lasso": [ + ".las", + ".lasso", + ".lasso9", + ".ldml" + ], + "Less": [ + ".less" + ], + "Literate CoffeeScript": [ + ".litcoffee" + ], + "LiveScript": [ + ".ls" + ], + "Logos": [ + ".xm" + ], "Logtalk": [ ".lgt" ], + "Lua": [ + ".pd_lua" + ], "Markdown": [ ".md" ], @@ -107,6 +138,16 @@ "Max": [ ".mxt" ], + "Monkey": [ + ".monkey" + ], + "MoonScript": [ + ".moon" + ], + "NSIS": [ + ".nsh", + ".nsi" + ], "Nemerle": [ ".n" ], @@ -116,12 +157,16 @@ "Nu": [ ".script!" ], + "OCaml": [ + ".eliom", + ".ml" + ], "Objective-C": [ ".h", ".m" ], - "OCaml": [ - ".ml" + "Omgrofl": [ + ".omgrofl" ], "Opa": [ ".opa" @@ -133,6 +178,11 @@ ".cls", ".p" ], + "PHP": [ + ".module", + ".php", + ".script!" + ], "Parrot Assembly": [ ".pasm" ], @@ -145,15 +195,16 @@ ".script!", ".t" ], - "PHP": [ - ".module", - ".php", - ".script!" + "PogoScript": [ + ".pogo" ], "PowerShell": [ ".ps1", ".psm1" ], + "Processing": [ + ".pde" + ], "Prolog": [ ".pl" ], @@ -168,10 +219,14 @@ ".scrbl", ".script!" ], + "Ragel in Ruby Host": [ + ".rl" + ], "Rebol": [ ".r" ], "Ruby": [ + ".pluginspec", ".rabl", ".rake", ".rb", @@ -180,6 +235,9 @@ "Rust": [ ".rs" ], + "SCSS": [ + ".scss" + ], "Sass": [ ".sass" ], @@ -195,9 +253,6 @@ ".sci", ".tst" ], - "SCSS": [ - ".scss" - ], "Shell": [ ".bash", ".script!", @@ -209,23 +264,30 @@ ".sml" ], "SuperCollider": [ - ".sc" + ".sc", + ".scd" ], - "Tea": [ - ".tea" + "TXL": [ + ".txl" ], "TeX": [ ".cls" ], + "Tea": [ + ".tea" + ], "Turing": [ ".t" ], - "Verilog": [ - ".v" + "TypeScript": [ + ".ts" ], "VHDL": [ ".vhd" ], + "Verilog": [ + ".v" + ], "Visual Basic": [ ".cls" ], @@ -234,11 +296,23 @@ ".ivy", ".xml" ], + "XProc": [ + ".xpl" + ], "XQuery": [ ".xqm" ], "XSLT": [ ".xslt" + ], + "Xtend": [ + ".xtend" + ], + "edn": [ + ".edn" + ], + "fish": [ + ".fish" ] }, "filenames": { @@ -248,6 +322,7 @@ "httpd.conf" ], "INI": [ + ".editorconfig", ".gitconfig" ], "Nginx": [ @@ -293,9 +368,268 @@ ".gemrc" ] }, - "tokens_total": 274995, - "languages_total": 304, + "tokens_total": 329472, + "languages_total": 382, "tokens": { + "ABAP": { + "*/**": 1, + "*": 56, + "The": 2, + "MIT": 2, + "License": 1, + "(": 8, + ")": 8, + "Copyright": 1, + "c": 3, + "Ren": 1, + "van": 1, + "Mil": 1, + "Permission": 1, + "is": 2, + "hereby": 1, + "granted": 1, + "free": 1, + "of": 6, + "charge": 1, + "to": 10, + "any": 1, + "person": 1, + "obtaining": 1, + "a": 1, + "copy": 2, + "this": 2, + "software": 1, + "and": 3, + "associated": 1, + "documentation": 1, + "files": 4, + "the": 10, + "deal": 1, + "in": 3, + "Software": 3, + "without": 2, + "restriction": 1, + "including": 1, + "limitation": 1, + "rights": 1, + "use": 1, + "modify": 1, + "merge": 1, + "publish": 1, + "distribute": 1, + "sublicense": 1, + "and/or": 1, + "sell": 1, + "copies": 2, + "permit": 1, + "persons": 1, + "whom": 1, + "furnished": 1, + "do": 4, + "so": 1, + "subject": 1, + "following": 1, + "conditions": 1, + "above": 1, + "copyright": 1, + "notice": 2, + "permission": 1, + "shall": 1, + "be": 1, + "included": 1, + "all": 1, + "or": 1, + "substantial": 1, + "portions": 1, + "Software.": 1, + "THE": 6, + "SOFTWARE": 2, + "IS": 1, + "PROVIDED": 1, + "WITHOUT": 1, + "WARRANTY": 1, + "OF": 4, + "ANY": 2, + "KIND": 1, + "EXPRESS": 1, + "OR": 7, + "IMPLIED": 1, + "INCLUDING": 1, + "BUT": 1, + "NOT": 1, + "LIMITED": 1, + "TO": 2, + "WARRANTIES": 1, + "MERCHANTABILITY": 1, + "FITNESS": 1, + "FOR": 2, + "A": 1, + "PARTICULAR": 1, + "PURPOSE": 1, + "AND": 1, + "NONINFRINGEMENT.": 1, + "IN": 4, + "NO": 1, + "EVENT": 1, + "SHALL": 1, + "AUTHORS": 1, + "COPYRIGHT": 1, + "HOLDERS": 1, + "BE": 1, + "LIABLE": 1, + "CLAIM": 1, + "DAMAGES": 1, + "OTHER": 2, + "LIABILITY": 1, + "WHETHER": 1, + "AN": 1, + "ACTION": 1, + "CONTRACT": 1, + "TORT": 1, + "OTHERWISE": 1, + "ARISING": 1, + "FROM": 1, + "OUT": 1, + "CONNECTION": 1, + "WITH": 1, + "USE": 1, + "DEALINGS": 1, + "SOFTWARE.": 1, + "*/": 1, + "-": 978, + "CLASS": 2, + "CL_CSV_PARSER": 6, + "DEFINITION": 2, + "class": 2, + "cl_csv_parser": 2, + "definition": 1, + "public": 3, + "inheriting": 1, + "from": 1, + "cl_object": 1, + "final": 1, + "create": 1, + ".": 9, + "section.": 3, + "not": 3, + "include": 3, + "other": 3, + "source": 3, + "here": 3, + "type": 11, + "pools": 1, + "abap": 1, + "methods": 2, + "constructor": 2, + "importing": 1, + "delegate": 1, + "ref": 1, + "if_csv_parser_delegate": 1, + "csvstring": 1, + "string": 1, + "separator": 1, + "skip_first_line": 1, + "abap_bool": 2, + "parse": 2, + "raising": 1, + "cx_csv_parse_error": 2, + "protected": 1, + "private": 1, + "constants": 1, + "_textindicator": 1, + "value": 2, + "IMPLEMENTATION": 2, + "implementation.": 1, + "": 2, + "+": 9, + "|": 7, + "Instance": 2, + "Public": 1, + "Method": 2, + "CONSTRUCTOR": 1, + "[": 5, + "]": 5, + "DELEGATE": 1, + "TYPE": 5, + "REF": 1, + "IF_CSV_PARSER_DELEGATE": 1, + "CSVSTRING": 1, + "STRING": 1, + "SEPARATOR": 1, + "C": 1, + "SKIP_FIRST_LINE": 1, + "ABAP_BOOL": 1, + "": 2, + "method": 2, + "constructor.": 1, + "super": 1, + "_delegate": 1, + "delegate.": 1, + "_csvstring": 2, + "csvstring.": 1, + "_separator": 1, + "separator.": 1, + "_skip_first_line": 1, + "skip_first_line.": 1, + "endmethod.": 2, + "Get": 1, + "lines": 4, + "data": 3, + "is_first_line": 1, + "abap_true.": 2, + "standard": 2, + "table": 3, + "string.": 3, + "_lines": 1, + "field": 1, + "symbols": 1, + "": 3, + "loop": 1, + "at": 2, + "assigning": 1, + "Parse": 1, + "line": 1, + "values": 2, + "_parse_line": 2, + "Private": 1, + "_LINES": 1, + "<": 1, + "RETURNING": 1, + "STRINGTAB": 1, + "_lines.": 1, + "split": 1, + "cl_abap_char_utilities": 1, + "cr_lf": 1, + "into": 6, + "returning.": 1, + "Space": 2, + "concatenate": 4, + "csvvalue": 6, + "csvvalue.": 5, + "else.": 4, + "char": 2, + "endif.": 6, + "This": 1, + "indicates": 1, + "an": 1, + "error": 1, + "CSV": 1, + "formatting": 1, + "text_ended": 1, + "message": 2, + "e003": 1, + "csv": 1, + "msg.": 2, + "raise": 1, + "exception": 1, + "exporting": 1, + "endwhile.": 2, + "append": 2, + "csvvalues.": 2, + "clear": 1, + "pos": 2, + "endclass.": 1 + }, "ApacheConf": { "ServerSignature": 1, "Off": 1, @@ -1152,64 +1486,23 @@ "TwilioAPI.getDefaultAccount": 1 }, "AppleScript": { - "set": 108, - "windowWidth": 3, - "to": 128, - "windowHeight": 3, - "delay": 3, - "AppleScript": 2, - "s": 3, - "text": 13, - "item": 13, - "delimiters": 1, - "tell": 40, - "application": 16, - "screen_width": 2, - "(": 89, - "do": 4, - "JavaScript": 2, - "in": 13, - "document": 2, - ")": 88, - "screen_height": 2, - "end": 67, - "myFrontMost": 3, - "name": 8, - "of": 72, - "first": 1, - "processes": 2, - "whose": 1, - "frontmost": 1, - "is": 40, - "true": 8, - "{": 32, - "desktopTop": 2, - "desktopLeft": 1, - "desktopRight": 1, - "desktopBottom": 1, - "}": 32, - "bounds": 2, - "desktop": 1, - "try": 10, - "process": 5, - "w": 5, - "h": 4, - "size": 5, - "drawer": 2, - "window": 5, - "on": 18, - "error": 3, - "position": 1, - "-": 57, - "/": 2, "property": 7, "type_list": 6, + "{": 32, + "}": 32, "extension_list": 6, + "-": 57, "html": 2, + "is": 40, "not": 5, "currently": 2, "handled": 2, + "on": 18, "run": 4, + "tell": 40, + "application": 16, + "to": 128, + "set": 108, "FinderSelection": 4, "the": 56, "selection": 2, @@ -1226,14 +1519,18 @@ "handler": 2, "SelectionCount": 6, "number": 6, + "of": 72, "count": 10, "if": 50, "then": 28, "userPicksFolder": 6, + "(": 89, + ")": 88, "else": 14, "MyPath": 4, "path": 6, "me": 2, + "item": 13, "If": 2, "I": 2, "m": 2, @@ -1241,6 +1538,7 @@ "double": 2, "clicked": 2, "droplet": 2, + "end": 67, "these_items": 18, "choose": 2, "file": 6, @@ -1256,25 +1554,32 @@ "info": 4, "for": 5, "folder": 10, + "true": 8, "processFolder": 8, "false": 9, "and": 7, + "in": 13, "or": 6, + "name": 8, "extension": 4, "theFilePath": 8, "string": 17, "thePOSIXFilePath": 8, "POSIX": 4, "processFile": 8, + "process": 5, "folders": 2, "theFolder": 6, "without": 2, "invisibles": 2, + "text": 13, "&": 63, "thePOSIXFileName": 6, + "try": 10, "terminalCommand": 6, "convertCommand": 4, "newFileName": 4, + "do": 4, "shell": 2, "script": 2, "need": 1, @@ -1304,6 +1609,7 @@ "subject": 1, "visible": 2, "font": 2, + "size": 5, "theMailboxes": 2, "mailboxes": 1, "returns": 2, @@ -1358,24 +1664,31 @@ "enabled": 2, "tab": 1, "group": 1, + "window": 5, "click": 1, "radio": 1, + "delay": 3, "get": 1, "value": 1, "field": 1, "isVoiceOverRunning": 3, "isRunning": 3, + "processes": 2, "contains": 1, "isVoiceOverRunningWithAppleScript": 3, "isRunningWithAppleScript": 3, + "AppleScript": 2, "VoiceOver": 1, "x": 1, + "bounds": 2, "vo": 1, "cursor": 1, + "error": 3, "currentDate": 3, "date": 1, "amPM": 4, "currentHour": 9, + "s": 3, "minutes": 2, "<": 2, "below": 1, @@ -1392,7 +1705,28 @@ "currentTime": 3, "day": 1, "output": 1, - "say": 1 + "say": 1, + "windowWidth": 3, + "windowHeight": 3, + "delimiters": 1, + "screen_width": 2, + "JavaScript": 2, + "document": 2, + "screen_height": 2, + "myFrontMost": 3, + "first": 1, + "whose": 1, + "frontmost": 1, + "desktopTop": 2, + "desktopLeft": 1, + "desktopRight": 1, + "desktopBottom": 1, + "desktop": 1, + "w": 5, + "h": 4, + "drawer": 2, + "position": 1, + "/": 2 }, "Arduino": { "void": 2, @@ -1411,79 +1745,192 @@ "Hello": 1, "World": 1 }, + "Awk": { + "SHEBANG#!awk": 1, + "BEGIN": 1, + "{": 17, + "n": 13, + ";": 55, + "printf": 1, + "network_max_bandwidth_in_byte": 3, + "network_max_packet_per_second": 3, + "last3": 3, + "last4": 3, + "last5": 3, + "last6": 3, + "}": 17, + "if": 14, + "(": 14, + "/Average/": 1, + ")": 14, + "#": 48, + "Skip": 1, + "the": 12, + "Average": 1, + "values": 1, + "next": 1, + "/all/": 1, + "This": 8, + "is": 7, + "cpu": 1, + "info": 7, + "print": 35, + "FILENAME": 35, + "-": 2, + "/eth0/": 1, + "eth0": 1, + "network": 1, + "Total": 9, + "number": 9, + "of": 22, + "packets": 4, + "received": 4, + "per": 14, + "second.": 8, + "else": 4, + "transmitted": 4, + "bytes": 4, + "/proc": 1, + "|": 4, + "cswch": 1, + "tps": 1, + "kbmemfree": 1, + "totsck/": 1, + "/": 2, + "[": 1, + "]": 1, + "proc/s": 1, + "context": 1, + "switches": 1, + "second": 6, + "disk": 1, + "total": 1, + "transfers": 1, + "read": 1, + "requests": 2, + "write": 1, + "block": 2, + "reads": 1, + "writes": 1, + "mem": 1, + "Amount": 7, + "free": 2, + "memory": 6, + "available": 1, + "in": 11, + "kilobytes.": 7, + "used": 8, + "does": 1, + "not": 1, + "take": 1, + "into": 1, + "account": 1, + "by": 4, + "kernel": 3, + "itself.": 1, + "Percentage": 2, + "memory.": 1, + "X": 1, + "shared": 1, + "system": 1, + "Always": 1, + "zero": 1, + "with": 1, + "kernels.": 1, + "as": 1, + "buffers": 1, + "to": 1, + "cache": 1, + "data": 1, + "swap": 3, + "space": 2, + "space.": 1, + "socket": 1, + "sockets.": 1, + "Number": 4, + "TCP": 1, + "sockets": 3, + "currently": 4, + "use.": 4, + "UDP": 1, + "RAW": 1, + "IP": 1, + "fragments": 1, + "END": 1 + }, "C": { - "#include": 138, - "const": 326, - "char": 394, + "#include": 149, + "const": 357, + "char": 529, "*blob_type": 2, - ";": 4325, - "struct": 224, + ";": 5439, + "struct": 359, "blob": 6, "*lookup_blob": 2, - "(": 5104, - "unsigned": 134, + "(": 6213, + "unsigned": 140, "*sha1": 16, - ")": 5106, - "{": 1372, + ")": 6215, + "{": 1528, "object": 10, - "*obj": 5, + "*obj": 9, "lookup_object": 2, "sha1": 20, - "if": 938, - "obj": 18, - "return": 501, + "if": 1015, + "obj": 48, + "return": 529, "create_object": 2, "OBJ_BLOB": 3, "alloc_blob_node": 1, - "-": 1725, - "type": 28, + "-": 1803, + "type": 36, "error": 96, "sha1_to_hex": 8, "typename": 2, - "NULL": 281, - "}": 1385, - "*": 190, - "int": 359, + "NULL": 330, + "}": 1544, + "*": 253, + "int": 446, "parse_blob_buffer": 2, "*item": 10, - "void": 250, + "void": 279, "*buffer": 6, - "long": 99, - "size": 110, + "long": 105, + "size": 120, "item": 24, "object.parsed": 4, - "#ifndef": 70, + "#ifndef": 84, "BLOB_H": 2, - "#define": 684, - "extern": 35, - "#endif": 164, + "#define": 911, + "extern": 37, + "#endif": 236, "git_cache_init": 1, "git_cache": 4, "*cache": 4, - "size_t": 40, + "size_t": 52, "git_cached_obj_freeptr": 1, "free_ptr": 2, - "<": 185, + "<": 219, "git__size_t_powerof2": 1, "cache": 26, "size_mask": 6, "lru_count": 1, "free_obj": 4, "git_mutex_init": 1, - "&": 425, + "&": 442, "lock": 6, "nodes": 10, "git__malloc": 3, - "sizeof": 67, + "sizeof": 71, "git_cached_obj": 5, "GITERR_CHECK_ALLOC": 3, "memset": 4, "git_cache_free": 1, - "i": 363, + "i": 410, "for": 88, - "+": 543, - "[": 422, - "]": 422, + "+": 551, + "[": 597, + "]": 597, "git_cached_obj_decref": 3, "git__free": 15, "*git_cache_get": 1, @@ -1498,7 +1945,7 @@ "id": 13, "git_mutex_lock": 2, "node": 9, - "&&": 224, + "&&": 248, "git_oid_cmp": 6, "git_cached_obj_incref": 3, "result": 48, @@ -1508,10 +1955,10 @@ "*entry": 2, "_entry": 1, "entry": 17, - "else": 170, + "else": 190, "save_commit_buffer": 3, "*commit_type": 2, - "static": 80, + "static": 454, "commit": 59, "*check_commit": 1, "quiet": 5, @@ -1526,7 +1973,7 @@ "*ref_name": 2, "*c": 69, "lookup_commit_reference": 2, - "c": 247, + "c": 252, "die": 5, "_": 3, "ref_name": 2, @@ -1536,20 +1983,20 @@ "*lookup_commit": 2, "alloc_commit_node": 1, "*lookup_commit_reference_by_name": 2, - "*name": 6, + "*name": 12, "*commit": 10, "get_sha1": 1, - "name": 16, - "||": 133, + "name": 28, + "||": 141, "parse_commit": 3, "parse_commit_date": 2, - "*buf": 9, + "*buf": 10, "*tail": 2, "*dateptr": 1, - "buf": 56, + "buf": 57, "tail": 12, "memcmp": 6, - "while": 64, + "while": 70, "dateptr": 2, "strtoul": 2, "commit_graft": 13, @@ -1560,7 +2007,7 @@ "lo": 6, "hi": 5, "mi": 5, - "/": 7, + "/": 9, "*graft": 3, "cmp": 9, "graft": 10, @@ -1576,15 +2023,15 @@ "parent": 7, "commit_list": 35, "**pptr": 1, - "<=>": 15, + "<=>": 16, "bufptr": 12, "46": 1, "tree": 3, "5": 1, "45": 1, - "n": 37, + "n": 70, "bogus": 1, - "s": 139, + "s": 154, "get_sha1_hex": 2, "lookup_tree": 1, "pptr": 5, @@ -1614,9 +2061,9 @@ "*eol": 1, "*p": 9, "commit_buffer": 1, - "a": 28, + "a": 80, "b_date": 3, - "b": 23, + "b": 66, "a_date": 2, "*commit_list_get_next": 1, "*a": 9, @@ -1690,9 +2137,9 @@ "*line_separator": 1, "userformat_find_requirements": 1, "*fmt": 2, - "*w": 1, + "*w": 2, "format_commit_message": 1, - "*format": 1, + "*format": 2, "*context": 1, "pretty_print_commit": 1, "*pp": 4, @@ -1717,9 +2164,9 @@ "list": 1, "lifo": 1, "FLEX_ARRAY": 1, - "typedef": 138, + "typedef": 189, "*read_graft_line": 1, - "len": 29, + "len": 30, "*lookup_commit_graft": 1, "*get_merge_bases": 1, "*rev1": 1, @@ -1751,12 +2198,12 @@ "*revision": 1, "*patch_mode": 1, "**pathspec": 1, - "inline": 2, + "inline": 3, "single_parent": 1, "*reduce_heads": 1, "commit_extra_header": 7, "*key": 5, - "*value": 3, + "*value": 5, "append_merge_tag_headers": 1, "***tail": 1, "commit_tree": 1, @@ -1789,7 +2236,7 @@ "": 1, "": 1, "": 1, - "#ifdef": 52, + "#ifdef": 64, "CONFIG_SMP": 1, "DEFINE_MUTEX": 1, "cpu_add_remove_lock": 3, @@ -1804,7 +2251,7 @@ "task_struct": 5, "*active_writer": 1, "mutex": 1, - "refcount": 1, + "refcount": 2, "cpu_hotplug": 1, ".active_writer": 1, ".lock": 1, @@ -1818,16 +2265,16 @@ "cpu_hotplug.refcount": 3, "EXPORT_SYMBOL_GPL": 4, "put_online_cpus": 2, - "unlikely": 1, + "unlikely": 54, "wake_up_process": 1, "cpu_hotplug_begin": 4, - "likely": 1, - "break": 241, + "likely": 22, + "break": 244, "__set_current_state": 1, "TASK_UNINTERRUPTIBLE": 1, "schedule": 1, "cpu_hotplug_done": 4, - "#else": 59, + "#else": 94, "__ref": 6, "register_cpu_notifier": 2, "notifier_block": 3, @@ -1840,7 +2287,7 @@ "nr_to_call": 2, "*nr_calls": 1, "__raw_notifier_call_chain": 1, - "v": 7, + "v": 11, "nr_calls": 9, "notifier_to_errno": 1, "cpu_notify": 5, @@ -1856,8 +2303,8 @@ "rcu_read_lock": 1, "for_each_process": 2, "p": 60, - "*t": 1, - "t": 27, + "*t": 2, + "t": 32, "find_lock_task_mm": 1, "cpumask_clear_cpu": 5, "mm_cpumask": 1, @@ -1876,7 +2323,7 @@ "KERN_WARNING": 3, "comm": 1, "task_pid_nr": 1, - "flags": 86, + "flags": 89, "write_unlock_irq": 1, "take_cpu_down_param": 3, "mod": 13, @@ -1888,7 +2335,7 @@ "err": 38, "__cpu_disable": 1, "CPU_DYING": 1, - "|": 123, + "|": 132, "param": 2, "hcpu": 10, "_cpu_down": 3, @@ -1903,7 +2350,7 @@ "CPU_DOWN_PREPARE": 1, "CPU_DOWN_FAILED": 2, "__func__": 2, - "goto": 93, + "goto": 159, "out_release": 3, "__stop_machine": 1, "cpumask_of": 1, @@ -1934,8 +2381,8 @@ "*pgdat": 1, "cpu_possible": 1, "KERN_ERR": 5, - "#if": 46, - "defined": 25, + "#if": 92, + "defined": 42, "CONFIG_IA64": 1, "cpu_to_node": 1, "node_online": 1, @@ -1978,13 +2425,13 @@ "cpu_hotplug_pm_callback": 2, "action": 2, "*ptr": 1, - "switch": 40, - "case": 258, + "switch": 46, + "case": 273, "PM_SUSPEND_PREPARE": 1, "PM_HIBERNATION_PREPARE": 1, "PM_POST_SUSPEND": 1, "PM_POST_HIBERNATION": 1, - "default": 30, + "default": 33, "NOTIFY_DONE": 1, "NOTIFY_OK": 1, "cpu_hotplug_pm_sync_init": 2, @@ -1994,9 +2441,9 @@ "cpumask_test_cpu": 1, "CPU_STARTING_FROZEN": 1, "MASK_DECLARE_1": 3, - "x": 24, + "x": 57, "UL": 1, - "<<": 55, + "<<": 56, "MASK_DECLARE_2": 3, "MASK_DECLARE_4": 3, "MASK_DECLARE_8": 9, @@ -2053,7 +2500,7 @@ "git_buf_free": 4, "diff_pathspec_is_interesting": 2, "*str": 1, - "count": 15, + "count": 17, "false": 77, "true": 73, "str": 162, @@ -2095,7 +2542,7 @@ "*d": 1, "git_pool": 4, "*pool": 3, - "d": 12, + "d": 16, "fail": 19, "*diff_delta__merge_like_cgit": 1, "*b": 6, @@ -2138,7 +2585,7 @@ "new_oid": 3, "git_oid_iszero": 2, "*diff_strdup_prefix": 1, - "strlen": 16, + "strlen": 17, "git_pool_strcat": 1, "git_pool_strndup": 1, "diff_delta__cmp": 3, @@ -2283,15 +2730,15 @@ "onto_pool": 7, "git_vector": 1, "onto_new": 6, - "j": 202, + "j": 206, "onto": 7, "from": 16, "deltas.length": 4, - "*o": 4, + "*o": 8, "GIT_VECTOR_GET": 2, "*f": 2, - "f": 180, - "o": 18, + "f": 184, + "o": 80, "diff_delta__merge_like_cgit": 1, "git_vector_swap": 1, "git_pool_swap": 1, @@ -2306,13 +2753,13 @@ "want": 3, "pager_command_config": 2, "*var": 1, - "*data": 11, + "*data": 12, "data": 69, "prefixcmp": 3, "var": 7, "cmd": 46, "git_config_maybe_bool": 1, - "value": 5, + "value": 9, "xstrdup": 2, "check_pager_config": 3, "c.cmd": 1, @@ -2357,7 +2804,7 @@ "have_repository": 1, "trace_repo_setup": 1, "setup_work_tree": 1, - "fn": 1, + "fn": 5, "fstat": 1, "fileno": 1, "stdout": 5, @@ -2482,7 +2929,7 @@ "STRBUF_INIT": 1, "*tmp": 1, "strbuf_addf": 1, - "tmp": 2, + "tmp": 6, "cmd.buf": 1, "run_command_v_opt": 1, "RUN_SILENT_EXEC_FAILURE": 1, @@ -2530,7 +2977,7 @@ "HELLO_H": 2, "hello": 1, "": 5, - "": 1, + "": 2, "": 3, "": 3, "": 4, @@ -2540,11 +2987,11 @@ "HTTP_PARSER_DEBUG": 4, "SET_ERRNO": 47, "e": 4, - "do": 15, + "do": 21, "parser": 334, "http_errno": 11, "error_lineno": 3, - "__LINE__": 1, + "__LINE__": 50, "CALLBACK_NOTIFY_": 3, "FOR": 11, "ER": 4, @@ -2575,7 +3022,7 @@ "string": 18, "#string": 1, "HTTP_METHOD_MAP": 3, - "#undef": 6, + "#undef": 7, "tokens": 5, "int8_t": 3, "unhex": 3, @@ -2672,15 +3119,15 @@ "classes": 1, "depends": 1, "on": 4, - "strict": 1, + "strict": 2, "define": 14, "CR": 18, - "r": 5, + "r": 58, "LF": 21, "LOWER": 7, "0x20": 1, "IS_ALPHA": 5, - "z": 1, + "z": 47, "IS_NUM": 14, "9": 1, "IS_ALPHANUM": 3, @@ -2728,7 +3175,7 @@ "HPE_INVALID_CONSTANT": 3, "method": 39, "HTTP_HEAD": 2, - "index": 57, + "index": 58, "STRICT_CHECK": 15, "HPE_INVALID_VERSION": 12, "http_major": 11, @@ -2794,17 +3241,17 @@ "Does": 1, "the": 91, "need": 5, - "to": 36, + "to": 37, "see": 2, "an": 2, "EOF": 26, "find": 1, "end": 48, - "of": 43, - "message": 1, + "of": 44, + "message": 3, "http_should_keep_alive": 2, "http_method_str": 1, - "m": 3, + "m": 8, "http_parser_init": 2, "http_parser_type": 3, "http_errno_name": 1, @@ -2820,7 +3267,7 @@ "http_parser_url_fields": 2, "uf": 14, "old_uf": 4, - "u": 10, + "u": 18, "port": 7, "field_set": 5, "UF_MAX": 3, @@ -2838,13 +3285,13 @@ "paused": 3, "HPE_PAUSED": 2, "http_parser_h": 2, - "__cplusplus": 8, + "__cplusplus": 18, "HTTP_PARSER_VERSION_MAJOR": 1, "HTTP_PARSER_VERSION_MINOR": 1, "": 2, - "_WIN32": 2, + "_WIN32": 3, "__MINGW32__": 1, - "_MSC_VER": 4, + "_MSC_VER": 5, "__int8": 2, "__int16": 2, "int16_t": 1, @@ -2916,7 +3363,7 @@ "HTTP_ERRNO_GEN": 3, "HPE_##n": 1, "HTTP_PARSER_ERRNO_LINE": 2, - "short": 3, + "short": 6, "http_cb": 3, "on_message_begin": 1, "http_data_cb": 4, @@ -2966,7 +3413,7 @@ "find_block_tag": 1, "work.size": 5, "cb.blockhtml": 6, - "ob": 8, + "ob": 14, "opaque": 8, "parse_table_row": 1, "columns": 3, @@ -3171,10 +3618,10 @@ "VALUE": 13, "rb_cRDiscount": 4, "rb_rdiscount_to_html": 2, - "self": 6, + "self": 9, "*res": 2, "szres": 8, - "encoding": 13, + "encoding": 14, "rb_funcall": 14, "rb_intern": 15, "rb_str_buf_new": 2, @@ -3222,11 +3669,11 @@ "": 2, "": 1, "": 1, - "": 2, + "": 3, "": 1, "sharedObjectsStruct": 1, "shared": 1, - "double": 7, + "double": 126, "R_Zero": 2, "R_PosInf": 2, "R_NegInf": 2, @@ -3377,7 +3824,7 @@ "bitopCommand": 1, "bitcountCommand": 1, "redisLogRaw": 3, - "level": 11, + "level": 12, "syslogLevelMap": 2, "LOG_DEBUG": 1, "LOG_INFO": 1, @@ -3469,7 +3916,7 @@ "key": 9, "dictGenHashFunction": 5, "dictSdsHash": 4, - "char*": 158, + "char*": 166, "dictSdsCaseHash": 2, "dictGenCaseHashFunction": 1, "dictEncObjKeyCompare": 4, @@ -3489,7 +3936,7 @@ "clusterNodesDictType": 1, "htNeedsResize": 3, "dict": 11, - "*dict": 2, + "*dict": 5, "used": 10, "dictSlots": 3, "dictSize": 10, @@ -3590,7 +4037,7 @@ "listNode": 4, "*head": 1, "listRotate": 1, - "head": 2, + "head": 3, "listFirst": 2, "listNodeValue": 3, "run_with_period": 6, @@ -3704,7 +4151,7 @@ "shared.lpop": 1, "REDIS_SHARED_INTEGERS": 1, "shared.integers": 2, - "void*": 134, + "void*": 135, "REDIS_SHARED_BULKHDR_LEN": 1, "shared.mbulkhdr": 1, "shared.bulkhdr": 1, @@ -3929,14 +4376,14 @@ "addReplyMultiBulkLen": 1, "addReplyBulkLongLong": 2, "bytesToHuman": 3, - "*s": 2, + "*s": 3, "sprintf": 10, "n/": 3, "LL*1024*1024": 2, "LL*1024*1024*1024": 1, "genRedisInfoString": 2, "*section": 2, - "info": 63, + "info": 64, "uptime": 2, "rusage": 1, "self_ru": 2, @@ -3962,8 +4409,8 @@ "name.release": 1, "name.machine": 1, "aeGetApiName": 1, - "__GNUC__": 2, - "__GNUC_MINOR__": 1, + "__GNUC__": 7, + "__GNUC_MINOR__": 2, "__GNUC_PATCHLEVEL__": 1, "uptime/": 1, "*24": 1, @@ -4006,7 +4453,7 @@ "REDIS_REPL_WAIT_BGSAVE_END": 1, "REDIS_REPL_SEND_BULK": 1, "REDIS_REPL_ONLINE": 1, - "float": 18, + "float": 26, "self_ru.ru_stime.tv_sec": 1, "self_ru.ru_stime.tv_usec/1000000": 1, "self_ru.ru_utime.tv_sec": 1, @@ -4028,7 +4475,7 @@ "slaves": 3, "obuf_bytes": 3, "getClientOutputBufferMemoryUsage": 1, - "k": 7, + "k": 15, "keys_freed": 3, "bestval": 5, "bestkey": 9, @@ -4050,7 +4497,7 @@ "daemonize": 2, "STDIN_FILENO": 1, "STDERR_FILENO": 2, - "version": 3, + "version": 4, "usage": 2, "redisAsciiArt": 2, "*16": 2, @@ -4181,7 +4628,7 @@ "RF_LITTLE_ENDIAN": 23, "fread": 12, "endianess": 40, - "needed": 9, + "needed": 10, "rfUTILS_SwapEndianUS": 10, "RF_HEXGE_US": 4, "xD800": 8, @@ -4218,7 +4665,7 @@ "opening": 2, "bracket": 4, "calling": 4, - "C": 13, + "C": 14, "xA": 1, "RF_CR": 1, "xD": 1, @@ -4253,14 +4700,14 @@ "i_MODE_": 2, "i_rfLMS_WRAP2": 5, "rfPclose": 1, - "stream": 2, + "stream": 3, "///closing": 1, "#endif//include": 1, "guards": 2, "": 1, "": 2, "local": 5, - "stack": 5, + "stack": 6, "memory": 4, "RF_OPTION_DEFAULT_ARGUMENTS": 24, "RF_String*": 222, @@ -4284,7 +4731,7 @@ "RF_UTF16_BE": 7, "codepoints": 44, "i/2": 2, - "#elif": 10, + "#elif": 14, "RF_UTF32_LE": 3, "RF_UTF32_BE": 3, "UTF16": 4, @@ -4456,7 +4903,7 @@ "RF_CASE_IGNORE": 2, "strstr": 2, "RF_MATCH_WORD": 5, - "exact": 4, + "exact": 6, "": 1, "0x5a": 1, "0x7a": 1, @@ -4770,7 +5217,7 @@ "i_SELECT_RF_STRING_INIT": 1, "i_SELECT_RF_STRING_INIT1": 1, "i_SELECT_RF_STRING_INIT0": 1, - "code": 2, + "code": 6, "i_SELECT_RF_STRING_CREATE_NC": 1, "i_SELECT_RF_STRING_CREATE_NC1": 1, "i_SELECT_RF_STRING_CREATE_NC0": 1, @@ -4980,7 +5427,7 @@ "i_SELECT_RF_STRING_FWRITE0": 1, "rfString_Fwrite_fUTF8": 1, "closing": 1, - "#error": 2, + "#error": 4, "Attempted": 1, "manipulation": 1, "flag": 1, @@ -4989,6 +5436,981 @@ "added": 1, "you": 1, "#endif//": 1, + "PY_SSIZE_T_CLEAN": 1, + "Py_PYTHON_H": 1, + "Python": 2, + "headers": 1, + "compile": 1, + "extensions": 1, + "please": 1, + "install": 1, + "development": 1, + "Python.": 1, + "PY_VERSION_HEX": 11, + "Cython": 1, + "requires": 1, + ".": 1, + "offsetof": 2, + "member": 2, + "type*": 1, + "WIN32": 2, + "MS_WINDOWS": 2, + "__stdcall": 2, + "__cdecl": 2, + "__fastcall": 2, + "DL_IMPORT": 2, + "DL_EXPORT": 2, + "PY_LONG_LONG": 5, + "LONG_LONG": 1, + "Py_HUGE_VAL": 2, + "HUGE_VAL": 1, + "PYPY_VERSION": 1, + "CYTHON_COMPILING_IN_PYPY": 3, + "CYTHON_COMPILING_IN_CPYTHON": 6, + "Py_ssize_t": 35, + "PY_SSIZE_T_MAX": 1, + "INT_MAX": 1, + "PY_SSIZE_T_MIN": 1, + "INT_MIN": 1, + "PY_FORMAT_SIZE_T": 1, + "CYTHON_FORMAT_SSIZE_T": 2, + "PyInt_FromSsize_t": 6, + "PyInt_FromLong": 3, + "PyInt_AsSsize_t": 3, + "__Pyx_PyInt_AsInt": 2, + "PyNumber_Index": 1, + "PyNumber_Check": 2, + "PyFloat_Check": 2, + "PyNumber_Int": 1, + "PyErr_Format": 4, + "PyExc_TypeError": 4, + "Py_TYPE": 7, + "tp_name": 4, + "PyObject*": 24, + "__Pyx_PyIndex_Check": 3, + "PyComplex_Check": 1, + "PyIndex_Check": 2, + "PyErr_WarnEx": 1, + "category": 2, + "stacklevel": 1, + "PyErr_Warn": 1, + "__PYX_BUILD_PY_SSIZE_T": 2, + "Py_REFCNT": 1, + "ob_refcnt": 1, + "ob_type": 7, + "Py_SIZE": 1, + "PyVarObject*": 1, + "ob_size": 1, + "PyVarObject_HEAD_INIT": 1, + "PyObject_HEAD_INIT": 1, + "PyType_Modified": 1, + "PyObject": 276, + "itemsize": 1, + "readonly": 1, + "ndim": 2, + "*shape": 1, + "*strides": 1, + "*suboffsets": 1, + "*internal": 1, + "Py_buffer": 6, + "PyBUF_SIMPLE": 1, + "PyBUF_WRITABLE": 3, + "PyBUF_FORMAT": 3, + "PyBUF_ND": 2, + "PyBUF_STRIDES": 6, + "PyBUF_C_CONTIGUOUS": 1, + "PyBUF_F_CONTIGUOUS": 1, + "PyBUF_ANY_CONTIGUOUS": 1, + "PyBUF_INDIRECT": 2, + "PyBUF_RECORDS": 1, + "PyBUF_FULL": 1, + "PY_MAJOR_VERSION": 13, + "__Pyx_BUILTIN_MODULE_NAME": 2, + "__Pyx_PyCode_New": 2, + "l": 7, + "fv": 4, + "cell": 4, + "fline": 4, + "lnos": 4, + "PyCode_New": 2, + "PY_MINOR_VERSION": 1, + "PyUnicode_FromString": 2, + "PyUnicode_Decode": 1, + "Py_TPFLAGS_CHECKTYPES": 1, + "Py_TPFLAGS_HAVE_INDEX": 1, + "Py_TPFLAGS_HAVE_NEWBUFFER": 1, + "PyUnicode_KIND": 1, + "CYTHON_PEP393_ENABLED": 2, + "__Pyx_PyUnicode_READY": 2, + "op": 8, + "PyUnicode_IS_READY": 1, + "_PyUnicode_Ready": 1, + "__Pyx_PyUnicode_GET_LENGTH": 2, + "PyUnicode_GET_LENGTH": 1, + "__Pyx_PyUnicode_READ_CHAR": 2, + "PyUnicode_READ_CHAR": 1, + "__Pyx_PyUnicode_READ": 2, + "PyUnicode_READ": 1, + "PyUnicode_GET_SIZE": 1, + "Py_UCS4": 2, + "PyUnicode_AS_UNICODE": 1, + "Py_UNICODE*": 1, + "PyBaseString_Type": 1, + "PyUnicode_Type": 2, + "PyStringObject": 2, + "PyUnicodeObject": 1, + "PyString_Type": 2, + "PyString_Check": 2, + "PyUnicode_Check": 1, + "PyString_CheckExact": 2, + "PyUnicode_CheckExact": 1, + "PyBytesObject": 1, + "PyBytes_Type": 1, + "PyBytes_Check": 1, + "PyBytes_CheckExact": 1, + "PyBytes_FromString": 2, + "PyString_FromString": 2, + "PyBytes_FromStringAndSize": 1, + "PyString_FromStringAndSize": 1, + "PyBytes_FromFormat": 1, + "PyString_FromFormat": 1, + "PyBytes_DecodeEscape": 1, + "PyString_DecodeEscape": 1, + "PyBytes_AsString": 2, + "PyString_AsString": 1, + "PyBytes_AsStringAndSize": 1, + "PyString_AsStringAndSize": 1, + "PyBytes_Size": 1, + "PyString_Size": 1, + "PyBytes_AS_STRING": 1, + "PyString_AS_STRING": 1, + "PyBytes_GET_SIZE": 1, + "PyString_GET_SIZE": 1, + "PyBytes_Repr": 1, + "PyString_Repr": 1, + "PyBytes_Concat": 1, + "PyString_Concat": 1, + "PyBytes_ConcatAndDel": 1, + "PyString_ConcatAndDel": 1, + "PySet_Check": 1, + "PyObject_TypeCheck": 3, + "PySet_Type": 2, + "PyFrozenSet_Check": 1, + "PyFrozenSet_Type": 1, + "PySet_CheckExact": 2, + "__Pyx_TypeCheck": 1, + "PyTypeObject": 25, + "PyIntObject": 1, + "PyLongObject": 2, + "PyInt_Type": 1, + "PyLong_Type": 1, + "PyInt_Check": 1, + "PyLong_Check": 1, + "PyInt_CheckExact": 1, + "PyLong_CheckExact": 1, + "PyInt_FromString": 1, + "PyLong_FromString": 1, + "PyInt_FromUnicode": 1, + "PyLong_FromUnicode": 1, + "PyLong_FromLong": 1, + "PyInt_FromSize_t": 1, + "PyLong_FromSize_t": 1, + "PyLong_FromSsize_t": 1, + "PyInt_AsLong": 2, + "PyLong_AsLong": 1, + "PyInt_AS_LONG": 1, + "PyLong_AS_LONG": 1, + "PyLong_AsSsize_t": 1, + "PyInt_AsUnsignedLongMask": 1, + "PyLong_AsUnsignedLongMask": 1, + "PyInt_AsUnsignedLongLongMask": 1, + "PyLong_AsUnsignedLongLongMask": 1, + "PyBoolObject": 1, + "Py_hash_t": 1, + "__Pyx_PyInt_FromHash_t": 2, + "__Pyx_PyInt_AsHash_t": 2, + "__Pyx_PySequence_GetSlice": 2, + "PySequence_GetSlice": 2, + "__Pyx_PySequence_SetSlice": 2, + "PySequence_SetSlice": 2, + "__Pyx_PySequence_DelSlice": 2, + "PySequence_DelSlice": 2, + "PyErr_SetString": 3, + "PyExc_SystemError": 3, + "tp_as_mapping": 3, + "PyMethod_New": 2, + "func": 3, + "klass": 1, + "PyInstanceMethod_New": 1, + "__Pyx_GetAttrString": 2, + "PyObject_GetAttrString": 2, + "__Pyx_SetAttrString": 2, + "PyObject_SetAttrString": 2, + "__Pyx_DelAttrString": 2, + "PyObject_DelAttrString": 2, + "__Pyx_NAMESTR": 2, + "__Pyx_DOCSTR": 2, + "__Pyx_PyNumber_Divide": 2, + "y": 14, + "PyNumber_TrueDivide": 1, + "__Pyx_PyNumber_InPlaceDivide": 2, + "PyNumber_InPlaceTrueDivide": 1, + "PyNumber_Divide": 1, + "PyNumber_InPlaceDivide": 1, + "__PYX_EXTERN_C": 3, + "_USE_MATH_DEFINES": 1, + "__PYX_HAVE__sklearn__linear_model__sgd_fast": 1, + "__PYX_HAVE_API__sklearn__linear_model__sgd_fast": 1, + "_OPENMP": 1, + "": 1, + "PYREX_WITHOUT_ASSERTIONS": 1, + "CYTHON_WITHOUT_ASSERTIONS": 1, + "CYTHON_INLINE": 65, + "__inline__": 1, + "__inline": 1, + "__STDC_VERSION__": 2, + "L": 1, + "CYTHON_UNUSED": 14, + "**p": 1, + "is_unicode": 1, + "is_str": 1, + "intern": 1, + "__Pyx_StringTabEntry": 2, + "__Pyx_PyBytes_FromUString": 1, + "__Pyx_PyBytes_AsUString": 1, + "__Pyx_Owned_Py_None": 1, + "Py_INCREF": 10, + "Py_None": 8, + "__Pyx_PyBool_FromLong": 1, + "Py_True": 2, + "Py_False": 2, + "__Pyx_PyObject_IsTrue": 1, + "__Pyx_PyNumber_Int": 1, + "__Pyx_PyIndex_AsSsize_t": 1, + "__Pyx_PyInt_FromSize_t": 1, + "__Pyx_PyInt_AsSize_t": 1, + "__pyx_PyFloat_AsDouble": 12, + "PyFloat_CheckExact": 1, + "PyFloat_AS_DOUBLE": 1, + "PyFloat_AsDouble": 2, + "__pyx_PyFloat_AsFloat": 1, + "__builtin_expect": 2, + "*__pyx_m": 1, + "*__pyx_b": 1, + "*__pyx_empty_tuple": 1, + "*__pyx_empty_bytes": 1, + "__pyx_lineno": 58, + "__pyx_clineno": 58, + "__pyx_cfilenm": 1, + "__FILE__": 4, + "*__pyx_filename": 7, + "CYTHON_CCOMPLEX": 12, + "_Complex_I": 3, + "": 1, + "": 1, + "__sun__": 1, + "fj": 1, + "*__pyx_f": 1, + "IS_UNSIGNED": 1, + "__Pyx_StructField_": 2, + "__PYX_BUF_FLAGS_PACKED_STRUCT": 1, + "__Pyx_StructField_*": 1, + "fields": 1, + "arraysize": 1, + "typegroup": 1, + "is_unsigned": 1, + "__Pyx_TypeInfo": 2, + "__Pyx_TypeInfo*": 2, + "offset": 1, + "__Pyx_StructField": 2, + "__Pyx_StructField*": 1, + "field": 1, + "parent_offset": 1, + "__Pyx_BufFmt_StackElem": 1, + "root": 1, + "__Pyx_BufFmt_StackElem*": 2, + "fmt_offset": 1, + "new_count": 1, + "enc_count": 1, + "struct_alignment": 1, + "is_complex": 1, + "enc_type": 1, + "new_packmode": 1, + "enc_packmode": 1, + "is_valid_array": 1, + "__Pyx_BufFmt_Context": 1, + "npy_int8": 1, + "__pyx_t_5numpy_int8_t": 1, + "npy_int16": 1, + "__pyx_t_5numpy_int16_t": 1, + "npy_int32": 1, + "__pyx_t_5numpy_int32_t": 4, + "npy_int64": 1, + "__pyx_t_5numpy_int64_t": 1, + "npy_uint8": 1, + "__pyx_t_5numpy_uint8_t": 1, + "npy_uint16": 1, + "__pyx_t_5numpy_uint16_t": 1, + "npy_uint32": 1, + "__pyx_t_5numpy_uint32_t": 1, + "npy_uint64": 1, + "__pyx_t_5numpy_uint64_t": 1, + "npy_float32": 1, + "__pyx_t_5numpy_float32_t": 1, + "npy_float64": 1, + "__pyx_t_5numpy_float64_t": 4, + "npy_long": 1, + "__pyx_t_5numpy_int_t": 1, + "npy_longlong": 2, + "__pyx_t_5numpy_long_t": 1, + "__pyx_t_5numpy_longlong_t": 1, + "npy_ulong": 1, + "__pyx_t_5numpy_uint_t": 1, + "npy_ulonglong": 2, + "__pyx_t_5numpy_ulong_t": 1, + "__pyx_t_5numpy_ulonglong_t": 1, + "npy_intp": 1, + "__pyx_t_5numpy_intp_t": 1, + "npy_uintp": 1, + "__pyx_t_5numpy_uintp_t": 1, + "npy_double": 2, + "__pyx_t_5numpy_float_t": 1, + "__pyx_t_5numpy_double_t": 1, + "npy_longdouble": 1, + "__pyx_t_5numpy_longdouble_t": 1, + "__pyx_t_7sklearn_5utils_13weight_vector_DOUBLE": 2, + "__pyx_t_7sklearn_5utils_13weight_vector_INTEGER": 1, + "__pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE": 7, + "__pyx_t_7sklearn_5utils_11seq_dataset_INTEGER": 7, + "__pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE": 4, + "__pyx_t_7sklearn_12linear_model_8sgd_fast_INTEGER": 3, + "std": 8, + "complex": 2, + "__pyx_t_float_complex": 27, + "_Complex": 2, + "real": 2, + "imag": 2, + "__pyx_t_double_complex": 27, + "__pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction": 15, + "__pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression": 11, + "__pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber": 6, + "__pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset": 5, + "__pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive": 6, + "__pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification": 7, + "__pyx_obj_7sklearn_5utils_11seq_dataset_CSRDataset": 2, + "__pyx_obj_7sklearn_12linear_model_8sgd_fast_Log": 5, + "__pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge": 6, + "__pyx_obj_7sklearn_5utils_11seq_dataset_ArrayDataset": 2, + "__pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge": 6, + "__pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber": 5, + "__pyx_obj_7sklearn_5utils_13weight_vector_WeightVector": 3, + "__pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss": 5, + "__pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive": 6, + "npy_cfloat": 1, + "__pyx_t_5numpy_cfloat_t": 1, + "npy_cdouble": 2, + "__pyx_t_5numpy_cdouble_t": 1, + "npy_clongdouble": 1, + "__pyx_t_5numpy_clongdouble_t": 1, + "__pyx_t_5numpy_complex_t": 1, + "PyObject_HEAD": 3, + "__pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction": 5, + "*__pyx_vtab": 3, + "__pyx_base": 18, + "__pyx_vtabstruct_7sklearn_5utils_11seq_dataset_SequentialDataset": 4, + "n_samples": 1, + "epsilon": 2, + "current_index": 2, + "stride": 2, + "*X_data_ptr": 2, + "*X_indptr_ptr": 1, + "*X_indices_ptr": 1, + "*Y_data_ptr": 2, + "PyArrayObject": 8, + "*feature_indices": 2, + "*feature_indices_ptr": 2, + "*index": 2, + "*index_data_ptr": 2, + "*sample_weight_data": 2, + "threshold": 2, + "n_features": 2, + "__pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector": 3, + "*w_data_ptr": 1, + "wscale": 1, + "sq_norm": 1, + "*__pyx_vtabptr_7sklearn_5utils_11seq_dataset_SequentialDataset": 1, + "__pyx_vtabstruct_7sklearn_5utils_11seq_dataset_ArrayDataset": 2, + "*__pyx_vtabptr_7sklearn_5utils_11seq_dataset_ArrayDataset": 1, + "__pyx_vtabstruct_7sklearn_5utils_11seq_dataset_CSRDataset": 2, + "*__pyx_vtabptr_7sklearn_5utils_11seq_dataset_CSRDataset": 1, + "__pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive": 2, + "__pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Regression": 3, + "*__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive": 1, + "__pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredHinge": 2, + "*__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredHinge": 1, + "__pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Huber": 2, + "*__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Huber": 1, + "__pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Hinge": 2, + "__pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Classification": 1, + "*__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Hinge": 1, + "*__pyx_vtabptr_7sklearn_5utils_13weight_vector_WeightVector": 1, + "CYTHON_REFNANNY": 3, + "__Pyx_RefNannyAPIStruct": 3, + "*__Pyx_RefNanny": 1, + "*__Pyx_RefNannyImportAPI": 1, + "*modname": 1, + "__Pyx_RefNannyDeclarations": 11, + "*__pyx_refnanny": 1, + "WITH_THREAD": 1, + "__Pyx_RefNannySetupContext": 12, + "acquire_gil": 4, + "PyGILState_STATE": 1, + "__pyx_gilstate_save": 2, + "PyGILState_Ensure": 1, + "__pyx_refnanny": 8, + "__Pyx_RefNanny": 8, + "SetupContext": 3, + "PyGILState_Release": 1, + "__Pyx_RefNannyFinishContext": 14, + "FinishContext": 1, + "__Pyx_INCREF": 6, + "INCREF": 1, + "__Pyx_DECREF": 20, + "DECREF": 1, + "__Pyx_GOTREF": 24, + "GOTREF": 1, + "__Pyx_GIVEREF": 9, + "GIVEREF": 1, + "__Pyx_XINCREF": 2, + "__Pyx_XDECREF": 20, + "__Pyx_XGOTREF": 2, + "__Pyx_XGIVEREF": 5, + "Py_DECREF": 2, + "Py_XINCREF": 1, + "Py_XDECREF": 1, + "__Pyx_CLEAR": 1, + "__Pyx_XCLEAR": 1, + "*__Pyx_GetName": 1, + "__Pyx_ErrRestore": 1, + "*type": 4, + "*tb": 2, + "__Pyx_ErrFetch": 1, + "**type": 1, + "**value": 1, + "**tb": 1, + "__Pyx_Raise": 4, + "*cause": 1, + "__Pyx_RaiseArgtupleInvalid": 7, + "func_name": 2, + "num_min": 1, + "num_max": 1, + "num_found": 1, + "__Pyx_RaiseDoubleKeywordsError": 1, + "kw_name": 1, + "__Pyx_ParseOptionalKeywords": 4, + "*kwds": 1, + "**argnames": 1, + "*kwds2": 1, + "*values": 1, + "num_pos_args": 1, + "function_name": 1, + "__Pyx_ArgTypeTest": 1, + "none_allowed": 1, + "__Pyx_GetBufferAndValidate": 1, + "Py_buffer*": 2, + "dtype": 1, + "nd": 1, + "cast": 1, + "__Pyx_SafeReleaseBuffer": 1, + "__Pyx_TypeTest": 1, + "__Pyx_RaiseBufferFallbackError": 1, + "*__Pyx_GetItemInt_Generic": 1, + "*r": 7, + "PyObject_GetItem": 1, + "__Pyx_GetItemInt_List": 1, + "to_py_func": 6, + "__Pyx_GetItemInt_List_Fast": 1, + "__Pyx_GetItemInt_Generic": 6, + "*__Pyx_GetItemInt_List_Fast": 1, + "PyList_GET_SIZE": 5, + "PyList_GET_ITEM": 3, + "PySequence_GetItem": 3, + "__Pyx_GetItemInt_Tuple": 1, + "__Pyx_GetItemInt_Tuple_Fast": 1, + "*__Pyx_GetItemInt_Tuple_Fast": 1, + "PyTuple_GET_SIZE": 14, + "PyTuple_GET_ITEM": 15, + "__Pyx_GetItemInt": 1, + "__Pyx_GetItemInt_Fast": 2, + "PyList_CheckExact": 1, + "PyTuple_CheckExact": 1, + "PySequenceMethods": 1, + "*m": 1, + "tp_as_sequence": 1, + "sq_item": 2, + "sq_length": 2, + "PySequence_Check": 1, + "__Pyx_RaiseTooManyValuesError": 1, + "expected": 2, + "__Pyx_RaiseNeedMoreValuesError": 1, + "__Pyx_RaiseNoneNotIterableError": 1, + "__Pyx_IterFinish": 1, + "__Pyx_IternextUnpackEndCheck": 1, + "*retval": 1, + "shape": 1, + "strides": 1, + "suboffsets": 1, + "__Pyx_Buf_DimInfo": 2, + "pybuffer": 1, + "__Pyx_Buffer": 2, + "*rcbuffer": 1, + "diminfo": 1, + "__Pyx_LocalBuf_ND": 1, + "__Pyx_GetBuffer": 2, + "*view": 2, + "__Pyx_ReleaseBuffer": 2, + "PyObject_GetBuffer": 1, + "PyBuffer_Release": 1, + "__Pyx_zeros": 1, + "__Pyx_minusones": 1, + "*__Pyx_Import": 1, + "*from_list": 1, + "__Pyx_RaiseImportError": 1, + "__Pyx_Print": 1, + "__pyx_print": 1, + "__pyx_print_kwargs": 1, + "__Pyx_PrintOne": 1, + "__Pyx_CREAL": 4, + ".real": 3, + "__Pyx_CIMAG": 4, + ".imag": 3, + "__real__": 1, + "__imag__": 1, + "__Pyx_SET_CREAL": 2, + "__Pyx_SET_CIMAG": 2, + "__pyx_t_float_complex_from_parts": 1, + "__Pyx_c_eqf": 2, + "__Pyx_c_sumf": 2, + "__Pyx_c_difff": 2, + "__Pyx_c_prodf": 2, + "__Pyx_c_quotf": 2, + "__Pyx_c_negf": 2, + "__Pyx_c_is_zerof": 3, + "__Pyx_c_conjf": 3, + "conj": 3, + "__Pyx_c_absf": 3, + "abs": 2, + "__Pyx_c_powf": 3, + "pow": 2, + "conjf": 1, + "cabsf": 1, + "cpowf": 1, + "__pyx_t_double_complex_from_parts": 1, + "__Pyx_c_eq": 2, + "__Pyx_c_sum": 2, + "__Pyx_c_diff": 2, + "__Pyx_c_prod": 2, + "__Pyx_c_quot": 2, + "__Pyx_c_neg": 2, + "__Pyx_c_is_zero": 3, + "__Pyx_c_conj": 3, + "__Pyx_c_abs": 3, + "__Pyx_c_pow": 3, + "cabs": 1, + "cpow": 1, + "__Pyx_PyInt_AsUnsignedChar": 1, + "__Pyx_PyInt_AsUnsignedShort": 1, + "__Pyx_PyInt_AsUnsignedInt": 1, + "__Pyx_PyInt_AsChar": 1, + "__Pyx_PyInt_AsShort": 1, + "signed": 5, + "__Pyx_PyInt_AsSignedChar": 1, + "__Pyx_PyInt_AsSignedShort": 1, + "__Pyx_PyInt_AsSignedInt": 1, + "__Pyx_PyInt_AsLongDouble": 1, + "__Pyx_PyInt_AsUnsignedLong": 1, + "__Pyx_PyInt_AsUnsignedLongLong": 1, + "__Pyx_PyInt_AsLong": 1, + "__Pyx_PyInt_AsLongLong": 1, + "__Pyx_PyInt_AsSignedLong": 1, + "__Pyx_PyInt_AsSignedLongLong": 1, + "__Pyx_WriteUnraisable": 4, + "clineno": 1, + "lineno": 1, + "*filename": 2, + "__Pyx_check_binary_version": 1, + "__Pyx_SetVtable": 1, + "*vtable": 1, + "__Pyx_PyIdentifier_FromString": 3, + "*__Pyx_ImportModule": 1, + "*__Pyx_ImportType": 1, + "*module_name": 1, + "*class_name": 1, + "__Pyx_GetVtable": 1, + "code_line": 4, + "PyCodeObject*": 2, + "code_object": 2, + "__Pyx_CodeObjectCacheEntry": 1, + "__Pyx_CodeObjectCache": 2, + "max_count": 1, + "__Pyx_CodeObjectCacheEntry*": 2, + "entries": 2, + "__pyx_code_cache": 1, + "__pyx_bisect_code_objects": 1, + "PyCodeObject": 1, + "*__pyx_find_code_object": 1, + "__pyx_insert_code_object": 1, + "__Pyx_AddTraceback": 7, + "*funcname": 1, + "c_line": 1, + "py_line": 1, + "__Pyx_InitStrings": 1, + "*__pyx_ptype_7cpython_4type_type": 1, + "*__pyx_ptype_5numpy_dtype": 1, + "*__pyx_ptype_5numpy_flatiter": 1, + "*__pyx_ptype_5numpy_broadcast": 1, + "*__pyx_ptype_5numpy_ndarray": 1, + "*__pyx_ptype_5numpy_ufunc": 1, + "*__pyx_f_5numpy__util_dtypestring": 1, + "PyArray_Descr": 1, + "*__pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector": 1, + "*__pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset": 1, + "*__pyx_ptype_7sklearn_5utils_11seq_dataset_ArrayDataset": 1, + "*__pyx_ptype_7sklearn_5utils_11seq_dataset_CSRDataset": 1, + "*__pyx_ptype_7sklearn_12linear_model_8sgd_fast_LossFunction": 1, + "*__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Regression": 1, + "*__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Classification": 1, + "*__pyx_ptype_7sklearn_12linear_model_8sgd_fast_ModifiedHuber": 1, + "*__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Hinge": 1, + "*__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredHinge": 1, + "*__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Log": 1, + "*__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredLoss": 1, + "*__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Huber": 1, + "*__pyx_ptype_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive": 1, + "*__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive": 1, + "__pyx_f_7sklearn_12linear_model_8sgd_fast_max": 1, + "__pyx_f_7sklearn_12linear_model_8sgd_fast_min": 1, + "__pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm": 1, + "__pyx_f_7sklearn_12linear_model_8sgd_fast_l1penalty": 1, + "__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE": 1, + "__Pyx_MODULE_NAME": 1, + "__pyx_module_is_main_sklearn__linear_model__sgd_fast": 1, + "*__pyx_builtin_NotImplementedError": 1, + "*__pyx_builtin_range": 1, + "*__pyx_builtin_ValueError": 1, + "*__pyx_builtin_RuntimeError": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss": 2, + "*__pyx_v_self": 52, + "__pyx_v_p": 46, + "__pyx_v_y": 46, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_2dloss": 2, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss": 2, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_2dloss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_loss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_2dloss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_2dloss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_4__reduce__": 1, + "__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge___init__": 1, + "__pyx_v_threshold": 2, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_2loss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_4dloss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_6__reduce__": 1, + "__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge___init__": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_2loss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_4dloss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_6__reduce__": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_loss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_2dloss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_4__reduce__": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_2dloss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_4__reduce__": 1, + "__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber___init__": 1, + "__pyx_v_c": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_2loss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_4dloss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_6__reduce__": 1, + "__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive___init__": 1, + "__pyx_v_epsilon": 2, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_2loss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_4dloss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_6__reduce__": 1, + "__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive___init__": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_2loss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_4dloss": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_6__reduce__": 1, + "*__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd": 1, + "*__pyx_self": 1, + "*__pyx_v_weights": 1, + "__pyx_v_intercept": 1, + "*__pyx_v_loss": 1, + "__pyx_v_penalty_type": 1, + "__pyx_v_alpha": 1, + "__pyx_v_C": 1, + "__pyx_v_rho": 1, + "*__pyx_v_dataset": 1, + "__pyx_v_n_iter": 1, + "__pyx_v_fit_intercept": 1, + "__pyx_v_verbose": 1, + "__pyx_v_shuffle": 1, + "*__pyx_v_seed": 1, + "__pyx_v_weight_pos": 1, + "__pyx_v_weight_neg": 1, + "__pyx_v_learning_rate": 1, + "__pyx_v_eta0": 1, + "__pyx_v_power_t": 1, + "__pyx_v_t": 1, + "__pyx_v_intercept_decay": 1, + "__pyx_pf_5numpy_7ndarray___getbuffer__": 1, + "*__pyx_v_info": 2, + "__pyx_v_flags": 1, + "__pyx_pf_5numpy_7ndarray_2__releasebuffer__": 1, + "__pyx_k_1": 1, + "__pyx_k_2": 1, + "__pyx_k_3": 1, + "__pyx_k_4": 1, + "__pyx_k_6": 1, + "__pyx_k_8": 1, + "__pyx_k_10": 1, + "__pyx_k_12": 1, + "__pyx_k_13": 1, + "__pyx_k_16": 1, + "__pyx_k_20": 1, + "__pyx_k_21": 1, + "__pyx_k__B": 1, + "__pyx_k__C": 1, + "__pyx_k__H": 1, + "__pyx_k__I": 1, + "__pyx_k__L": 1, + "__pyx_k__O": 1, + "__pyx_k__Q": 1, + "__pyx_k__b": 1, + "__pyx_k__c": 1, + "__pyx_k__d": 1, + "__pyx_k__f": 1, + "__pyx_k__g": 1, + "__pyx_k__h": 1, + "__pyx_k__i": 1, + "__pyx_k__l": 1, + "__pyx_k__p": 1, + "__pyx_k__q": 1, + "__pyx_k__t": 1, + "__pyx_k__u": 1, + "__pyx_k__w": 1, + "__pyx_k__y": 1, + "__pyx_k__Zd": 1, + "__pyx_k__Zf": 1, + "__pyx_k__Zg": 1, + "__pyx_k__np": 1, + "__pyx_k__any": 1, + "__pyx_k__eta": 1, + "__pyx_k__rho": 1, + "__pyx_k__sys": 1, + "__pyx_k__eta0": 1, + "__pyx_k__loss": 1, + "__pyx_k__seed": 1, + "__pyx_k__time": 1, + "__pyx_k__xnnz": 1, + "__pyx_k__alpha": 1, + "__pyx_k__count": 1, + "__pyx_k__dloss": 1, + "__pyx_k__dtype": 1, + "__pyx_k__epoch": 1, + "__pyx_k__isinf": 1, + "__pyx_k__isnan": 1, + "__pyx_k__numpy": 1, + "__pyx_k__order": 1, + "__pyx_k__range": 1, + "__pyx_k__shape": 1, + "__pyx_k__zeros": 1, + "__pyx_k__n_iter": 1, + "__pyx_k__update": 1, + "__pyx_k__dataset": 1, + "__pyx_k__epsilon": 1, + "__pyx_k__float64": 1, + "__pyx_k__nonzero": 1, + "__pyx_k__power_t": 1, + "__pyx_k__shuffle": 1, + "__pyx_k__sumloss": 1, + "__pyx_k__t_start": 1, + "__pyx_k__verbose": 1, + "__pyx_k__weights": 1, + "__pyx_k____main__": 1, + "__pyx_k____test__": 1, + "__pyx_k__is_hinge": 1, + "__pyx_k__intercept": 1, + "__pyx_k__n_samples": 1, + "__pyx_k__plain_sgd": 1, + "__pyx_k__threshold": 1, + "__pyx_k__x_ind_ptr": 1, + "__pyx_k__ValueError": 1, + "__pyx_k__n_features": 1, + "__pyx_k__q_data_ptr": 1, + "__pyx_k__weight_neg": 1, + "__pyx_k__weight_pos": 1, + "__pyx_k__x_data_ptr": 1, + "__pyx_k__RuntimeError": 1, + "__pyx_k__class_weight": 1, + "__pyx_k__penalty_type": 1, + "__pyx_k__fit_intercept": 1, + "__pyx_k__learning_rate": 1, + "__pyx_k__sample_weight": 1, + "__pyx_k__intercept_decay": 1, + "__pyx_k__NotImplementedError": 1, + "*__pyx_kp_s_1": 1, + "*__pyx_kp_u_10": 1, + "*__pyx_kp_u_12": 1, + "*__pyx_kp_u_13": 1, + "*__pyx_kp_u_16": 1, + "*__pyx_kp_s_2": 1, + "*__pyx_kp_s_20": 1, + "*__pyx_n_s_21": 1, + "*__pyx_kp_s_3": 1, + "*__pyx_kp_s_4": 1, + "*__pyx_kp_u_6": 1, + "*__pyx_kp_u_8": 1, + "*__pyx_n_s__C": 1, + "*__pyx_n_s__NotImplementedError": 1, + "*__pyx_n_s__RuntimeError": 1, + "*__pyx_n_s__ValueError": 1, + "*__pyx_n_s____main__": 1, + "*__pyx_n_s____test__": 1, + "*__pyx_n_s__alpha": 1, + "*__pyx_n_s__any": 1, + "*__pyx_n_s__c": 1, + "*__pyx_n_s__class_weight": 1, + "*__pyx_n_s__count": 1, + "*__pyx_n_s__dataset": 1, + "*__pyx_n_s__dloss": 1, + "*__pyx_n_s__dtype": 1, + "*__pyx_n_s__epoch": 1, + "*__pyx_n_s__epsilon": 1, + "*__pyx_n_s__eta": 1, + "*__pyx_n_s__eta0": 1, + "*__pyx_n_s__fit_intercept": 1, + "*__pyx_n_s__float64": 1, + "*__pyx_n_s__i": 1, + "*__pyx_n_s__intercept": 1, + "*__pyx_n_s__intercept_decay": 1, + "*__pyx_n_s__is_hinge": 1, + "*__pyx_n_s__isinf": 1, + "*__pyx_n_s__isnan": 1, + "*__pyx_n_s__learning_rate": 1, + "*__pyx_n_s__loss": 1, + "*__pyx_n_s__n_features": 1, + "*__pyx_n_s__n_iter": 1, + "*__pyx_n_s__n_samples": 1, + "*__pyx_n_s__nonzero": 1, + "*__pyx_n_s__np": 1, + "*__pyx_n_s__numpy": 1, + "*__pyx_n_s__order": 1, + "*__pyx_n_s__p": 1, + "*__pyx_n_s__penalty_type": 1, + "*__pyx_n_s__plain_sgd": 1, + "*__pyx_n_s__power_t": 1, + "*__pyx_n_s__q": 1, + "*__pyx_n_s__q_data_ptr": 1, + "*__pyx_n_s__range": 1, + "*__pyx_n_s__rho": 1, + "*__pyx_n_s__sample_weight": 1, + "*__pyx_n_s__seed": 1, + "*__pyx_n_s__shape": 1, + "*__pyx_n_s__shuffle": 1, + "*__pyx_n_s__sumloss": 1, + "*__pyx_n_s__sys": 1, + "*__pyx_n_s__t": 1, + "*__pyx_n_s__t_start": 1, + "*__pyx_n_s__threshold": 1, + "*__pyx_n_s__time": 1, + "*__pyx_n_s__u": 1, + "*__pyx_n_s__update": 1, + "*__pyx_n_s__verbose": 1, + "*__pyx_n_s__w": 1, + "*__pyx_n_s__weight_neg": 1, + "*__pyx_n_s__weight_pos": 1, + "*__pyx_n_s__weights": 1, + "*__pyx_n_s__x_data_ptr": 1, + "*__pyx_n_s__x_ind_ptr": 1, + "*__pyx_n_s__xnnz": 1, + "*__pyx_n_s__y": 1, + "*__pyx_n_s__zeros": 1, + "*__pyx_int_15": 1, + "*__pyx_k_tuple_5": 1, + "*__pyx_k_tuple_7": 1, + "*__pyx_k_tuple_9": 1, + "*__pyx_k_tuple_11": 1, + "*__pyx_k_tuple_14": 1, + "*__pyx_k_tuple_15": 1, + "*__pyx_k_tuple_17": 1, + "*__pyx_k_tuple_18": 1, + "*__pyx_k_codeobj_19": 1, + "*__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_1loss": 3, + "*__pyx_args": 9, + "*__pyx_kwds": 9, + "__pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss": 1, + "__pyx_skip_dispatch": 6, + "__pyx_r": 39, + "*__pyx_t_1": 6, + "*__pyx_t_2": 3, + "*__pyx_t_3": 3, + "*__pyx_t_4": 3, + "__pyx_t_5": 12, + "__pyx_v_self": 15, + "tp_dictoffset": 3, + "__pyx_t_1": 69, + "PyObject_GetAttr": 3, + "__pyx_n_s__loss": 2, + "__pyx_filename": 51, + "__pyx_f": 42, + "__pyx_L1_error": 33, + "PyCFunction_Check": 3, + "PyCFunction_GET_FUNCTION": 3, + "PyCFunction": 3, + "__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_1loss": 1, + "__pyx_t_2": 21, + "PyFloat_FromDouble": 9, + "__pyx_t_3": 39, + "__pyx_t_4": 27, + "PyTuple_New": 3, + "PyTuple_SET_ITEM": 6, + "PyObject_Call": 6, + "PyErr_Occurred": 9, + "__pyx_L0": 18, + "__pyx_builtin_NotImplementedError": 3, + "__pyx_empty_tuple": 3, + "__pyx_doc_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss": 1, + "*__pyx_r": 6, + "**__pyx_pyargnames": 3, + "__pyx_n_s__p": 6, + "__pyx_n_s__y": 6, + "values": 30, + "__pyx_kwds": 15, + "kw_args": 15, + "pos_args": 12, + "__pyx_args": 21, + "__pyx_L5_argtuple_error": 12, + "PyDict_Size": 3, + "PyDict_GetItem": 6, + "__pyx_L3_error": 18, + "__pyx_pyargnames": 3, + "__pyx_L4_argument_unpacking_done": 6, + "__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss": 1, + "__pyx_vtab": 2, + "loss": 1, + "*__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_3dloss": 3, + "__pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_dloss": 1, + "__pyx_n_s__dloss": 1, + "__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_3dloss": 1, + "__pyx_doc_7sklearn_12linear_model_8sgd_fast_12LossFunction_2dloss": 1, + "__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_2dloss": 1, + "dloss": 1, + "*__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_1loss": 3, + "__pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_loss": 1, + "__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_1loss": 1, + "__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss": 1, + "__pyx_base.__pyx_vtab": 1, + "__pyx_base.loss": 1, "__wglew_h__": 2, "__WGLEW_H__": 1, "__wglext_h_": 2, @@ -5106,7 +6528,6 @@ "PFNWGLDELETEBUFFERREGIONARBPROC": 2, "hRegion": 3, "PFNWGLRESTOREBUFFERREGIONARBPROC": 2, - "y": 2, "width": 3, "height": 3, "xSrc": 1, @@ -6040,17 +7461,17 @@ "C++": { "class": 32, "Bar": 2, - "{": 298, + "{": 467, "protected": 4, - "char": 34, - "*name": 2, - ";": 848, + "char": 121, + "*name": 6, + ";": 2134, "public": 24, - "void": 65, + "void": 105, "hello": 2, - "(": 894, - ")": 896, - "}": 300, + "(": 2183, + ")": 2184, + "}": 466, "foo": 2, "cudaArray*": 1, "cu_array": 4, @@ -6064,24 +7485,24 @@ "cudaCreateChannelDesc": 1, "": 1, "cudaMallocArray": 1, - "&": 87, + "&": 98, "width": 5, "height": 5, "cudaMemcpyToArray": 1, "image": 1, "width*height*sizeof": 1, - "float": 2, + "float": 9, "cudaMemcpyHostToDevice": 1, "tex.addressMode": 2, - "[": 32, - "]": 32, + "[": 192, + "]": 192, "cudaAddressModeClamp": 2, "tex.filterMode": 1, "cudaFilterModePoint": 1, "tex.normalized": 1, "false": 40, "//": 230, - "do": 2, + "do": 5, "not": 2, "normalize": 1, "coordinates": 1, @@ -6089,60 +7510,60 @@ "dim3": 2, "blockDim": 2, "gridDim": 2, - "+": 40, + "+": 51, "blockDim.x": 2, - "-": 120, - "/": 9, + "-": 200, + "/": 11, "blockDim.y": 2, "kernel": 2, "<<": 16, - "<": 27, + "<": 51, "d_data": 1, "cudaUnbindTexture": 1, "//end": 1, "__global__": 1, "float*": 1, "odata": 2, - "int": 80, - "unsigned": 16, - "x": 19, + "int": 138, + "unsigned": 22, + "x": 48, "blockIdx.x*blockDim.x": 1, "threadIdx.x": 1, - "y": 4, + "y": 16, "blockIdx.y*blockDim.y": 1, "threadIdx.y": 1, - "if": 138, - "&&": 13, + "if": 263, + "&&": 24, "c": 52, "tex2D": 1, "y*width": 1, - "#include": 79, + "#include": 89, "": 1, "": 1, "": 2, - "static": 57, + "static": 254, "Env": 13, "*env_instance": 1, - "*": 13, - "NULL": 49, + "*": 159, + "NULL": 101, "*Env": 1, "instance": 4, "env_instance": 3, "new": 2, - "return": 114, + "return": 123, "QObject": 2, "QCoreApplication": 1, "parse": 3, - "const": 103, + "const": 114, "**envp": 1, "**env": 1, "**": 2, "QString": 20, "envvar": 2, - "name": 3, - "value": 5, + "name": 6, + "value": 9, "indexOfEquals": 5, - "for": 16, + "for": 18, "env": 3, "envp": 4, "*env": 1, @@ -6154,14 +7575,14 @@ "QVariantMap": 3, "asVariantMap": 2, "m_map": 2, - "#ifndef": 8, + "#ifndef": 20, "ENV_H": 3, - "#define": 9, + "#define": 187, "": 1, "Q_OBJECT": 1, "*instance": 1, "private": 10, - "#endif": 19, + "#endif": 77, "GDSDBREADER_H": 3, "": 1, "GDS_DIR": 1, @@ -6199,7 +7620,7 @@ "bool": 92, "noFatherRoot": 1, "Used": 1, - "to": 74, + "to": 75, "tell": 1, "this": 4, "node": 1, @@ -6207,17 +7628,17 @@ "root": 1, "so": 1, "hasn": 1, - "t": 8, + "t": 13, "in": 9, "argument": 1, "list": 2, - "of": 44, + "of": 45, "an": 2, "operator": 9, "overload.": 1, "A": 1, "friend": 7, - "stream": 4, + "stream": 5, "myclass.label": 2, "myclass.depth": 2, "myclass.userIndex": 2, @@ -6240,7 +7661,7 @@ "": 1, "using": 1, "namespace": 14, - "std": 18, + "std": 26, "main": 2, "cout": 1, "endl": 1, @@ -6263,7 +7684,7 @@ "EC_KEY_get0_group": 2, "ctx": 26, "BN_CTX_new": 2, - "goto": 24, + "goto": 155, "err": 26, "pub_key": 6, "EC_POINT_new": 4, @@ -6293,7 +7714,7 @@ "*Q": 1, "*rr": 1, "*zero": 1, - "n": 7, + "n": 28, "i": 47, "BN_CTX_start": 1, "order": 8, @@ -6303,7 +7724,7 @@ "BN_mul_word": 1, "BN_add": 1, "ecsig": 3, - "r": 9, + "r": 36, "field": 3, "EC_GROUP_get_curve_GFp": 1, "BN_cmp": 1, @@ -6326,7 +7747,7 @@ "BN_mod_inverse": 1, "sor": 3, "BN_mod_mul": 2, - "s": 5, + "s": 9, "eor": 3, "BN_CTX_end": 1, "CKey": 26, @@ -6342,13 +7763,13 @@ "throw": 4, "key_error": 6, "fSet": 7, - "b": 15, + "b": 57, "EC_KEY_dup": 1, "b.pkey": 2, "b.fSet": 2, "EC_KEY_copy": 1, "hash": 20, - "sizeof": 6, + "sizeof": 11, "vchSig": 18, "nSize": 2, "vchSig.clear": 2, @@ -6356,7 +7777,7 @@ "Shrink": 1, "fit": 1, "actual": 1, - "size": 1, + "size": 3, "SignCompact": 2, "uint256": 10, "vector": 14, @@ -6364,7 +7785,7 @@ "fOk": 3, "*sig": 2, "ECDSA_do_sign": 1, - "char*": 7, + "char*": 10, "sig": 11, "nBitsR": 3, "BN_num_bits": 2, @@ -6374,7 +7795,7 @@ "keyRec": 5, "1": 2, "GetPubKey": 5, - "break": 30, + "break": 32, "BN_bn2bin": 2, "/8": 2, "ECDSA_SIG_free": 2, @@ -6400,7 +7821,7 @@ "key2.GetPubKey": 1, "BITCOIN_KEY_H": 2, "": 1, - "": 1, + "": 2, "": 1, "definition": 1, "runtime_error": 2, @@ -6413,7 +7834,7 @@ "CPubKey": 11, "vchPubKey": 6, "vchPubKeyIn": 2, - "a": 34, + "a": 82, "a.vchPubKey": 3, "b.vchPubKey": 3, "IMPLEMENT_SERIALIZE": 1, @@ -6425,10 +7846,10 @@ "vchPubKey.begin": 1, "vchPubKey.end": 1, "vchPubKey.size": 3, - "||": 8, + "||": 17, "IsCompressed": 2, "Raw": 1, - "typedef": 5, + "typedef": 38, "secure_allocator": 2, "CPrivKey": 3, "EC_KEY*": 1, @@ -6442,13 +7863,13 @@ "GetPrivKey": 1, "SetPubKey": 1, "Sign": 1, - "#ifdef": 7, + "#ifdef": 16, "Q_OS_LINUX": 2, "": 1, - "#if": 4, + "#if": 42, "QT_VERSION": 1, "QT_VERSION_CHECK": 1, - "#error": 2, + "#error": 3, "Something": 1, "wrong": 1, "with": 3, @@ -6486,7 +7907,7 @@ "phantom.returnValue": 1, "QSCICOMMAND_H": 2, "__APPLE__": 4, - "extern": 2, + "extern": 4, "": 1, "": 2, "": 1, @@ -6559,7 +7980,7 @@ "document.": 8, "ScrollToStart": 1, "SCI_SCROLLTOSTART": 1, - "end": 15, + "end": 18, "ScrollToEnd": 1, "SCI_SCROLLTOEND": 1, "vertically": 1, @@ -6878,7 +8299,7 @@ "alter": 1, "layout": 1, "adding": 2, - "headers": 2, + "headers": 3, "footers": 2, "example.": 1, "Constructs": 1, @@ -6990,7 +8411,7 @@ "overflow": 1, "digits": 3, "c0_": 64, - "d": 6, + "d": 8, "HexValue": 2, "j": 4, "PushBack": 8, @@ -7027,12 +8448,12 @@ "next_.location.beg_pos": 3, "next_.location.end_pos": 4, "current_.token": 4, - "inline": 12, + "inline": 13, "IsByteOrderMark": 2, "xFEFF": 1, "xFFFE": 1, "start_position": 2, - "while": 6, + "while": 10, "IsWhiteSpace": 2, "IsLineTerminator": 6, "SkipSingleLineComment": 6, @@ -7047,7 +8468,7 @@ "case": 32, "ScanString": 3, "LTE": 1, - "else": 32, + "else": 42, "ASSIGN_SHL": 1, "SHL": 1, "GTE": 1, @@ -7112,7 +8533,7 @@ "X": 2, "E": 3, "l": 1, - "p": 1, + "p": 5, "w": 1, "keyword": 1, "Unescaped": 1, @@ -7130,7 +8551,7 @@ "CLASSIC_MODE": 2, "STRICT_MODE": 2, "EXTENDED_MODE": 2, - "|": 2, + "|": 7, "detect": 1, "x16": 1, "x36.": 1, @@ -7219,14 +8640,14 @@ "": 1, "dst": 2, "Scanner*": 2, - "self": 2, + "self": 5, "scanner_": 5, "complete_": 4, "StartLiteral": 2, "DropLiteral": 2, "Complete": 1, "TerminateLiteral": 2, - "struct": 2, + "struct": 7, "beg_pos": 5, "end_pos": 4, "kNoOctalLocation": 1, @@ -7294,7 +8715,7 @@ "QTemporaryFile": 1, "showUsage": 1, "QtMsgType": 1, - "type": 1, + "type": 6, "dump_path": 1, "minidump_id": 1, "void*": 1, @@ -7419,7 +8840,7 @@ "IncrementCallDepth": 1, "DecrementCallDepth": 1, "union": 1, - "double": 2, + "double": 23, "double_value": 1, "uint64_t": 2, "uint64_t_value": 1, @@ -7455,11 +8876,11 @@ "ExternalReference": 1, "CallOnce": 1, "V8_V8_H_": 3, - "defined": 6, + "defined": 21, "GOOGLE3": 2, "DEBUG": 3, "NDEBUG": 4, - "#undef": 1, + "#undef": 2, "both": 1, "set": 1, "Deserializer": 1, @@ -7473,7 +8894,727 @@ "kUndefinedValue": 1, "EqualityKind": 1, "kStrictEquality": 1, - "kNonStrictEquality": 1 + "kNonStrictEquality": 1, + "PY_SSIZE_T_CLEAN": 1, + "Py_PYTHON_H": 1, + "Python": 1, + "needed": 1, + "compile": 1, + "C": 1, + "extensions": 1, + "please": 1, + "install": 1, + "development": 1, + "version": 1, + "Python.": 1, + "#else": 24, + "": 1, + "offsetof": 2, + "member": 2, + "size_t": 3, + "type*": 1, + "WIN32": 2, + "MS_WINDOWS": 2, + "__stdcall": 2, + "__cdecl": 2, + "__fastcall": 2, + "DL_IMPORT": 2, + "DL_EXPORT": 2, + "PY_LONG_LONG": 5, + "LONG_LONG": 1, + "PY_VERSION_HEX": 9, + "METH_COEXIST": 1, + "PyDict_CheckExact": 1, + "op": 6, + "Py_TYPE": 4, + "PyDict_Type": 1, + "PyDict_Contains": 1, + "o": 20, + "PySequence_Contains": 1, + "Py_ssize_t": 17, + "PY_SSIZE_T_MAX": 1, + "INT_MAX": 1, + "PY_SSIZE_T_MIN": 1, + "INT_MIN": 1, + "PY_FORMAT_SIZE_T": 1, + "PyInt_FromSsize_t": 2, + "z": 46, + "PyInt_FromLong": 13, + "PyInt_AsSsize_t": 2, + "PyInt_AsLong": 2, + "PyNumber_Index": 1, + "PyNumber_Int": 1, + "PyIndex_Check": 1, + "PyNumber_Check": 1, + "PyErr_WarnEx": 1, + "category": 2, + "message": 2, + "stacklevel": 1, + "PyErr_Warn": 1, + "Py_REFCNT": 1, + "ob": 6, + "PyObject*": 16, + "ob_refcnt": 1, + "ob_type": 7, + "Py_SIZE": 1, + "PyVarObject*": 1, + "ob_size": 1, + "PyVarObject_HEAD_INIT": 1, + "PyObject_HEAD_INIT": 1, + "PyType_Modified": 1, + "*buf": 1, + "PyObject": 221, + "*obj": 2, + "len": 1, + "itemsize": 2, + "readonly": 2, + "ndim": 2, + "*format": 1, + "*shape": 1, + "*strides": 1, + "*suboffsets": 1, + "*internal": 1, + "Py_buffer": 5, + "PyBUF_SIMPLE": 1, + "PyBUF_WRITABLE": 1, + "PyBUF_FORMAT": 1, + "PyBUF_ND": 2, + "PyBUF_STRIDES": 5, + "PyBUF_C_CONTIGUOUS": 3, + "PyBUF_F_CONTIGUOUS": 3, + "PyBUF_ANY_CONTIGUOUS": 1, + "PyBUF_INDIRECT": 1, + "PY_MAJOR_VERSION": 10, + "__Pyx_BUILTIN_MODULE_NAME": 2, + "Py_TPFLAGS_CHECKTYPES": 1, + "Py_TPFLAGS_HAVE_INDEX": 1, + "Py_TPFLAGS_HAVE_NEWBUFFER": 1, + "PyBaseString_Type": 1, + "PyUnicode_Type": 2, + "PyStringObject": 2, + "PyUnicodeObject": 1, + "PyString_Type": 2, + "PyString_Check": 2, + "PyUnicode_Check": 1, + "PyString_CheckExact": 2, + "PyUnicode_CheckExact": 1, + "PyBytesObject": 1, + "PyBytes_Type": 1, + "PyBytes_Check": 1, + "PyBytes_CheckExact": 1, + "PyBytes_FromString": 2, + "PyString_FromString": 1, + "PyBytes_FromStringAndSize": 1, + "PyString_FromStringAndSize": 1, + "PyBytes_FromFormat": 1, + "PyString_FromFormat": 1, + "PyBytes_DecodeEscape": 1, + "PyString_DecodeEscape": 1, + "PyBytes_AsString": 2, + "PyString_AsString": 1, + "PyBytes_AsStringAndSize": 1, + "PyString_AsStringAndSize": 1, + "PyBytes_Size": 1, + "PyString_Size": 1, + "PyBytes_AS_STRING": 1, + "PyString_AS_STRING": 1, + "PyBytes_GET_SIZE": 1, + "PyString_GET_SIZE": 1, + "PyBytes_Repr": 1, + "PyString_Repr": 1, + "PyBytes_Concat": 1, + "PyString_Concat": 1, + "PyBytes_ConcatAndDel": 1, + "PyString_ConcatAndDel": 1, + "PySet_Check": 1, + "obj": 42, + "PyObject_TypeCheck": 3, + "PySet_Type": 2, + "PyFrozenSet_Check": 1, + "PyFrozenSet_Type": 1, + "PySet_CheckExact": 2, + "__Pyx_TypeCheck": 1, + "PyTypeObject": 2, + "PyIntObject": 1, + "PyLongObject": 2, + "PyInt_Type": 1, + "PyLong_Type": 1, + "PyInt_Check": 1, + "PyLong_Check": 1, + "PyInt_CheckExact": 1, + "PyLong_CheckExact": 1, + "PyInt_FromString": 1, + "PyLong_FromString": 1, + "PyInt_FromUnicode": 1, + "PyLong_FromUnicode": 1, + "PyLong_FromLong": 1, + "PyInt_FromSize_t": 1, + "PyLong_FromSize_t": 1, + "PyLong_FromSsize_t": 1, + "PyLong_AsLong": 1, + "PyInt_AS_LONG": 1, + "PyLong_AS_LONG": 1, + "PyLong_AsSsize_t": 1, + "PyInt_AsUnsignedLongMask": 1, + "PyLong_AsUnsignedLongMask": 1, + "PyInt_AsUnsignedLongLongMask": 1, + "PyLong_AsUnsignedLongLongMask": 1, + "PyBoolObject": 1, + "__Pyx_PyNumber_Divide": 2, + "PyNumber_TrueDivide": 1, + "__Pyx_PyNumber_InPlaceDivide": 2, + "PyNumber_InPlaceTrueDivide": 1, + "PyNumber_Divide": 1, + "PyNumber_InPlaceDivide": 1, + "__Pyx_PySequence_GetSlice": 2, + "PySequence_GetSlice": 2, + "__Pyx_PySequence_SetSlice": 2, + "PySequence_SetSlice": 2, + "__Pyx_PySequence_DelSlice": 2, + "PySequence_DelSlice": 2, + "unlikely": 69, + "PyErr_SetString": 4, + "PyExc_SystemError": 3, + "likely": 15, + "tp_as_mapping": 3, + "PyErr_Format": 4, + "PyExc_TypeError": 5, + "tp_name": 4, + "PyMethod_New": 2, + "func": 3, + "klass": 1, + "PyInstanceMethod_New": 1, + "__Pyx_GetAttrString": 2, + "PyObject_GetAttrString": 3, + "__Pyx_SetAttrString": 2, + "PyObject_SetAttrString": 2, + "__Pyx_DelAttrString": 2, + "PyObject_DelAttrString": 2, + "__Pyx_NAMESTR": 3, + "__Pyx_DOCSTR": 3, + "__cplusplus": 10, + "__PYX_EXTERN_C": 2, + "_USE_MATH_DEFINES": 1, + "": 1, + "__PYX_HAVE_API__wrapper_inner": 1, + "PYREX_WITHOUT_ASSERTIONS": 1, + "CYTHON_WITHOUT_ASSERTIONS": 1, + "CYTHON_INLINE": 68, + "__GNUC__": 5, + "__inline__": 1, + "#elif": 3, + "_MSC_VER": 1, + "__inline": 1, + "__STDC_VERSION__": 2, + "L": 1, + "CYTHON_UNUSED": 7, + "**p": 1, + "*s": 1, + "long": 5, + "encoding": 1, + "is_unicode": 1, + "is_str": 1, + "intern": 1, + "__Pyx_StringTabEntry": 1, + "__Pyx_PyBytes_FromUString": 1, + "__Pyx_PyBytes_AsUString": 1, + "__Pyx_PyBool_FromLong": 1, + "Py_INCREF": 3, + "Py_True": 2, + "Py_False": 2, + "__Pyx_PyObject_IsTrue": 8, + "__Pyx_PyNumber_Int": 1, + "__Pyx_PyIndex_AsSsize_t": 1, + "__Pyx_PyInt_FromSize_t": 1, + "__Pyx_PyInt_AsSize_t": 1, + "__pyx_PyFloat_AsDouble": 3, + "PyFloat_CheckExact": 1, + "PyFloat_AS_DOUBLE": 1, + "PyFloat_AsDouble": 1, + "__GNUC_MINOR__": 1, + "__builtin_expect": 2, + "*__pyx_m": 1, + "*__pyx_b": 1, + "*__pyx_empty_tuple": 1, + "*__pyx_empty_bytes": 1, + "__pyx_lineno": 80, + "__pyx_clineno": 80, + "__pyx_cfilenm": 1, + "__FILE__": 2, + "*__pyx_filename": 1, + "CYTHON_CCOMPLEX": 12, + "_Complex_I": 3, + "": 1, + "": 1, + "__sun__": 1, + "fj": 1, + "*__pyx_f": 1, + "npy_int8": 1, + "__pyx_t_5numpy_int8_t": 1, + "npy_int16": 1, + "__pyx_t_5numpy_int16_t": 1, + "npy_int32": 1, + "__pyx_t_5numpy_int32_t": 1, + "npy_int64": 1, + "__pyx_t_5numpy_int64_t": 1, + "npy_uint8": 1, + "__pyx_t_5numpy_uint8_t": 1, + "npy_uint16": 1, + "__pyx_t_5numpy_uint16_t": 1, + "npy_uint32": 1, + "__pyx_t_5numpy_uint32_t": 1, + "npy_uint64": 1, + "__pyx_t_5numpy_uint64_t": 1, + "npy_float32": 1, + "__pyx_t_5numpy_float32_t": 1, + "npy_float64": 1, + "__pyx_t_5numpy_float64_t": 1, + "npy_long": 1, + "__pyx_t_5numpy_int_t": 1, + "npy_longlong": 1, + "__pyx_t_5numpy_long_t": 1, + "npy_intp": 10, + "__pyx_t_5numpy_intp_t": 1, + "npy_uintp": 1, + "__pyx_t_5numpy_uintp_t": 1, + "npy_ulong": 1, + "__pyx_t_5numpy_uint_t": 1, + "npy_ulonglong": 1, + "__pyx_t_5numpy_ulong_t": 1, + "npy_double": 2, + "__pyx_t_5numpy_float_t": 1, + "__pyx_t_5numpy_double_t": 1, + "npy_longdouble": 1, + "__pyx_t_5numpy_longdouble_t": 1, + "complex": 2, + "__pyx_t_float_complex": 27, + "_Complex": 2, + "real": 2, + "imag": 2, + "__pyx_t_double_complex": 27, + "npy_cfloat": 1, + "__pyx_t_5numpy_cfloat_t": 1, + "npy_cdouble": 2, + "__pyx_t_5numpy_cdouble_t": 1, + "npy_clongdouble": 1, + "__pyx_t_5numpy_clongdouble_t": 1, + "__pyx_t_5numpy_complex_t": 1, + "CYTHON_REFNANNY": 3, + "__Pyx_RefNannyAPIStruct": 4, + "*__Pyx_RefNanny": 1, + "__Pyx_RefNannyImportAPI": 1, + "*modname": 1, + "*m": 1, + "*p": 1, + "*r": 1, + "m": 4, + "PyImport_ImportModule": 1, + "modname": 1, + "PyLong_AsVoidPtr": 1, + "Py_XDECREF": 3, + "__Pyx_RefNannySetupContext": 13, + "*__pyx_refnanny": 1, + "__Pyx_RefNanny": 6, + "SetupContext": 1, + "__LINE__": 84, + "__Pyx_RefNannyFinishContext": 12, + "FinishContext": 1, + "__pyx_refnanny": 5, + "__Pyx_INCREF": 36, + "INCREF": 1, + "__Pyx_DECREF": 66, + "DECREF": 1, + "__Pyx_GOTREF": 60, + "GOTREF": 1, + "__Pyx_GIVEREF": 10, + "GIVEREF": 1, + "__Pyx_XDECREF": 26, + "Py_DECREF": 1, + "__Pyx_XGIVEREF": 7, + "__Pyx_XGOTREF": 1, + "__Pyx_TypeTest": 4, + "*type": 3, + "*__Pyx_GetName": 1, + "*dict": 1, + "__Pyx_ErrRestore": 1, + "*value": 2, + "*tb": 2, + "__Pyx_ErrFetch": 1, + "**type": 1, + "**value": 1, + "**tb": 1, + "__Pyx_Raise": 8, + "__Pyx_RaiseNoneNotIterableError": 1, + "__Pyx_RaiseNeedMoreValuesError": 1, + "index": 2, + "__Pyx_RaiseTooManyValuesError": 1, + "expected": 1, + "__Pyx_UnpackTupleError": 2, + "*__Pyx_Import": 1, + "*from_list": 1, + "__Pyx_Print": 1, + "__pyx_print": 1, + "__pyx_print_kwargs": 1, + "__Pyx_PrintOne": 4, + "*o": 1, + "*__Pyx_PyInt_to_py_Py_intptr_t": 1, + "Py_intptr_t": 1, + "__Pyx_CREAL": 4, + ".real": 3, + "__Pyx_CIMAG": 4, + ".imag": 3, + "__real__": 1, + "__imag__": 1, + "_WIN32": 1, + "__Pyx_SET_CREAL": 2, + "__Pyx_SET_CIMAG": 2, + "__pyx_t_float_complex_from_parts": 1, + "__Pyx_c_eqf": 2, + "__Pyx_c_sumf": 2, + "__Pyx_c_difff": 2, + "__Pyx_c_prodf": 2, + "__Pyx_c_quotf": 2, + "__Pyx_c_negf": 2, + "__Pyx_c_is_zerof": 3, + "__Pyx_c_conjf": 3, + "conj": 3, + "__Pyx_c_absf": 3, + "abs": 2, + "__Pyx_c_powf": 3, + "pow": 2, + "conjf": 1, + "cabsf": 1, + "cpowf": 1, + "__pyx_t_double_complex_from_parts": 1, + "__Pyx_c_eq": 2, + "__Pyx_c_sum": 2, + "__Pyx_c_diff": 2, + "__Pyx_c_prod": 2, + "__Pyx_c_quot": 2, + "__Pyx_c_neg": 2, + "__Pyx_c_is_zero": 3, + "__Pyx_c_conj": 3, + "__Pyx_c_abs": 3, + "__Pyx_c_pow": 3, + "cabs": 1, + "cpow": 1, + "__Pyx_PyInt_AsUnsignedChar": 1, + "short": 3, + "__Pyx_PyInt_AsUnsignedShort": 1, + "__Pyx_PyInt_AsUnsignedInt": 1, + "__Pyx_PyInt_AsChar": 1, + "__Pyx_PyInt_AsShort": 1, + "__Pyx_PyInt_AsInt": 1, + "signed": 5, + "__Pyx_PyInt_AsSignedChar": 1, + "__Pyx_PyInt_AsSignedShort": 1, + "__Pyx_PyInt_AsSignedInt": 1, + "__Pyx_PyInt_AsLongDouble": 1, + "__Pyx_PyInt_AsUnsignedLong": 1, + "__Pyx_PyInt_AsUnsignedLongLong": 1, + "__Pyx_PyInt_AsLong": 1, + "__Pyx_PyInt_AsLongLong": 1, + "__Pyx_PyInt_AsSignedLong": 1, + "__Pyx_PyInt_AsSignedLongLong": 1, + "__Pyx_WriteUnraisable": 3, + "__Pyx_ExportFunction": 1, + "*__pyx_f_5numpy_PyArray_MultiIterNew2": 2, + "*__pyx_f_5numpy_PyArray_MultiIterNew3": 2, + "*__pyx_f_5numpy_PyArray_MultiIterNew4": 2, + "*__pyx_f_5numpy_PyArray_MultiIterNew5": 2, + "*__pyx_f_5numpy__util_dtypestring": 2, + "PyArray_Descr": 6, + "__pyx_f_5numpy_set_array_base": 1, + "PyArrayObject": 19, + "*__pyx_f_5numpy_get_array_base": 1, + "inner_work_1d": 2, + "inner_work_2d": 2, + "__Pyx_MODULE_NAME": 1, + "__pyx_module_is_main_wrapper_inner": 1, + "*__pyx_builtin_ValueError": 1, + "*__pyx_builtin_range": 1, + "*__pyx_builtin_RuntimeError": 1, + "__pyx_k_1": 1, + "__pyx_k_2": 1, + "__pyx_k_3": 1, + "__pyx_k_5": 1, + "__pyx_k_7": 1, + "__pyx_k_9": 1, + "__pyx_k_11": 1, + "__pyx_k_12": 1, + "__pyx_k_15": 1, + "__pyx_k__B": 2, + "__pyx_k__H": 2, + "__pyx_k__I": 2, + "__pyx_k__L": 2, + "__pyx_k__O": 2, + "__pyx_k__Q": 2, + "__pyx_k__b": 2, + "__pyx_k__d": 2, + "__pyx_k__f": 2, + "__pyx_k__g": 2, + "__pyx_k__h": 2, + "__pyx_k__i": 2, + "__pyx_k__l": 2, + "__pyx_k__q": 2, + "__pyx_k__Zd": 2, + "__pyx_k__Zf": 2, + "__pyx_k__Zg": 2, + "__pyx_k__np": 1, + "__pyx_k__buf": 1, + "__pyx_k__obj": 1, + "__pyx_k__base": 1, + "__pyx_k__ndim": 1, + "__pyx_k__ones": 1, + "__pyx_k__descr": 1, + "__pyx_k__names": 1, + "__pyx_k__numpy": 1, + "__pyx_k__range": 1, + "__pyx_k__shape": 1, + "__pyx_k__fields": 1, + "__pyx_k__format": 1, + "__pyx_k__strides": 1, + "__pyx_k____main__": 1, + "__pyx_k____test__": 1, + "__pyx_k__itemsize": 1, + "__pyx_k__readonly": 1, + "__pyx_k__type_num": 1, + "__pyx_k__byteorder": 1, + "__pyx_k__ValueError": 1, + "__pyx_k__suboffsets": 1, + "__pyx_k__work_module": 1, + "__pyx_k__RuntimeError": 1, + "__pyx_k__pure_py_test": 1, + "__pyx_k__wrapper_inner": 1, + "__pyx_k__do_awesome_work": 1, + "*__pyx_kp_s_1": 1, + "*__pyx_kp_u_11": 1, + "*__pyx_kp_u_12": 1, + "*__pyx_kp_u_15": 1, + "*__pyx_kp_s_2": 1, + "*__pyx_kp_s_3": 1, + "*__pyx_kp_u_5": 1, + "*__pyx_kp_u_7": 1, + "*__pyx_kp_u_9": 1, + "*__pyx_n_s__RuntimeError": 1, + "*__pyx_n_s__ValueError": 1, + "*__pyx_n_s____main__": 1, + "*__pyx_n_s____test__": 1, + "*__pyx_n_s__base": 1, + "*__pyx_n_s__buf": 1, + "*__pyx_n_s__byteorder": 1, + "*__pyx_n_s__descr": 1, + "*__pyx_n_s__do_awesome_work": 1, + "*__pyx_n_s__fields": 1, + "*__pyx_n_s__format": 1, + "*__pyx_n_s__itemsize": 1, + "*__pyx_n_s__names": 1, + "*__pyx_n_s__ndim": 1, + "*__pyx_n_s__np": 1, + "*__pyx_n_s__numpy": 1, + "*__pyx_n_s__obj": 1, + "*__pyx_n_s__ones": 1, + "*__pyx_n_s__pure_py_test": 1, + "*__pyx_n_s__range": 1, + "*__pyx_n_s__readonly": 1, + "*__pyx_n_s__shape": 1, + "*__pyx_n_s__strides": 1, + "*__pyx_n_s__suboffsets": 1, + "*__pyx_n_s__type_num": 1, + "*__pyx_n_s__work_module": 1, + "*__pyx_n_s__wrapper_inner": 1, + "*__pyx_int_5": 1, + "*__pyx_int_15": 1, + "*__pyx_k_tuple_4": 1, + "*__pyx_k_tuple_6": 1, + "*__pyx_k_tuple_8": 1, + "*__pyx_k_tuple_10": 1, + "*__pyx_k_tuple_13": 1, + "*__pyx_k_tuple_14": 1, + "*__pyx_k_tuple_16": 1, + "__pyx_v_num_x": 4, + "*__pyx_v_data_ptr": 2, + "*__pyx_v_answer_ptr": 2, + "__pyx_v_nd": 6, + "*__pyx_v_dims": 2, + "__pyx_v_typenum": 6, + "*__pyx_v_data_np": 2, + "__pyx_v_sum": 6, + "__pyx_t_1": 154, + "*__pyx_t_2": 4, + "*__pyx_t_3": 4, + "*__pyx_t_4": 3, + "__pyx_t_5": 75, + "__pyx_kp_s_1": 1, + "__pyx_filename": 79, + "__pyx_f": 79, + "__pyx_L1_error": 88, + "__pyx_v_dims": 4, + "NPY_DOUBLE": 3, + "__pyx_t_2": 120, + "PyArray_SimpleNewFromData": 2, + "__pyx_v_data_ptr": 2, + "Py_None": 38, + "__pyx_ptype_5numpy_ndarray": 2, + "__pyx_v_data_np": 10, + "__Pyx_GetName": 4, + "__pyx_m": 4, + "__pyx_n_s__work_module": 3, + "__pyx_t_3": 113, + "PyObject_GetAttr": 4, + "__pyx_n_s__do_awesome_work": 3, + "PyTuple_New": 4, + "PyTuple_SET_ITEM": 4, + "__pyx_t_4": 35, + "PyObject_Call": 11, + "PyErr_Occurred": 2, + "__pyx_v_answer_ptr": 2, + "__pyx_L0": 24, + "__pyx_v_num_y": 2, + "__pyx_kp_s_2": 1, + "*__pyx_pf_13wrapper_inner_pure_py_test": 2, + "*__pyx_self": 2, + "*unused": 2, + "PyMethodDef": 1, + "__pyx_mdef_13wrapper_inner_pure_py_test": 1, + "PyCFunction": 1, + "__pyx_pf_13wrapper_inner_pure_py_test": 1, + "METH_NOARGS": 1, + "*__pyx_v_data": 1, + "*__pyx_r": 7, + "*__pyx_t_1": 8, + "__pyx_self": 2, + "__pyx_v_data": 7, + "__pyx_kp_s_3": 1, + "__pyx_n_s__np": 1, + "__pyx_n_s__ones": 1, + "__pyx_k_tuple_4": 1, + "__pyx_r": 39, + "__Pyx_AddTraceback": 7, + "__pyx_pf_5numpy_7ndarray___getbuffer__": 2, + "*__pyx_v_self": 4, + "*__pyx_v_info": 4, + "__pyx_v_flags": 4, + "__pyx_v_copy_shape": 5, + "__pyx_v_i": 6, + "__pyx_v_ndim": 6, + "__pyx_v_endian_detector": 6, + "__pyx_v_little_endian": 8, + "__pyx_v_t": 29, + "*__pyx_v_f": 2, + "*__pyx_v_descr": 2, + "__pyx_v_offset": 9, + "__pyx_v_hasfields": 4, + "__pyx_t_6": 40, + "__pyx_t_7": 9, + "*__pyx_t_8": 1, + "*__pyx_t_9": 1, + "__pyx_v_info": 33, + "__pyx_v_self": 16, + "PyArray_NDIM": 1, + "__pyx_L5": 6, + "PyArray_CHKFLAGS": 2, + "NPY_C_CONTIGUOUS": 1, + "__pyx_builtin_ValueError": 5, + "__pyx_k_tuple_6": 1, + "__pyx_L6": 6, + "NPY_F_CONTIGUOUS": 1, + "__pyx_k_tuple_8": 1, + "__pyx_L7": 2, + "buf": 1, + "PyArray_DATA": 1, + "strides": 5, + "malloc": 2, + "shape": 3, + "PyArray_STRIDES": 2, + "PyArray_DIMS": 2, + "__pyx_L8": 2, + "suboffsets": 1, + "PyArray_ITEMSIZE": 1, + "PyArray_ISWRITEABLE": 1, + "__pyx_v_f": 31, + "descr": 2, + "__pyx_v_descr": 10, + "PyDataType_HASFIELDS": 2, + "__pyx_L11": 7, + "type_num": 2, + "byteorder": 4, + "__pyx_k_tuple_10": 1, + "__pyx_L13": 2, + "NPY_BYTE": 2, + "__pyx_L14": 18, + "NPY_UBYTE": 2, + "NPY_SHORT": 2, + "NPY_USHORT": 2, + "NPY_INT": 2, + "NPY_UINT": 2, + "NPY_LONG": 1, + "NPY_ULONG": 1, + "NPY_LONGLONG": 1, + "NPY_ULONGLONG": 1, + "NPY_FLOAT": 1, + "NPY_LONGDOUBLE": 1, + "NPY_CFLOAT": 1, + "NPY_CDOUBLE": 1, + "NPY_CLONGDOUBLE": 1, + "NPY_OBJECT": 1, + "__pyx_t_8": 16, + "PyNumber_Remainder": 1, + "__pyx_kp_u_11": 1, + "format": 6, + "__pyx_L12": 2, + "__pyx_t_9": 7, + "__pyx_f_5numpy__util_dtypestring": 1, + "__pyx_L2": 2, + "__pyx_pf_5numpy_7ndarray_1__releasebuffer__": 2, + "PyArray_HASFIELDS": 1, + "free": 2, + "*__pyx_f_5numpy_PyArray_MultiIterNew1": 1, + "*__pyx_v_a": 5, + "PyArray_MultiIterNew": 5, + "__pyx_v_a": 5, + "*__pyx_v_b": 4, + "__pyx_v_b": 4, + "*__pyx_v_c": 3, + "__pyx_v_c": 3, + "*__pyx_v_d": 2, + "__pyx_v_d": 2, + "*__pyx_v_e": 1, + "__pyx_v_e": 1, + "*__pyx_v_end": 1, + "*__pyx_v_offset": 1, + "*__pyx_v_child": 1, + "*__pyx_v_fields": 1, + "*__pyx_v_childname": 1, + "*__pyx_v_new_offset": 1, + "*__pyx_v_t": 1, + "*__pyx_t_5": 1, + "__pyx_t_10": 7, + "*__pyx_t_11": 1, + "__pyx_v_child": 8, + "__pyx_v_fields": 7, + "__pyx_v_childname": 4, + "__pyx_v_new_offset": 5, + "names": 2, + "PyTuple_GET_SIZE": 2, + "PyTuple_GET_ITEM": 3, + "PyObject_GetItem": 1, + "fields": 1, + "PyTuple_CheckExact": 1, + "tuple": 3, + "__pyx_ptype_5numpy_dtype": 1, + "__pyx_v_end": 2, + "PyNumber_Subtract": 2, + "PyObject_RichCompare": 8, + "__pyx_int_15": 1, + "Py_LT": 2, + "__pyx_builtin_RuntimeError": 2, + "__pyx_k_tuple_13": 1, + "__pyx_k_tuple_14": 1, + "elsize": 1, + "__pyx_k_tuple_16": 1, + "__pyx_L10": 2, + "Py_EQ": 6 }, "Ceylon": { "doc": 2, @@ -8819,129 +10960,6 @@ "s_compile_correct": 1, "app_nil_end.": 1, "execute_theorem.": 1, - "Eqdep_dec.": 1, - "Arith.": 2, - "eq_rect_eq_nat": 2, - "Q": 3, - "eq_rect": 3, - "h.": 1, - "K_dec_set": 1, - "eq_nat_dec.": 1, - "Scheme": 1, - "le_ind": 1, - "replace": 4, - "le_n": 4, - "fun": 17, - "refl_equal": 4, - "pattern": 2, - "case": 2, - "trivial.": 14, - "contradiction": 8, - "le_Sn_n": 5, - "le_S": 6, - "Heq": 8, - "m0": 1, - "HeqS": 3, - "injection": 4, - "HeqS.": 2, - "eq_rect_eq_nat.": 1, - "IHp": 2, - "dep_pair_intro": 2, - "Hx": 20, - "Hy": 14, - "<=n),>": 1, - "x=": 1, - "exist": 7, - "Hy.": 3, - "Heq.": 6, - "le_uniqueness_proof": 1, - "Hy0": 1, - "card": 2, - "f": 108, - "card_interval": 1, - "<=n}>": 1, - "proj1_sig": 1, - "proj2_sig": 1, - "Hp": 5, - "Hq": 3, - "Hpq.": 1, - "Hmn.": 1, - "Hmn": 1, - "interval_dec": 1, - "left.": 3, - "dep_pair_intro.": 3, - "right.": 9, - "discriminate": 3, - "le_Sn_le": 2, - "eq_S.": 1, - "Hneq.": 2, - "card_inj_aux": 1, - "g": 6, - "False.": 1, - "Hfbound": 1, - "Hfinj": 1, - "Hgsurj.": 1, - "Hgsurj": 3, - "Hfx": 2, - "le_n_O_eq.": 2, - "Hfbound.": 2, - "Hx.": 5, - "le_lt_dec": 9, - "xSn": 21, - "then": 9, - "else": 9, - "is": 4, - "bounded": 1, - "injective": 6, - "Hlefx": 1, - "Hgefx": 1, - "Hlefy": 1, - "Hgefy": 1, - "Hfinj.": 3, - "sym_not_eq.": 2, - "Heqf.": 2, - "Hneqy.": 2, - "le_lt_trans": 2, - "le_O_n.": 2, - "le_neq_lt": 2, - "Hneqx.": 2, - "pred_inj.": 1, - "lt_O_neq": 2, - "neq_dep_intro": 2, - "inj_restrict": 1, - "Heqf": 1, - "surjective": 1, - "Hlep.": 3, - "Hle": 1, - "Hlt": 3, - "Hfsurj": 2, - "le_n_S": 1, - "Hlep": 4, - "Hneq": 7, - "Heqx.": 2, - "Heqx": 4, - "Hle.": 1, - "le_not_lt": 1, - "lt_trans": 4, - "lt_n_Sn.": 1, - "Hlt.": 1, - "lt_irrefl": 2, - "lt_le_trans": 1, - "pose": 2, - "let": 3, - "Hneqx": 1, - "Hneqy": 1, - "Heqg": 1, - "Hdec": 3, - "Heqy": 1, - "Hginj": 1, - "HSnx.": 1, - "HSnx": 1, - "interval_discr": 1, - "<=m}>": 1, - "card_inj": 1, - "interval_dec.": 1, - "card_interval.": 2, "Basics.": 2, "NatList.": 2, "natprod": 5, @@ -8980,6 +10998,8 @@ "r1": 2, "v2": 2, "r2": 2, + "then": 9, + "else": 9, "test_beq_natlist1": 1, "test_beq_natlist2": 1, "beq_natlist_refl": 1, @@ -8995,173 +11015,11 @@ "symmetry.": 2, "rev_exercise": 1, "rev_involutive.": 1, - "Setoid": 1, - "Compare_dec": 1, - "ListNotations.": 1, - "Implicit": 15, - "Arguments.": 2, - "Permutation.": 2, - "Permutation": 38, - "perm_nil": 1, - "perm_skip": 1, - "Local": 7, - "Constructors": 3, - "Permutation_nil": 2, - "HF.": 3, - "@nil": 1, - "HF": 2, - "||": 1, - "Permutation_nil_cons": 1, - "discriminate.": 2, - "Permutation_refl": 1, - "Permutation_sym": 1, - "Hperm": 7, - "perm_trans": 1, - "Permutation_trans": 4, - "Logic.eq": 2, - "@Permutation": 5, - "iff": 1, - "@In": 1, - "red": 6, - "Permutation_in.": 2, - "Permutation_app_tail": 2, - "tl": 8, - "eapply": 8, - "Permutation_app_head": 2, - "app_comm_cons": 5, - "Permutation_app": 3, - "Hpermmm": 1, - "idtac": 1, - "Global": 5, - "@app": 1, - "Permutation_app.": 1, - "Permutation_add_inside": 1, - "Permutation_cons_append": 1, - "IHl": 8, - "Permutation_cons_append.": 3, - "Permutation_app_comm": 3, - "app_nil_r": 1, - "app_assoc": 2, - "Permutation_cons_app": 3, - "Permutation_middle": 2, - "Permutation_rev": 3, - "rev": 7, - "1": 1, - "@rev": 1, - "2": 1, - "Permutation_length": 2, - "length": 21, - "transitivity": 4, - "@length": 1, - "Permutation_length.": 1, - "Permutation_ind_bis": 2, - "Hnil": 1, - "Hskip": 3, - "Hswap": 2, - "Htrans.": 1, - "Htrans": 1, - "eauto.": 7, - "Ltac": 1, - "break_list": 5, - "Permutation_nil_app_cons": 1, - "l4": 3, - "P.": 5, - "IH": 3, - "Permutation_middle.": 3, - "perm_swap.": 2, - "perm_swap": 1, - "eq_refl": 2, - "In_split": 1, - "Permutation_app_inv": 1, - "NoDup": 4, - "incl": 3, - "N.": 1, - "E": 7, - "Ha": 6, - "In": 6, - "N": 1, - "Hal": 1, - "Hl": 1, - "exfalso.": 1, - "NoDup_Permutation_bis": 2, - "inversion_clear": 6, - "intuition.": 2, - "Permutation_NoDup": 1, - "Permutation_map": 1, - "Hf": 15, - "injective_bounded_surjective": 1, - "set": 1, - "seq": 2, - "map": 4, - "x.": 3, - "in_map_iff.": 2, - "in_seq": 4, - "arith": 4, - "NoDup_cardinal_incl": 1, - "injective_map_NoDup": 2, - "seq_NoDup": 1, - "map_length": 1, - "by": 7, - "in_map_iff": 1, - "split": 14, - "nat_bijection_Permutation": 1, - "BD.": 1, - "seq_NoDup.": 1, - "map_length.": 1, - "Injection": 1, - "Permutation_alt": 1, - "Alternative": 1, - "characterization": 1, - "of": 4, - "via": 1, - "nth_error": 7, - "and": 1, - "nth": 2, - "adapt": 4, - "adapt_injective": 1, - "adapt.": 2, - "EQ.": 2, - "LE": 11, - "LT": 14, - "eq_add_S": 2, - "Hf.": 1, - "Lt.le_lt_or_eq": 3, - "LE.": 3, - "EQ": 8, - "lt": 3, - "LT.": 5, - "Lt.S_pred": 3, - "Lt.lt_not_le": 2, - "adapt_ok": 2, - "nth_error_app1": 1, - "nth_error_app2": 1, - "arith.": 8, - "Minus.minus_Sn_m": 1, - "Permutation_nth_error": 2, - "IHP": 2, - "IHP2": 1, - "Hg": 2, - "E.": 2, - "L12": 2, - "app_length.": 2, - "plus_n_Sm.": 1, - "adapt_injective.": 1, - "nth_error_None": 4, - "Hn": 1, - "Hf2": 1, - "Hf3": 2, - "Lt.le_or_lt": 1, - "Lt.lt_irrefl": 2, - "Lt.lt_le_trans": 2, - "Hf1": 1, - "do": 4, - "congruence.": 1, - "Permutation_alt.": 1, - "Permutation_app_swap": 1, - "only": 3, - "parsing": 3, "Omega": 1, "SetoidList.": 1, + "Implicit": 15, + "Arguments.": 2, + "Local": 7, "nil.": 2, "..": 4, "Permut.": 1, @@ -9170,22 +11028,29 @@ "list_contents_app": 5, "permut_refl": 1, "permut_sym": 4, + "trivial.": 14, "permut_trans": 5, "permut_cons_eq": 3, "meq_left": 1, "meq_singleton": 1, "permut_cons": 5, "permut_app": 1, + "l4": 3, "specialize": 6, "a0.": 1, + "Ha": 6, "decide": 1, + "replace": 4, "permut_add_inside_eq": 1, "permut_add_cons_inside": 3, "permut_add_inside": 1, "permut_middle": 1, "permut_refl.": 5, "permut_sym_app": 1, + "do": 4, + "arith.": 8, "permut_rev": 1, + "rev": 7, "permut_add_cons_inside.": 1, "app_nil_end": 1, "results": 1, @@ -9200,33 +11065,48 @@ "B": 6, "if_eqA_refl": 3, "decide_left": 1, + "Global": 5, "if_eqA": 1, "contradict": 3, + "transitivity": 4, "A1": 2, "if_eqA_rewrite_r": 1, "A2": 4, "Hxx": 1, "multiplicity_InA": 4, "InA": 8, + "split": 14, + "right.": 9, + "IHl": 8, "multiplicity_InA_O": 2, "multiplicity_InA_S": 1, "multiplicity_NoDupA": 1, "NoDupA": 3, + "inversion_clear": 6, + "EQ": 8, "NEQ": 1, + "Permutation": 38, + "is": 4, "compatible": 1, "permut_InA_InA": 3, "multiplicity_InA.": 1, "meq.": 2, "permut_cons_InA": 3, "permut_nil": 3, + "by": 7, "Abs": 2, "permut_length_1": 1, + "discriminate.": 2, "permut_length_2": 1, + "P.": 5, "permut_length_1.": 2, + "red": 6, "@if_eqA_rewrite_l": 2, "permut_length": 1, + "length": 21, "InA_split": 1, "h2": 1, + "app_length.": 2, "plus_n_Sm": 1, "f_equal.": 1, "app_length": 1, @@ -9241,18 +11121,177 @@ "Forall2": 2, "permutation_Permutation": 1, "Forall2.": 1, + "pose": 2, "proof": 1, + "IHP": 2, "IHA": 2, "Forall2_app_inv_r": 1, "Hl1": 1, "Hl2": 1, + "Permutation_cons_app": 3, "Forall2_app": 1, "Forall2_cons": 1, + "Heq": 8, "Permutation_impl_permutation": 1, "permut_eqA": 1, "Permut_permut.": 1, "permut_right": 1, + "only": 3, + "parsing": 3, "permut_tran": 1, + "Setoid": 1, + "Compare_dec": 1, + "ListNotations.": 1, + "Permutation.": 2, + "perm_nil": 1, + "perm_skip": 1, + "Constructors": 3, + "Permutation_nil": 2, + "HF.": 3, + "@nil": 1, + "HF": 2, + "discriminate": 3, + "||": 1, + "Permutation_nil_cons": 1, + "Permutation_refl": 1, + "Permutation_sym": 1, + "Hperm": 7, + "perm_trans": 1, + "Permutation_trans": 4, + "Logic.eq": 2, + "@Permutation": 5, + "iff": 1, + "@In": 1, + "Permutation_in.": 2, + "Permutation_app_tail": 2, + "tl": 8, + "eapply": 8, + "Permutation_app_head": 2, + "app_comm_cons": 5, + "Permutation_app": 3, + "Hpermmm": 1, + "idtac": 1, + "@app": 1, + "Permutation_app.": 1, + "Permutation_add_inside": 1, + "Permutation_cons_append": 1, + "Permutation_cons_append.": 3, + "Permutation_app_comm": 3, + "app_nil_r": 1, + "app_assoc": 2, + "Permutation_middle": 2, + "Permutation_rev": 3, + "1": 1, + "@rev": 1, + "2": 1, + "Permutation_length": 2, + "@length": 1, + "Permutation_length.": 1, + "Permutation_ind_bis": 2, + "Hnil": 1, + "Hskip": 3, + "Hswap": 2, + "Htrans.": 1, + "Htrans": 1, + "eauto.": 7, + "Ltac": 1, + "break_list": 5, + "injection": 4, + "Permutation_nil_app_cons": 1, + "Hp": 5, + "IH": 3, + "Permutation_middle.": 3, + "perm_swap.": 2, + "perm_swap": 1, + "eq_refl": 2, + "In_split": 1, + "Permutation_app_inv": 1, + "NoDup": 4, + "incl": 3, + "N.": 1, + "E": 7, + "Hx.": 5, + "In": 6, + "Hy": 14, + "N": 1, + "Hal": 1, + "Hl": 1, + "exfalso.": 1, + "Hx": 20, + "NoDup_Permutation_bis": 2, + "intuition.": 2, + "Permutation_NoDup": 1, + "Permutation_map": 1, + "Hf": 15, + "Hy.": 3, + "injective_bounded_surjective": 1, + "f": 108, + "injective": 6, + "set": 1, + "seq": 2, + "map": 4, + "x.": 3, + "in_map_iff.": 2, + "in_seq": 4, + "arith": 4, + "NoDup_cardinal_incl": 1, + "injective_map_NoDup": 2, + "seq_NoDup": 1, + "map_length": 1, + "in_map_iff": 1, + "nat_bijection_Permutation": 1, + "let": 3, + "BD.": 1, + "seq_NoDup.": 1, + "map_length.": 1, + "Injection": 1, + "Permutation_alt": 1, + "Alternative": 1, + "characterization": 1, + "of": 4, + "via": 1, + "nth_error": 7, + "and": 1, + "nth": 2, + "adapt": 4, + "le_lt_dec": 9, + "adapt_injective": 1, + "adapt.": 2, + "EQ.": 2, + "LE": 11, + "LT": 14, + "eq_add_S": 2, + "Hf.": 1, + "Lt.le_lt_or_eq": 3, + "LE.": 3, + "lt": 3, + "LT.": 5, + "Lt.S_pred": 3, + "Lt.lt_not_le": 2, + "adapt_ok": 2, + "nth_error_app1": 1, + "nth_error_app2": 1, + "Minus.minus_Sn_m": 1, + "Permutation_nth_error": 2, + "fun": 17, + "IHP2": 1, + "g": 6, + "Hg": 2, + "E.": 2, + "L12": 2, + "plus_n_Sm.": 1, + "adapt_injective.": 1, + "nth_error_None": 4, + "Hn": 1, + "Hf2": 1, + "Hf3": 2, + "Lt.le_or_lt": 1, + "Lt.lt_irrefl": 2, + "Lt.lt_le_trans": 2, + "Hf1": 1, + "congruence.": 1, + "Permutation_alt.": 1, + "Permutation_app_swap": 1, "Lists.": 1, "X.": 4, "app": 5, @@ -9366,11 +11405,15 @@ "Hmo.": 4, "Hnm.": 3, "IHHmo.": 1, + "lt_trans": 4, "lt.": 2, "transitive.": 1, + "le_S": 6, "Hm": 1, + "le_Sn_le": 2, "le_S_n": 2, "Sn_le_Sm__n_le_m.": 1, + "le_Sn_n": 5, "not": 1, "TODO": 1, "Hmo": 1, @@ -9464,6 +11507,7 @@ "bool_step_prop4_holds": 1, "bool_step_prop4.": 2, "ST_ShortCut.": 1, + "left.": 3, "IHt1.": 1, "t2.": 4, "t3.": 2, @@ -9556,7 +11600,104 @@ "T12": 2, "IHhas_type.": 1, "IHhas_type1.": 1, - "IHhas_type2.": 1 + "IHhas_type2.": 1, + "Eqdep_dec.": 1, + "Arith.": 2, + "eq_rect_eq_nat": 2, + "Q": 3, + "eq_rect": 3, + "h.": 1, + "K_dec_set": 1, + "eq_nat_dec.": 1, + "Scheme": 1, + "le_ind": 1, + "le_n": 4, + "refl_equal": 4, + "pattern": 2, + "case": 2, + "contradiction": 8, + "m0": 1, + "HeqS": 3, + "HeqS.": 2, + "eq_rect_eq_nat.": 1, + "IHp": 2, + "dep_pair_intro": 2, + "<=n),>": 1, + "x=": 1, + "exist": 7, + "Heq.": 6, + "le_uniqueness_proof": 1, + "Hy0": 1, + "card": 2, + "card_interval": 1, + "<=n}>": 1, + "proj1_sig": 1, + "proj2_sig": 1, + "Hq": 3, + "Hpq.": 1, + "Hmn.": 1, + "Hmn": 1, + "interval_dec": 1, + "dep_pair_intro.": 3, + "eq_S.": 1, + "Hneq.": 2, + "card_inj_aux": 1, + "False.": 1, + "Hfbound": 1, + "Hfinj": 1, + "Hgsurj.": 1, + "Hgsurj": 3, + "Hfx": 2, + "le_n_O_eq.": 2, + "Hfbound.": 2, + "xSn": 21, + "bounded": 1, + "Hlefx": 1, + "Hgefx": 1, + "Hlefy": 1, + "Hgefy": 1, + "Hfinj.": 3, + "sym_not_eq.": 2, + "Heqf.": 2, + "Hneqy.": 2, + "le_lt_trans": 2, + "le_O_n.": 2, + "le_neq_lt": 2, + "Hneqx.": 2, + "pred_inj.": 1, + "lt_O_neq": 2, + "neq_dep_intro": 2, + "inj_restrict": 1, + "Heqf": 1, + "surjective": 1, + "Hlep.": 3, + "Hle": 1, + "Hlt": 3, + "Hfsurj": 2, + "le_n_S": 1, + "Hlep": 4, + "Hneq": 7, + "Heqx.": 2, + "Heqx": 4, + "Hle.": 1, + "le_not_lt": 1, + "lt_n_Sn.": 1, + "Hlt.": 1, + "lt_irrefl": 2, + "lt_le_trans": 1, + "Hneqx": 1, + "Hneqy": 1, + "Heqg": 1, + "Hdec": 3, + "Heqy": 1, + "Hginj": 1, + "HSnx.": 1, + "HSnx": 1, + "interval_discr": 1, + "<=m}>": 1, + "card_inj": 1, + "interval_dec.": 1, + "card_interval.": 2 }, "Dart": { "class": 1, @@ -9822,6 +11963,258 @@ "print": 1, ")": 1 }, + "Forth": { + "KataDiversion": 1, + "in": 4, + "Forth": 1, + "-": 473, + "utils": 1, + "empty": 2, + "the": 7, + "stack": 3, + "EMPTY": 1, + "DEPTH": 2, + "<": 14, + "IF": 10, + "BEGIN": 3, + "DROP": 5, + "UNTIL": 3, + "THEN": 10, + ";": 61, + "power": 2, + "**": 2, + "(": 88, + "n1": 2, + "n2": 2, + "n1_pow_n2": 1, + ")": 87, + "SWAP": 8, + "DUP": 14, + "DO": 2, + "OVER": 2, + "*": 9, + "LOOP": 2, + "NIP": 4, + "compute": 1, + "highest": 1, + "of": 3, + "below": 1, + "N.": 1, + "e.g.": 2, + "MAXPOW2": 2, + "n": 22, + "log2_n": 1, + "ABORT": 1, + "ELSE": 7, + "R": 13, + "|": 4, + "i": 5, + "I": 5, + "[": 16, + "]": 15, + "i*2": 1, + "/": 3, + "kata": 1, + "test": 1, + "if": 9, + "given": 3, + "N": 6, + "has": 1, + "two": 2, + "adjacent": 2, + "bits": 3, + "NOT": 3, + "TWO": 3, + "ADJACENT": 3, + "BITS": 3, + "bool": 1, + "word": 9, + "uses": 1, + "following": 1, + "algorithm": 1, + "return": 5, + "A": 5, + "X": 5, + "LOG2": 1, + "loop": 4, + "then": 5, + "+": 17, + "else": 6, + "end": 1, + "and": 3, + "OR": 1, + "INVERT": 1, + "maximum": 1, + "number": 4, + "which": 3, + "can": 2, + "be": 2, + "made": 2, + "with": 2, + "MAX": 2, + "NB": 3, + "m": 2, + "**n": 1, + "numbers": 1, + "or": 1, + "less": 1, + "have": 1, + "not": 1, + "bits.": 1, + "see": 1, + "http": 1, + "//www.codekata.com/2007/01/code_kata_fifte.html": 1, + "HOW": 1, + "MANY": 1, + "Block": 2, + "words.": 6, + "variable": 3, + "blk": 3, + "current": 5, + "block": 8, + "addr": 11, + "buffer": 2, + "evaluate": 1, + "extended": 3, + "semantics": 3, + "flush": 1, + "load": 2, + "...": 4, + "dup": 10, + "save": 2, + "input": 2, + "@": 13, + "source": 5, + "#source": 2, + "interpret": 1, + "restore": 1, + "buffers": 2, + "update": 1, + "extension": 4, + "scr": 2, + "list": 1, + "bounds": 1, + "do": 2, + "emit": 2, + "refill": 2, + "thru": 1, + "x": 10, + "y": 5, + "swap": 12, + "forth": 2, + "Copyright": 3, + "Lars": 3, + "Brinkhoff": 3, + "Kernel": 4, + "#tib": 2, + "TODO": 12, + ".r": 1, + ".": 5, + "char": 10, + "parse": 5, + "type": 3, + "immediate": 19, + "flag": 4, + "r": 18, + "x1": 5, + "x2": 5, + "rot": 2, + "r@": 2, + "noname": 1, + "align": 2, + "here": 9, + "c": 3, + "allot": 2, + "lastxt": 4, + "SP": 1, + "query": 1, + "tib": 1, + "body": 1, + "true": 1, + "tuck": 2, + "over": 5, + "u.r": 1, + "u": 3, + "drop": 4, + "false": 1, + "unused": 1, + "value": 1, + "create": 2, + "does": 5, + "within": 1, + "compile": 2, + "Forth2012": 2, + "core": 1, + "action": 1, + "defer": 2, + "name": 1, + "s": 4, + "c@": 2, + "negate": 1, + "nip": 2, + "bl": 4, + "ahead": 2, + "resolve": 4, + "literal": 4, + "postpone": 14, + "nonimmediate": 1, + "caddr": 1, + "C": 9, + "find": 2, + "cells": 1, + "postponers": 1, + "execute": 1, + "unresolved": 4, + "orig": 5, + "chars": 1, + "orig1": 1, + "orig2": 1, + "branch": 5, + "dodoes_code": 1, + "code": 3, + "begin": 2, + "dest": 5, + "while": 2, + "repeat": 2, + "until": 1, + "recurse": 1, + "pad": 3, + "If": 1, + "necessary": 1, + "keep": 1, + "parsing.": 1, + "string": 3, + "cmove": 1, + "state": 2, + "cr": 3, + "abort": 3, + "": 1, + "Undefined": 1, + "ok": 1, + "HELLO": 4, + "Tools": 2, + ".s": 1, + "depth": 1, + "traverse": 1, + "dictionary": 1, + "assembler": 1, + "kernel": 1, + "bye": 1, + "cs": 2, + "pick": 1, + "roll": 1, + "editor": 1, + "forget": 1, + "reveal": 1, + "tools": 1, + "nr": 1, + "synonym": 1, + "undefined": 2, + "defined": 1, + "invert": 1, + "/cell": 2, + "cell": 2 + }, "GAS": { ".cstring": 1, "LC0": 2, @@ -9879,9 +12272,6 @@ ".subsections_via_symbols": 1 }, "Gosu": { - "print": 4, - "(": 54, - ")": 55, "<%!-->": 1, "defined": 1, "in": 3, @@ -9891,9 +12281,11 @@ "%": 2, "@": 1, "params": 1, + "(": 54, "users": 2, "Collection": 1, "": 1, + ")": 55, "<%>": 2, "for": 2, "user": 1, @@ -9919,7 +12311,6 @@ "as": 3, "int": 2, "Relationship.valueOf": 2, - "hello": 1, "uses": 2, "java.util.*": 1, "java.io.File": 1, @@ -9963,6 +12354,7 @@ "+": 2, "@Deprecated": 1, "printPersonInfo": 1, + "print": 4, "addPerson": 4, "p": 5, "if": 4, @@ -10011,7 +12403,8 @@ "writer": 2, "FileWriter": 1, "PersonCSVTemplate.renderToString": 1, - "PersonCSVTemplate.render": 1 + "PersonCSVTemplate.render": 1, + "hello": 1 }, "Groovy": { "task": 1, @@ -10130,9 +12523,24 @@ "/each": 1 }, "INI": { - "[": 1, + ";": 1, + "editorconfig.org": 1, + "root": 1, + "true": 3, + "[": 2, + "*": 1, + "]": 2, + "indent_style": 1, + "space": 1, + "indent_size": 1, + "end_of_line": 1, + "lf": 1, + "charset": 1, + "utf": 1, + "-": 1, + "trim_trailing_whitespace": 1, + "insert_final_newline": 1, "user": 1, - "]": 1, "name": 1, "Josh": 1, "Peek": 1, @@ -10143,262 +12551,19 @@ "SHEBANG#!ioke": 1, "println": 1 }, + "JSON": { + "{": 143, + "}": 143, + "[": 165, + "]": 165, + "true": 3 + }, "Java": { "package": 5, - "clojure.asm": 1, + "nokogiri.internals": 1, ";": 725, "import": 66, - "java.lang.reflect.Constructor": 1, - "java.lang.reflect.Method": 1, - "public": 162, - "class": 9, - "Type": 42, - "{": 330, - "final": 66, "static": 112, - "int": 52, - "VOID": 5, - "BOOLEAN": 6, - "CHAR": 6, - "BYTE": 6, - "SHORT": 6, - "INT": 6, - "FLOAT": 6, - "LONG": 7, - "DOUBLE": 7, - "ARRAY": 6, - "OBJECT": 7, - "VOID_TYPE": 3, - "new": 118, - "(": 895, - ")": 895, - "BOOLEAN_TYPE": 3, - "CHAR_TYPE": 3, - "BYTE_TYPE": 3, - "SHORT_TYPE": 3, - "INT_TYPE": 3, - "FLOAT_TYPE": 3, - "LONG_TYPE": 3, - "DOUBLE_TYPE": 3, - "private": 56, - "sort": 18, - "char": 13, - "[": 49, - "]": 49, - "buf": 43, - "off": 25, - "len": 24, - "this.sort": 2, - "this.len": 2, - "}": 330, - "this.buf": 2, - "this.off": 1, - "getType": 10, - "String": 32, - "typeDescriptor": 1, - "return": 208, - "typeDescriptor.toCharArray": 1, - "Class": 10, - "c": 21, - "if": 95, - "c.isPrimitive": 2, - "Integer.TYPE": 2, - "else": 28, - "Void.TYPE": 3, - "Boolean.TYPE": 2, - "Byte.TYPE": 2, - "Character.TYPE": 2, - "Short.TYPE": 2, - "Double.TYPE": 2, - "Float.TYPE": 2, - "getDescriptor": 11, - "getObjectType": 1, - "name": 10, - "l": 5, - "name.length": 2, - "+": 80, - "name.getChars": 1, - "getArgumentTypes": 2, - "methodDescriptor": 2, - "methodDescriptor.toCharArray": 2, - "size": 8, - "while": 9, - "true": 16, - "car": 18, - "break": 1, - "args": 6, - ".len": 1, - "Method": 3, - "method": 2, - "classes": 2, - "method.getParameterTypes": 1, - "types": 3, - "classes.length": 2, - "for": 16, - "i": 54, - "-": 11, - "getReturnType": 2, - "methodDescriptor.indexOf": 1, - "method.getReturnType": 1, - "switch": 5, - "case": 54, - "//": 16, - "default": 5, - "getSort": 1, - "getDimensions": 3, - "getElementType": 2, - "getClassName": 1, - "StringBuffer": 14, - "b": 1, - ".getClassName": 1, - "b.append": 1, - "b.toString": 1, - ".replace": 2, - "getInternalName": 2, - "buf.toString": 4, - "getMethodDescriptor": 2, - "returnType": 1, - "argumentTypes": 2, - "buf.append": 21, - "<": 13, - "argumentTypes.length": 1, - ".getDescriptor": 1, - "returnType.getDescriptor": 1, - "void": 21, - "c.getName": 1, - "getConstructorDescriptor": 1, - "Constructor": 1, - "parameters": 4, - "c.getParameterTypes": 1, - "parameters.length": 2, - ".toString": 1, - "m": 1, - "m.getParameterTypes": 1, - "m.getReturnType": 1, - "d": 10, - "d.isPrimitive": 1, - "d.isArray": 1, - "d.getComponentType": 1, - "d.getName": 1, - "name.charAt": 1, - "getSize": 1, - "||": 8, - "getOpcode": 1, - "opcode": 17, - "Opcodes.IALOAD": 1, - "Opcodes.IASTORE": 1, - "boolean": 29, - "equals": 2, - "Object": 31, - "o": 12, - "this": 4, - "instanceof": 14, - "false": 9, - "t": 6, - "t.sort": 1, - "Type.OBJECT": 2, - "Type.ARRAY": 2, - "t.len": 1, - "j": 9, - "t.off": 1, - "end": 4, - "t.buf": 1, - "hashCode": 1, - "hc": 4, - "*": 2, - "toString": 1, - "clojure.lang": 1, - "java.lang.ref.Reference": 1, - "java.math.BigInteger": 1, - "java.util.Map": 3, - "java.util.concurrent.ConcurrentHashMap": 1, - "java.lang.ref.SoftReference": 1, - "java.lang.ref.ReferenceQueue": 1, - "Util": 1, - "equiv": 17, - "k1": 40, - "k2": 38, - "null": 75, - "Number": 9, - "&&": 6, - "Numbers.equal": 1, - "IPersistentCollection": 5, - "pcequiv": 2, - "k1.equals": 2, - "long": 4, - "double": 4, - "c1": 2, - "c2": 2, - ".equiv": 2, - "identical": 1, - "classOf": 1, - "x": 8, - "x.getClass": 1, - "compare": 1, - "Numbers.compare": 1, - "Comparable": 1, - ".compareTo": 1, - "hash": 3, - "o.hashCode": 2, - "hasheq": 1, - "Numbers.hasheq": 1, - "IHashEq": 2, - ".hasheq": 1, - "hashCombine": 1, - "seed": 5, - "//a": 1, - "la": 1, - "boost": 1, - "e3779b9": 1, - "<<": 1, - "isPrimitive": 1, - "isInteger": 1, - "Integer": 2, - "Long": 1, - "BigInt": 1, - "BigInteger": 1, - "ret1": 2, - "ret": 4, - "nil": 2, - "ISeq": 2, - "": 1, - "clearCache": 1, - "ReferenceQueue": 1, - "rq": 1, - "ConcurrentHashMap": 1, - "K": 2, - "Reference": 3, - "": 3, - "cache": 1, - "//cleanup": 1, - "any": 1, - "dead": 1, - "entries": 1, - "rq.poll": 2, - "Map.Entry": 1, - "e": 27, - "cache.entrySet": 1, - "val": 3, - "e.getValue": 1, - "val.get": 1, - "cache.remove": 1, - "e.getKey": 1, - "RuntimeException": 5, - "runtimeException": 2, - "s": 4, - "Throwable": 4, - "sneakyThrow": 1, - "throw": 3, - "NullPointerException": 1, - "Util.": 1, - "": 1, - "sneakyThrow0": 2, - "@SuppressWarnings": 1, - "": 1, - "extends": 7, - "throws": 11, - "T": 2, - "nokogiri.internals": 1, "nokogiri.internals.NokogiriHelpers.getNokogiriClass": 1, "nokogiri.internals.NokogiriHelpers.isNamespace": 1, "nokogiri.internals.NokogiriHelpers.stringOrNil": 1, @@ -10421,22 +12586,33 @@ "org.w3c.dom.Document": 1, "org.w3c.dom.NamedNodeMap": 1, "org.w3c.dom.NodeList": 1, + "public": 162, + "class": 9, "HtmlDomParserContext": 3, + "extends": 7, "XmlDomParserContext": 1, + "{": 330, + "(": 895, "Ruby": 43, "runtime": 88, "IRubyObject": 35, "options": 4, + ")": 895, "super": 5, + "}": 330, "encoding": 2, "@Override": 6, "protected": 4, + "void": 21, "initErrorHandler": 1, + "if": 95, "options.strict": 1, "errorHandler": 6, + "new": 118, "NokogiriStrictErrorHandler": 1, "options.noError": 2, "options.noWarning": 2, + "else": 28, "NokogiriNonStrictErrorHandler4NekoHtml": 1, "initParser": 1, "XMLParserConfiguration": 1, @@ -10448,6 +12624,8 @@ "elementValidityCheckFilter": 3, "ElementValidityCheckFilter": 3, "//XMLDocumentFilter": 1, + "[": 49, + "]": 49, "filters": 3, "config.setErrorHandler": 1, "this.errorHandler": 2, @@ -10456,11 +12634,15 @@ "setProperty": 4, "java_encoding": 2, "setFeature": 4, + "true": 16, + "false": 9, "enableDocumentFragment": 1, "XmlDocument": 8, "getNewEmptyDocument": 1, "ThreadContext": 2, "context": 8, + "args": 6, + "return": 208, "XmlDocument.rbNew": 1, "getNokogiriClass": 1, "context.getRuntime": 3, @@ -10475,22 +12657,32 @@ "htmlDocument.setDocumentNode": 1, "ruby_encoding.isNil": 1, "detected_encoding": 2, + "null": 75, + "&&": 6, "detected_encoding.isNil": 1, "ruby_encoding": 3, + "String": 32, "charset": 2, "tryGetCharsetFromHtml5MetaTag": 2, "stringOrNil": 1, "htmlDocument.setEncoding": 1, "htmlDocument.setParsedEncoding": 1, + "private": 56, ".equalsIgnoreCase": 5, "document.getDocumentElement": 2, ".getNodeName": 4, "NodeList": 2, "list": 1, ".getChildNodes": 2, + "for": 16, + "int": 52, + "i": 54, + "<": 13, "list.getLength": 1, + "+": 80, "list.item": 2, "headers": 1, + "j": 9, "headers.getLength": 1, "headers.item": 2, "NamedNodeMap": 1, @@ -10508,26 +12700,35 @@ "attrs": 4, "Augmentations": 2, "augs": 4, + "throws": 11, "XNIException": 2, "attrs.getLength": 1, "isNamespace": 1, "attrs.getQName": 1, "attrs.removeAttributeAt": 1, + "-": 11, "element.uri": 1, "super.startElement": 2, "NokogiriErrorHandler": 2, "element_names": 3, + "//": 16, "g": 1, "r": 1, "w": 1, + "x": 8, "y": 1, "z": 1, + "boolean": 29, "isValid": 2, "testee": 1, + "char": 13, + "c": 21, "testee.toCharArray": 1, "index": 4, + "Integer": 2, ".length": 1, "testee.equals": 1, + "name": 10, "name.rawname": 2, "errorHandler.getErrors": 1, ".add": 1, @@ -10556,10 +12757,12 @@ "java.text.ParseException": 1, "java.util.Collections": 2, "java.util.List": 1, + "java.util.Map": 3, "hudson.Util.fixEmpty": 1, "Hudson": 5, "Jenkins": 2, "transient": 2, + "final": 66, "CopyOnWriteList": 4, "": 2, "itemListeners": 2, @@ -10577,6 +12780,7 @@ "IOException": 8, "InterruptedException": 2, "ReactorException": 2, + "this": 4, "PluginManager": 1, "pluginManager": 2, "getJobListeners": 1, @@ -10586,6 +12790,7 @@ "Node": 1, "n": 3, "getNode": 1, + "instanceof": 14, "List": 3, "": 2, "getSlaves": 1, @@ -10643,6 +12848,7 @@ "Messages.Hudson_NotANegativeNumber": 1, "catch": 24, "ParseException": 1, + "e": 27, "Messages.Hudson_NotANumber": 1, "FormValidation.ok": 1, "isWindows": 1, @@ -10903,6 +13109,7 @@ "xmlReader.clone": 1, "XmlAttributeDecl": 1, "XmlEntityDecl": 1, + "throw": 3, "runtime.newNotImplementedError": 1, "XmlRelaxng": 5, "xmlRelaxng": 3, @@ -10923,7 +13130,215 @@ "xmlXpathContext.clone": 1, "XsltStylesheet": 4, "xsltStylesheet": 3, - "xsltStylesheet.clone": 1 + "xsltStylesheet.clone": 1, + "clojure.asm": 1, + "java.lang.reflect.Constructor": 1, + "java.lang.reflect.Method": 1, + "Type": 42, + "VOID": 5, + "BOOLEAN": 6, + "CHAR": 6, + "BYTE": 6, + "SHORT": 6, + "INT": 6, + "FLOAT": 6, + "LONG": 7, + "DOUBLE": 7, + "ARRAY": 6, + "OBJECT": 7, + "VOID_TYPE": 3, + "BOOLEAN_TYPE": 3, + "CHAR_TYPE": 3, + "BYTE_TYPE": 3, + "SHORT_TYPE": 3, + "INT_TYPE": 3, + "FLOAT_TYPE": 3, + "LONG_TYPE": 3, + "DOUBLE_TYPE": 3, + "sort": 18, + "buf": 43, + "off": 25, + "len": 24, + "this.sort": 2, + "this.len": 2, + "this.buf": 2, + "this.off": 1, + "getType": 10, + "typeDescriptor": 1, + "typeDescriptor.toCharArray": 1, + "Class": 10, + "c.isPrimitive": 2, + "Integer.TYPE": 2, + "Void.TYPE": 3, + "Boolean.TYPE": 2, + "Byte.TYPE": 2, + "Character.TYPE": 2, + "Short.TYPE": 2, + "Double.TYPE": 2, + "Float.TYPE": 2, + "getDescriptor": 11, + "getObjectType": 1, + "l": 5, + "name.length": 2, + "name.getChars": 1, + "getArgumentTypes": 2, + "methodDescriptor": 2, + "methodDescriptor.toCharArray": 2, + "size": 8, + "while": 9, + "car": 18, + "break": 1, + ".len": 1, + "Method": 3, + "method": 2, + "classes": 2, + "method.getParameterTypes": 1, + "types": 3, + "classes.length": 2, + "getReturnType": 2, + "methodDescriptor.indexOf": 1, + "method.getReturnType": 1, + "switch": 5, + "case": 54, + "default": 5, + "getSort": 1, + "getDimensions": 3, + "getElementType": 2, + "getClassName": 1, + "StringBuffer": 14, + "b": 1, + ".getClassName": 1, + "b.append": 1, + "b.toString": 1, + ".replace": 2, + "getInternalName": 2, + "buf.toString": 4, + "getMethodDescriptor": 2, + "returnType": 1, + "argumentTypes": 2, + "buf.append": 21, + "argumentTypes.length": 1, + ".getDescriptor": 1, + "returnType.getDescriptor": 1, + "c.getName": 1, + "getConstructorDescriptor": 1, + "Constructor": 1, + "parameters": 4, + "c.getParameterTypes": 1, + "parameters.length": 2, + ".toString": 1, + "m": 1, + "m.getParameterTypes": 1, + "m.getReturnType": 1, + "d": 10, + "d.isPrimitive": 1, + "d.isArray": 1, + "d.getComponentType": 1, + "d.getName": 1, + "name.charAt": 1, + "getSize": 1, + "||": 8, + "getOpcode": 1, + "opcode": 17, + "Opcodes.IALOAD": 1, + "Opcodes.IASTORE": 1, + "equals": 2, + "Object": 31, + "o": 12, + "t": 6, + "t.sort": 1, + "Type.OBJECT": 2, + "Type.ARRAY": 2, + "t.len": 1, + "t.off": 1, + "end": 4, + "t.buf": 1, + "hashCode": 1, + "hc": 4, + "*": 2, + "toString": 1, + "clojure.lang": 1, + "java.lang.ref.Reference": 1, + "java.math.BigInteger": 1, + "java.util.concurrent.ConcurrentHashMap": 1, + "java.lang.ref.SoftReference": 1, + "java.lang.ref.ReferenceQueue": 1, + "Util": 1, + "equiv": 17, + "k1": 40, + "k2": 38, + "Number": 9, + "Numbers.equal": 1, + "IPersistentCollection": 5, + "pcequiv": 2, + "k1.equals": 2, + "long": 4, + "double": 4, + "c1": 2, + "c2": 2, + ".equiv": 2, + "identical": 1, + "classOf": 1, + "x.getClass": 1, + "compare": 1, + "Numbers.compare": 1, + "Comparable": 1, + ".compareTo": 1, + "hash": 3, + "o.hashCode": 2, + "hasheq": 1, + "Numbers.hasheq": 1, + "IHashEq": 2, + ".hasheq": 1, + "hashCombine": 1, + "seed": 5, + "//a": 1, + "la": 1, + "boost": 1, + "e3779b9": 1, + "<<": 1, + "isPrimitive": 1, + "isInteger": 1, + "Long": 1, + "BigInt": 1, + "BigInteger": 1, + "ret1": 2, + "ret": 4, + "nil": 2, + "ISeq": 2, + "": 1, + "clearCache": 1, + "ReferenceQueue": 1, + "rq": 1, + "ConcurrentHashMap": 1, + "K": 2, + "Reference": 3, + "": 3, + "cache": 1, + "//cleanup": 1, + "any": 1, + "dead": 1, + "entries": 1, + "rq.poll": 2, + "Map.Entry": 1, + "cache.entrySet": 1, + "val": 3, + "e.getValue": 1, + "val.get": 1, + "cache.remove": 1, + "e.getKey": 1, + "RuntimeException": 5, + "runtimeException": 2, + "s": 4, + "Throwable": 4, + "sneakyThrow": 1, + "NullPointerException": 1, + "Util.": 1, + "": 1, + "sneakyThrow0": 2, + "@SuppressWarnings": 1, + "": 1, + "T": 2 }, "JavaScript": { "function": 1210, @@ -16938,13 +19353,6 @@ "exports.set_logger": 1, "logger": 2 }, - "JSON": { - "{": 143, - "}": 143, - "[": 165, - "]": 165, - "true": 3 - }, "Julia": { "##": 5, "Test": 1, @@ -17107,6 +19515,1131 @@ "true": 1, "return": 1 }, + "Lasso": { + "<": 7, + "LassoScript": 1, + "//": 169, + "JSON": 2, + "Encoding": 1, + "and": 52, + "Decoding": 1, + "Copyright": 1, + "-": 2248, + "LassoSoft": 1, + "Inc.": 1, + "": 1, + "": 1, + "": 1, + "This": 5, + "tag": 11, + "is": 35, + "now": 23, + "incorporated": 1, + "in": 46, + "Lasso": 15, + "If": 4, + "(": 640, + "Lasso_TagExists": 1, + ")": 639, + "False": 1, + ";": 573, + "Define_Tag": 1, + "Namespace": 1, + "Required": 1, + "Optional": 1, + "Local": 7, + "Map": 3, + "r": 8, + "n": 30, + "t": 8, + "f": 2, + "b": 2, + "output": 30, + "newoptions": 1, + "options": 2, + "array": 20, + "set": 10, + "list": 4, + "queue": 2, + "priorityqueue": 2, + "stack": 2, + "pair": 1, + "map": 23, + "[": 22, + "]": 23, + "literal": 3, + "string": 59, + "integer": 30, + "decimal": 5, + "boolean": 4, + "null": 26, + "date": 23, + "temp": 12, + "object": 7, + "{": 18, + "}": 18, + "client_ip": 1, + "client_address": 1, + "__jsonclass__": 6, + "deserialize": 2, + "": 3, + "": 3, + "Decode_JSON": 2, + "Decode_": 1, + "value": 14, + "consume_string": 1, + "ibytes": 9, + "unescapes": 1, + "u": 1, + "UTF": 4, + "%": 14, + "QT": 4, + "TZ": 2, + "T": 3, + "consume_token": 1, + "obytes": 3, + "delimit": 7, + "true": 12, + "false": 8, + ".": 5, + "consume_array": 1, + "consume_object": 1, + "key": 3, + "val": 1, + "native": 2, + "comment": 2, + "http": 6, + "//www.lassosoft.com/json": 1, + "start": 5, + "Literal": 2, + "String": 1, + "Object": 2, + "JSON_RPCCall": 1, + "RPCCall": 1, + "JSON_": 1, + "method": 7, + "params": 11, + "id": 7, + "host": 6, + "//localhost/lassoapps.8/rpc/rpc.lasso": 1, + "request": 2, + "result": 6, + "JSON_Records": 3, + "KeyField": 1, + "ReturnField": 1, + "ExcludeField": 1, + "Fields": 1, + "_fields": 1, + "fields": 2, + "No": 1, + "found": 5, + "for": 65, + "_keyfield": 4, + "keyfield": 4, + "ID": 1, + "_index": 1, + "_return": 1, + "returnfield": 1, + "_exclude": 1, + "excludefield": 1, + "_records": 1, + "_record": 1, + "_temp": 1, + "_field": 1, + "_output": 1, + "error_msg": 15, + "error_code": 11, + "found_count": 11, + "rows": 1, + "#_records": 1, + "Return": 7, + "@#_output": 1, + "/Define_Tag": 1, + "/If": 3, + "define": 20, + "trait_json_serialize": 2, + "trait": 1, + "require": 1, + "asString": 3, + "json_serialize": 18, + "e": 13, + "bytes": 8, + "+": 146, + "#e": 13, + "Replace": 19, + "&": 21, + "json_literal": 1, + "asstring": 4, + "format": 7, + "gmt": 1, + "|": 13, + "trait_forEach": 1, + "local": 116, + "foreach": 1, + "#output": 50, + "#delimit": 7, + "#1": 3, + "return": 75, + "with": 25, + "pr": 1, + "eachPair": 1, + "select": 1, + "#pr": 2, + "first": 12, + "second": 8, + "join": 5, + "json_object": 2, + "foreachpair": 1, + "any": 14, + "serialize": 1, + "json_consume_string": 3, + "while": 9, + "#temp": 19, + "#ibytes": 17, + "export8bits": 6, + "#obytes": 5, + "import8bits": 4, + "Escape": 1, + "/while": 7, + "unescape": 1, + "//Replace": 1, + "if": 76, + "BeginsWith": 1, + "&&": 30, + "EndsWith": 1, + "Protect": 1, + "serialization_reader": 1, + "xml": 1, + "read": 1, + "/Protect": 1, + "else": 32, + "size": 24, + "or": 6, + "regexp": 1, + "d": 2, + "Z": 1, + "matches": 1, + "Format": 1, + "yyyyMMdd": 2, + "HHmmssZ": 1, + "HHmmss": 1, + "/if": 53, + "json_consume_token": 2, + "marker": 4, + "Is": 1, + "also": 5, + "end": 2, + "of": 24, + "token": 1, + "//............................................................................": 2, + "string_IsNumeric": 1, + "json_consume_array": 3, + "While": 1, + "Discard": 1, + "whitespace": 3, + "Else": 7, + "insert": 18, + "#key": 12, + "json_consume_object": 2, + "Loop_Abort": 1, + "/While": 1, + "Find": 3, + "isa": 25, + "First": 4, + "find": 57, + "Second": 1, + "json_deserialize": 1, + "removeLeading": 1, + "bom_utf8": 1, + "Reset": 1, + "on": 1, + "provided": 1, + "**/": 1, + "type": 63, + "parent": 5, + "public": 1, + "onCreate": 1, + "...": 3, + "..onCreate": 1, + "#rest": 1, + "json_rpccall": 1, + "#id": 2, + "#host": 4, + "Lasso_UniqueID": 1, + "Include_URL": 1, + "PostParams": 1, + "Encode_JSON": 1, + "#method": 1, + "#params": 5, + "": 6, + "2009": 14, + "09": 10, + "04": 8, + "JS": 126, + "Added": 40, + "content_body": 14, + "compatibility": 4, + "pre": 4, + "8": 6, + "5": 4, + "05": 4, + "07": 6, + "timestamp": 4, + "to": 98, + "knop_cachestore": 4, + "maxage": 2, + "parameter": 8, + "knop_cachefetch": 4, + "Corrected": 8, + "construction": 2, + "cache_name": 2, + "internally": 2, + "the": 86, + "knop_cache": 2, + "tags": 14, + "so": 16, + "it": 20, + "will": 12, + "work": 6, + "correctly": 2, + "at": 10, + "site": 4, + "root": 2, + "2008": 6, + "11": 8, + "dummy": 2, + "knop_debug": 4, + "ctype": 2, + "be": 38, + "able": 14, + "transparently": 2, + "without": 4, + "L": 2, + "Debug": 2, + "24": 2, + "knop_stripbackticks": 2, + "01": 4, + "28": 2, + "Cache": 2, + "name": 32, + "used": 12, + "when": 10, + "using": 8, + "session": 4, + "storage": 8, + "2007": 6, + "12": 8, + "knop_cachedelete": 2, + "Created": 4, + "03": 2, + "knop_foundrows": 2, + "condition": 4, + "returning": 2, + "normal": 2, + "For": 2, + "lasso_tagexists": 4, + "define_tag": 48, + "namespace=": 12, + "__html_reply__": 4, + "define_type": 14, + "debug": 2, + "_unknowntag": 6, + "onconvert": 2, + "stripbackticks": 2, + "description=": 2, + "priority=": 2, + "required=": 2, + "input": 2, + "split": 2, + "@#output": 2, + "/define_tag": 36, + "description": 34, + "namespace": 16, + "priority": 8, + "Johan": 2, + "S": 2, + "lve": 2, + "#charlist": 6, + "current": 10, + "time": 8, + "a": 52, + "mixed": 2, + "up": 4, + "as": 26, + "seed": 6, + "#seed": 36, + "convert": 4, + "this": 14, + "base": 6, + "conversion": 4, + "get": 12, + "#base": 8, + "/": 6, + "over": 2, + "new": 14, + "chunk": 2, + "millisecond": 2, + "math_random": 2, + "lower": 2, + "upper": 2, + "__lassoservice_ip__": 2, + "response_localpath": 8, + "removetrailing": 8, + "response_filepath": 8, + "//tagswap.net/found_rows": 2, + "action_statement": 2, + "string_findregexp": 8, + "#sql": 42, + "ignorecase": 12, + "||": 8, + "maxrecords_value": 2, + "inaccurate": 2, + "must": 4, + "accurate": 2, + "Default": 2, + "usually": 2, + "fastest.": 2, + "Can": 2, + "not": 10, + "GROUP": 4, + "BY": 6, + "example.": 2, + "normalize": 4, + "around": 2, + "FROM": 2, + "expression": 6, + "string_replaceregexp": 8, + "replace": 8, + "ReplaceOnlyOne": 2, + "substring": 6, + "remove": 6, + "ORDER": 2, + "statement": 4, + "since": 4, + "causes": 4, + "problems": 2, + "field": 26, + "aliases": 2, + "we": 2, + "can": 14, + "simple": 2, + "later": 2, + "query": 4, + "contains": 2, + "use": 10, + "SQL_CALC_FOUND_ROWS": 2, + "which": 2, + "much": 2, + "slower": 2, + "see": 16, + "//bugs.mysql.com/bug.php": 2, + "removeleading": 2, + "inline": 4, + "sql": 2, + "exit": 2, + "here": 2, + "normally": 2, + "/inline": 2, + "fallback": 4, + "required": 10, + "optional": 36, + "local_defined": 26, + "knop_seed": 2, + "#RandChars": 4, + "Get": 2, + "Math_Random": 2, + "Min": 2, + "Max": 2, + "Size": 2, + "#value": 14, + "#numericValue": 4, + "length": 8, + "#cryptvalue": 10, + "#anyChar": 2, + "Encrypt_Blowfish": 2, + "decrypt_blowfish": 2, + "String_Remove": 2, + "StartPosition": 2, + "EndPosition": 2, + "Seed": 2, + "String_IsAlphaNumeric": 2, + "self": 72, + "_date_msec": 4, + "/define_type": 4, + "seconds": 4, + "default": 4, + "store": 4, + "all": 6, + "page": 14, + "vars": 8, + "specified": 8, + "iterate": 12, + "keys": 6, + "var": 38, + "#item": 10, + "#type": 26, + "#data": 14, + "/iterate": 12, + "//fail_if": 6, + "session_id": 6, + "#session": 10, + "session_addvar": 4, + "#cache_name": 72, + "duration": 4, + "#expires": 4, + "server_name": 6, + "initiate": 10, + "thread": 6, + "RW": 6, + "lock": 24, + "global": 40, + "Thread_RWLock": 6, + "create": 6, + "reference": 10, + "@": 8, + "writing": 6, + "#lock": 12, + "writelock": 4, + "check": 6, + "cache": 4, + "unlock": 6, + "writeunlock": 4, + "#maxage": 4, + "cached": 8, + "data": 12, + "too": 4, + "old": 4, + "reading": 2, + "readlock": 2, + "readunlock": 2, + "ignored": 2, + "//##################################################################": 4, + "knoptype": 2, + "All": 4, + "Knop": 6, + "custom": 8, + "types": 10, + "should": 4, + "have": 6, + "identify": 2, + "registered": 2, + "knop": 6, + "isknoptype": 2, + "knop_knoptype": 2, + "prototype": 4, + "version": 4, + "14": 4, + "Base": 2, + "framework": 2, + "Contains": 2, + "common": 4, + "member": 10, + "Used": 2, + "boilerplate": 2, + "creating": 4, + "other": 4, + "instance": 8, + "variables": 2, + "are": 4, + "available": 2, + "well": 2, + "CHANGE": 4, + "NOTES": 4, + "Syntax": 4, + "adjustments": 4, + "9": 2, + "Changed": 6, + "error": 22, + "numbers": 2, + "added": 10, + "even": 2, + "language": 10, + "already": 2, + "exists.": 2, + "improved": 4, + "reporting": 2, + "messages": 6, + "such": 2, + "from": 6, + "bad": 2, + "database": 14, + "queries": 2, + "error_lang": 2, + "provide": 2, + "knop_lang": 8, + "add": 12, + "localized": 2, + "except": 2, + "knop_base": 8, + "html": 4, + "xhtml": 28, + "help": 10, + "nicely": 2, + "formatted": 2, + "output.": 2, + "Centralized": 2, + "knop_base.": 2, + "Moved": 6, + "codes": 2, + "improve": 2, + "documentation.": 2, + "It": 2, + "always": 2, + "an": 8, + "parameter.": 2, + "trace": 2, + "tagtime": 4, + "was": 6, + "nav": 4, + "earlier": 2, + "varname": 4, + "retreive": 2, + "variable": 8, + "that": 18, + "stored": 2, + "in.": 2, + "automatically": 2, + "sense": 2, + "doctype": 6, + "exists": 2, + "buffer.": 2, + "The": 6, + "performance.": 2, + "internal": 2, + "html.": 2, + "Introduced": 2, + "_knop_data": 10, + "general": 2, + "level": 2, + "caching": 2, + "between": 2, + "different": 2, + "objects.": 2, + "TODO": 2, + "option": 2, + "Google": 2, + "Code": 2, + "Wiki": 2, + "working": 2, + "properly": 4, + "run": 2, + "by": 12, + "atbegin": 2, + "handler": 2, + "explicitly": 2, + "*/": 2, + "entire": 4, + "ms": 2, + "defined": 4, + "each": 8, + "instead": 4, + "avoid": 2, + "recursion": 2, + "properties": 4, + "#endslash": 10, + "#tags": 2, + "#t": 2, + "doesn": 4, + "p": 2, + "Parameters": 4, + "nParameters": 2, + "Internal.": 2, + "Finds": 2, + "out": 2, + "used.": 2, + "Looks": 2, + "unless": 2, + "array.": 2, + "variable.": 2, + "Looking": 2, + "#xhtmlparam": 4, + "plain": 2, + "#doctype": 4, + "copy": 4, + "standard": 2, + "code": 2, + "errors": 12, + "error_data": 12, + "form": 2, + "grid": 2, + "lang": 2, + "user": 4, + "#error_lang": 12, + "addlanguage": 4, + "strings": 6, + "@#errorcodes": 2, + "#error_lang_custom": 2, + "#custom_language": 10, + "once": 4, + "one": 2, + "#custom_string": 4, + "#errorcodes": 4, + "#error_code": 10, + "message": 6, + "getstring": 2, + "test": 2, + "known": 2, + "lasso": 2, + "knop_timer": 2, + "knop_unique": 2, + "look": 2, + "#varname": 6, + "loop_abort": 2, + "tag_name": 2, + "#timer": 2, + "#trace": 4, + "merge": 2, + "#eol": 8, + "2010": 4, + "23": 4, + "Custom": 2, + "interact": 2, + "databases": 2, + "Supports": 4, + "both": 2, + "MySQL": 2, + "FileMaker": 2, + "datasources": 2, + "2012": 4, + "06": 2, + "10": 2, + "SP": 4, + "Fix": 2, + "precision": 2, + "bug": 2, + "6": 2, + "0": 2, + "1": 2, + "renderfooter": 2, + "15": 2, + "Add": 2, + "support": 6, + "Thanks": 2, + "Ric": 2, + "Lewis": 2, + "settable": 4, + "removed": 2, + "table": 6, + "nextrecord": 12, + "deprecation": 2, + "warning": 2, + "corrected": 2, + "verification": 2, + "index": 4, + "before": 4, + "calling": 2, + "resultset_count": 6, + "break": 2, + "versions": 2, + "fixed": 4, + "incorrect": 2, + "debug_trace": 2, + "addrecord": 4, + "how": 2, + "keyvalue": 10, + "returned": 6, + "adding": 2, + "records": 4, + "inserting": 2, + "generated": 2, + "suppressed": 2, + "specifying": 2, + "saverecord": 8, + "deleterecord": 4, + "case.": 2, + "recorddata": 6, + "no": 2, + "longer": 2, + "touch": 2, + "current_record": 2, + "zero": 2, + "access": 2, + "occurrence": 2, + "same": 4, + "returns": 4, + "knop_databaserows": 2, + "inlinename.": 4, + "next.": 2, + "remains": 2, + "supported": 2, + "backwards": 2, + "compatibility.": 2, + "resets": 2, + "record": 20, + "pointer": 8, + "reaching": 2, + "last": 4, + "honors": 2, + "incremented": 2, + "recordindex": 4, + "specific": 2, + "found.": 2, + "getrecord": 8, + "REALLY": 2, + "works": 4, + "keyvalues": 4, + "double": 2, + "oops": 4, + "I": 4, + "thought": 2, + "but": 2, + "misplaced": 2, + "paren...": 2, + "corresponding": 2, + "resultset": 2, + "/resultset": 2, + "through": 2, + "handling": 2, + "better": 2, + "knop_user": 4, + "keeplock": 4, + "updates": 2, + "datatype": 2, + "knop_databaserow": 2, + "iterated.": 2, + "When": 2, + "iterating": 2, + "row": 2, + "values.": 2, + "Addedd": 2, + "increments": 2, + "recordpointer": 2, + "called": 2, + "until": 2, + "reached.": 2, + "Returns": 2, + "long": 2, + "there": 2, + "more": 2, + "records.": 2, + "Useful": 2, + "loop": 2, + "example": 2, + "below": 2, + "Implemented": 2, + "reset": 2, + "query.": 2, + "shortcut": 2, + "Removed": 2, + "onassign": 2, + "touble": 2, + "Extended": 2, + "field_names": 2, + "names": 4, + "db": 2, + "objects": 2, + "never": 2, + "been": 2, + "optionally": 2, + "supports": 2, + "sql.": 2, + "Make": 2, + "sure": 2, + "SQL": 2, + "includes": 2, + "relevant": 2, + "lockfield": 2, + "locking": 4, + "capturesearchvars": 2, + "mysteriously": 2, + "after": 2, + "operations": 2, + "caused": 2, + "errors.": 2, + "flag": 2, + "save": 2, + "locked": 2, + "releasing": 2, + "Adding": 2, + "progress.": 2, + "Done": 2, + "oncreate": 2, + "getrecord.": 2, + "documentation": 2, + "most": 2, + "existing": 2, + "it.": 2, + "Faster": 2, + "than": 2, + "scratch.": 2, + "shown_first": 2, + "again": 2, + "hoping": 2, + "s": 2, + "only": 2, + "captured": 2, + "update": 2, + "uselimit": 2, + "querys": 2, + "LIMIT": 2, + "still": 2, + "gets": 2, + "proper": 2, + "searchresult": 2, + "separate": 2, + "COUNT": 2 + }, + "Less": { + "@blue": 4, + "#3bbfce": 1, + ";": 7, + "@margin": 3, + "px": 1, + ".content": 1, + "-": 3, + "navigation": 1, + "{": 2, + "border": 2, + "color": 3, + "darken": 1, + "(": 1, + "%": 1, + ")": 1, + "}": 2, + ".border": 1, + "padding": 1, + "/": 2, + "margin": 1 + }, + "Literate CoffeeScript": { + "The": 2, + "**Scope**": 2, + "class": 2, + "regulates": 1, + "lexical": 1, + "scoping": 1, + "within": 2, + "CoffeeScript.": 1, + "As": 1, + "you": 2, + "generate": 1, + "code": 1, + "create": 1, + "a": 8, + "tree": 1, + "of": 4, + "scopes": 1, + "in": 2, + "the": 12, + "same": 1, + "shape": 1, + "as": 3, + "nested": 1, + "function": 2, + "bodies.": 1, + "Each": 1, + "scope": 2, + "knows": 1, + "about": 1, + "variables": 3, + "declared": 2, + "it": 4, + "and": 5, + "has": 1, + "reference": 3, + "to": 8, + "its": 3, + "parent": 2, + "enclosing": 1, + "scope.": 2, + "In": 1, + "this": 3, + "way": 1, + "we": 4, + "know": 1, + "which": 3, + "are": 3, + "new": 2, + "need": 2, + "be": 2, + "with": 3, + "var": 4, + "shared": 1, + "external": 1, + "scopes.": 1, + "Import": 1, + "helpers": 1, + "plan": 1, + "use.": 1, + "{": 4, + "extend": 1, + "last": 1, + "}": 4, + "require": 1, + "exports.Scope": 1, + "Scope": 1, + "root": 1, + "is": 3, + "top": 2, + "-": 5, + "level": 1, + "object": 1, + "for": 3, + "given": 1, + "file.": 1, + "@root": 1, + "null": 1, + "Initialize": 1, + "lookups": 1, + "up": 1, + "chain": 1, + "well": 1, + "**Block**": 1, + "node": 1, + "belongs": 2, + "where": 1, + "should": 1, + "declare": 1, + "that": 2, + "to.": 1, + "constructor": 1, + "(": 5, + "@parent": 2, + "@expressions": 1, + "@method": 1, + ")": 6, + "@variables": 3, + "[": 4, + "name": 8, + "type": 5, + "]": 4, + "@positions": 4, + "Scope.root": 1, + "unless": 1, + "Adds": 1, + "variable": 1, + "or": 1, + "overrides": 1, + "an": 1, + "existing": 1, + "one.": 1, + "add": 1, + "immediate": 3, + "return": 1, + "@parent.add": 1, + "if": 2, + "@shared": 1, + "not": 1, + "Object": 1, + "hasOwnProperty.call": 1, + ".type": 1, + "else": 2, + "@variables.push": 1, + "When": 1, + "super": 1, + "called": 1, + "find": 1, + "current": 1, + "method": 1, + "param": 1, + "_": 3, + "then": 1, + "tempVars": 1, + "realVars": 1, + ".push": 1, + "v.name": 1, + "realVars.sort": 1, + ".concat": 1, + "tempVars.sort": 1, + "Return": 1, + "list": 1, + "assignments": 1, + "supposed": 1, + "made": 1, + "at": 1, + "assignedVariables": 1, + "v": 1, + "when": 1, + "v.type.assigned": 1 + }, + "LiveScript": { + "a": 8, + "-": 25, + "const": 1, + "b": 3, + "var": 1, + "c": 3, + "d": 3, + "_000_000km": 1, + "*": 1, + "ms": 1, + "e": 2, + "(": 9, + ")": 10, + "dashes": 1, + "identifiers": 1, + "underscores_i": 1, + "/regexp1/": 1, + "and": 3, + "//regexp2//g": 1, + "strings": 1, + "[": 2, + "til": 1, + "]": 2, + "or": 2, + "to": 2, + "|": 3, + "map": 1, + "filter": 1, + "fold": 1, + "+": 1, + "class": 1, + "Class": 1, + "extends": 1, + "Anc": 1, + "est": 1, + "args": 1, + "copy": 1, + "from": 1, + "callback": 4, + "error": 6, + "data": 2, + "<": 1, + "read": 1, + "file": 2, + "return": 2, + "if": 2, + "<~>": 1, + "write": 1 + }, + "Logos": { + "%": 15, + "hook": 2, + "ABC": 2, + "-": 3, + "(": 8, + "id": 2, + ")": 8, + "a": 1, + "B": 1, + "b": 1, + "{": 4, + "log": 1, + ";": 8, + "return": 2, + "orig": 2, + "nil": 2, + "}": 4, + "end": 4, + "subclass": 1, + "DEF": 1, + "NSObject": 1, + "init": 3, + "[": 2, + "c": 1, + "RuntimeAccessibleClass": 1, + "alloc": 1, + "]": 2, + "group": 1, + "OptionalHooks": 2, + "void": 1, + "release": 1, + "self": 1, + "retain": 1, + "ctor": 1, + "if": 1, + "OptionalCondition": 1 + }, "Logtalk": { "-": 3, "object": 2, @@ -17131,46 +20664,1109 @@ "write": 1, "end_object.": 1 }, + "Lua": { + "-": 60, + "A": 1, + "simple": 1, + "counting": 1, + "object": 1, + "that": 1, + "increments": 1, + "an": 1, + "internal": 1, + "counter": 1, + "whenever": 1, + "it": 2, + "receives": 2, + "a": 5, + "bang": 3, + "at": 2, + "its": 2, + "first": 1, + "inlet": 2, + "or": 2, + "changes": 1, + "to": 8, + "whatever": 1, + "number": 3, + "second": 1, + "inlet.": 1, + "local": 11, + "HelloCounter": 4, + "pd.Class": 3, + "new": 3, + "(": 56, + ")": 56, + "register": 3, + "function": 16, + "initialize": 3, + "sel": 3, + "atoms": 3, + "self.inlets": 3, + "self.outlets": 3, + "self.num": 5, + "return": 3, + "true": 3, + "end": 26, + "in_1_bang": 2, + "self": 10, + "outlet": 10, + "{": 16, + "}": 16, + "+": 3, + "in_2_float": 2, + "f": 12, + "FileListParser": 5, + "Base": 1, + "filename": 2, + "File": 2, + "extension": 2, + "Number": 4, + "of": 9, + "files": 1, + "in": 7, + "batch": 2, + "To": 3, + "[": 17, + "list": 1, + "trim": 1, + "]": 17, + "binfile": 3, + "vidya": 1, + "file": 8, + "modder": 1, + "s": 5, + "mechanisms": 1, + "self.extension": 3, + "the": 7, + "last": 1, + "self.batchlimit": 3, + "in_1_symbol": 1, + "for": 9, + "i": 10, + "do": 8, + "..": 7, + "in_2_list": 1, + "d": 9, + "in_3_float": 1, + "FileModder": 10, + "Object": 1, + "triggering": 1, + "Incoming": 1, + "single": 1, + "data": 2, + "bytes": 3, + "from": 3, + "Total": 1, + "route": 1, + "buflength": 1, + "Glitch": 3, + "type": 2, + "point": 2, + "times": 2, + "glitch": 2, + "Toggle": 1, + "randomized": 1, + "glitches": 3, + "within": 2, + "bounds": 2, + "Active": 1, + "get": 1, + "next": 1, + "byte": 2, + "clear": 2, + "buffer": 2, + "FLOAT": 1, + "write": 3, + "Currently": 1, + "active": 2, + "namedata": 1, + "self.filedata": 4, + "pattern": 1, + "random": 3, + "splice": 1, + "self.glitchtype": 5, + "Minimum": 1, + "image": 1, + "self.glitchpoint": 6, + "repeat": 1, + "on": 1, + "given": 1, + "self.randrepeat": 5, + "Toggles": 1, + "whether": 1, + "repeating": 1, + "should": 1, + "be": 1, + "self.randtoggle": 3, + "Hold": 1, + "all": 1, + "which": 1, + "are": 1, + "converted": 1, + "ints": 1, + "range": 1, + "self.bytebuffer": 8, + "Buffer": 1, + "length": 1, + "currently": 1, + "self.buflength": 7, + "if": 2, + "then": 4, + "plen": 2, + "math.random": 8, + "patbuffer": 3, + "table.insert": 4, + "%": 1, + "#patbuffer": 1, + "elseif": 2, + "randlimit": 4, + "else": 1, + "sloc": 3, + "schunksize": 2, + "splicebuffer": 3, + "table.remove": 1, + "insertpoint": 2, + "#self.bytebuffer": 1, + "_": 2, + "v": 4, + "ipairs": 2, + "outname": 3, + "pd.post": 1, + "in_3_list": 1, + "Shift": 1, + "indexed": 2, + "in_4_list": 1, + "in_5_float": 1, + "in_6_float": 1, + "in_7_list": 1, + "in_8_list": 1 + }, "Markdown": { "Tender": 1 }, "Matlab": { - "function": 9, - "y": 2, + "x_0": 45, + "linspace": 14, + "(": 1357, + ")": 1358, + ";": 891, + "vx_0": 37, + "z": 3, + "zeros": 60, + "for": 77, + "i": 334, + "j": 242, + "*vx_0": 1, + "end": 147, + "figure": 17, + "pcolor": 2, + "shading": 3, + "flat": 3, + "tic": 7, + "clear": 13, + "all": 15, + "%": 552, + "Choice": 2, + "of": 35, + "the": 14, + "mass": 2, + "parameter": 2, + "mu": 73, + "Computation": 9, + "Lagrangian": 3, + "Points": 2, + "[": 309, + "xl1": 13, + "yl1": 12, + "xl2": 9, + "yl2": 8, + "xl3": 8, + "yl3": 8, + "xl4": 10, + "yl4": 9, + "xl5": 8, + "yl5": 8, + "]": 309, + "Lagr": 6, + "initial": 5, + "total": 6, + "energy": 8, + "E_L1": 4, + "-": 672, + "Omega": 7, + "E": 8, + "+": 169, + "Offset": 2, + "as": 4, + "in": 8, + "Initial": 3, + "conditions": 3, + "range": 2, + "x_0_min": 8, + "x_0_max": 8, + "vx_0_min": 8, + "vx_0_max": 8, + "y_0": 29, + "n": 102, + "T": 22, + "ndgrid": 2, + "vy_0": 22, + "sqrt": 14, + "*E": 2, + "*Omega": 5, + "vx_0.": 2, + "E_cin": 4, + "Transforming": 1, + "into": 1, + "Hamiltonian": 1, + "variables": 2, + "px_0": 2, + "py_0": 2, + "x_T": 25, + "y_T": 17, + "px_T": 4, + "py_T": 4, + "filtro": 15, + "ones": 6, + "E_T": 11, + "a": 17, + "matrix": 3, + "numbers": 2, + "integration": 9, + "steps": 2, + "each": 2, + "np": 8, + "number": 2, + "integrated": 5, + "points": 11, + "fprintf": 18, + "Energy": 4, + "tolerance": 2, + "setting": 4, + "energy_tol": 6, + "inf": 1, + "Jacobian": 3, + "system": 2, + "options": 14, + "odeset": 4, + "@cr3bp_jac": 1, + "Parallel": 2, + "equations": 2, + "motion": 2, + "parfor": 5, + "if": 52, + "&&": 13, + "isreal": 8, + "Check": 6, + "real": 3, + "velocity": 2, + "and": 7, + "positive": 2, + "Kinetic": 2, + "t": 32, + "Y": 19, + "ode45": 6, + "@fH": 1, + "length": 49, + "Saving": 4, + "solutions": 2, + "final": 2, + "difference": 2, + "with": 2, + "one": 3, + "EnergyH": 1, + "delta_E": 7, + "abs": 12, + "conservation": 2, + "position": 2, + "point": 14, + "else": 23, + "interesting": 4, + "non": 2, + "sense": 2, + "bad": 4, + "t_integrazione": 3, + "toc": 5, + "t_integr": 1, + "Back": 1, + "to": 9, + "vx_T": 22, + "vy_T": 12, + "FTLE": 14, + "dphi": 12, + "ftle": 10, + "...": 162, + "/": 59, + "Manual": 2, + "visualize": 2, + "Inf": 1, + "*T": 3, + "*log": 2, + "max": 9, + "eig": 6, + "tempo": 4, + "per": 5, + "integrare": 2, + ".2f": 5, + "s": 13, + "calcolare": 2, + "var_": 2, + "_": 2, + "var_xvx_": 2, + "ode00": 2, + "_n": 2, + "_e": 1, + "_H": 1, + "save": 2, + "nome": 2, + "Elements": 1, + "grid": 1, + "definition": 2, + "Dimensionless": 1, + "integrating": 1, + "time": 21, + "C_L1": 3, + "*E_L1": 1, + "from": 2, + "Szebehely": 1, + "Setting": 1, + "integrator": 2, + "RelTol": 2, + "e": 14, + "AbsTol": 2, + "From": 1, + "Short": 1, + "h": 19, + "waitbar": 6, + "S": 5, + "r1": 3, + "r2": 3, + "g": 5, + "i/n": 1, + "sprintf": 11, + ".": 13, + "y_0.": 2, + "./": 1, + "mu./": 1, + "@f_reg": 1, + "close": 4, + "filtro_1": 12, + "||": 3, + "ftle_norm": 1, + "ds_x": 1, + "ds_vx": 1, + "La": 1, + "direzione": 1, + "dello": 1, + "spostamento": 1, + "la": 2, + "decide": 1, + "il": 1, + "denominatore": 1, + "TODO": 1, + "spiegarsi": 1, + "teoricamente": 1, + "come": 1, + "mai": 1, + "matrice": 1, + "pu": 1, + "essere": 1, + "ridotta": 1, + "x2": 1, + "*ds_x": 2, + "*ds_vx": 2, + "/abs": 3, + "dphi*dphi": 1, + "num2str": 10, + "function": 32, + "e_T": 7, + "filter": 14, + "Integrate_FILE": 1, + "e_0": 7, + "N": 9, + "Integrate": 6, + "nx": 32, + "ny": 29, + "nvx": 32, + "ne": 29, + "Look": 2, + "phisically": 2, + "meaningful": 6, + "meaningless": 2, + "only": 7, + "i/nx": 2, + "k": 75, + "l": 64, + "*Potential": 5, + "*e_0": 3, + "ci": 9, + "te": 2, + "ye": 9, + "ie": 2, + "@f": 6, + "*": 46, + "Potential": 1, + "delta_e": 3, + "Integrate_FTLE_Gawlick_ell": 1, + "ecc": 2, + "nu": 2, + "useful": 9, + "ecc*cos": 1, + "@f_ell": 1, + "<": 9, + "Consider": 1, + "also": 1, + "negative": 1, + "Compute": 3, + "goodness": 1, + "/2": 3, + "c1": 5, + "roots": 3, + "*mu": 6, + "c2": 5, + "c3": 3, + "hold": 23, + "plot": 26, + "Conditions": 1, + "C": 13, + "Integration": 2, + "@cross_y": 1, + "y": 22, + "ode113": 2, + "x": 42, + "RK4": 3, + "fun": 5, + "tspan": 7, + "th": 1, + "order": 11, + "Runge": 1, + "Kutta": 1, + "dim": 2, + "while": 1, + "k1": 4, + "k2": 3, + "h/2": 2, + "k1*h/2": 1, + "k3": 3, + "k2*h/2": 1, + "k4": 4, + "h*k3": 1, + "h/6*": 1, + "*k2": 1, + "*k3": 1, + "Earth": 2, + "Moon": 2, + "C_star": 1, + "C/2": 1, + "first": 3, + "orbit": 1, + "t0": 6, + "Y0": 6, + "x0": 4, + "y0": 2, + "vx0": 2, + "vy0": 2, + "l0": 1, + "delta_E0": 1, + "Hill": 1, + "Edgecolor": 1, + "none": 1, + "ok": 2, + "sg": 1, + "sr": 1, + "dx": 6, + "adapting_structural_model": 2, + "u": 3, + "varargin": 25, + "size": 8, + "aux": 3, + "{": 157, + "}": 157, + "m": 44, + "b": 12, + "elseif": 14, + "display": 10, + "aux.pars": 3, + ".*": 2, + "Yp": 2, + "human": 1, + "aux.timeDelay": 2, + "aux.m": 3, + "aux.b": 3, + "Yc": 5, + "parallel": 2, + "plant": 4, + "aux.plantFirst": 2, + "aux.plantSecond": 2, + "Ys": 1, + "feedback": 1, + "A": 11, + "B": 9, + "D": 7, + "tf2ss": 1, + "Ys.num": 1, + "Ys.den": 1, "average": 1, - "(": 50, - "x": 4, - ")": 50, - "[": 3, - "m": 3, - "n": 3, - "]": 3, - "size": 2, - ";": 24, - "if": 1, "|": 2, - "&": 1, - "error": 1, - "end": 19, - "sum": 1, + "&": 4, + "error": 14, + "sum": 2, "/length": 1, + "bicycle": 7, + "bicycle_state_space": 1, + "speed": 20, + "dbstack": 1, + "CURRENT_DIRECTORY": 2, + "fileparts": 1, + ".file": 1, + "par": 7, + "par_text_to_struct": 4, + "filesep": 14, + "whipple_pull_force_abcd": 2, + "states": 7, + "outputs": 10, + "inputs": 14, + "defaultSettings.states": 1, + "defaultSettings.inputs": 1, + "defaultSettings.outputs": 1, + "userSettings": 3, + "varargin_to_structure": 2, + "struct": 1, + "settings": 3, + "overwrite_settings": 2, + "defaultSettings": 3, + "minStates": 2, + "ismember": 15, + "settings.states": 3, + "keepStates": 2, + "find": 24, + "removeStates": 1, + "row": 6, + "col": 5, + "removeInputs": 2, + "settings.inputs": 1, + "keepOutputs": 2, + "settings.outputs": 1, + "It": 1, + "is": 7, + "not": 3, + "possible": 1, + "keep": 1, + "output": 7, + "because": 1, + "it": 1, + "depends": 1, + "on": 13, + "input": 14, + "StateName": 1, + "OutputName": 1, + "InputName": 1, + "name": 4, + "convert_variable": 1, + "variable": 10, + "coordinates": 6, + "speeds": 21, + "get_variables": 2, + "columns": 4, + "create_ieee_paper_plots": 2, + "data": 27, + "rollData": 8, + "global": 6, + "goldenRatio": 12, + "exist": 1, + "mkdir": 1, + "linestyles": 15, + "colors": 13, + "loop_shape_example": 3, + "data.Benchmark.Medium": 2, + "plot_io_roll": 3, + "open_loop_all_bikes": 1, + "handling_all_bikes": 1, + "path_plots": 1, + "var": 3, + "io": 7, + "typ": 3, + "plot_io": 1, + "phase_portraits": 2, + "eigenvalues": 2, + "bikeData": 2, + "figWidth": 24, + "figHeight": 19, + "set": 43, + "gcf": 17, + "freq": 12, + "closedLoops": 1, + "bikeData.closedLoops": 1, + "bops": 7, + "bodeoptions": 1, + "bops.FreqUnits": 1, + "strcmp": 24, + "gray": 7, + "deltaNum": 2, + "closedLoops.Delta.num": 1, + "deltaDen": 2, + "closedLoops.Delta.den": 1, + "bodeplot": 6, + "tf": 18, + "neuroNum": 2, + "neuroDen": 2, + "whichLines": 3, + "phiDotNum": 2, + "closedLoops.PhiDot.num": 1, + "phiDotDen": 2, + "closedLoops.PhiDot.den": 1, + "closedBode": 3, + "off": 10, + "opts": 4, + "getoptions": 2, + "opts.YLim": 3, + "opts.PhaseMatching": 2, + "opts.PhaseMatchingValue": 2, + "opts.Title.String": 2, + "setoptions": 2, + "lines": 17, + "findobj": 5, + "raise": 19, + "plotAxes": 22, + "curPos1": 4, + "get": 11, + "curPos2": 4, + "xLab": 8, + "legWords": 3, + "closeLeg": 2, + "legend": 7, + "axes": 9, + "db1": 4, + "text": 11, + "db2": 2, + "dArrow1": 2, + "annotation": 13, + "dArrow2": 2, + "dArrow": 2, + "filename": 21, + "pathToFile": 11, + "print": 6, + "fix_ps_linestyle": 6, + "openLoops": 1, + "bikeData.openLoops": 1, + "num": 24, + "openLoops.Phi.num": 1, + "den": 15, + "openLoops.Phi.den": 1, + "openLoops.Psi.num": 1, + "openLoops.Psi.den": 1, + "openLoops.Y.num": 1, + "openLoops.Y.den": 1, + "openBode": 3, + "line": 15, + "wc": 14, + "wShift": 5, + "bikeData.handlingMetric.num": 1, + "bikeData.handlingMetric.den": 1, + "w": 3, + "mag": 4, + "phase": 2, + "bode": 5, + "metricLine": 1, + "Linewidth": 7, + "Color": 13, + "Linestyle": 6, + "Handling": 2, + "Quality": 2, + "Metric": 2, + "Frequency": 2, + "rad/s": 4, + "Level": 6, + "benchmark": 1, + "Handling.eps": 1, + "plots": 4, + "deps2": 1, + "loose": 4, + "PaperOrientation": 3, + "portrait": 3, + "PaperUnits": 3, + "inches": 3, + "PaperPositionMode": 3, + "manual": 3, + "PaperPosition": 3, + "PaperSize": 3, + "rad/sec": 1, + "phi": 13, + "Open": 1, + "Loop": 1, + "Bode": 1, + "Diagrams": 1, + "at": 3, + "m/s": 6, + "Latex": 1, + "type": 4, + "LineStyle": 2, + "LineWidth": 2, + "Location": 2, + "Southwest": 1, + "Fontsize": 4, + "YColor": 2, + "XColor": 1, + "Position": 6, + "Xlabel": 1, + "Units": 1, + "normalized": 1, + "openBode.eps": 1, + "deps2c": 3, + "maxMag": 2, + "magnitudes": 1, + "area": 1, + "fillColors": 1, + "gca": 8, + "speedNames": 12, + "metricLines": 2, + "bikes": 24, + "data.": 6, + ".handlingMetric.num": 1, + ".handlingMetric.den": 1, + "chil": 2, + "legLines": 1, + "Hands": 1, + "free": 1, + "@": 1, + "handling.eps": 1, + "f": 13, + "YTick": 1, + "YTickLabel": 1, + "Path": 1, + "Southeast": 1, + "Distance": 1, + "Lateral": 1, + "Deviation": 1, + "paths.eps": 1, + "d": 3, + "like": 1, + "plot.": 1, + "names": 6, + "prettyNames": 3, + "units": 3, + "index": 6, + "fieldnames": 5, + "data.Browser": 1, + "maxValue": 4, + "oneSpeed": 3, + "history": 7, + "oneSpeed.": 3, + "round": 1, + "pad": 10, + "yShift": 16, + "xShift": 3, + "oneSpeed.time": 2, + "oneSpeed.speed": 2, + "distance": 6, + "xAxis": 12, + "xData": 3, + "textX": 3, + "ylim": 2, + "ticks": 4, + "xlabel": 8, + "xLimits": 6, + "xlim": 8, + "loc": 3, + "l1": 2, + "l2": 2, + "ylabel": 4, + "box": 4, + "x_r": 6, + "y_r": 6, + "w_r": 5, + "h_r": 5, + "rectangle": 2, + "w_r/2": 4, + "h_r/2": 4, + "x_a": 10, + "y_a": 10, + "w_a": 7, + "h_a": 5, + "ax": 15, + "axis": 5, + "rollData.speed": 1, + "rollData.time": 1, + "path": 3, + "rollData.path": 1, + "frontWheel": 3, + "rollData.outputs": 3, + "rollAngle": 4, + "steerAngle": 4, + "rollTorque": 4, + "rollData.inputs": 1, + "subplot": 3, + "h1": 5, + "h2": 5, + "plotyy": 3, + "inset": 3, + "gainChanges": 2, + "loopNames": 4, + "xy": 7, + "xySource": 7, + "xlabels": 2, + "ylabels": 2, + "legends": 3, + "floatSpec": 3, + "twentyPercent": 1, + "generate_data": 5, + "nominalData": 1, + "nominalData.": 2, + "bikeData.": 2, + "twentyPercent.": 2, + "equal": 2, + "leg1": 2, + "bikeData.modelPar.": 1, + "leg2": 2, + "twentyPercent.modelPar.": 1, + "eVals": 5, + "pathToParFile": 2, + "str": 2, + "eigenValues": 1, + "zeroIndices": 3, + "maxEvals": 4, + "maxLine": 7, + "minLine": 4, + "min": 1, + "speedInd": 12, + "value": 2, + "isterminal": 2, + "direction": 2, + "FIXME": 1, + "largest": 1, + "primary": 1, + "x_min": 3, + "x_max": 3, + "y_min": 3, + "y_max": 3, + "how": 1, + "many": 1, + "measure": 1, + "unit": 1, + "both": 1, + "ds": 1, + "x_res": 7, + "*n": 2, + "y_res": 7, + "grid_x": 3, + "grid_y": 3, + "advected_x": 12, + "advected_y": 12, + "X": 6, + "@dg": 1, + "store": 4, + "advected": 2, + "positions": 2, + "they": 2, + "would": 2, + "appear": 2, + "coords": 2, + "sigma": 6, + "compute": 2, + "*ds": 4, + "eigenvalue": 2, + "*phi": 2, + "log": 2, + "lambda_max": 2, + "field": 2, + "contourf": 2, + "location": 1, + "EastOutside": 1, + "f_x_t": 2, + "inline": 1, + "grid_min": 3, + "grid_max": 3, + "grid_width": 1, + "grid_spacing": 5, + "grid_width/": 1, + "*grid_width/": 4, + "colorbar": 1, + "load_data": 4, + "t1": 6, + "t2": 6, + "t3": 1, + "dataPlantOne": 3, + "data.Ts": 6, + "dataAdapting": 3, + "dataPlantTwo": 3, + "guessPlantOne": 4, + "resultPlantOne": 1, + "find_structural_gains": 2, + "yh": 2, + "fit": 6, + "compare": 3, + "resultPlantOne.fit": 1, + "guessPlantTwo": 3, + "resultPlantTwo": 1, + "resultPlantTwo.fit": 1, + "kP1": 4, + "resultPlantOne.fit.par": 1, + "kP2": 3, + "resultPlantTwo.fit.par": 1, + "gainSlopeOffset": 6, + "eye": 9, + "this": 2, + "uses": 1, + "tau": 1, + "through": 1, + "wfs": 1, + "true": 2, + "plantOneSlopeOffset": 3, + "plantTwoSlopeOffset": 3, + "mod": 3, + "idnlgrey": 1, + "pem": 1, + "guess.plantOne": 3, + "guess.plantTwo": 2, + "plantNum.plantOne": 2, + "plantNum.plantTwo": 2, + "sections": 13, + "secData.": 1, + "guess.": 2, + "result.": 2, + ".fit.par": 1, + "currentGuess": 2, + "warning": 1, + "randomGuess": 1, + "The": 6, + "self": 2, + "validation": 2, + "VAF": 2, + "f.": 2, + "data/": 1, + "results.mat": 1, + "guess": 1, + "plantNum": 1, + "result": 5, + "plots/": 1, + ".png": 1, + "task": 1, + "closed": 1, + "loop": 1, + "u.": 1, + "gain": 1, + "guesses": 1, + "identified": 1, + "gains": 12, + ".vaf": 1, + "Range": 1, + "E_0": 4, + "C_L1/2": 1, + "Y_0": 4, + "dvx": 3, + "dy": 5, + "de": 4, + "Definition": 1, + "arrays": 1, + "In": 1, + "approach": 1, + "pints": 1, + "are": 1, + "stored": 1, + "v_y": 3, + "vx": 2, + "vy": 2, + "Selection": 1, + "Data": 2, + "transfer": 1, + "GPU": 3, + "x_gpu": 3, + "gpuArray": 4, + "y_gpu": 3, + "vx_gpu": 3, + "vy_gpu": 3, + "x_f": 3, + "y_f": 3, + "vx_f": 3, + "vy_f": 3, + "arrayfun": 2, + "@RKF45_FILE_gpu": 1, + "back": 1, + "CPU": 1, + "memory": 1, + "cleaning": 1, + "gather": 4, + "Construction": 1, + "computation": 2, + "X_T": 4, + "Y_T": 4, + "VX_T": 4, + "VY_T": 3, + "filter_ftle": 11, + "Compute_FILE_gpu": 1, + "Plot": 1, + "results": 1, + "squeeze": 1, + "clc": 1, + "load_bikes": 2, + "lane_change": 1, + "start": 4, + "width": 3, + "slope": 3, + "pathLength": 3, + "single": 1, + "double": 1, + "Double": 1, + "lane": 4, + "change": 1, + "needs": 1, + "lane.": 1, + "laneLength": 4, + "startOfSlope": 3, + "endOfSlope": 1, + "<=>": 1, + "1": 1, + "downSlope": 3, + "gains.Benchmark.Slow": 1, + "place": 2, + "holder": 2, + "gains.Browserins.Slow": 1, + "gains.Browser.Slow": 1, + "gains.Pista.Slow": 1, + "gains.Fisher.Slow": 1, + "gains.Yellow.Slow": 1, + "gains.Yellowrev.Slow": 1, + "gains.Benchmark.Medium": 1, + "gains.Browserins.Medium": 1, + "gains.Browser.Medium": 1, + "gains.Pista.Medium": 1, + "gains.Fisher.Medium": 1, + "gains.Yellow.Medium": 1, + "gains.Yellowrev.Medium": 1, + "gains.Benchmark.Fast": 1, + "gains.Browserins.Fast": 1, + "gains.Browser.Fast": 1, + "gains.Pista.Fast": 1, + "gains.Fisher.Fast": 1, + "gains.Yellow.Fast": 1, + "gains.Yellowrev.Fast": 1, + "gains.": 1, + "parser": 1, + "inputParser": 1, + "parser.addRequired": 1, + "parser.addParamValue": 3, + "parser.parse": 1, + "args": 1, + "parser.Results": 1, + "raw": 1, + "load": 1, + "args.directory": 1, + "iddata": 1, + "raw.theta": 1, + "raw.theta_c": 1, + "args.sampleTime": 1, + "args.detrend": 1, + "detrend": 1, "filtfcn": 2, "statefcn": 2, "makeFilter": 1, - "b": 6, - "a": 4, - "%": 5, - "v": 10, - "zeros": 1, + "v": 12, "@iirFilter": 1, "@getState": 1, "yn": 2, "iirFilter": 1, "xn": 4, - "+": 3, - "*": 5, - "-": 5, - "...": 3, "vOut": 2, "getState": 1, "classdef": 1, @@ -17178,16 +21774,13 @@ "properties": 1, "R": 1, "G": 1, - "B": 3, "methods": 1, "obj": 2, "r": 2, - "g": 2, "obj.R": 2, "obj.G": 2, "obj.B": 2, "disp": 8, - "num2str": 3, "enumeration": 1, "red": 1, "green": 1, @@ -17199,30 +21792,92 @@ "white": 1, "ret": 3, "matlab_function": 5, - "A": 2, "Call": 2, "which": 2, "resides": 2, - "in": 2, - "the": 2, "same": 2, "directory": 2, "value1": 4, "semicolon": 2, - "at": 2, - "of": 2, - "line": 2, - "is": 2, - "not": 2, "mandatory": 2, - "only": 2, "suppresses": 2, - "output": 2, - "to": 2, "command": 2, "line.": 2, "value2": 4, - "result": 4 + "overrideSettings": 3, + "overrideNames": 2, + "defaultNames": 2, + "notGiven": 5, + "setxor": 1, + "settings.": 1, + "defaultSettings.": 1, + "fid": 7, + "fopen": 2, + "textscan": 1, + "fclose": 2, + "strtrim": 2, + "vals": 2, + "regexp": 1, + "par.": 1, + "str2num": 1, + "choose_plant": 4, + "p": 7, + "arg1": 1, + "arg": 2, + "RK4_par": 1, + "wnm": 11, + "zetanm": 5, + "ss": 3, + "data.modelPar.A": 1, + "data.modelPar.B": 1, + "data.modelPar.C": 1, + "data.modelPar.D": 1, + "bicycle.StateName": 2, + "bicycle.OutputName": 4, + "bicycle.InputName": 2, + "analytic": 3, + "system_state_space": 2, + "numeric": 2, + "data.system.A": 1, + "data.system.B": 1, + "data.system.C": 1, + "data.system.D": 1, + "numeric.StateName": 1, + "data.bicycle.states": 1, + "numeric.InputName": 1, + "data.bicycle.inputs": 1, + "numeric.OutputName": 1, + "data.bicycle.outputs": 1, + "pzplot": 1, + "ss2tf": 2, + "analytic.A": 3, + "analytic.B": 1, + "analytic.C": 1, + "analytic.D": 1, + "mine": 1, + "data.forceTF.PhiDot.num": 1, + "data.forceTF.PhiDot.den": 1, + "numeric.A": 2, + "numeric.B": 1, + "numeric.C": 1, + "numeric.D": 1, + "whipple_pull_force_ABCD": 1, + "bottomRow": 1, + "prod": 3, + "arguments": 7, + "ischar": 1, + "options.": 1, + "write_gains": 1, + "contents": 1, + "importdata": 1, + "speedsInFile": 5, + "contents.data": 2, + "gainsInFile": 3, + "sameSpeedIndices": 5, + "allGains": 4, + "allSpeeds": 4, + "sort": 1, + "contents.colheaders": 1 }, "Max": { "max": 1, @@ -17261,6 +21916,657 @@ "fasten": 1, "pop": 1 }, + "Monkey": { + "Strict": 1, + "sample": 1, + "class": 1, + "from": 1, + "the": 1, + "documentation": 1, + "Class": 3, + "Game": 1, + "Extends": 2, + "App": 1, + "Function": 2, + "New": 1, + "(": 12, + ")": 12, + "End": 8, + "DrawSpiral": 3, + "clock": 3, + "Local": 3, + "w": 3, + "DeviceWidth/2": 1, + "For": 1, + "i#": 1, + "Until": 1, + "w*1.5": 1, + "Step": 1, + ".2": 1, + "x#": 1, + "y#": 1, + "x": 2, + "+": 5, + "i*Sin": 1, + "i*3": 1, + "y": 2, + "i*Cos": 1, + "i*2": 1, + "DrawRect": 1, + "Next": 1, + "hitbox.Collide": 1, + "event.pos": 1, + "Field": 2, + "updateCount": 3, + "Method": 4, + "OnCreate": 1, + "Print": 2, + "SetUpdateRate": 1, + "OnUpdate": 1, + "OnRender": 1, + "Cls": 1, + "updateCount*1.1": 1, + "Enemy": 1, + "Die": 1, + "Abstract": 1, + "field": 1, + "testField": 1, + "Bool": 2, + "True": 2, + "oss": 1, + "he": 2, + "-": 2, + "killed": 1, + "me": 1, + "b": 6, + "extending": 1, + "with": 1, + "generics": 1, + "VectorNode": 1, + "Node": 1, + "": 1, + "array": 1, + "syntax": 1, + "Global": 14, + "listOfStuff": 3, + "String": 4, + "[": 6, + "]": 6, + "lessStuff": 1, + "oneStuff": 1, + "a": 3, + "comma": 1, + "separated": 1, + "sequence": 1, + "text": 1, + "worstCase": 1, + "worst.List": 1, + "": 1, + "escape": 1, + "characers": 1, + "in": 1, + "strings": 1, + "string3": 1, + "string4": 1, + "string5": 1, + "string6": 1, + "prints": 1, + ".ToUpper": 1, + "Boolean": 1, + "shorttype": 1, + "boolVariable1": 1, + "boolVariable2": 1, + "False": 1, + "preprocessor": 1, + "keywords": 1, + "#If": 1, + "TARGET": 2, + "DoStuff": 1, + "#ElseIf": 1, + "DoOtherStuff": 1, + "#End": 1, + "operators": 1, + "|": 2, + "&": 1, + "c": 1 + }, + "MoonScript": { + "types": 2, + "require": 5, + "util": 2, + "data": 1, + "import": 5, + "reversed": 2, + "unpack": 22, + "from": 4, + "ntype": 16, + "mtype": 3, + "build": 7, + "smart_node": 7, + "is_slice": 2, + "value_is_singular": 3, + "insert": 18, + "table": 2, + "NameProxy": 14, + "LocalName": 2, + "destructure": 1, + "local": 1, + "implicitly_return": 2, + "class": 4, + "Run": 8, + "new": 2, + "(": 54, + "@fn": 1, + ")": 54, + "self": 2, + "[": 79, + "]": 79, + "call": 3, + "state": 2, + "self.fn": 1, + "-": 51, + "transform": 2, + "the": 4, + "last": 6, + "stm": 16, + "is": 2, + "a": 4, + "list": 6, + "of": 1, + "stms": 4, + "will": 1, + "puke": 1, + "on": 1, + "group": 1, + "apply_to_last": 6, + "fn": 3, + "find": 2, + "real": 1, + "exp": 17, + "last_exp_id": 3, + "for": 20, + "i": 15, + "#stms": 1, + "if": 43, + "and": 8, + "break": 1, + "return": 11, + "in": 18, + "ipairs": 3, + "else": 22, + "body": 26, + "sindle": 1, + "expression/statement": 1, + "is_singular": 2, + "false": 2, + "#body": 1, + "true": 4, + "find_assigns": 2, + "out": 9, + "{": 135, + "}": 136, + "thing": 4, + "*body": 2, + "switch": 7, + "when": 12, + "table.insert": 3, + "extract": 1, + "names": 16, + "hoist_declarations": 1, + "assigns": 5, + "hoist": 1, + "plain": 1, + "old": 1, + "*find_assigns": 1, + "name": 31, + "*names": 3, + "type": 5, + "after": 1, + "runs": 1, + "idx": 4, + "while": 3, + "do": 2, + "+": 2, + "expand_elseif_assign": 2, + "ifstm": 5, + "#ifstm": 1, + "case": 13, + "split": 4, + "constructor_name": 2, + "with_continue_listener": 4, + "continue_name": 13, + "nil": 8, + "@listen": 1, + "unless": 6, + "@put_name": 2, + "build.group": 14, + "@splice": 1, + "lines": 2, + "Transformer": 2, + "@transformers": 3, + "@seen_nodes": 3, + "setmetatable": 1, + "__mode": 1, + "scope": 4, + "node": 68, + "...": 10, + "transformer": 3, + "res": 3, + "or": 6, + "bind": 1, + "@transform": 2, + "__call": 1, + "can_transform": 1, + "construct_comprehension": 2, + "inner": 2, + "clauses": 4, + "current_stms": 7, + "_": 10, + "clause": 4, + "t": 10, + "iter": 2, + "elseif": 1, + "cond": 11, + "error": 4, + "..t": 1, + "Statement": 2, + "root_stms": 1, + "@": 1, + "assign": 9, + "values": 10, + "bubble": 1, + "cascading": 2, + "transformed": 2, + "#values": 1, + "value": 7, + "@transform.statement": 2, + "types.cascading": 1, + "ret": 16, + "types.is_value": 1, + "destructure.has_destructure": 2, + "destructure.split_assign": 1, + "continue": 1, + "@send": 1, + "build.assign_one": 11, + "export": 1, + "they": 1, + "are": 1, + "included": 1, + "#node": 3, + "cls": 5, + "cls.name": 1, + "build.assign": 3, + "update": 1, + "op": 2, + "op_final": 3, + "match": 1, + "..op": 1, + "not": 2, + "source": 7, + "stubs": 1, + "real_names": 4, + "build.chain": 7, + "base": 8, + "stub": 4, + "*stubs": 2, + "source_name": 3, + "comprehension": 1, + "action": 4, + "decorated": 1, + "dec": 6, + "wrapped": 4, + "fail": 5, + "..": 1, + "build.declare": 1, + "*stm": 1, + "expand": 1, + "destructure.build_assign": 2, + "build.do": 2, + "apply": 1, + "decorator": 1, + "mutate": 1, + "all": 1, + "bodies": 1, + "body_idx": 3, + "with": 3, + "block": 2, + "scope_name": 5, + "named_assign": 2, + "assign_name": 1, + "@set": 1, + "foreach": 1, + "node.iter": 1, + "destructures": 5, + "node.names": 3, + "proxy": 2, + "next": 1, + "node.body": 9, + "index_name": 3, + "list_name": 6, + "slice_var": 3, + "bounds": 3, + "slice": 7, + "#list": 1, + "table.remove": 2, + "max_tmp_name": 5, + "index": 2, + "conds": 3, + "exp_name": 3, + "convert": 1, + "into": 1, + "statment": 1, + "convert_cond": 2, + "case_exps": 3, + "cond_exp": 5, + "first": 3, + "if_stm": 5, + "*conds": 1, + "if_cond": 4, + "parent_assign": 3, + "parent_val": 1, + "apart": 1, + "properties": 4, + "statements": 4, + "item": 3, + "tuple": 8, + "*item": 1, + "constructor": 7, + "*properties": 1, + "key": 3, + "parent_cls_name": 5, + "base_name": 4, + "self_name": 4, + "cls_name": 1, + "build.fndef": 3, + "args": 3, + "arrow": 1, + "then": 2, + "constructor.arrow": 1, + "real_name": 6, + "#real_name": 1, + "build.table": 2, + "look": 1, + "up": 1, + "object": 1, + "class_lookup": 3, + "cls_mt": 2, + "out_body": 1, + "make": 1, + "sure": 1, + "we": 1, + "don": 1, + "string": 1, + "parens": 2, + "colon_stub": 1, + "super": 1, + "dot": 1, + "varargs": 2, + "arg_list": 1, + "Value": 1 + }, + "NSIS": { + ";": 39, + "bigtest.nsi": 1, + "This": 2, + "script": 1, + "attempts": 1, + "to": 6, + "test": 1, + "most": 1, + "of": 3, + "the": 4, + "functionality": 1, + "NSIS": 3, + "exehead.": 1, + "-": 205, + "ifdef": 2, + "HAVE_UPX": 1, + "packhdr": 1, + "tmp.dat": 1, + "endif": 4, + "NOCOMPRESS": 1, + "SetCompress": 1, + "off": 1, + "Name": 1, + "Caption": 1, + "Icon": 1, + "OutFile": 1, + "SetDateSave": 1, + "on": 6, + "SetDatablockOptimize": 1, + "CRCCheck": 1, + "SilentInstall": 1, + "normal": 1, + "BGGradient": 1, + "FFFFFF": 1, + "InstallColors": 1, + "FF8080": 1, + "XPStyle": 1, + "InstallDir": 1, + "InstallDirRegKey": 1, + "HKLM": 9, + "CheckBitmap": 1, + "LicenseText": 1, + "LicenseData": 1, + "RequestExecutionLevel": 1, + "admin": 1, + "Page": 4, + "license": 1, + "components": 1, + "directory": 3, + "instfiles": 2, + "UninstPage": 2, + "uninstConfirm": 1, + "ifndef": 2, + "NOINSTTYPES": 1, + "only": 1, + "if": 4, + "not": 2, + "defined": 1, + "InstType": 6, + "/NOCUSTOM": 1, + "/COMPONENTSONLYONCUSTOM": 1, + "AutoCloseWindow": 1, + "false": 1, + "ShowInstDetails": 1, + "show": 1, + "Section": 5, + "empty": 1, + "string": 1, + "makes": 1, + "it": 3, + "hidden": 1, + "so": 1, + "would": 1, + "starting": 1, + "with": 1, + "write": 2, + "reg": 1, + "info": 1, + "StrCpy": 2, + "DetailPrint": 1, + "WriteRegStr": 4, + "SOFTWARE": 7, + "NSISTest": 7, + "BigNSISTest": 8, + "uninstall": 2, + "strings": 1, + "SetOutPath": 3, + "INSTDIR": 15, + "File": 3, + "/a": 1, + "CreateDirectory": 1, + "recursively": 1, + "create": 1, + "a": 2, + "for": 2, + "fun.": 1, + "WriteUninstaller": 1, + "Nop": 1, + "fun": 1, + "SectionEnd": 5, + "SectionIn": 4, + "Start": 2, + "MessageBox": 11, + "MB_OK": 8, + "MB_YESNO": 3, + "IDYES": 2, + "MyLabel": 2, + "SectionGroup": 2, + "/e": 1, + "SectionGroup1": 1, + "WriteRegDword": 3, + "xdeadbeef": 1, + "WriteRegBin": 1, + "WriteINIStr": 5, + "Call": 6, + "MyFunctionTest": 1, + "DeleteINIStr": 1, + "DeleteINISec": 1, + "ReadINIStr": 1, + "StrCmp": 1, + "INIDelSuccess": 2, + "ClearErrors": 1, + "ReadRegStr": 1, + "HKCR": 1, + "xyz_cc_does_not_exist": 1, + "IfErrors": 1, + "NoError": 2, + "Goto": 1, + "ErrorYay": 2, + "CSCTest": 1, + "Group2": 1, + "BeginTestSection": 1, + "IfFileExists": 1, + "BranchTest69": 1, + "|": 3, + "MB_ICONQUESTION": 1, + "IDNO": 1, + "NoOverwrite": 1, + "skipped": 2, + "file": 4, + "doesn": 2, + "s": 1, + "icon": 1, + "start": 1, + "minimized": 1, + "and": 1, + "give": 1, + "hotkey": 1, + "(": 5, + "Ctrl": 1, + "+": 2, + "Shift": 1, + "Q": 2, + ")": 5, + "CreateShortCut": 2, + "SW_SHOWMINIMIZED": 1, + "CONTROL": 1, + "SHIFT": 1, + "MyTestVar": 1, + "myfunc": 1, + "test.ini": 2, + "MySectionIni": 1, + "Value1": 1, + "failed": 1, + "TextInSection": 1, + "will": 1, + "example2.": 1, + "Hit": 1, + "next": 1, + "continue.": 1, + "{": 8, + "NSISDIR": 1, + "}": 8, + "Contrib": 1, + "Graphics": 1, + "Icons": 1, + "nsis1": 1, + "uninstall.ico": 1, + "Uninstall": 2, + "Software": 1, + "Microsoft": 1, + "Windows": 3, + "CurrentVersion": 1, + "silent.nsi": 1, + "LogicLib.nsi": 1, + "bt": 1, + "uninst.exe": 1, + "SMPROGRAMS": 2, + "Big": 1, + "Test": 2, + "*.*": 2, + "BiG": 1, + "Would": 1, + "you": 1, + "like": 1, + "remove": 1, + "cpdest": 3, + "MyProjectFamily": 2, + "MyProject": 1, + "Note": 1, + "could": 1, + "be": 1, + "removed": 1, + "IDOK": 1, + "t": 1, + "exist": 1, + "NoErrorMsg": 1, + "x64.nsh": 1, + "A": 1, + "few": 1, + "simple": 1, + "macros": 1, + "handle": 1, + "installations": 1, + "x64": 1, + "machines.": 1, + "RunningX64": 4, + "checks": 1, + "installer": 1, + "is": 2, + "running": 1, + "x64.": 1, + "If": 1, + "EndIf": 1, + "DisableX64FSRedirection": 4, + "disables": 1, + "system": 2, + "redirection.": 2, + "EnableX64FSRedirection": 4, + "enables": 1, + "SYSDIR": 1, + "some.dll": 2, + "#": 3, + "extracts": 2, + "C": 2, + "System32": 1, + "SysWOW64": 1, + "___X64__NSH___": 3, + "define": 4, + "include": 1, + "LogicLib.nsh": 1, + "macro": 3, + "_RunningX64": 1, + "_a": 1, + "_b": 1, + "_t": 2, + "_f": 2, + "insertmacro": 2, + "_LOGICLIB_TEMP": 3, + "System": 4, + "kernel32": 4, + "GetCurrentProcess": 1, + "i.s": 1, + "IsWow64Process": 1, + "*i.s": 1, + "Pop": 1, + "_": 1, + "macroend": 3, + "Wow64EnableWow64FsRedirection": 2, + "i0": 1, + "i1": 1 + }, "Nemerle": { "using": 1, "System.Console": 1, @@ -17371,6 +22677,93 @@ "puts": 1, ")": 1 }, + "OCaml": { + "type": 2, + "a": 4, + "-": 22, + "unit": 5, + ")": 23, + "module": 5, + "Ops": 2, + "struct": 5, + "let": 13, + "(": 21, + "@": 6, + "f": 10, + "k": 21, + "|": 15, + "x": 14, + "end": 5, + "open": 4, + "List": 1, + "rec": 3, + "map": 3, + "l": 8, + "match": 4, + "with": 4, + "[": 13, + "]": 13, + "hd": 6, + "tl": 6, + "fun": 9, + "fold": 2, + "acc": 5, + "Option": 1, + "opt": 2, + "None": 5, + "Some": 5, + "Lazy": 1, + "option": 1, + ";": 14, + "mutable": 1, + "waiters": 5, + "}": 13, + "make": 1, + "push": 4, + "cps": 7, + "{": 11, + "value": 3, + "force": 1, + "l.value": 2, + "when": 1, + "l.waiters": 5, + "<->": 3, + "function": 1, + "Base.List.iter": 1, + "l.push": 1, + "<": 1, + "get_state": 1, + "lazy_from_val": 1, + "_": 2, + "shared": 1, + "Eliom_content": 1, + "Html5.D": 1, + "Eliom_parameter": 1, + "server": 2, + "Example": 1, + "Eliom_registration.App": 1, + "application_name": 1, + "main": 2, + "Eliom_service.service": 1, + "path": 1, + "get_params": 1, + "client": 1, + "hello_popup": 2, + "Dom_html.window##alert": 1, + "Js.string": 1, + "Example.register": 1, + "service": 1, + "Lwt.return": 1, + "html": 1, + "head": 1, + "title": 1, + "pcdata": 4, + "body": 1, + "h1": 1, + "p": 1, + "h2": 1, + "a_onclick": 1 + }, "Objective-C": { "//": 317, "#import": 53, @@ -18933,9 +24326,6 @@ "window": 1, "applicationDidFinishLaunching": 1, "aNotification": 1, - "argc": 1, - "*argv": 1, - "NSLog": 4, "#include": 18, "": 1, "": 2, @@ -19634,6 +25024,7 @@ "animated": 27, "flashScrollIndicators": 1, "DEBUG": 1, + "NSLog": 4, "TTDPRINTMETHODNAME": 1, "TTDPRINT": 9, "TTMAXLOGLEVEL": 1, @@ -20189,66 +25580,24 @@ "setMaintainContentOffsetAfterReload": 1, "newValue": 2, "indexPathWithIndexes": 1, - "indexAtPosition": 2 + "indexAtPosition": 2, + "argc": 1, + "*argv": 1 }, - "OCaml": { - "type": 2, - "a": 3, - "-": 21, - "unit": 4, - ")": 9, - "module": 4, - "Ops": 2, - "struct": 4, - "let": 9, - "(": 7, - "@": 6, - "f": 10, - "k": 21, - "|": 15, - "x": 14, - "end": 4, - "open": 1, - "List": 1, - "rec": 3, - "map": 3, - "l": 8, - "match": 4, - "with": 4, - "[": 6, - "]": 6, - "hd": 6, - "tl": 6, - "fun": 8, - "fold": 2, - "acc": 5, - "Option": 1, - "opt": 2, - "None": 5, - "Some": 5, - "Lazy": 1, - "option": 1, - ";": 12, - "mutable": 1, - "waiters": 5, - "}": 3, - "make": 1, - "push": 4, - "cps": 7, - "{": 1, - "value": 3, - "force": 1, - "l.value": 2, - "when": 1, - "l.waiters": 5, - "<->": 3, - "function": 1, - "Base.List.iter": 1, - "l.push": 1, - "<": 1, - "get_state": 1, - "lazy_from_val": 1, - "_": 1 + "Omgrofl": { + "lol": 14, + "iz": 11, + "wtf": 1, + "liek": 1, + "lmao": 1, + "brb": 1, + "w00t": 1, + "Hello": 1, + "World": 1, + "rofl": 13, + "lool": 5, + "loool": 6, + "stfu": 1 }, "Opa": { "server": 1, @@ -20627,6 +25976,1029 @@ "SUBSTRING": 1, "lcPostBase64Data.": 1 }, + "PHP": { + "<": 11, + "php": 8, + "namespace": 28, + "Symfony": 24, + "Component": 24, + "Console": 17, + ";": 1382, + "use": 23, + "Input": 6, + "InputInterface": 4, + "ArgvInput": 2, + "ArrayInput": 3, + "InputDefinition": 2, + "InputOption": 15, + "InputArgument": 3, + "Output": 5, + "OutputInterface": 6, + "ConsoleOutput": 2, + "ConsoleOutputInterface": 2, + "Command": 6, + "HelpCommand": 2, + "ListCommand": 2, + "Helper": 3, + "HelperSet": 3, + "FormatterHelper": 2, + "DialogHelper": 2, + "class": 21, + "Application": 2, + "{": 974, + "private": 24, + "commands": 39, + "wantHelps": 4, + "false": 154, + "runningCommand": 5, + "name": 181, + "version": 8, + "catchExceptions": 4, + "autoExit": 4, + "definition": 3, + "helperSet": 6, + "public": 202, + "function": 205, + "__construct": 8, + "(": 2415, + ")": 2416, + "this": 928, + "-": 1271, + "true": 132, + "array": 296, + "getDefaultHelperSet": 2, + "getDefaultInputDefinition": 2, + "foreach": 94, + "getDefaultCommands": 2, + "as": 96, + "command": 41, + "add": 7, + "}": 972, + "run": 3, + "input": 20, + "null": 164, + "output": 60, + "if": 450, + "new": 73, + "try": 3, + "statusCode": 14, + "doRun": 2, + "catch": 3, + "Exception": 1, + "e": 18, + "throw": 19, + "instanceof": 8, + "renderException": 3, + "getErrorOutput": 2, + "else": 70, + "getCode": 1, + "is_numeric": 7, + "&&": 119, + "exit": 7, + "return": 305, + "getCommandName": 2, + "hasParameterOption": 7, + "setDecorated": 2, + "elseif": 31, + "setInteractive": 2, + "function_exists": 4, + "getHelperSet": 3, + "has": 7, + "inputStream": 2, + "get": 12, + "getInputStream": 1, + "posix_isatty": 1, + "setVerbosity": 2, + "VERBOSITY_QUIET": 1, + "VERBOSITY_VERBOSE": 2, + "writeln": 13, + "getLongVersion": 3, + "find": 17, + "setHelperSet": 1, + "getDefinition": 2, + "getHelp": 2, + "messages": 16, + "sprintf": 27, + "getOptions": 1, + "option": 5, + "[": 672, + "]": 672, + ".": 169, + "getName": 14, + "getShortcut": 2, + "getDescription": 3, + "implode": 8, + "PHP_EOL": 3, + "setCatchExceptions": 1, + "boolean": 4, + "Boolean": 4, + "setAutoExit": 1, + "setName": 1, + "getVersion": 3, + "setVersion": 1, + "register": 1, + "addCommands": 1, + "setApplication": 2, + "isEnabled": 1, + "getAliases": 3, + "alias": 87, + "isset": 101, + "InvalidArgumentException": 9, + "helpCommand": 3, + "setCommand": 1, + "getNamespaces": 3, + "namespaces": 4, + "extractNamespace": 7, + "array_values": 5, + "array_unique": 4, + "array_filter": 2, + "findNamespace": 4, + "allNamespaces": 3, + "n": 12, + "explode": 9, + "found": 4, + "i": 36, + "part": 10, + "abbrevs": 31, + "static": 6, + "getAbbreviations": 4, + "array_map": 2, + "p": 3, + "message": 12, + "<=>": 3, + "alternatives": 10, + "findAlternativeNamespace": 2, + "count": 32, + "getAbbreviationSuggestions": 4, + "searchName": 13, + "pos": 3, + "strrpos": 2, + "substr": 6, + "namespace.substr": 1, + "suggestions": 2, + "aliases": 8, + "findAlternativeCommands": 2, + "all": 11, + "substr_count": 1, + "+": 12, + "names": 3, + "for": 8, + "len": 11, + "strlen": 14, + "abbrev": 4, + "asText": 1, + "raw": 2, + "width": 7, + "sortCommands": 4, + "space": 5, + "space.": 1, + "asXml": 2, + "asDom": 2, + "dom": 12, + "DOMDocument": 2, + "formatOutput": 1, + "appendChild": 10, + "xml": 5, + "createElement": 6, + "commandsXML": 3, + "setAttribute": 2, + "namespacesXML": 3, + "namespaceArrayXML": 4, + "continue": 7, + "commandXML": 3, + "createTextNode": 1, + "node": 42, + "getElementsByTagName": 1, + "item": 9, + "importNode": 3, + "saveXml": 1, + "string": 5, + "encoding": 2, + "mb_detect_encoding": 1, + "mb_strlen": 1, + "do": 2, + "title": 3, + "get_class": 4, + "getTerminalWidth": 3, + "PHP_INT_MAX": 1, + "lines": 3, + "preg_split": 1, + "getMessage": 1, + "line": 10, + "str_split": 1, + "max": 2, + "str_repeat": 2, + "title.str_repeat": 1, + "line.str_repeat": 1, + "message.": 1, + "getVerbosity": 1, + "trace": 12, + "getTrace": 1, + "array_unshift": 2, + "getFile": 2, + "getLine": 2, + "type": 62, + "file": 2, + "while": 6, + "getPrevious": 1, + "getSynopsis": 1, + "protected": 59, + "defined": 2, + "ansicon": 4, + "getenv": 2, + "preg_replace": 4, + "preg_match": 6, + "getSttyColumns": 3, + "match": 4, + "getTerminalHeight": 1, + "trim": 3, + "getFirstArgument": 1, + "REQUIRED": 1, + "VALUE_NONE": 7, + "descriptorspec": 2, + "process": 10, + "proc_open": 1, + "pipes": 4, + "is_resource": 1, + "info": 5, + "stream_get_contents": 1, + "fclose": 2, + "proc_close": 1, + "namespacedCommands": 5, + "key": 64, + "ksort": 2, + "&": 19, + "limit": 3, + "parts": 4, + "array_pop": 1, + "array_slice": 1, + "callback": 5, + "findAlternatives": 3, + "collection": 3, + "call_user_func": 2, + "lev": 6, + "levenshtein": 2, + "3": 1, + "strpos": 15, + "values": 53, + "/": 1, + "||": 52, + "value": 53, + "asort": 1, + "array_keys": 7, + "BrowserKit": 1, + "DomCrawler": 5, + "Crawler": 2, + "Link": 3, + "Form": 4, + "Process": 1, + "PhpProcess": 2, + "abstract": 2, + "Client": 1, + "history": 15, + "cookieJar": 9, + "server": 20, + "request": 76, + "response": 33, + "crawler": 7, + "insulated": 7, + "redirect": 6, + "followRedirects": 5, + "History": 2, + "CookieJar": 2, + "setServerParameters": 2, + "followRedirect": 4, + "insulate": 1, + "class_exists": 2, + "RuntimeException": 2, + "array_merge": 32, + "setServerParameter": 1, + "getServerParameter": 1, + "default": 8, + "getHistory": 1, + "getCookieJar": 1, + "getCrawler": 1, + "getResponse": 1, + "getRequest": 1, + "click": 1, + "link": 9, + "submit": 2, + "getMethod": 6, + "getUri": 8, + "form": 7, + "setValues": 2, + "getPhpValues": 2, + "getPhpFiles": 2, + "method": 31, + "uri": 23, + "parameters": 4, + "files": 7, + "content": 4, + "changeHistory": 4, + "getAbsoluteUri": 2, + "isEmpty": 2, + "current": 4, + "parse_url": 3, + "PHP_URL_HOST": 1, + "PHP_URL_SCHEME": 1, + "Request": 3, + "allValues": 1, + "filterRequest": 2, + "doRequestInProcess": 2, + "doRequest": 2, + "filterResponse": 2, + "updateFromResponse": 1, + "getHeader": 2, + "createCrawlerFromContent": 2, + "getContent": 2, + "getScript": 2, + "sys_get_temp_dir": 2, + "isSuccessful": 1, + "getOutput": 3, + "unserialize": 1, + "LogicException": 4, + "addContent": 1, + "back": 2, + "requestFromRequest": 4, + "forward": 2, + "reload": 1, + "empty": 96, + "restart": 1, + "clear": 2, + "currentUri": 7, + "path": 20, + "PHP_URL_PATH": 1, + "path.": 1, + "getParameters": 1, + "getFiles": 3, + "getServer": 1, + "": 2, + "CakePHP": 6, + "tm": 6, + "Rapid": 2, + "Development": 2, + "Framework": 2, + "http": 12, + "cakephp": 4, + "org": 10, + "Copyright": 4, + "2005": 4, + "2012": 4, + "Cake": 7, + "Software": 4, + "Foundation": 4, + "Inc": 4, + "cakefoundation": 4, + "Licensed": 2, + "under": 2, + "The": 4, + "MIT": 4, + "License": 4, + "Redistributions": 2, + "of": 10, + "must": 2, + "retain": 2, + "the": 11, + "above": 2, + "copyright": 4, + "notice": 2, + "Project": 2, + "package": 2, + "Controller": 4, + "since": 2, + "v": 17, + "0": 4, + "2": 2, + "9": 1, + "license": 4, + "www": 2, + "opensource": 2, + "licenses": 2, + "mit": 2, + "App": 20, + "uses": 46, + "CakeResponse": 2, + "Network": 1, + "ClassRegistry": 9, + "Utility": 6, + "ComponentCollection": 2, + "View": 9, + "CakeEvent": 13, + "Event": 6, + "CakeEventListener": 4, + "CakeEventManager": 5, + "controller": 3, + "organization": 1, + "business": 1, + "logic": 1, + "Provides": 1, + "basic": 1, + "functionality": 1, + "such": 1, + "rendering": 1, + "views": 1, + "inside": 1, + "layouts": 1, + "automatic": 1, + "model": 34, + "availability": 1, + "redirection": 2, + "callbacks": 4, + "and": 5, + "more": 1, + "Controllers": 2, + "should": 1, + "provide": 1, + "a": 11, + "number": 1, + "action": 7, + "methods": 5, + "These": 1, + "are": 5, + "on": 4, + "that": 2, + "not": 2, + "prefixed": 1, + "with": 5, + "_": 1, + "Each": 1, + "serves": 1, + "an": 1, + "endpoint": 1, + "performing": 2, + "specific": 1, + "resource": 1, + "or": 7, + "resources": 1, + "For": 2, + "example": 2, + "adding": 1, + "editing": 1, + "object": 14, + "listing": 1, + "set": 26, + "objects": 5, + "You": 2, + "can": 2, + "access": 1, + "using": 2, + "contains": 1, + "POST": 1, + "GET": 1, + "FILES": 1, + "*": 25, + "were": 1, + "request.": 1, + "After": 1, + "required": 2, + "actions": 2, + "controllers": 2, + "responsible": 1, + "creating": 1, + "response.": 2, + "This": 1, + "usually": 1, + "takes": 1, + "generated": 1, + "possibly": 1, + "to": 6, + "another": 1, + "action.": 1, + "In": 1, + "either": 1, + "case": 31, + "allows": 1, + "you": 1, + "manipulate": 1, + "aspects": 1, + "created": 8, + "by": 1, + "Dispatcher": 1, + "based": 2, + "routing.": 1, + "By": 1, + "conventional": 1, + "names.": 1, + "/posts/index": 1, + "maps": 1, + "PostsController": 1, + "index": 5, + "re": 1, + "map": 1, + "urls": 1, + "Router": 5, + "connect": 1, + "@package": 2, + "Cake.Controller": 1, + "@property": 8, + "AclComponent": 1, + "Acl": 1, + "AuthComponent": 1, + "Auth": 1, + "CookieComponent": 1, + "Cookie": 1, + "EmailComponent": 1, + "Email": 1, + "PaginatorComponent": 1, + "Paginator": 1, + "RequestHandlerComponent": 1, + "RequestHandler": 1, + "SecurityComponent": 1, + "Security": 1, + "SessionComponent": 1, + "Session": 1, + "@link": 2, + "//book.cakephp.org/2.0/en/controllers.html": 1, + "*/": 2, + "extends": 3, + "Object": 4, + "implements": 3, + "helpers": 1, + "_responseClass": 1, + "viewPath": 3, + "layoutPath": 1, + "viewVars": 3, + "view": 5, + "layout": 5, + "autoRender": 6, + "autoLayout": 2, + "Components": 7, + "components": 1, + "viewClass": 10, + "ext": 1, + "plugin": 31, + "cacheAction": 1, + "passedArgs": 2, + "scaffold": 2, + "modelClass": 25, + "modelKey": 2, + "validationErrors": 50, + "_mergeParent": 4, + "_eventManager": 12, + "Inflector": 12, + "singularize": 4, + "underscore": 3, + "childMethods": 2, + "get_class_methods": 2, + "parentMethods": 2, + "array_diff": 3, + "CakeRequest": 5, + "setRequest": 2, + "parent": 14, + "__isset": 2, + "switch": 6, + "is_array": 37, + "list": 29, + "pluginSplit": 12, + "loadModel": 3, + "__get": 2, + "params": 34, + "load": 3, + "settings": 2, + "__set": 1, + "camelize": 3, + "array_key_exists": 11, + "invokeAction": 1, + "ReflectionMethod": 2, + "_isPrivateAction": 2, + "PrivateActionException": 1, + "invokeArgs": 1, + "ReflectionException": 1, + "_getScaffold": 2, + "MissingActionException": 1, + "privateAction": 4, + "isPublic": 1, + "in_array": 26, + "prefixes": 4, + "prefix": 2, + "Scaffold": 1, + "_mergeControllerVars": 2, + "pluginController": 9, + "pluginDot": 4, + "mergeParent": 2, + "is_subclass_of": 3, + "pluginVars": 3, + "appVars": 6, + "merge": 12, + "_mergeVars": 5, + "get_class_vars": 2, + "_mergeUses": 3, + "implementedEvents": 2, + "constructClasses": 1, + "init": 4, + "getEventManager": 13, + "attach": 4, + "startupProcess": 1, + "dispatch": 11, + "shutdownProcess": 1, + "httpCodes": 3, + "code": 4, + "id": 82, + "MissingModelException": 1, + "url": 18, + "status": 15, + "extract": 9, + "EXTR_OVERWRITE": 3, + "event": 35, + "//TODO": 1, + "Remove": 1, + "following": 1, + "when": 1, + "events": 1, + "fully": 1, + "migrated": 1, + "break": 19, + "breakOn": 4, + "collectReturn": 1, + "isStopped": 4, + "result": 21, + "_parseBeforeRedirect": 2, + "session_write_close": 1, + "header": 3, + "is_string": 7, + "codes": 3, + "array_flip": 1, + "send": 1, + "_stop": 1, + "resp": 6, + "compact": 8, + "one": 19, + "two": 6, + "data": 187, + "array_combine": 2, + "setAction": 1, + "args": 5, + "func_get_args": 5, + "unset": 22, + "call_user_func_array": 3, + "validate": 9, + "errors": 9, + "validateErrors": 1, + "invalidFields": 2, + "render": 3, + "className": 27, + "models": 6, + "keys": 19, + "currentModel": 2, + "currentObject": 6, + "getObject": 1, + "is_a": 1, + "location": 1, + "body": 1, + "referer": 5, + "local": 2, + "disableCache": 2, + "flash": 1, + "pause": 2, + "postConditions": 1, + "op": 9, + "bool": 5, + "exclusive": 2, + "cond": 5, + "arrayOp": 2, + "fields": 60, + "field": 88, + "fieldOp": 11, + "strtoupper": 3, + "paginate": 3, + "scope": 2, + "whitelist": 14, + "beforeFilter": 1, + "beforeRender": 1, + "beforeRedirect": 1, + "afterFilter": 1, + "beforeScaffold": 2, + "_beforeScaffold": 1, + "afterScaffoldSave": 2, + "_afterScaffoldSave": 1, + "afterScaffoldSaveError": 2, + "_afterScaffoldSaveError": 1, + "scaffoldError": 2, + "_scaffoldError": 1, + "Field": 9, + "FormField": 3, + "ArrayAccess": 1, + "button": 6, + "DOMNode": 3, + "initialize": 2, + "getFormNode": 1, + "getValues": 3, + "isDisabled": 2, + "FileFormField": 3, + "hasValue": 1, + "getValue": 2, + "qs": 4, + "http_build_query": 3, + "parse_str": 2, + "queryString": 2, + "sep": 1, + "sep.": 1, + "getRawUri": 1, + "getAttribute": 10, + "remove": 4, + "offsetExists": 1, + "offsetGet": 1, + "offsetSet": 1, + "offsetUnset": 1, + "setNode": 1, + "nodeName": 13, + "parentNode": 1, + "FormFieldRegistry": 2, + "document": 6, + "root": 4, + "xpath": 2, + "DOMXPath": 1, + "query": 102, + "hasAttribute": 1, + "InputFormField": 2, + "ChoiceFormField": 2, + "addChoice": 1, + "TextareaFormField": 1, + "base": 8, + "segments": 13, + "getSegments": 4, + "target": 20, + "array_shift": 5, + "self": 1, + "create": 13, + "k": 7, + "setValue": 1, + "walk": 3, + "registry": 4, + "m": 5, + "relational": 2, + "mapper": 2, + "DBO": 2, + "backed": 2, + "mapping": 1, + "database": 2, + "tables": 5, + "PHP": 1, + "versions": 1, + "5": 1, + "Model": 5, + "10": 1, + "Validation": 1, + "String": 5, + "Set": 9, + "BehaviorCollection": 2, + "ModelBehavior": 1, + "ConnectionManager": 2, + "Xml": 2, + "Automatically": 1, + "selects": 1, + "table": 21, + "pluralized": 1, + "lowercase": 1, + "User": 1, + "is": 1, + "have": 1, + "at": 1, + "least": 1, + "primary": 3, + "key.": 1, + "Cake.Model": 1, + "//book.cakephp.org/2.0/en/models.html": 1, + "useDbConfig": 7, + "useTable": 12, + "displayField": 4, + "schemaName": 1, + "primaryKey": 38, + "_schema": 11, + "validationDomain": 1, + "tablePrefix": 8, + "tableToModel": 4, + "cacheQueries": 1, + "belongsTo": 7, + "hasOne": 2, + "hasMany": 2, + "hasAndBelongsToMany": 24, + "actsAs": 2, + "Behaviors": 6, + "cacheSources": 7, + "findQueryType": 3, + "recursive": 9, + "order": 4, + "virtualFields": 8, + "_associationKeys": 2, + "_associations": 5, + "__backAssociation": 22, + "__backInnerAssociation": 1, + "__backOriginalAssociation": 1, + "__backContainableAssociation": 1, + "_insertID": 1, + "_sourceConfigured": 1, + "findMethods": 3, + "ds": 3, + "addObject": 2, + "parentClass": 3, + "get_parent_class": 1, + "tableize": 2, + "_createLinks": 3, + "__call": 1, + "dispatchMethod": 1, + "getDataSource": 15, + "relation": 7, + "assocKey": 13, + "dynamic": 2, + "isKeySet": 1, + "AppModel": 1, + "_constructLinkedModel": 2, + "schema": 11, + "hasField": 7, + "setDataSource": 2, + "property_exists": 3, + "bindModel": 1, + "reset": 6, + "assoc": 75, + "assocName": 6, + "unbindModel": 1, + "_generateAssociation": 2, + "dynamicWith": 3, + "sort": 1, + "setSource": 1, + "tableName": 4, + "db": 45, + "method_exists": 5, + "sources": 3, + "listSources": 1, + "strtolower": 1, + "MissingTableException": 1, + "is_object": 2, + "SimpleXMLElement": 1, + "_normalizeXmlData": 3, + "toArray": 1, + "reverse": 1, + "_setAliasData": 2, + "modelName": 3, + "fieldSet": 3, + "fieldName": 6, + "fieldValue": 7, + "deconstruct": 2, + "getAssociated": 4, + "getColumnType": 4, + "useNewDate": 2, + "dateFields": 5, + "timeFields": 2, + "date": 9, + "val": 27, + "format": 3, + "columns": 5, + "str_replace": 3, + "describe": 1, + "getColumnTypes": 1, + "trigger_error": 1, + "__d": 1, + "E_USER_WARNING": 1, + "cols": 7, + "column": 10, + "startQuote": 4, + "endQuote": 4, + "checkVirtual": 3, + "isVirtualField": 3, + "hasMethod": 2, + "getVirtualField": 1, + "filterKey": 2, + "defaults": 6, + "properties": 4, + "read": 2, + "conditions": 41, + "saveField": 1, + "options": 85, + "save": 9, + "fieldList": 1, + "_whitelist": 4, + "keyPresentAndEmpty": 2, + "exists": 6, + "validates": 60, + "updateCol": 6, + "colType": 4, + "time": 3, + "strtotime": 1, + "joined": 5, + "x": 4, + "y": 2, + "success": 10, + "cache": 2, + "_prepareUpdateFields": 2, + "update": 2, + "fInfo": 4, + "isUUID": 5, + "j": 2, + "array_search": 1, + "uuid": 3, + "updateCounterCache": 6, + "_saveMulti": 2, + "_clearCache": 2, + "join": 22, + "joinModel": 8, + "keyInfo": 4, + "withModel": 4, + "pluginName": 1, + "dbMulti": 6, + "newData": 5, + "newValues": 8, + "newJoins": 7, + "primaryAdded": 3, + "idField": 3, + "row": 17, + "keepExisting": 3, + "associationForeignKey": 5, + "links": 4, + "oldLinks": 4, + "delete": 9, + "oldJoin": 4, + "insertMulti": 1, + "foreignKey": 11, + "fkQuoted": 3, + "escapeField": 6, + "intval": 4, + "updateAll": 3, + "foreignKeys": 3, + "included": 3, + "array_intersect": 1, + "old": 2, + "saveAll": 1, + "numeric": 1, + "validateMany": 4, + "saveMany": 3, + "validateAssociated": 5, + "saveAssociated": 5, + "transactionBegun": 4, + "begin": 2, + "record": 10, + "saved": 18, + "commit": 2, + "rollback": 2, + "associations": 9, + "association": 47, + "notEmpty": 4, + "_return": 3, + "recordData": 2, + "cascade": 10, + "_deleteDependent": 3, + "_deleteLinks": 3, + "_collectForeignKeys": 2, + "savedAssociatons": 3, + "deleteAll": 2, + "records": 6, + "ids": 8, + "_id": 2, + "getID": 2, + "hasAny": 1, + "buildQuery": 2, + "is_null": 1, + "results": 22, + "resetAssociations": 3, + "_filterResults": 2, + "ucfirst": 2, + "modParams": 2, + "_findFirst": 1, + "state": 15, + "_findCount": 1, + "calculate": 2, + "expression": 1, + "_findList": 1, + "tokenize": 1, + "lst": 4, + "combine": 1, + "_findNeighbors": 1, + "prevVal": 2, + "return2": 6, + "_findThreaded": 1, + "nest": 1, + "isUnique": 1, + "is_bool": 1, + "sql": 1, + "php_help": 1, + "arg": 1, + "t": 25, + "php_permission": 1, + "TRUE": 1, + "php_eval": 1, + "global": 2, + "theme_path": 5, + "theme_info": 3, + "conf": 2, + "old_theme_path": 2, + "drupal_get_path": 1, + "dirname": 1, + "filename": 1, + "ob_start": 1, + "print": 1, + "eval": 1, + "ob_get_contents": 1, + "ob_end_clean": 1, + "_php_filter_tips": 1, + "filter": 1, + "long": 2, + "FALSE": 2, + "base_url": 1, + "php_filter_info": 1, + "filters": 2, + "SHEBANG#!php": 2, + "echo": 2 + }, "Parrot Assembly": { "SHEBANG#!parrot": 1, ".pcc_sub": 1, @@ -21343,19 +27715,469 @@ "License": 2, "v2.0.": 2, "End": 3, + "Plack": 25, + "Request": 10, + "_001": 1, + "HTTP": 16, + "Headers": 8, + "Carp": 11, + "Hash": 9, + "MultiValue": 9, + "Body": 2, + "Upload": 2, + "TempBuffer": 2, + "URI": 11, + "Escape": 6, + "_deprecated": 8, + "alt": 1, + "method": 7, + "caller": 2, + "carp": 2, + "class": 8, + "env": 76, + "croak": 3, + "required": 2, + "bless": 7, + "address": 2, + "REMOTE_ADDR": 1, + "remote_host": 2, + "REMOTE_HOST": 1, + "protocol": 1, + "SERVER_PROTOCOL": 1, + "REQUEST_METHOD": 1, + "port": 1, + "SERVER_PORT": 2, + "REMOTE_USER": 1, + "request_uri": 1, + "REQUEST_URI": 2, + "path_info": 4, + "PATH_INFO": 3, + "script_name": 1, + "SCRIPT_NAME": 2, + "scheme": 3, + "secure": 2, + "body": 30, + "input": 9, + "content_length": 4, + "CONTENT_LENGTH": 3, + "content_type": 5, + "CONTENT_TYPE": 2, + "session": 1, + "session_options": 1, + "logger": 1, + "cookies": 9, + "self": 141, + "HTTP_COOKIE": 3, + "@pairs": 2, + "pair": 4, + "uri_unescape": 1, + "query_parameters": 3, + "uri": 11, + "query_form": 2, + "content": 8, + "_parse_request_body": 4, + "cl": 10, + "read": 6, + "seek": 4, + "raw_body": 1, + "headers": 56, + "field": 2, + "HTTPS": 1, + "_//": 1, + "CONTENT": 1, + "COOKIE": 1, + "content_encoding": 5, + "referer": 3, + "user_agent": 3, + "body_parameters": 3, + "parameters": 8, + "query": 4, + "flatten": 3, + "uploads": 5, + "hostname": 1, + "url_scheme": 1, + "params": 1, + "query_params": 1, + "body_params": 1, + "cookie": 6, + "param": 8, + "wantarray": 3, + "get_all": 2, + "upload": 13, + "raw_uri": 1, + "base": 10, + "path_query": 1, + "_uri_base": 3, + "path_escape_class": 2, + "uri_escape": 3, + "QUERY_STRING": 3, + "canonical": 2, + "HTTP_HOST": 1, + "SERVER_NAME": 1, + "new_response": 4, + "Response": 16, + "ct": 3, + "cleanup": 1, + "buffer": 9, + "spin": 2, + "chunk": 4, + "length": 1, + "rewind": 1, + "from_mixed": 2, + "@uploads": 3, + "@obj": 3, + "splice": 2, + "_make_upload": 2, + "copy": 4, + "__END__": 2, + "Portable": 2, + "request": 6, + "object": 6, + "PSGI": 6, + "hash": 11, + "app_or_middleware": 1, + "req": 28, + "finalize": 5, + "DESCRIPTION": 4, + "": 2, + "provides": 1, + "consistent": 1, + "API": 2, + "objects": 2, + "across": 1, + "web": 5, + "server": 1, + "environments.": 1, + "CAVEAT": 1, + "Note": 4, + "module": 2, + "intended": 1, + "middleware": 1, + "developers": 3, + "framework": 2, + "rather": 2, + "than": 5, + "users": 4, + "Writing": 1, + "your": 13, + "directly": 1, + "using": 2, + "certainly": 2, + "possible": 1, + "recommended": 1, + "Apache": 2, + "yet": 1, + "too": 1, + "low": 1, + "level.": 1, + "re": 3, + "encouraged": 1, + "frameworks": 2, + "support": 2, + "": 1, + "modules": 1, + "like": 12, + "": 1, + "provide": 1, + "higher": 1, + "level": 1, + "top": 1, + "PSGI.": 1, + "METHODS": 2, + "Some": 1, + "methods": 3, + "earlier": 1, + "versions": 1, + "deprecated": 1, + "Take": 1, + "at": 3, + "": 1, + "Unless": 1, + "noted": 1, + "": 1, + "passing": 1, + "values": 5, + "an": 11, + "accessor": 1, + "doesn": 8, + "debug": 1, + "set.": 1, + "item": 42, + "": 2, + "request.": 1, + "uploads.": 2, + "": 2, + "": 1, + "objects.": 1, + "Shortcut": 6, + "content_encoding.": 1, + "content_length.": 1, + "content_type.": 1, + "header.": 2, + "referer.": 1, + "user_agent.": 1, + "GET": 1, + "POST": 1, + "CGI.pm": 2, + "compatible": 1, + "method.": 1, + "alternative": 1, + "accessing": 1, + "parameters.": 3, + "Unlike": 1, + "": 1, + "allow": 1, + "setting": 1, + "modifying": 1, + "@values": 1, + "@params": 1, + "convenient": 1, + "access": 2, + "@fields": 1, + "Creates": 2, + "": 3, + "object.": 4, + "Handy": 1, + "remove": 2, + "dependency": 1, + "code": 7, + "easy": 1, + "subclassing": 1, + "duck": 1, + "typing": 1, + "well": 2, + "overriding": 1, + "generation": 1, + "middlewares.": 1, + "back": 3, + "Parameters": 1, + "take": 5, + "multiple": 5, + "": 1, + "": 1, + "": 1, + "": 1, + "store": 1, + "means": 2, + "plain": 2, + "": 1, + "scalars": 1, + "": 2, + "references": 1, + "so": 3, + "don": 2, + "ARRAY": 1, + "foo": 6, + "parse": 1, + "more": 2, + "twice": 1, + "efficiency.": 1, + "DISPATCHING": 1, + "wants": 1, + "dispatch": 1, + "route": 1, + "actions": 1, + "based": 1, + "paths": 3, + "sure": 1, + "because": 3, + "": 1, + "gives": 2, + "virtual": 1, + "regardless": 1, + "how": 1, + "mounted.": 1, + "hosted": 1, + "mod_perl": 1, + "CGI": 2, + "scripts": 1, + "multiplexed": 1, + "tools": 1, + "": 1, + "good": 2, + "idea": 1, + "subclass": 1, + "define": 1, + "such": 5, + "uri_for": 2, + "args": 3, + "So": 1, + "say": 1, + "link": 1, + "signoff": 1, + "": 1, + "empty.": 1, + "need": 3, + "older": 1, + "behavior": 3, + "just": 2, + "call": 1, + "instead.": 1, + "Cookie": 2, + "handling": 1, + "simplified": 1, + "always": 5, + "string": 5, + "encoding": 2, + "decoding": 1, + "totally": 1, + "up": 1, + "framework.": 1, + "Also": 1, + "": 1, + "now": 1, + "": 1, + "Simple": 1, + "longer": 1, + "have": 2, + "write": 1, + "wacky": 1, + "instead": 4, + "simply": 1, + "AUTHORS": 1, + "Tatsuhiko": 2, + "Miyagawa": 2, + "Kazuhiro": 1, + "Osawa": 1, + "Tokuhiro": 2, + "Matsuno": 2, + "SEE": 3, + "ALSO": 3, + "": 1, + "": 1, + "library": 1, + "same": 1, + "Util": 3, + "Accessor": 1, + "status": 17, + "Scalar": 2, + "shortcut": 2, + "location": 4, + "redirect": 1, + "url": 2, + "clone": 1, + "_finalize_cookies": 2, + "/chr": 1, + "/ge": 1, + "replace": 3, + "LWS": 1, + "single": 1, + "SP": 1, + "//g": 1, + "CR": 1, + "LF": 1, + "since": 1, + "char": 1, + "invalid": 1, + "here": 2, + "header_field_names": 1, + "_body": 2, + "blessed": 1, + "overload": 1, + "Method": 1, + "_bake_cookie": 2, + "push_header": 1, + "@cookie": 7, + "domain": 3, + "_date": 2, + "expires": 7, + "httponly": 1, + "@MON": 1, + "Jan": 1, + "Feb": 1, + "Mar": 1, + "Apr": 1, + "May": 2, + "Jun": 1, + "Jul": 1, + "Aug": 1, + "Sep": 1, + "Oct": 1, + "Nov": 1, + "Dec": 1, + "@WDAY": 1, + "Sun": 1, + "Mon": 1, + "Tue": 1, + "Wed": 1, + "Thu": 1, + "Fri": 1, + "Sat": 1, + "sec": 2, + "min": 3, + "hour": 2, + "mday": 2, + "mon": 2, + "year": 3, + "wday": 2, + "gmtime": 1, + "sprintf": 1, + "WDAY": 1, + "MON": 1, + "response": 5, + "psgi_handler": 1, + "allows": 2, + "way": 2, + "create": 2, + "simple": 2, + "API.": 1, + "over": 1, + "Sets": 2, + "gets": 2, + "": 1, + "alias.": 2, + "response.": 1, + "Setter": 2, + "either": 2, + "headers.": 1, + "body_str": 1, + "io": 1, + "sets": 4, + "body.": 1, + "IO": 1, + "Handle": 1, + "": 1, + "X": 2, + "Foo": 11, + "text/plain": 1, + "gzip": 1, + "normalize": 1, + "given": 10, + "string.": 1, + "Users": 1, + "responsible": 1, + "properly": 1, + "": 1, + "names": 1, + "their": 1, + "corresponding": 1, + "": 2, + "everything": 1, + "contain": 2, + "": 1, + "": 2, + "": 1, + "": 1, + "": 1, + "integer": 1, + "epoch": 1, + "time": 3, + "": 1, + "convert": 1, + "formats": 1, + "<+3M>": 1, + "reference.": 1, + "AUTHOR": 1, "SHEBANG#!#! perl": 4, "examples/benchmarks/fib.pl": 1, "Fibonacci": 2, "Benchmark": 1, - "DESCRIPTION": 4, "Calculates": 1, "Number": 1, "": 1, "unspecified": 1, "fib": 4, "N": 2, - "SEE": 3, - "ALSO": 3, "": 1, "SHEBANG#!perl": 4, "MAIN": 1, @@ -21363,7 +28185,6 @@ "env_is_usable": 3, "th": 1, "pt": 1, - "env": 76, "@keys": 2, "ACK_/": 1, "@ENV": 1, @@ -21376,7 +28197,6 @@ "Resource": 5, "file_matching": 2, "check_regex": 2, - "like": 12, "finder": 1, "options": 7, "FILE...": 1, @@ -21387,10 +28207,8 @@ "": 5, "searches": 1, "named": 3, - "input": 9, "FILEs": 1, "standard": 1, - "given": 10, "PATTERN.": 1, "By": 2, "prints": 2, @@ -21398,24 +28216,19 @@ "would": 3, "actually": 1, "let": 1, - "take": 5, "advantage": 1, ".wango": 1, "won": 1, "throw": 1, "away": 1, - "because": 3, "times": 2, "symlinks": 1, - "than": 5, "whatever": 1, "were": 1, "specified": 3, "line.": 4, "default.": 2, - "item": 42, "": 11, - "paths": 3, "included": 1, "search.": 1, "entire": 2, @@ -21430,7 +28243,6 @@ "apply": 2, "relative": 1, "convenience": 1, - "shortcut": 2, "<-f>": 6, "<--group>": 2, "<--nogroup>": 2, @@ -21447,7 +28259,6 @@ "<--no-filename>": 1, "Suppress": 1, "prefixing": 1, - "multiple": 5, "searched.": 1, "<--help>": 1, "short": 1, @@ -21464,33 +28275,26 @@ "options.": 4, "": 2, "etc": 2, - "May": 2, "directories.": 2, "mason": 1, - "users": 4, "may": 3, "wish": 1, "include": 1, "<--ignore-dir=data>": 1, "<--noignore-dir>": 1, - "allows": 2, "normally": 1, "perhaps": 1, "research": 1, "<.svn/props>": 1, - "always": 5, - "simple": 2, "name.": 1, "Nested": 1, "": 1, "NOT": 1, "supported.": 1, "You": 3, - "need": 3, "specify": 1, "<--ignore-dir=foo>": 1, "then": 3, - "foo": 6, "taken": 1, "account": 1, "explicitly": 1, @@ -21508,17 +28312,14 @@ "matter": 1, "<-l>": 2, "<--files-with-matches>": 1, - "instead": 4, "text.": 1, "<-L>": 1, "<--files-without-matches>": 1, - "": 2, "equivalent": 2, "specifying": 1, "Specify": 1, "explicitly.": 1, "helpful": 2, - "don": 2, "": 1, "via": 1, "": 4, @@ -21538,7 +28339,6 @@ "Highlighting": 1, "work": 1, "though": 1, - "so": 3, "highlight": 1, "seeing": 1, "tail": 1, @@ -21551,7 +28351,6 @@ "usual": 1, "newline.": 1, "dealing": 1, - "contain": 2, "whitespace": 1, "e.g.": 1, "html": 1, @@ -21565,8 +28364,6 @@ "<-r>": 1, "<-R>": 1, "<--recurse>": 1, - "just": 2, - "here": 2, "compatibility": 2, "turning": 1, "<--no-recurse>": 1, @@ -21585,7 +28382,6 @@ "<--sort-files>": 1, "Sorts": 1, "Use": 6, - "your": 13, "listings": 1, "deterministic": 1, "runs": 1, @@ -21599,7 +28395,6 @@ "Bill": 1, "Cat": 1, "logo.": 1, - "Note": 4, "exact": 1, "spelling": 1, "<--thpppppt>": 1, @@ -21639,7 +28434,6 @@ "Underline": 1, "reset.": 1, "alone": 1, - "sets": 4, "foreground": 1, "on_color": 1, "background": 1, @@ -21652,7 +28446,6 @@ "See": 1, "": 1, "specifications.": 1, - "such": 5, "": 1, "": 1, "": 1, @@ -21660,12 +28453,10 @@ "output.": 1, "except": 1, "assume": 1, - "support": 2, "both": 1, "understands": 1, "sequences.": 1, "never": 1, - "back": 3, "ACK": 2, "OTHER": 1, "TOOLS": 1, @@ -21689,7 +28480,6 @@ "Jackson": 1, "put": 1, "together": 1, - "an": 11, "": 1, "extension": 1, "": 1, @@ -21702,19 +28492,15 @@ "Code": 1, "greater": 1, "normal": 1, - "code": 7, "<$?=256>": 1, "": 1, "backticks.": 1, "errors": 1, "used.": 1, - "at": 3, "least": 1, "returned.": 1, "DEBUGGING": 1, "PROBLEMS": 1, - "gives": 2, - "re": 3, "expecting": 1, "forgotten": 1, "<--noenv>": 1, @@ -21729,8 +28515,6 @@ "working": 1, "big": 1, "codesets": 1, - "more": 2, - "create": 2, "tree": 1, "ideal": 1, "sending": 1, @@ -21748,7 +28532,6 @@ "loading": 1, "": 1, "took": 1, - "access": 2, "log": 3, "scanned": 1, "twice.": 1, @@ -21758,7 +28541,6 @@ "troublesome.gif": 1, "first": 1, "finds": 2, - "Apache": 2, "IP.": 1, "second": 1, "troublesome": 1, @@ -21779,8 +28561,6 @@ "FAQ": 1, "Why": 2, "isn": 1, - "doesn": 8, - "behavior": 3, "driven": 1, "filetype.": 1, "": 1, @@ -21790,30 +28570,21 @@ "you.": 1, "source": 2, "compiled": 1, - "object": 6, "control": 1, "metadata": 1, "wastes": 1, "lot": 1, - "time": 3, "those": 2, - "well": 2, "returning": 1, "things": 1, "great": 1, "did": 1, - "replace": 3, - "read": 6, "only.": 1, "has": 2, "perfectly": 1, - "good": 2, - "way": 2, - "using": 2, "<-p>": 1, "<-n>": 1, "switches.": 1, - "certainly": 2, "select": 1, "update.": 1, "change": 1, @@ -21865,20 +28636,15 @@ "@queue": 8, "_setup": 2, "fullpath": 12, - "splice": 2, "local": 5, - "wantarray": 3, "_candidate_files": 2, "sort_standard": 2, "cmp": 2, "sort_reverse": 1, "@parts": 3, "passed_parms": 6, - "copy": 4, "parm": 1, - "hash": 11, "badkey": 1, - "caller": 2, "start": 6, "dh": 4, "opendir": 1, @@ -21896,7 +28662,6 @@ "bak": 1, "core": 1, "swp": 1, - "min": 3, "js": 1, "1": 1, "str": 12, @@ -21906,1436 +28671,102 @@ "_my_program": 3, "Basename": 2, "FAIL": 12, - "Carp": 11, "confess": 2, "@ISA": 2, - "class": 8, - "self": 141, - "bless": 7, "could_be_binary": 4, "opened": 1, "id": 1, "*STDIN": 1, "size": 5, "_000": 1, - "buffer": 9, "sysread": 1, "regex/m": 1, - "seek": 4, "readline": 1, "nexted": 3, - "Foo": 11, "Bar": 1, - "@array": 1, - "Plack": 25, - "Request": 10, - "_001": 1, - "HTTP": 16, - "Headers": 8, - "Hash": 9, - "MultiValue": 9, - "Body": 2, - "Upload": 2, - "TempBuffer": 2, - "URI": 11, - "Escape": 6, - "_deprecated": 8, - "alt": 1, - "method": 7, - "carp": 2, - "croak": 3, - "required": 2, - "address": 2, - "REMOTE_ADDR": 1, - "remote_host": 2, - "REMOTE_HOST": 1, - "protocol": 1, - "SERVER_PROTOCOL": 1, - "REQUEST_METHOD": 1, - "port": 1, - "SERVER_PORT": 2, - "REMOTE_USER": 1, - "request_uri": 1, - "REQUEST_URI": 2, - "path_info": 4, - "PATH_INFO": 3, - "script_name": 1, - "SCRIPT_NAME": 2, - "scheme": 3, - "secure": 2, - "body": 30, - "content_length": 4, - "CONTENT_LENGTH": 3, - "content_type": 5, - "CONTENT_TYPE": 2, - "session": 1, - "session_options": 1, - "logger": 1, - "cookies": 9, - "HTTP_COOKIE": 3, - "@pairs": 2, - "pair": 4, - "uri_unescape": 1, - "query_parameters": 3, - "uri": 11, - "query_form": 2, - "content": 8, - "_parse_request_body": 4, - "cl": 10, - "raw_body": 1, - "headers": 56, - "field": 2, - "HTTPS": 1, - "_//": 1, - "CONTENT": 1, - "COOKIE": 1, - "content_encoding": 5, - "referer": 3, - "user_agent": 3, - "body_parameters": 3, - "parameters": 8, - "query": 4, - "flatten": 3, - "uploads": 5, - "hostname": 1, - "url_scheme": 1, - "params": 1, - "query_params": 1, - "body_params": 1, - "cookie": 6, - "param": 8, - "get_all": 2, - "upload": 13, - "raw_uri": 1, - "base": 10, - "path_query": 1, - "_uri_base": 3, - "path_escape_class": 2, - "uri_escape": 3, - "QUERY_STRING": 3, - "canonical": 2, - "HTTP_HOST": 1, - "SERVER_NAME": 1, - "new_response": 4, - "Response": 16, - "ct": 3, - "cleanup": 1, - "spin": 2, - "chunk": 4, - "length": 1, - "rewind": 1, - "from_mixed": 2, - "@uploads": 3, - "@obj": 3, - "_make_upload": 2, - "__END__": 2, - "Portable": 2, - "request": 6, - "PSGI": 6, - "app_or_middleware": 1, - "req": 28, - "finalize": 5, - "": 2, - "provides": 1, - "consistent": 1, - "API": 2, - "objects": 2, - "across": 1, - "web": 5, - "server": 1, - "environments.": 1, - "CAVEAT": 1, - "module": 2, - "intended": 1, - "middleware": 1, - "developers": 3, - "framework": 2, - "rather": 2, - "Writing": 1, - "directly": 1, - "possible": 1, - "recommended": 1, - "yet": 1, - "too": 1, - "low": 1, - "level.": 1, - "encouraged": 1, - "frameworks": 2, - "": 1, - "modules": 1, - "": 1, - "provide": 1, - "higher": 1, - "level": 1, - "top": 1, - "PSGI.": 1, - "METHODS": 2, - "Some": 1, - "methods": 3, - "earlier": 1, - "versions": 1, - "deprecated": 1, - "Take": 1, - "": 1, - "Unless": 1, - "noted": 1, - "": 1, - "passing": 1, - "values": 5, - "accessor": 1, - "debug": 1, - "set.": 1, - "": 2, - "request.": 1, - "uploads.": 2, - "": 2, - "": 1, - "objects.": 1, - "Shortcut": 6, - "content_encoding.": 1, - "content_length.": 1, - "content_type.": 1, - "header.": 2, - "referer.": 1, - "user_agent.": 1, - "GET": 1, - "POST": 1, - "CGI.pm": 2, - "compatible": 1, - "method.": 1, - "alternative": 1, - "accessing": 1, - "parameters.": 3, - "Unlike": 1, - "": 1, - "allow": 1, - "setting": 1, - "modifying": 1, - "@values": 1, - "@params": 1, - "convenient": 1, - "@fields": 1, - "Creates": 2, - "": 3, - "object.": 4, - "Handy": 1, - "remove": 2, - "dependency": 1, - "easy": 1, - "subclassing": 1, - "duck": 1, - "typing": 1, - "overriding": 1, - "generation": 1, - "middlewares.": 1, - "Parameters": 1, - "": 1, - "": 1, - "": 1, - "": 1, - "store": 1, - "means": 2, - "plain": 2, - "": 1, - "scalars": 1, - "references": 1, - "ARRAY": 1, - "parse": 1, - "twice": 1, - "efficiency.": 1, - "DISPATCHING": 1, - "wants": 1, - "dispatch": 1, - "route": 1, - "actions": 1, - "based": 1, - "sure": 1, - "": 1, - "virtual": 1, - "regardless": 1, - "how": 1, - "mounted.": 1, - "hosted": 1, - "mod_perl": 1, - "CGI": 2, - "scripts": 1, - "multiplexed": 1, - "tools": 1, - "": 1, - "idea": 1, - "subclass": 1, - "define": 1, - "uri_for": 2, - "args": 3, - "So": 1, - "say": 1, - "link": 1, - "signoff": 1, - "": 1, - "empty.": 1, - "older": 1, - "call": 1, - "instead.": 1, - "Cookie": 2, - "handling": 1, - "simplified": 1, - "string": 5, - "encoding": 2, - "decoding": 1, - "totally": 1, - "up": 1, - "framework.": 1, - "Also": 1, - "": 1, - "now": 1, - "": 1, - "Simple": 1, - "longer": 1, - "have": 2, - "write": 1, - "wacky": 1, - "simply": 1, - "AUTHORS": 1, - "Tatsuhiko": 2, - "Miyagawa": 2, - "Kazuhiro": 1, - "Osawa": 1, - "Tokuhiro": 2, - "Matsuno": 2, - "": 1, - "": 1, - "library": 1, - "same": 1, - "Util": 3, - "Accessor": 1, - "status": 17, - "Scalar": 2, - "location": 4, - "redirect": 1, - "url": 2, - "clone": 1, - "_finalize_cookies": 2, - "/chr": 1, - "/ge": 1, - "LWS": 1, - "single": 1, - "SP": 1, - "//g": 1, - "CR": 1, - "LF": 1, - "since": 1, - "char": 1, - "invalid": 1, - "header_field_names": 1, - "_body": 2, - "blessed": 1, - "overload": 1, - "Method": 1, - "_bake_cookie": 2, - "push_header": 1, - "@cookie": 7, - "domain": 3, - "_date": 2, - "expires": 7, - "httponly": 1, - "@MON": 1, - "Jan": 1, - "Feb": 1, - "Mar": 1, - "Apr": 1, - "Jun": 1, - "Jul": 1, - "Aug": 1, - "Sep": 1, - "Oct": 1, - "Nov": 1, - "Dec": 1, - "@WDAY": 1, - "Sun": 1, - "Mon": 1, - "Tue": 1, - "Wed": 1, - "Thu": 1, - "Fri": 1, - "Sat": 1, - "sec": 2, - "hour": 2, - "mday": 2, - "mon": 2, - "year": 3, - "wday": 2, - "gmtime": 1, - "sprintf": 1, - "WDAY": 1, - "MON": 1, - "response": 5, - "psgi_handler": 1, - "API.": 1, - "over": 1, - "Sets": 2, - "gets": 2, - "": 1, - "alias.": 2, - "response.": 1, - "Setter": 2, - "either": 2, - "headers.": 1, - "body_str": 1, - "io": 1, - "body.": 1, - "IO": 1, - "Handle": 1, - "": 1, - "X": 2, - "text/plain": 1, - "gzip": 1, - "normalize": 1, - "string.": 1, - "Users": 1, - "responsible": 1, - "properly": 1, - "": 1, - "names": 1, - "their": 1, - "corresponding": 1, - "": 2, - "everything": 1, - "": 1, - "": 2, - "": 1, - "": 1, - "": 1, - "integer": 1, - "epoch": 1, - "": 1, - "convert": 1, - "formats": 1, - "<+3M>": 1, - "reference.": 1, - "AUTHOR": 1 + "@array": 1 }, - "PHP": { - "<": 11, - "php": 8, - "namespace": 28, - "Symfony": 24, - "Component": 24, - "Console": 17, - ";": 1382, - "use": 23, - "Input": 6, - "InputInterface": 4, - "ArgvInput": 2, - "ArrayInput": 3, - "InputDefinition": 2, - "InputOption": 15, - "InputArgument": 3, - "Output": 5, - "OutputInterface": 6, - "ConsoleOutput": 2, - "ConsoleOutputInterface": 2, - "Command": 6, - "HelpCommand": 2, - "ListCommand": 2, - "Helper": 3, - "HelperSet": 3, - "FormatterHelper": 2, - "DialogHelper": 2, - "class": 21, - "Application": 2, - "{": 974, - "private": 24, - "commands": 39, - "wantHelps": 4, - "false": 154, - "runningCommand": 5, - "name": 181, - "version": 8, - "catchExceptions": 4, - "autoExit": 4, - "definition": 3, - "helperSet": 6, - "public": 202, - "function": 205, - "__construct": 8, - "(": 2415, - ")": 2416, - "this": 928, - "-": 1271, - "true": 132, - "array": 296, - "getDefaultHelperSet": 2, - "getDefaultInputDefinition": 2, - "foreach": 94, - "getDefaultCommands": 2, - "as": 96, - "command": 41, - "add": 7, - "}": 972, - "run": 3, - "input": 20, - "null": 164, - "output": 60, - "if": 450, - "new": 73, - "try": 3, - "statusCode": 14, - "doRun": 2, - "catch": 3, - "Exception": 1, - "e": 18, - "throw": 19, - "instanceof": 8, - "renderException": 3, - "getErrorOutput": 2, - "else": 70, - "getCode": 1, - "is_numeric": 7, - "&&": 119, - "exit": 7, - "return": 305, - "getCommandName": 2, - "hasParameterOption": 7, - "setDecorated": 2, - "elseif": 31, - "setInteractive": 2, - "function_exists": 4, - "getHelperSet": 3, - "has": 7, - "inputStream": 2, - "get": 12, - "getInputStream": 1, - "posix_isatty": 1, - "setVerbosity": 2, - "VERBOSITY_QUIET": 1, - "VERBOSITY_VERBOSE": 2, - "writeln": 13, - "getLongVersion": 3, - "find": 17, - "setHelperSet": 1, - "getDefinition": 2, - "getHelp": 2, - "messages": 16, - "sprintf": 27, - "getOptions": 1, - "option": 5, - "[": 672, - "]": 672, - ".": 169, - "getName": 14, - "getShortcut": 2, - "getDescription": 3, - "implode": 8, - "PHP_EOL": 3, - "setCatchExceptions": 1, - "boolean": 4, - "Boolean": 4, - "setAutoExit": 1, - "setName": 1, - "getVersion": 3, - "setVersion": 1, - "register": 1, - "addCommands": 1, - "setApplication": 2, - "isEnabled": 1, - "getAliases": 3, - "alias": 87, - "isset": 101, - "InvalidArgumentException": 9, - "helpCommand": 3, - "setCommand": 1, - "getNamespaces": 3, - "namespaces": 4, - "extractNamespace": 7, - "array_values": 5, - "array_unique": 4, - "array_filter": 2, - "findNamespace": 4, - "allNamespaces": 3, - "n": 12, - "explode": 9, - "found": 4, - "i": 36, - "part": 10, - "abbrevs": 31, - "static": 6, - "getAbbreviations": 4, - "array_map": 2, - "p": 3, - "message": 12, - "<=>": 3, - "alternatives": 10, - "findAlternativeNamespace": 2, - "count": 32, - "getAbbreviationSuggestions": 4, - "searchName": 13, - "pos": 3, - "strrpos": 2, - "substr": 6, - "namespace.substr": 1, - "suggestions": 2, - "aliases": 8, - "findAlternativeCommands": 2, - "all": 11, - "substr_count": 1, - "+": 12, - "names": 3, - "for": 8, - "len": 11, - "strlen": 14, - "abbrev": 4, - "asText": 1, - "raw": 2, - "width": 7, - "sortCommands": 4, - "space": 5, - "space.": 1, - "asXml": 2, - "asDom": 2, - "dom": 12, - "DOMDocument": 2, - "formatOutput": 1, - "appendChild": 10, - "xml": 5, - "createElement": 6, - "commandsXML": 3, - "setAttribute": 2, - "namespacesXML": 3, - "namespaceArrayXML": 4, - "continue": 7, - "commandXML": 3, - "createTextNode": 1, - "node": 42, - "getElementsByTagName": 1, - "item": 9, - "importNode": 3, - "saveXml": 1, - "string": 5, - "encoding": 2, - "mb_detect_encoding": 1, - "mb_strlen": 1, - "do": 2, - "title": 3, - "get_class": 4, - "getTerminalWidth": 3, - "PHP_INT_MAX": 1, - "lines": 3, - "preg_split": 1, - "getMessage": 1, - "line": 10, - "str_split": 1, - "max": 2, - "str_repeat": 2, - "title.str_repeat": 1, - "line.str_repeat": 1, - "message.": 1, - "getVerbosity": 1, - "trace": 12, - "getTrace": 1, - "array_unshift": 2, - "getFile": 2, - "getLine": 2, - "type": 62, - "file": 2, - "while": 6, - "getPrevious": 1, - "getSynopsis": 1, - "protected": 59, - "defined": 2, - "ansicon": 4, - "getenv": 2, - "preg_replace": 4, - "preg_match": 6, - "getSttyColumns": 3, - "match": 4, - "getTerminalHeight": 1, - "trim": 3, - "getFirstArgument": 1, - "REQUIRED": 1, - "VALUE_NONE": 7, - "descriptorspec": 2, - "process": 10, - "proc_open": 1, - "pipes": 4, - "is_resource": 1, - "info": 5, - "stream_get_contents": 1, - "fclose": 2, - "proc_close": 1, - "namespacedCommands": 5, - "key": 64, - "ksort": 2, - "&": 19, - "limit": 3, - "parts": 4, - "array_pop": 1, - "array_slice": 1, - "callback": 5, - "findAlternatives": 3, - "collection": 3, - "call_user_func": 2, - "lev": 6, - "levenshtein": 2, - "3": 1, - "strpos": 15, - "values": 53, - "/": 1, - "||": 52, - "value": 53, - "asort": 1, - "array_keys": 7, - "BrowserKit": 1, - "DomCrawler": 5, - "Crawler": 2, - "Link": 3, - "Form": 4, - "Process": 1, - "PhpProcess": 2, - "abstract": 2, - "Client": 1, - "history": 15, - "cookieJar": 9, - "server": 20, - "request": 76, - "response": 33, - "crawler": 7, - "insulated": 7, - "redirect": 6, - "followRedirects": 5, - "History": 2, - "CookieJar": 2, - "setServerParameters": 2, - "followRedirect": 4, - "insulate": 1, - "class_exists": 2, - "RuntimeException": 2, - "array_merge": 32, - "setServerParameter": 1, - "getServerParameter": 1, - "default": 8, - "getHistory": 1, - "getCookieJar": 1, - "getCrawler": 1, - "getResponse": 1, - "getRequest": 1, - "click": 1, - "link": 9, - "submit": 2, - "getMethod": 6, - "getUri": 8, - "form": 7, - "setValues": 2, - "getPhpValues": 2, - "getPhpFiles": 2, - "method": 31, - "uri": 23, - "parameters": 4, - "files": 7, - "content": 4, - "changeHistory": 4, - "getAbsoluteUri": 2, - "isEmpty": 2, - "current": 4, - "parse_url": 3, - "PHP_URL_HOST": 1, - "PHP_URL_SCHEME": 1, - "Request": 3, - "allValues": 1, - "filterRequest": 2, - "doRequestInProcess": 2, - "doRequest": 2, - "filterResponse": 2, - "updateFromResponse": 1, - "getHeader": 2, - "createCrawlerFromContent": 2, - "getContent": 2, - "getScript": 2, - "sys_get_temp_dir": 2, - "isSuccessful": 1, - "getOutput": 3, - "unserialize": 1, - "LogicException": 4, - "addContent": 1, - "back": 2, - "requestFromRequest": 4, - "forward": 2, - "reload": 1, - "empty": 96, - "restart": 1, - "clear": 2, - "currentUri": 7, - "path": 20, - "PHP_URL_PATH": 1, - "path.": 1, - "getParameters": 1, - "getFiles": 3, - "getServer": 1, - "": 2, - "CakePHP": 6, - "tm": 6, - "Rapid": 2, - "Development": 2, - "Framework": 2, - "http": 12, - "cakephp": 4, - "org": 10, - "Copyright": 4, - "2005": 4, - "2012": 4, - "Cake": 7, - "Software": 4, - "Foundation": 4, - "Inc": 4, - "cakefoundation": 4, - "Licensed": 2, - "under": 2, - "The": 4, - "MIT": 4, - "License": 4, - "Redistributions": 2, - "of": 10, - "must": 2, - "retain": 2, - "the": 11, - "above": 2, - "copyright": 4, - "notice": 2, - "Project": 2, - "package": 2, - "Controller": 4, - "since": 2, - "v": 17, - "0": 4, - "2": 2, - "9": 1, - "license": 4, - "www": 2, - "opensource": 2, - "licenses": 2, - "mit": 2, - "App": 20, - "uses": 46, - "CakeResponse": 2, - "Network": 1, - "ClassRegistry": 9, - "Utility": 6, - "ComponentCollection": 2, - "View": 9, - "CakeEvent": 13, - "Event": 6, - "CakeEventListener": 4, - "CakeEventManager": 5, - "controller": 3, - "organization": 1, - "business": 1, - "logic": 1, - "Provides": 1, - "basic": 1, - "functionality": 1, - "such": 1, - "rendering": 1, - "views": 1, - "inside": 1, - "layouts": 1, - "automatic": 1, - "model": 34, - "availability": 1, - "redirection": 2, - "callbacks": 4, - "and": 5, - "more": 1, - "Controllers": 2, - "should": 1, - "provide": 1, - "a": 11, - "number": 1, - "action": 7, - "methods": 5, - "These": 1, - "are": 5, - "on": 4, - "that": 2, - "not": 2, - "prefixed": 1, - "with": 5, - "_": 1, - "Each": 1, - "serves": 1, - "an": 1, - "endpoint": 1, - "performing": 2, - "specific": 1, - "resource": 1, - "or": 7, - "resources": 1, - "For": 2, - "example": 2, - "adding": 1, - "editing": 1, - "object": 14, - "listing": 1, - "set": 26, - "objects": 5, - "You": 2, - "can": 2, - "access": 1, - "using": 2, - "contains": 1, - "POST": 1, - "GET": 1, - "FILES": 1, - "*": 25, - "were": 1, - "request.": 1, - "After": 1, - "required": 2, - "actions": 2, - "controllers": 2, - "responsible": 1, - "creating": 1, - "response.": 2, - "This": 1, - "usually": 1, - "takes": 1, - "generated": 1, - "possibly": 1, - "to": 6, - "another": 1, - "action.": 1, - "In": 1, - "either": 1, - "case": 31, - "allows": 1, - "you": 1, - "manipulate": 1, - "aspects": 1, - "created": 8, - "by": 1, - "Dispatcher": 1, - "based": 2, - "routing.": 1, - "By": 1, - "conventional": 1, - "names.": 1, - "/posts/index": 1, - "maps": 1, - "PostsController": 1, - "index": 5, - "re": 1, - "map": 1, - "urls": 1, - "Router": 5, - "connect": 1, - "@package": 2, - "Cake.Controller": 1, - "@property": 8, - "AclComponent": 1, - "Acl": 1, - "AuthComponent": 1, - "Auth": 1, - "CookieComponent": 1, - "Cookie": 1, - "EmailComponent": 1, - "Email": 1, - "PaginatorComponent": 1, - "Paginator": 1, - "RequestHandlerComponent": 1, - "RequestHandler": 1, - "SecurityComponent": 1, - "Security": 1, - "SessionComponent": 1, - "Session": 1, - "@link": 2, - "//book.cakephp.org/2.0/en/controllers.html": 1, - "*/": 2, - "extends": 3, - "Object": 4, - "implements": 3, - "helpers": 1, - "_responseClass": 1, - "viewPath": 3, - "layoutPath": 1, - "viewVars": 3, - "view": 5, - "layout": 5, - "autoRender": 6, - "autoLayout": 2, - "Components": 7, - "components": 1, - "viewClass": 10, - "ext": 1, - "plugin": 31, - "cacheAction": 1, - "passedArgs": 2, - "scaffold": 2, - "modelClass": 25, - "modelKey": 2, - "validationErrors": 50, - "_mergeParent": 4, - "_eventManager": 12, - "Inflector": 12, - "singularize": 4, - "underscore": 3, - "childMethods": 2, - "get_class_methods": 2, - "parentMethods": 2, - "array_diff": 3, - "CakeRequest": 5, - "setRequest": 2, - "parent": 14, - "__isset": 2, - "switch": 6, - "is_array": 37, - "list": 29, - "pluginSplit": 12, - "loadModel": 3, - "__get": 2, - "params": 34, - "load": 3, - "settings": 2, - "__set": 1, - "camelize": 3, - "array_key_exists": 11, - "invokeAction": 1, - "ReflectionMethod": 2, - "_isPrivateAction": 2, - "PrivateActionException": 1, - "invokeArgs": 1, - "ReflectionException": 1, - "_getScaffold": 2, - "MissingActionException": 1, - "privateAction": 4, - "isPublic": 1, - "in_array": 26, - "prefixes": 4, - "prefix": 2, - "Scaffold": 1, - "_mergeControllerVars": 2, - "pluginController": 9, - "pluginDot": 4, - "mergeParent": 2, - "is_subclass_of": 3, - "pluginVars": 3, - "appVars": 6, - "merge": 12, - "_mergeVars": 5, - "get_class_vars": 2, - "_mergeUses": 3, - "implementedEvents": 2, - "constructClasses": 1, - "init": 4, - "getEventManager": 13, - "attach": 4, - "startupProcess": 1, - "dispatch": 11, - "shutdownProcess": 1, - "httpCodes": 3, - "code": 4, - "id": 82, - "MissingModelException": 1, - "url": 18, - "status": 15, - "extract": 9, - "EXTR_OVERWRITE": 3, - "event": 35, - "//TODO": 1, - "Remove": 1, - "following": 1, - "when": 1, - "events": 1, - "fully": 1, - "migrated": 1, - "break": 19, - "breakOn": 4, - "collectReturn": 1, - "isStopped": 4, - "result": 21, - "_parseBeforeRedirect": 2, - "session_write_close": 1, - "header": 3, - "is_string": 7, - "codes": 3, - "array_flip": 1, - "send": 1, - "_stop": 1, - "resp": 6, - "compact": 8, - "one": 19, - "two": 6, - "data": 187, - "array_combine": 2, - "setAction": 1, - "args": 5, - "func_get_args": 5, - "unset": 22, - "call_user_func_array": 3, - "validate": 9, - "errors": 9, - "validateErrors": 1, - "invalidFields": 2, - "render": 3, - "className": 27, - "models": 6, - "keys": 19, - "currentModel": 2, - "currentObject": 6, - "getObject": 1, - "is_a": 1, - "location": 1, - "body": 1, - "referer": 5, - "local": 2, - "disableCache": 2, - "flash": 1, - "pause": 2, - "postConditions": 1, - "op": 9, - "bool": 5, - "exclusive": 2, - "cond": 5, - "arrayOp": 2, - "fields": 60, - "field": 88, - "fieldOp": 11, - "strtoupper": 3, - "paginate": 3, - "scope": 2, - "whitelist": 14, - "beforeFilter": 1, - "beforeRender": 1, - "beforeRedirect": 1, - "afterFilter": 1, - "beforeScaffold": 2, - "_beforeScaffold": 1, - "afterScaffoldSave": 2, - "_afterScaffoldSave": 1, - "afterScaffoldSaveError": 2, - "_afterScaffoldSaveError": 1, - "scaffoldError": 2, - "_scaffoldError": 1, - "php_help": 1, - "arg": 1, - "t": 25, - "php_permission": 1, - "TRUE": 1, - "php_eval": 1, - "global": 2, - "theme_path": 5, - "theme_info": 3, - "conf": 2, - "old_theme_path": 2, - "drupal_get_path": 1, - "dirname": 1, - "filename": 1, - "ob_start": 1, - "print": 1, - "eval": 1, - "ob_get_contents": 1, - "ob_end_clean": 1, - "_php_filter_tips": 1, - "filter": 1, - "format": 3, - "long": 2, - "FALSE": 2, - "base_url": 1, - "php_filter_info": 1, - "filters": 2, - "Field": 9, - "FormField": 3, - "ArrayAccess": 1, - "button": 6, - "DOMNode": 3, - "initialize": 2, - "getFormNode": 1, - "getValues": 3, - "isDisabled": 2, - "FileFormField": 3, - "hasValue": 1, - "getValue": 2, - "qs": 4, - "http_build_query": 3, - "parse_str": 2, - "queryString": 2, - "sep": 1, - "sep.": 1, - "getRawUri": 1, - "getAttribute": 10, - "remove": 4, - "offsetExists": 1, - "offsetGet": 1, - "offsetSet": 1, - "offsetUnset": 1, - "setNode": 1, - "nodeName": 13, - "parentNode": 1, - "FormFieldRegistry": 2, - "document": 6, - "root": 4, - "xpath": 2, - "DOMXPath": 1, - "query": 102, - "hasAttribute": 1, - "InputFormField": 2, - "ChoiceFormField": 2, - "addChoice": 1, - "TextareaFormField": 1, - "base": 8, - "segments": 13, - "getSegments": 4, - "target": 20, - "array_shift": 5, - "self": 1, - "create": 13, - "k": 7, - "setValue": 1, - "walk": 3, - "registry": 4, - "m": 5, - "relational": 2, - "mapper": 2, - "DBO": 2, - "backed": 2, - "mapping": 1, - "database": 2, - "tables": 5, - "PHP": 1, - "versions": 1, - "5": 1, - "Model": 5, - "10": 1, - "Validation": 1, - "String": 5, - "Set": 9, - "BehaviorCollection": 2, - "ModelBehavior": 1, - "ConnectionManager": 2, - "Xml": 2, - "Automatically": 1, - "selects": 1, - "table": 21, - "pluralized": 1, - "lowercase": 1, - "User": 1, - "is": 1, - "have": 1, - "at": 1, - "least": 1, - "primary": 3, - "key.": 1, - "Cake.Model": 1, - "//book.cakephp.org/2.0/en/models.html": 1, - "useDbConfig": 7, - "useTable": 12, - "displayField": 4, - "schemaName": 1, - "primaryKey": 38, - "_schema": 11, - "validationDomain": 1, - "tablePrefix": 8, - "tableToModel": 4, - "cacheQueries": 1, - "belongsTo": 7, - "hasOne": 2, - "hasMany": 2, - "hasAndBelongsToMany": 24, - "actsAs": 2, - "Behaviors": 6, - "cacheSources": 7, - "findQueryType": 3, - "recursive": 9, - "order": 4, - "virtualFields": 8, - "_associationKeys": 2, - "_associations": 5, - "__backAssociation": 22, - "__backInnerAssociation": 1, - "__backOriginalAssociation": 1, - "__backContainableAssociation": 1, - "_insertID": 1, - "_sourceConfigured": 1, - "findMethods": 3, - "ds": 3, - "addObject": 2, - "parentClass": 3, - "get_parent_class": 1, - "tableize": 2, - "_createLinks": 3, - "__call": 1, - "dispatchMethod": 1, - "getDataSource": 15, - "relation": 7, - "assocKey": 13, - "dynamic": 2, - "isKeySet": 1, - "AppModel": 1, - "_constructLinkedModel": 2, - "schema": 11, - "hasField": 7, - "setDataSource": 2, - "property_exists": 3, - "bindModel": 1, - "reset": 6, - "assoc": 75, - "assocName": 6, - "unbindModel": 1, - "_generateAssociation": 2, - "dynamicWith": 3, - "sort": 1, - "setSource": 1, - "tableName": 4, - "db": 45, - "method_exists": 5, - "sources": 3, - "listSources": 1, - "strtolower": 1, - "MissingTableException": 1, - "is_object": 2, - "SimpleXMLElement": 1, - "_normalizeXmlData": 3, - "toArray": 1, - "reverse": 1, - "_setAliasData": 2, - "modelName": 3, - "fieldSet": 3, - "fieldName": 6, - "fieldValue": 7, - "deconstruct": 2, - "getAssociated": 4, - "getColumnType": 4, - "useNewDate": 2, - "dateFields": 5, - "timeFields": 2, - "date": 9, - "val": 27, - "columns": 5, - "str_replace": 3, - "describe": 1, - "getColumnTypes": 1, - "trigger_error": 1, - "__d": 1, - "E_USER_WARNING": 1, - "cols": 7, - "column": 10, - "startQuote": 4, - "endQuote": 4, - "checkVirtual": 3, - "isVirtualField": 3, - "hasMethod": 2, - "getVirtualField": 1, - "filterKey": 2, - "defaults": 6, - "properties": 4, - "read": 2, - "conditions": 41, - "saveField": 1, - "options": 85, - "save": 9, - "fieldList": 1, - "_whitelist": 4, - "keyPresentAndEmpty": 2, - "exists": 6, - "validates": 60, - "updateCol": 6, - "colType": 4, - "time": 3, - "strtotime": 1, - "joined": 5, - "x": 4, - "y": 2, - "success": 10, - "cache": 2, - "_prepareUpdateFields": 2, - "update": 2, - "fInfo": 4, - "isUUID": 5, - "j": 2, - "array_search": 1, - "uuid": 3, - "updateCounterCache": 6, - "_saveMulti": 2, - "_clearCache": 2, - "join": 22, - "joinModel": 8, - "keyInfo": 4, - "withModel": 4, - "pluginName": 1, - "dbMulti": 6, - "newData": 5, - "newValues": 8, - "newJoins": 7, - "primaryAdded": 3, - "idField": 3, - "row": 17, - "keepExisting": 3, - "associationForeignKey": 5, - "links": 4, - "oldLinks": 4, - "delete": 9, - "oldJoin": 4, - "insertMulti": 1, - "foreignKey": 11, - "fkQuoted": 3, - "escapeField": 6, - "intval": 4, - "updateAll": 3, - "foreignKeys": 3, - "included": 3, - "array_intersect": 1, - "old": 2, - "saveAll": 1, - "numeric": 1, - "validateMany": 4, - "saveMany": 3, - "validateAssociated": 5, - "saveAssociated": 5, - "transactionBegun": 4, - "begin": 2, - "record": 10, - "saved": 18, - "commit": 2, - "rollback": 2, - "associations": 9, - "association": 47, - "notEmpty": 4, - "_return": 3, - "recordData": 2, - "cascade": 10, - "_deleteDependent": 3, - "_deleteLinks": 3, - "_collectForeignKeys": 2, - "savedAssociatons": 3, - "deleteAll": 2, - "records": 6, - "ids": 8, - "_id": 2, - "getID": 2, - "hasAny": 1, - "buildQuery": 2, - "is_null": 1, - "results": 22, - "resetAssociations": 3, - "_filterResults": 2, - "ucfirst": 2, - "modParams": 2, - "_findFirst": 1, - "state": 15, - "_findCount": 1, - "calculate": 2, - "expression": 1, - "_findList": 1, - "tokenize": 1, - "lst": 4, - "combine": 1, - "_findNeighbors": 1, - "prevVal": 2, - "return2": 6, - "_findThreaded": 1, - "nest": 1, - "isUnique": 1, - "is_bool": 1, - "sql": 1, - "SHEBANG#!php": 2, - "echo": 2 + "PogoScript": { + "httpism": 1, + "require": 3, + "async": 1, + "resolve": 2, + ".resolve": 1, + "exports.squash": 1, + "(": 38, + "url": 5, + ")": 38, + "html": 15, + "httpism.get": 2, + ".body": 2, + "squash": 2, + "callback": 2, + "replacements": 6, + "sort": 2, + "links": 2, + "in": 11, + ".concat": 1, + "scripts": 2, + "for": 2, + "each": 2, + "@": 6, + "r": 1, + "{": 3, + "r.url": 1, + "r.href": 1, + "}": 3, + "async.map": 1, + "get": 2, + "err": 2, + "requested": 2, + "replace": 2, + "replacements.sort": 1, + "a": 1, + "b": 1, + "a.index": 1, + "-": 1, + "b.index": 1, + "replacement": 2, + "replacement.body": 1, + "replacement.url": 1, + "i": 3, + "parts": 3, + "rep": 1, + "rep.index": 1, + "+": 2, + "rep.length": 1, + "html.substr": 1, + "link": 2, + "reg": 5, + "r/": 2, + "": 1, + "]": 7, + "*href": 1, + "[": 5, + "*": 2, + "/": 2, + "|": 2, + "s*": 2, + "<\\/link\\>": 1, + "/gi": 2, + "elements": 5, + "matching": 3, + "as": 3, + "script": 2, + "": 1, + "*src": 1, + "<\\/script\\>": 1, + "tag": 3, + "while": 1, + "m": 1, + "reg.exec": 1, + "elements.push": 1, + "index": 1, + "m.index": 1, + "length": 1, + "m.0.length": 1, + "href": 1, + "m.1": 1 }, "PowerShell": { "Write": 2, @@ -23348,6 +28779,27 @@ "{": 1, "}": 1 }, + "Processing": { + "void": 2, + "setup": 1, + "(": 17, + ")": 17, + "{": 2, + "size": 1, + ";": 15, + "background": 1, + "noStroke": 1, + "}": 2, + "draw": 1, + "fill": 6, + "triangle": 2, + "rect": 1, + "quad": 1, + "ellipse": 1, + "arc": 1, + "PI": 1, + "TWO_PI": 1 + }, "Prolog": { "action_module": 1, "(": 585, @@ -24557,6 +30009,140 @@ "section": 9, "@index": 1 }, + "Ragel in Ruby Host": { + "begin": 3, + "%": 34, + "{": 19, + "machine": 3, + "ephemeris_parser": 1, + ";": 38, + "action": 9, + "mark": 6, + "p": 8, + "}": 19, + "parse_start_time": 2, + "parser.start_time": 1, + "data": 15, + "[": 20, + "mark..p": 4, + "]": 20, + ".pack": 6, + "(": 33, + ")": 33, + "parse_stop_time": 2, + "parser.stop_time": 1, + "parse_step_size": 2, + "parser.step_size": 1, + "parse_ephemeris_table": 2, + "fhold": 1, + "parser.ephemeris_table": 1, + "ws": 2, + "t": 1, + "r": 1, + "n": 1, + "adbc": 2, + "|": 11, + "year": 2, + "digit": 7, + "month": 2, + "upper": 1, + "lower": 1, + "date": 2, + "hours": 2, + "minutes": 2, + "seconds": 2, + "tz": 2, + "datetime": 3, + "time_unit": 2, + "s": 4, + "soe": 2, + "eoe": 2, + "ephemeris_table": 3, + "alnum": 1, + "*": 9, + "-": 5, + "./": 1, + "start_time": 4, + "space*": 2, + "stop_time": 4, + "step_size": 3, + "+": 7, + "ephemeris": 2, + "main": 3, + "any*": 3, + "end": 23, + "require": 1, + "module": 1, + "Tengai": 1, + "EPHEMERIS_DATA": 2, + "Struct.new": 1, + ".freeze": 1, + "class": 3, + "EphemerisParser": 1, + "<": 1, + "def": 10, + "self.parse": 1, + "parser": 2, + "new": 1, + "data.unpack": 1, + "if": 4, + "data.is_a": 1, + "String": 1, + "eof": 3, + "data.length": 3, + "write": 9, + "init": 3, + "exec": 3, + "time": 6, + "super": 2, + "parse_time": 3, + "private": 1, + "DateTime.parse": 1, + "simple_scanner": 1, + "Emit": 4, + "emit": 4, + "ts": 4, + "..": 1, + "te": 1, + "foo": 8, + "any": 4, + "#": 4, + "SimpleScanner": 1, + "attr_reader": 2, + "path": 8, + "initialize": 2, + "@path": 2, + "stdout.puts": 2, + "perform": 2, + "pe": 4, + "ignored": 4, + "leftover": 8, + "File.open": 2, + "do": 2, + "f": 2, + "while": 2, + "chunk": 2, + "f.read": 2, + "ENV": 2, + ".to_i": 2, + "chunk.unpack": 2, + "||": 1, + "ts..pe": 1, + "else": 2, + "SimpleScanner.new": 1, + "ARGV": 2, + "s.perform": 2, + "simple_tokenizer": 1, + "MyTs": 2, + "my_ts": 6, + "MyTe": 2, + "my_te": 6, + "my_ts...my_te": 1, + "nil": 4, + "SimpleTokenizer": 1, + "my_ts..": 1, + "SimpleTokenizer.new": 1 + }, "Rebol": { "REBOL": 1, "[": 3, @@ -24572,16 +30158,16 @@ "]": 56, ".each": 4, "{": 68, - "|": 89, - "plugin": 2, + "|": 91, + "plugin": 3, "(": 244, ")": 256, "}": 68, "task": 2, "default": 2, - "do": 34, + "do": 35, "puts": 12, - "end": 235, + "end": 236, "module": 8, "Foo": 1, "require": 58, @@ -25200,6 +30786,19 @@ "err.to_s": 1, "DEFAULTS.deep_merge": 1, ".deep_merge": 1, + "Jenkins": 1, + "Plugin": 1, + "Specification.new": 1, + "plugin.name": 1, + "plugin.display_name": 1, + "plugin.version": 1, + "plugin.description": 1, + "plugin.url": 1, + "plugin.developed_by": 1, + "plugin.uses_repository": 1, + "github": 1, + "plugin.depends_on": 1, + "#plugin.depends_on": 1, "SHEBANG#!macruby": 1, "object": 2, "@user": 1, @@ -25538,14 +31137,449 @@ "SHEBANG#!python": 1 }, "Rust": { - "fn": 1, - "main": 1, + "//": 20, + "use": 10, + "cell": 1, + "Cell": 2, + ";": 218, + "cmp": 1, + "Eq": 2, + "option": 4, + "result": 18, + "Result": 3, + "comm": 5, + "{": 213, + "stream": 21, + "Chan": 4, + "GenericChan": 1, + "GenericPort": 1, + "Port": 3, + "SharedChan": 4, + "}": 210, + "prelude": 1, + "*": 1, + "task": 39, + "rt": 29, + "task_id": 2, + "sched_id": 2, + "rust_task": 1, + "util": 4, + "replace": 8, + "mod": 5, + "local_data_priv": 1, + "pub": 26, + "local_data": 1, + "spawn": 15, + "///": 13, + "A": 6, + "handle": 3, + "to": 6, + "a": 9, + "scheduler": 6, + "#": 61, + "[": 61, + "deriving_eq": 3, + "]": 61, + "enum": 4, + "Scheduler": 4, + "SchedulerHandle": 2, + "(": 429, + ")": 434, + "Task": 2, + "TaskHandle": 2, + "TaskResult": 4, + "Success": 6, + "Failure": 6, + "impl": 3, + "for": 10, + "pure": 2, + "fn": 89, + "eq": 1, + "&": 30, + "self": 15, + "other": 4, + "-": 33, + "bool": 6, + "match": 4, + "|": 20, + "true": 9, + "_": 4, + "false": 7, + "ne": 1, + ".eq": 1, + "modes": 1, + "SchedMode": 4, + "Run": 3, + "on": 5, + "the": 10, + "default": 1, + "DefaultScheduler": 2, + "current": 1, + "CurrentScheduler": 2, + "specific": 1, + "ExistingScheduler": 1, + "PlatformThread": 2, + "All": 1, + "tasks": 1, + "run": 1, + "in": 3, + "same": 1, + "OS": 3, + "thread": 2, + "SingleThreaded": 4, + "Tasks": 2, + "are": 2, + "distributed": 2, + "among": 2, + "available": 1, + "CPUs": 1, + "ThreadPerCore": 2, + "Each": 1, + "runs": 1, + "its": 1, + "own": 1, + "ThreadPerTask": 1, + "fixed": 1, + "number": 1, + "of": 3, + "threads": 1, + "ManualThreads": 3, + "uint": 7, + "struct": 7, + "SchedOpts": 4, + "mode": 9, + "foreign_stack_size": 3, + "Option": 4, + "": 2, + "TaskOpts": 12, + "linked": 15, + "supervised": 11, + "mut": 16, + "notify_chan": 24, + "<": 3, + "": 3, + "sched": 10, + "TaskBuilder": 21, + "opts": 21, + "gen_body": 4, + "@fn": 2, + "v": 6, + "can_not_copy": 11, + "": 1, + "consumed": 4, + "default_task_opts": 4, + "body": 6, + "Identity": 1, + "function": 1, + "None": 23, + "doc": 1, + "hidden": 1, + "FIXME": 1, + "#3538": 1, + "priv": 1, + "consume": 1, + "if": 7, + "self.consumed": 2, + "fail": 17, + "Fake": 1, + "move": 1, + "let": 84, + "self.opts.notify_chan": 7, + "self.opts.linked": 4, + "self.opts.supervised": 5, + "self.opts.sched": 6, + "self.gen_body": 2, + "unlinked": 1, + "..": 8, + "self.consume": 7, + "future_result": 1, + "blk": 2, + "self.opts.notify_chan.is_some": 1, + "notify_pipe_po": 2, + "notify_pipe_ch": 2, + "Some": 8, + "Configure": 1, + "custom": 1, + "task.": 1, + "sched_mode": 1, + "add_wrapper": 1, + "wrapper": 2, + "prev_gen_body": 2, + "f": 38, + "x": 7, + "x.opts.linked": 1, + "x.opts.supervised": 1, + "x.opts.sched": 1, + "spawn_raw": 1, + "x.gen_body": 1, + "Runs": 1, + "while": 2, + "transfering": 1, + "ownership": 1, + "one": 1, + "argument": 1, + "child.": 1, + "spawn_with": 2, + "": 2, + "arg": 5, + "do": 49, + "self.spawn": 1, + "arg.take": 1, + "try": 5, + "": 2, + "T": 2, + "": 2, + "po": 11, + "ch": 26, + "": 1, + "fr_task_builder": 1, + "self.future_result": 1, + "+": 4, + "r": 6, + "fr_task_builder.spawn": 1, + "||": 11, + "ch.send": 11, + "unwrap": 3, + ".recv": 3, + "Ok": 3, + "po.recv": 10, + "Err": 2, + ".spawn": 9, + "spawn_unlinked": 6, + ".unlinked": 3, + "spawn_supervised": 5, + ".supervised": 2, + ".spawn_with": 1, + "spawn_sched": 8, + ".sched_mode": 2, + ".try": 1, + "yield": 16, + "Yield": 1, + "control": 1, + "unsafe": 31, + "task_": 2, + "rust_get_task": 5, + "killed": 3, + "rust_task_yield": 1, + "&&": 1, + "failing": 2, + "True": 1, + "running": 2, + "has": 1, + "failed": 1, + "rust_task_is_unwinding": 1, + "get_task": 1, + "Get": 1, + "get_task_id": 1, + "get_scheduler": 1, + "rust_get_sched_id": 6, + "unkillable": 5, + "": 3, + "U": 6, + "AllowFailure": 5, + "t": 24, + "*rust_task": 6, + "drop": 3, + "rust_task_allow_kill": 3, + "self.t": 4, + "_allow_failure": 2, + "rust_task_inhibit_kill": 3, + "The": 1, + "inverse": 1, + "unkillable.": 1, + "Only": 1, + "ever": 1, + "be": 2, + "used": 1, + "nested": 1, + ".": 1, + "rekillable": 1, + "DisallowFailure": 5, + "atomically": 3, + "DeferInterrupts": 5, + "rust_task_allow_yield": 1, + "_interrupts": 1, + "rust_task_inhibit_yield": 1, + "test": 31, + "should_fail": 11, + "ignore": 16, + "cfg": 16, + "windows": 14, + "test_cant_dup_task_builder": 1, + "b": 2, + "b.spawn": 2, + "should": 2, + "have": 1, + "been": 1, + "by": 1, + "previous": 1, + "call": 1, + "test_spawn_unlinked_unsup_no_fail_down": 1, + "grandchild": 1, + "sends": 1, + "port": 3, + "ch.clone": 2, + "iter": 8, + "repeat": 8, + "If": 1, + "first": 1, + "grandparent": 1, + "hangs.": 1, + "Shouldn": 1, + "leave": 1, + "child": 3, + "hanging": 1, + "around.": 1, + "test_spawn_linked_sup_fail_up": 1, + "fails": 4, + "parent": 2, + "_ch": 1, + "<()>": 6, + "opts.linked": 2, + "opts.supervised": 2, + "b0": 5, + "b1": 3, + "b1.spawn": 3, + "We": 1, + "get": 1, + "punted": 1, + "awake": 1, + "test_spawn_linked_sup_fail_down": 1, + "loop": 5, + "*both*": 1, + "mechanisms": 1, + "would": 1, + "wrong": 1, + "this": 1, + "didn": 1, + "s": 1, + "failure": 1, + "propagate": 1, + "across": 1, + "gap": 1, + "test_spawn_failure_propagate_secondborn": 1, + "test_spawn_failure_propagate_nephew_or_niece": 1, + "test_spawn_linked_sup_propagate_sibling": 1, + "test_run_basic": 1, + "Wrapper": 5, + "test_add_wrapper": 1, + "b0.add_wrapper": 1, + "ch.f.swap_unwrap": 4, + "test_future_result": 1, + ".future_result": 4, + "assert": 10, + "test_back_to_the_future_result": 1, + "test_try_success": 1, + "test_try_fail": 1, + "test_spawn_sched_no_threads": 1, + "u": 2, + "test_spawn_sched": 1, + "i": 3, + "int": 5, + "parent_sched_id": 4, + "child_sched_id": 5, + "else": 1, + "test_spawn_sched_childs_on_default_sched": 1, + "default_id": 2, + "nolink": 1, + "extern": 1, + "testrt": 9, + "rust_dbg_lock_create": 2, + "*libc": 6, + "c_void": 6, + "rust_dbg_lock_destroy": 2, + "lock": 13, + "rust_dbg_lock_lock": 3, + "rust_dbg_lock_unlock": 3, + "rust_dbg_lock_wait": 2, + "rust_dbg_lock_signal": 2, + "test_spawn_sched_blocking": 1, + "start_po": 1, + "start_ch": 1, + "fin_po": 1, + "fin_ch": 1, + "start_ch.send": 1, + "fin_ch.send": 1, + "start_po.recv": 1, + "pingpong": 3, + "": 2, + "val": 4, + "setup_po": 1, + "setup_ch": 1, + "parent_po": 2, + "parent_ch": 2, + "child_po": 2, + "child_ch": 4, + "setup_ch.send": 1, + "setup_po.recv": 1, + "child_ch.send": 1, + "fin_po.recv": 1, + "avoid_copying_the_body": 5, + "spawnfn": 2, + "p": 3, + "x_in_parent": 2, + "ptr": 2, + "addr_of": 2, + "as": 7, + "x_in_child": 4, + "p.recv": 1, + "test_avoid_copying_the_body_spawn": 1, + "test_avoid_copying_the_body_task_spawn": 1, + "test_avoid_copying_the_body_try": 1, + "test_avoid_copying_the_body_unlinked": 1, + "test_platform_thread": 1, + "test_unkillable": 1, + "pp": 2, + "*uint": 1, + "cast": 2, + "transmute": 2, + "_p": 1, + "test_unkillable_nested": 1, + "Here": 1, + "test_atomically_nested": 1, + "test_child_doesnt_ref_parent": 1, + "const": 1, + "generations": 2, + "child_no": 3, + "return": 1, + "test_sched_thread_per_core": 1, + "chan": 2, + "cores": 2, + "rust_num_threads": 1, + "reported_threads": 2, + "rust_sched_threads": 2, + "chan.send": 2, + "port.recv": 2, + "test_spawn_thread_on_demand": 1, + "max_threads": 2, + "running_threads": 2, + "rust_sched_current_nonlazy_threads": 2, + "port2": 1, + "chan2": 1, + "chan2.send": 1, + "running_threads2": 2, + "port2.recv": 1 + }, + "SCSS": { + "blue": 4, + "#3bbfce": 1, + ";": 7, + "margin": 4, + "px": 1, + ".content": 1, + "-": 3, + "navigation": 1, + "{": 2, + "border": 2, + "color": 3, + "darken": 1, "(": 1, + "%": 1, ")": 1, - "{": 1, - "log": 1, - ";": 1, - "}": 1 + "}": 2, + ".border": 1, + "padding": 1, + "/": 2 }, "Sass": { "blue": 4, @@ -25917,27 +31951,6 @@ "assert_checkequal": 1, "assert_checkfalse": 1 }, - "SCSS": { - "blue": 4, - "#3bbfce": 1, - ";": 7, - "margin": 4, - "px": 1, - ".content": 1, - "-": 3, - "navigation": 1, - "{": 2, - "border": 2, - "color": 3, - "darken": 1, - "(": 1, - "%": 1, - ")": 1, - "}": 2, - ".border": 1, - "padding": 1, - "/": 2 - }, "Shell": { "SHEBANG#!bash": 6, "echo": 63, @@ -26685,35 +32698,35 @@ }, "SuperCollider": { "BCR2000": 1, - "{": 9, - "var": 1, + "{": 14, + "var": 2, "controls": 2, "controlBuses": 2, "rangedControlBuses": 2, "responders": 2, - ";": 14, + ";": 32, "*new": 1, "super.new.init": 1, - "}": 9, + "}": 14, "init": 1, "Dictionary.new": 3, - "(": 12, - ")": 12, + "(": 34, + ")": 34, "this.createCCResponders": 1, "createCCResponders": 1, "Array.fill": 1, "|": 4, - "i": 4, + "i": 5, "CCResponder": 1, "src": 3, "chan": 3, "num": 3, "val": 4, - "[": 1, - "]": 1, + "[": 3, + "]": 3, ".postln": 1, "controls.put": 1, - "+": 3, + "+": 4, "controlBuses.put": 1, "Bus.control": 1, "Server.default": 1, @@ -26724,16 +32737,83 @@ "//": 4, "value": 1, "at": 1, - "arg": 3, + "arg": 4, "controlNum": 6, "controls.at": 2, "scalarAt": 1, - "busAt": 1 + "busAt": 1, + "//boot": 1, + "server": 1, + "s.boot": 1, + "SynthDef": 1, + "sig": 7, + "resfreq": 3, + "Saw.ar": 1, + "SinOsc.kr": 1, + "*": 3, + "RLPF.ar": 1, + "Out.ar": 1, + ".play": 2, + "do": 2, + "Pan2.ar": 1, + "SinOsc.ar": 1, + "exprand": 1, + "LFNoise2.kr": 2, + "rrand": 2, + ".range": 2, + "**": 1, + "rand2": 1, + "a": 2, + "Env.perc": 1, + "-": 1, + "b": 1, + "a.delay": 2, + "a.test.plot": 1, + "b.test.plot": 1, + "Env": 1, + ".plot": 2, + "e": 1, + "Env.sine.asStream": 1, + "e.next.postln": 1, + "wait": 1, + ".fork": 1 }, - "Tea": { - "<%>": 1, - "template": 1, - "foo": 1 + "TXL": { + "define": 12, + "program": 1, + "[": 38, + "expression": 9, + "]": 38, + "end": 12, + "term": 6, + "|": 3, + "addop": 2, + "primary": 4, + "mulop": 2, + "number": 10, + "(": 2, + ")": 2, + "-": 3, + "/": 3, + "rule": 12, + "main": 1, + "replace": 6, + "E": 3, + "construct": 1, + "NewE": 3, + "resolveAddition": 2, + "resolveSubtraction": 2, + "resolveMultiplication": 2, + "resolveDivision": 2, + "resolveParentheses": 2, + "where": 1, + "not": 1, + "by": 6, + "N1": 8, + "+": 2, + "N2": 8, + "*": 2, + "N": 2 }, "TeX": { "%": 59, @@ -27042,6 +33122,11 @@ "sign": 1, "makebox": 6 }, + "Tea": { + "<%>": 1, + "template": 1, + "foo": 1 + }, "Turing": { "function": 1, "factorial": 4, @@ -27065,6 +33150,64 @@ "exit": 1, "when": 1 }, + "TypeScript": { + "class": 3, + "Animal": 4, + "{": 9, + "constructor": 3, + "(": 17, + "public": 1, + "name": 5, + ")": 17, + "}": 9, + "move": 3, + "meters": 2, + "alert": 3, + "this.name": 1, + "+": 3, + ";": 7, + "Snake": 2, + "extends": 2, + "super": 2, + "super.move": 2, + "Horse": 2, + "var": 2, + "sam": 1, + "new": 2, + "tom": 1, + "sam.move": 1, + "tom.move": 1, + "console.log": 1 + }, + "VHDL": { + "-": 2, + "VHDL": 1, + "example": 1, + "file": 1, + "library": 1, + "ieee": 1, + ";": 7, + "use": 1, + "ieee.std_logic_1164.all": 1, + "entity": 2, + "inverter": 2, + "is": 2, + "port": 1, + "(": 1, + "a": 2, + "in": 1, + "std_logic": 2, + "b": 2, + "out": 1, + ")": 1, + "end": 2, + "architecture": 2, + "rtl": 1, + "of": 1, + "begin": 1, + "<": 1, + "not": 1 + }, "Verilog": { "////////////////////////////////////////////////////////////////////////////////": 14, "//": 117, @@ -27547,35 +33690,6 @@ ".csrm_dat_o": 1, ".csrm_dat_i": 1 }, - "VHDL": { - "-": 2, - "VHDL": 1, - "example": 1, - "file": 1, - "library": 1, - "ieee": 1, - ";": 7, - "use": 1, - "ieee.std_logic_1164.all": 1, - "entity": 2, - "inverter": 2, - "is": 2, - "port": 1, - "(": 1, - "a": 2, - "in": 1, - "std_logic": 2, - "b": 2, - "out": 1, - ")": 1, - "end": 2, - "architecture": 2, - "rtl": 1, - "of": 1, - "begin": 1, - "<": 1, - "not": 1 - }, "VimL": { "no": 1, "toolbar": 1, @@ -28523,6 +34637,27 @@ "": 1, "": 1 }, + "XProc": { + "": 1, + "version=": 2, + "encoding=": 1, + "": 1, + "xmlns": 2, + "p=": 1, + "c=": 1, + "": 1, + "port=": 2, + "": 1, + "": 1, + "Hello": 1, + "world": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1, + "": 1 + }, "XQuery": { "(": 38, "-": 486, @@ -28654,6 +34789,159 @@ "": 1, "": 1 }, + "Xtend": { + "package": 2, + "example2": 1, + "import": 7, + "org.junit.Test": 2, + "static": 4, + "org.junit.Assert.*": 2, + "class": 4, + "BasicExpressions": 2, + "{": 14, + "@Test": 7, + "def": 7, + "void": 7, + "literals": 5, + "(": 42, + ")": 42, + "//": 11, + "string": 1, + "work": 1, + "with": 2, + "single": 1, + "or": 1, + "double": 2, + "quotes": 1, + "assertEquals": 14, + "number": 1, + "big": 1, + "decimals": 1, + "in": 2, + "this": 1, + "case": 1, + "+": 6, + "*": 1, + "bd": 3, + "boolean": 1, + "true": 1, + "false": 1, + "getClass": 1, + "typeof": 1, + "}": 13, + "collections": 2, + "There": 1, + "are": 1, + "various": 1, + "methods": 2, + "to": 1, + "create": 1, + "and": 1, + "numerous": 1, + "extension": 2, + "which": 1, + "make": 1, + "working": 1, + "them": 1, + "convenient.": 1, + "val": 9, + "list": 1, + "newArrayList": 2, + "list.map": 1, + "[": 9, + "toUpperCase": 1, + "]": 9, + ".head": 1, + "set": 1, + "newHashSet": 1, + "set.filter": 1, + "it": 2, + ".size": 2, + "map": 1, + "newHashMap": 1, + "-": 5, + "map.get": 1, + "controlStructures": 1, + "looks": 1, + "like": 1, + "Java": 1, + "if": 1, + ".length": 1, + "but": 1, + "foo": 1, + "bar": 1, + "Never": 2, + "happens": 3, + "text": 2, + "never": 1, + "s": 1, + "cascades.": 1, + "Object": 1, + "someValue": 2, + "switch": 1, + "Number": 1, + "String": 2, + "loops": 1, + "for": 2, + "loop": 2, + "var": 1, + "counter": 8, + "i": 4, + "..": 1, + "while": 2, + "iterator": 1, + ".iterator": 2, + "iterator.hasNext": 1, + "iterator.next": 1, + "example6": 1, + "java.io.FileReader": 1, + "java.util.Set": 1, + "com.google.common.io.CharStreams.*": 1, + "Movies": 1, + "numberOfActionMovies": 1, + "movies.filter": 2, + "categories.contains": 1, + "yearOfBestMovieFrom80ies": 1, + ".contains": 1, + "year": 2, + ".sortBy": 1, + "rating": 3, + ".last.year": 1, + "sumOfVotesOfTop2": 1, + "long": 2, + "movies": 3, + "movies.sortBy": 1, + ".take": 1, + ".map": 1, + "numberOfVotes": 2, + ".reduce": 1, + "a": 2, + "b": 2, + "|": 2, + "_229": 1, + "new": 2, + "FileReader": 1, + ".readLines.map": 1, + "line": 1, + "segments": 1, + "line.split": 1, + "return": 1, + "Movie": 2, + "segments.next": 4, + "Integer": 1, + "parseInt": 1, + "Double": 1, + "parseDouble": 1, + "Long": 1, + "parseLong": 1, + "segments.toSet": 1, + "@Data": 1, + "title": 1, + "int": 1, + "Set": 1, + "": 1, + "categories": 1 + }, "YAML": { "gem": 1, "-": 16, @@ -28669,16 +34957,198 @@ "gempath": 1, "/usr/local/rubygems": 1, "/home/gavin/.rubygems": 1 + }, + "edn": { + "[": 24, + "{": 22, + "db/id": 22, + "#db/id": 22, + "db.part/db": 6, + "]": 24, + "db/ident": 3, + "object/name": 18, + "db/doc": 4, + "db/valueType": 3, + "db.type/string": 2, + "db/index": 3, + "true": 3, + "db/cardinality": 3, + "db.cardinality/one": 3, + "db.install/_attribute": 3, + "}": 22, + "object/meanRadius": 18, + "db.type/double": 1, + "data/source": 2, + "db.part/tx": 2, + "db.part/user": 17 + }, + "fish": { + "#": 18, + "set": 49, + "-": 102, + "g": 1, + "IFS": 4, + "n": 5, + "t": 2, + "l": 15, + "configdir": 2, + "/.config": 1, + "if": 21, + "q": 9, + "XDG_CONFIG_HOME": 2, + "end": 33, + "not": 8, + "fish_function_path": 4, + "configdir/fish/functions": 1, + "__fish_sysconfdir/functions": 1, + "__fish_datadir/functions": 3, + "contains": 4, + "[": 13, + "]": 13, + "fish_complete_path": 4, + "configdir/fish/completions": 1, + "__fish_sysconfdir/completions": 1, + "__fish_datadir/completions": 3, + "test": 7, + "d": 3, + "/usr/xpg4/bin": 3, + "PATH": 6, + "path_list": 4, + "/bin": 1, + "/usr/bin": 1, + "/usr/X11R6/bin": 1, + "/usr/local/bin": 1, + "__fish_bin_dir": 1, + "switch": 3, + "USER": 1, + "case": 9, + "root": 1, + "/sbin": 1, + "/usr/sbin": 1, + "/usr/local/sbin": 1, + "for": 1, + "i": 5, + "in": 2, + "function": 6, + "fish_sigtrap_handler": 1, + "on": 2, + "signal": 1, + "TRAP": 1, + "no": 2, + "scope": 1, + "shadowing": 1, + "description": 2, + "breakpoint": 1, + "__fish_on_interactive": 2, + "event": 1, + "fish_prompt": 1, + "__fish_config_interactive": 1, + "functions": 5, + "e": 6, + "eval": 5, + "S": 1, + "If": 2, + "we": 2, + "are": 1, + "an": 1, + "interactive": 8, + "shell": 1, + "should": 2, + "enable": 1, + "full": 4, + "job": 5, + "control": 5, + "since": 1, + "it": 1, + "behave": 1, + "like": 2, + "the": 1, + "real": 1, + "code": 1, + "was": 1, + "executed.": 1, + "don": 1, + "do": 1, + "this": 1, + "commands": 1, + "that": 1, + "expect": 1, + "to": 1, + "be": 1, + "used": 1, + "interactively": 1, + "less": 1, + "wont": 1, + "work": 1, + "using": 1, + "eval.": 1, + "mode": 5, + "status": 7, + "is": 3, + "else": 3, + "none": 1, + "echo": 3, + "|": 3, + ".": 2, + "<": 1, + "&": 1, + "res": 2, + "return": 6, + "funced": 3, + "editor": 7, + "EDITOR": 1, + "funcname": 14, + "while": 2, + "argv": 9, + "h": 1, + "help": 1, + "__fish_print_help": 1, + "set_color": 4, + "red": 2, + "printf": 3, + "(": 7, + "_": 3, + ")": 7, + "normal": 2, + "begin": 2, + ";": 7, + "or": 3, + "init": 5, + "nend": 2, + "editor_cmd": 2, + "type": 1, + "f": 3, + "/dev/null": 2, + "fish": 3, + "z": 1, + "fish_indent": 2, + "indent": 1, + "prompt": 2, + "read": 1, + "p": 1, + "c": 1, + "s": 1, + "cmd": 2, + "TMPDIR": 2, + "/tmp": 1, + "tmpname": 8, + "%": 2, + "self": 2, + "random": 2, + "stat": 2, + "rm": 1 } }, "language_tokens": { + "ABAP": 1500, "ApacheConf": 1449, "Apex": 4408, "AppleScript": 1862, "Arduino": 20, "AutoHotkey": 3, - "C": 49038, - "C++": 9713, + "Awk": 544, + "C": 58732, + "C++": 19321, "Ceylon": 50, "CoffeeScript": 2955, "Coq": 18259, @@ -28688,72 +35158,94 @@ "Ecl": 281, "Elm": 628, "Emacs Lisp": 3, + "Forth": 1516, "GAS": 133, "Gosu": 413, "Groovy": 69, "Groovy Server Pages": 91, "Haml": 4, "Handlebars": 69, - "INI": 8, + "INI": 27, "Ioke": 2, + "JSON": 619, "Java": 7336, "JavaScript": 76934, - "JSON": 619, "Julia": 247, "Kotlin": 155, + "Lasso": 9849, + "Less": 39, + "Literate CoffeeScript": 275, + "LiveScript": 123, + "Logos": 93, "Logtalk": 36, + "Lua": 724, "Markdown": 1, - "Matlab": 343, + "Matlab": 11787, "Max": 136, + "Monkey": 207, + "MoonScript": 1718, + "NSIS": 725, "Nemerle": 17, "Nginx": 179, "Nimrod": 1, "Nu": 4, + "OCaml": 382, "Objective-C": 26518, - "OCaml": 269, + "Omgrofl": 57, "Opa": 28, "OpenCL": 88, "OpenEdge ABL": 2894, + "PHP": 20647, "Parrot Assembly": 6, "Parrot Internal Representation": 5, "Perl": 17113, - "PHP": 20647, + "PogoScript": 250, "PowerShell": 12, + "Processing": 74, "Prolog": 4040, "Python": 4020, "R": 14, "Racket": 269, + "Ragel in Ruby Host": 593, "Rebol": 11, - "Ruby": 3836, - "Rust": 8, + "Ruby": 3854, + "Rust": 3566, + "SCSS": 39, "Sass": 28, "Scala": 280, "Scheme": 3478, "Scilab": 69, - "SCSS": 39, "Shell": 3481, "Standard ML": 243, - "SuperCollider": 135, - "Tea": 3, + "SuperCollider": 268, + "TXL": 213, "TeX": 1155, + "Tea": 3, "Turing": 44, - "Verilog": 3778, + "TypeScript": 106, "VHDL": 42, + "Verilog": 3778, "VimL": 20, "Visual Basic": 345, "XML": 5622, + "XProc": 22, "XQuery": 801, "XSLT": 44, - "YAML": 30 + "Xtend": 399, + "YAML": 30, + "edn": 227, + "fish": 636 }, "languages": { + "ABAP": 1, "ApacheConf": 3, "Apex": 6, "AppleScript": 7, "Arduino": 1, "AutoHotkey": 1, - "C": 23, - "C++": 17, + "Awk": 1, + "C": 24, + "C++": 18, "Ceylon": 1, "CoffeeScript": 9, "Coq": 12, @@ -28763,63 +35255,83 @@ "Ecl": 1, "Elm": 3, "Emacs Lisp": 1, + "Forth": 7, "GAS": 1, "Gosu": 5, "Groovy": 2, "Groovy Server Pages": 4, "Haml": 1, "Handlebars": 2, - "INI": 1, + "INI": 2, "Ioke": 1, + "JSON": 5, "Java": 5, "JavaScript": 20, - "JSON": 5, "Julia": 1, "Kotlin": 1, + "Lasso": 4, + "Less": 1, + "Literate CoffeeScript": 1, + "LiveScript": 1, + "Logos": 1, "Logtalk": 1, + "Lua": 3, "Markdown": 1, - "Matlab": 6, + "Matlab": 37, "Max": 1, + "Monkey": 1, + "MoonScript": 1, + "NSIS": 2, "Nemerle": 1, "Nginx": 1, "Nimrod": 1, "Nu": 1, + "OCaml": 2, "Objective-C": 19, - "OCaml": 1, + "Omgrofl": 1, "Opa": 2, "OpenCL": 1, "OpenEdge ABL": 5, + "PHP": 8, "Parrot Assembly": 1, "Parrot Internal Representation": 1, "Perl": 13, - "PHP": 8, + "PogoScript": 1, "PowerShell": 2, + "Processing": 1, "Prolog": 6, "Python": 4, "R": 1, "Racket": 2, + "Ragel in Ruby Host": 3, "Rebol": 1, - "Ruby": 15, + "Ruby": 16, "Rust": 1, + "SCSS": 1, "Sass": 1, "Scala": 2, "Scheme": 1, "Scilab": 3, - "SCSS": 1, "Shell": 34, "Standard ML": 2, - "SuperCollider": 1, - "Tea": 1, + "SuperCollider": 2, + "TXL": 1, "TeX": 1, + "Tea": 1, "Turing": 1, - "Verilog": 13, + "TypeScript": 3, "VHDL": 1, + "Verilog": 13, "VimL": 2, "Visual Basic": 1, "XML": 3, + "XProc": 1, "XQuery": 1, "XSLT": 1, - "YAML": 1 + "Xtend": 2, + "YAML": 1, + "edn": 1, + "fish": 3 }, - "md5": "85a9c056dba62cfff4c4c87a29c9547a" + "md5": "8ca95cd668b53b8f80df6813e838d2f7" } \ No newline at end of file diff --git a/lib/linguist/vendor.yml b/lib/linguist/vendor.yml index f0567eba..7adaeefb 100644 --- a/lib/linguist/vendor.yml +++ b/lib/linguist/vendor.yml @@ -16,11 +16,15 @@ # https://github.com/joyent/node - ^deps/ - ^tools/ +- (^|/)configure$ +- (^|/)configure.ac$ +- (^|/)config.guess$ +- (^|/)config.sub$ -# Node depedencies +# Node dependencies - node_modules/ -# Vendored depedencies +# Vendored dependencies - vendor/ # Debian packaging @@ -63,8 +67,16 @@ # MathJax - (^|/)MathJax/ +# SyntaxHighlighter - http://alexgorbatchev.com/ +- (^|/)shBrush([^.]*)\.js$ +- (^|/)shCore\.js$ +- (^|/)shLegacy\.js$ + ## Python ## +# django +- (^|/)admin_media/ + # Fabric - ^fabfile\.py$ @@ -96,3 +108,6 @@ # Samples folders - ^[Ss]amples/ + +# Test fixtures +- ^[Tt]est/fixtures/ diff --git a/samples/ABAP/cl_csv_parser.abap b/samples/ABAP/cl_csv_parser.abap new file mode 100644 index 00000000..2b32d047 --- /dev/null +++ b/samples/ABAP/cl_csv_parser.abap @@ -0,0 +1,219 @@ +*/** +* The MIT License (MIT) +* Copyright (c) 2012 René van Mil +* +* Permission is hereby granted, free of charge, to any person obtaining +* a copy of this software and associated documentation files (the +* "Software"), to deal in the Software without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +*----------------------------------------------------------------------* +* CLASS CL_CSV_PARSER DEFINITION +*----------------------------------------------------------------------* +* +*----------------------------------------------------------------------* +class cl_csv_parser definition + public + inheriting from cl_object + final + create public . + + public section. +*"* public components of class CL_CSV_PARSER +*"* do not include other source files here!!! + + type-pools abap . + methods constructor + importing + !delegate type ref to if_csv_parser_delegate + !csvstring type string + !separator type c + !skip_first_line type abap_bool . + methods parse + raising + cx_csv_parse_error . + protected section. +*"* protected components of class CL_CSV_PARSER +*"* do not include other source files here!!! + private section. +*"* private components of class CL_CSV_PARSER +*"* do not include other source files here!!! + + constants _textindicator type c value '"'. "#EC NOTEXT + data _delegate type ref to if_csv_parser_delegate . + data _csvstring type string . + data _separator type c . + type-pools abap . + data _skip_first_line type abap_bool . + + methods _lines + returning + value(returning) type stringtab . + methods _parse_line + importing + !line type string + returning + value(returning) type stringtab + raising + cx_csv_parse_error . +endclass. "CL_CSV_PARSER DEFINITION + + + +*----------------------------------------------------------------------* +* CLASS CL_CSV_PARSER IMPLEMENTATION +*----------------------------------------------------------------------* +* +*----------------------------------------------------------------------* +class cl_csv_parser implementation. + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method CL_CSV_PARSER->CONSTRUCTOR +* +-------------------------------------------------------------------------------------------------+ +* | [--->] DELEGATE TYPE REF TO IF_CSV_PARSER_DELEGATE +* | [--->] CSVSTRING TYPE STRING +* | [--->] SEPARATOR TYPE C +* | [--->] SKIP_FIRST_LINE TYPE ABAP_BOOL +* +-------------------------------------------------------------------------------------- + method constructor. + super->constructor( ). + _delegate = delegate. + _csvstring = csvstring. + _separator = separator. + _skip_first_line = skip_first_line. + endmethod. "constructor + + +* ---------------------------------------------------------------------------------------+ +* | Instance Public Method CL_CSV_PARSER->PARSE +* +-------------------------------------------------------------------------------------------------+ +* | [!CX!] CX_CSV_PARSE_ERROR +* +-------------------------------------------------------------------------------------- + method parse. + data msg type string. + if _csvstring is initial. + message e002(csv) into msg. + raise exception type cx_csv_parse_error + exporting + message = msg. + endif. + + " Get the lines + data is_first_line type abap_bool value abap_true. + data lines type standard table of string. + lines = _lines( ). + field-symbols type string. + loop at lines assigning . + " Should we skip the first line? + if _skip_first_line = abap_true and is_first_line = abap_true. + is_first_line = abap_false. + continue. + endif. + " Parse the line + data values type standard table of string. + values = _parse_line( ). + " Send values to delegate + _delegate->values_found( values ). + endloop. + endmethod. "parse + + +* ---------------------------------------------------------------------------------------+ +* | Instance Private Method CL_CSV_PARSER->_LINES +* +-------------------------------------------------------------------------------------------------+ +* | [<-()] RETURNING TYPE STRINGTAB +* +-------------------------------------------------------------------------------------- + method _lines. + split _csvstring at cl_abap_char_utilities=>cr_lf into table returning. + endmethod. "_lines + + +* ---------------------------------------------------------------------------------------+ +* | Instance Private Method CL_CSV_PARSER->_PARSE_LINE +* +-------------------------------------------------------------------------------------------------+ +* | [--->] LINE TYPE STRING +* | [<-()] RETURNING TYPE STRINGTAB +* | [!CX!] CX_CSV_PARSE_ERROR +* +-------------------------------------------------------------------------------------- + method _parse_line. + data msg type string. + + data csvvalue type string. + data csvvalues type standard table of string. + + data char type c. + data pos type i value 0. + data len type i. + len = strlen( line ). + while pos < len. + char = line+pos(1). + if char <> _separator. + if char = _textindicator. + data text_ended type abap_bool. + text_ended = abap_false. + while text_ended = abap_false. + pos = pos + 1. + if pos < len. + char = line+pos(1). + if char = _textindicator. + text_ended = abap_true. + else. + if char is initial. " Space + concatenate csvvalue ` ` into csvvalue. + else. + concatenate csvvalue char into csvvalue. + endif. + endif. + else. + " Reached the end of the line while inside a text value + " This indicates an error in the CSV formatting + text_ended = abap_true. + message e003(csv) into msg. + raise exception type cx_csv_parse_error + exporting + message = msg. + endif. + endwhile. + " Check if next character is a separator, otherwise the CSV formatting is incorrect + data nextpos type i. + nextpos = pos + 1. + if nextpos < len and line+nextpos(1) <> _separator. + message e003(csv) into msg. + raise exception type cx_csv_parse_error + exporting + message = msg. + endif. + else. + if char is initial. " Space + concatenate csvvalue ` ` into csvvalue. + else. + concatenate csvvalue char into csvvalue. + endif. + endif. + else. + append csvvalue to csvvalues. + clear csvvalue. + endif. + pos = pos + 1. + endwhile. + append csvvalue to csvvalues. " Don't forget the last value + + returning = csvvalues. + endmethod. "_parse_line +endclass. "CL_CSV_PARSER IMPLEMENTATION \ No newline at end of file diff --git a/samples/Awk/test.awk b/samples/Awk/test.awk new file mode 100644 index 00000000..9f0e3ec9 --- /dev/null +++ b/samples/Awk/test.awk @@ -0,0 +1,121 @@ +#!/bin/awk -f + +BEGIN { + # It is not possible to define output file names here because + # FILENAME is not define in the BEGIN section + n = ""; + printf "Generating data files ..."; + network_max_bandwidth_in_byte = 10000000; + network_max_packet_per_second = 1000000; + last3 = 0; + last4 = 0; + last5 = 0; + last6 = 0; +} +{ + if ($1 ~ /Average/) + { # Skip the Average values + n = ""; + next; + } + + if ($2 ~ /all/) + { # This is the cpu info + print $3 > FILENAME".cpu.user.dat"; +# print $4 > FILENAME".cpu.nice.dat"; + print $5 > FILENAME".cpu.system.dat"; +# print $6 > FILENAME".cpu.iowait.dat"; + print $7 > FILENAME".cpu.idle.dat"; + print 100-$7 > FILENAME".cpu.busy.dat"; + } + if ($2 ~ /eth0/) + { # This is the eth0 network info + if ($3 > network_max_packet_per_second) + print last3 > FILENAME".net.rxpck.dat"; # Total number of packets received per second. + else + { + last3 = $3; + print $3 > FILENAME".net.rxpck.dat"; # Total number of packets received per second. + } + if ($4 > network_max_packet_per_second) + print last4 > FILENAME".net.txpck.dat"; # Total number of packets transmitted per second. + else + { + last4 = $4; + print $4 > FILENAME".net.txpck.dat"; # Total number of packets transmitted per second. + } + if ($5 > network_max_bandwidth_in_byte) + print last5 > FILENAME".net.rxbyt.dat"; # Total number of bytes received per second. + else + { + last5 = $5; + print $5 > FILENAME".net.rxbyt.dat"; # Total number of bytes received per second. + } + if ($6 > network_max_bandwidth_in_byte) + print last6 > FILENAME".net.txbyt.dat"; # Total number of bytes transmitted per second. + else + { + last6 = $6; + print $6 > FILENAME".net.txbyt.dat"; # Total number of bytes transmitted per second. + } +# print $7 > FILENAME".net.rxcmp.dat"; # Number of compressed packets received per second (for cslip etc.). +# print $8 > FILENAME".net.txcmp.dat"; # Number of compressed packets transmitted per second. +# print $9 > FILENAME".net.rxmcst.dat"; # Number of multicast packets received per second. + } + + # Detect which is the next info to be parsed + if ($2 ~ /proc|cswch|tps|kbmemfree|totsck/) + { + n = $2; + } + + # Only get lines with numbers (real data !) + if ($2 ~ /[0-9]/) + { + if (n == "proc/s") + { # This is the proc/s info + print $2 > FILENAME".proc.dat"; +# n = ""; + } + if (n == "cswch/s") + { # This is the context switches per second info + print $2 > FILENAME".ctxsw.dat"; +# n = ""; + } + if (n == "tps") + { # This is the disk info + print $2 > FILENAME".disk.tps.dat"; # total transfers per second + print $3 > FILENAME".disk.rtps.dat"; # read requests per second + print $4 > FILENAME".disk.wtps.dat"; # write requests per second + print $5 > FILENAME".disk.brdps.dat"; # block reads per second + print $6 > FILENAME".disk.bwrps.dat"; # block writes per second +# n = ""; + } + if (n == "kbmemfree") + { # This is the mem info + print $2 > FILENAME".mem.kbmemfree.dat"; # Amount of free memory available in kilobytes. + print $3 > FILENAME".mem.kbmemused.dat"; # Amount of used memory in kilobytes. This does not take into account memory used by the kernel itself. + print $4 > FILENAME".mem.memused.dat"; # Percentage of used memory. +# It appears the kbmemshrd has been removed from the sysstat output - ntolia +# print $X > FILENAME".mem.kbmemshrd.dat"; # Amount of memory shared by the system in kilobytes. Always zero with 2.4 kernels. +# print $5 > FILENAME".mem.kbbuffers.dat"; # Amount of memory used as buffers by the kernel in kilobytes. + print $6 > FILENAME".mem.kbcached.dat"; # Amount of memory used to cache data by the kernel in kilobytes. +# print $7 > FILENAME".mem.kbswpfree.dat"; # Amount of free swap space in kilobytes. +# print $8 > FILENAME".mem.kbswpused.dat"; # Amount of used swap space in kilobytes. + print $9 > FILENAME".mem.swpused.dat"; # Percentage of used swap space. +# n = ""; + } + if (n == "totsck") + { # This is the socket info + print $2 > FILENAME".sock.totsck.dat"; # Total number of used sockets. + print $3 > FILENAME".sock.tcpsck.dat"; # Number of TCP sockets currently in use. +# print $4 > FILENAME".sock.udpsck.dat"; # Number of UDP sockets currently in use. +# print $5 > FILENAME".sock.rawsck.dat"; # Number of RAW sockets currently in use. +# print $6 > FILENAME".sock.ip-frag.dat"; # Number of IP fragments currently in use. +# n = ""; + } + } +} +END { + print " '" FILENAME "' done."; +} diff --git a/samples/Binary/cube.stl b/samples/Binary/cube.stl new file mode 100644 index 00000000..f4d2a267 Binary files /dev/null and b/samples/Binary/cube.stl differ diff --git a/samples/C++/wrapper_inner.cpp b/samples/C++/wrapper_inner.cpp new file mode 100644 index 00000000..0ea890c0 --- /dev/null +++ b/samples/C++/wrapper_inner.cpp @@ -0,0 +1,4674 @@ +/* Generated by Cython 0.14.1 on Mon Jun 27 13:03:43 2011 */ + +#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. +#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 + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#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) PyInt_AsLong(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) +#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) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#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_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_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 + +#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 + +#ifdef __cplusplus +#define __PYX_EXTERN_C extern "C" +#else +#define __PYX_EXTERN_C extern +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE_API__wrapper_inner +#include "stdio.h" +#include "stdlib.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#include + +#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) +# 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_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)) + + +#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; + + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif + +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +static const char *__pyx_f[] = { + "wrapper_inner.pyx", + "numpy.pxd", +}; + +typedef npy_int8 __pyx_t_5numpy_int8_t; + +typedef npy_int16 __pyx_t_5numpy_int16_t; + +typedef npy_int32 __pyx_t_5numpy_int32_t; + +typedef npy_int64 __pyx_t_5numpy_int64_t; + +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +typedef npy_float32 __pyx_t_5numpy_float32_t; + +typedef npy_float64 __pyx_t_5numpy_float64_t; + +typedef npy_long __pyx_t_5numpy_int_t; + +typedef npy_longlong __pyx_t_5numpy_long_t; + +typedef npy_intp __pyx_t_5numpy_intp_t; + +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +typedef npy_ulong __pyx_t_5numpy_uint_t; + +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +typedef npy_double __pyx_t_5numpy_float_t; + +typedef npy_double __pyx_t_5numpy_double_t; + +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + +/* Type declarations */ + +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +#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) { + 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; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #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_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #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_XDECREF(r) Py_XDECREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +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); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ + +static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/ +#if PY_MAJOR_VERSION >= 3 +static PyObject* __pyx_print = 0; +static PyObject* __pyx_print_kwargs = 0; +#endif + +static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/ + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t); + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif + +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +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 void __Pyx_WriteUnraisable(const char *name); /*proto*/ + +static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from cpython.buffer */ + +/* Module declarations from cpython.ref */ + +/* Module declarations from libc.stdio */ + +/* Module declarations from cpython.object */ + +/* Module declarations from libc.stdlib */ + +/* Module declarations from numpy */ + +/* Module declarations from numpy */ + +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ +/* Module declarations from libcpp.vector */ + +/* Module declarations from wrapper_inner */ + +static void inner_work_1d(int, double *, double *); /*proto*/ +static void inner_work_2d(int, int, double *, double *); /*proto*/ +#define __Pyx_MODULE_NAME "wrapper_inner" +static int __pyx_module_is_main_wrapper_inner = 0; + +/* Implementation of wrapper_inner */ +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_RuntimeError; +static char __pyx_k_1[] = "\nHello from Cython inner_work_1d!"; +static char __pyx_k_2[] = "\nHello from Cython inner_work_2d!"; +static char __pyx_k_3[] = "\nHello from a pure Python function inside the Cython module."; +static char __pyx_k_5[] = "ndarray is not C contiguous"; +static char __pyx_k_7[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_9[] = "Non-native byte order not supported"; +static char __pyx_k_11[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_12[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_15[] = "Format string allocated too short."; +static char __pyx_k__B[] = "B"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__np[] = "np"; +static char __pyx_k__buf[] = "buf"; +static char __pyx_k__obj[] = "obj"; +static char __pyx_k__base[] = "base"; +static char __pyx_k__ndim[] = "ndim"; +static char __pyx_k__ones[] = "ones"; +static char __pyx_k__descr[] = "descr"; +static char __pyx_k__names[] = "names"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__shape[] = "shape"; +static char __pyx_k__fields[] = "fields"; +static char __pyx_k__format[] = "format"; +static char __pyx_k__strides[] = "strides"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__itemsize[] = "itemsize"; +static char __pyx_k__readonly[] = "readonly"; +static char __pyx_k__type_num[] = "type_num"; +static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__suboffsets[] = "suboffsets"; +static char __pyx_k__work_module[] = "work_module"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__pure_py_test[] = "pure_py_test"; +static char __pyx_k__wrapper_inner[] = "wrapper_inner"; +static char __pyx_k__do_awesome_work[] = "do_awesome_work"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_u_11; +static PyObject *__pyx_kp_u_12; +static PyObject *__pyx_kp_u_15; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_u_5; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_9; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__base; +static PyObject *__pyx_n_s__buf; +static PyObject *__pyx_n_s__byteorder; +static PyObject *__pyx_n_s__descr; +static PyObject *__pyx_n_s__do_awesome_work; +static PyObject *__pyx_n_s__fields; +static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__itemsize; +static PyObject *__pyx_n_s__names; +static PyObject *__pyx_n_s__ndim; +static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__obj; +static PyObject *__pyx_n_s__ones; +static PyObject *__pyx_n_s__pure_py_test; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__readonly; +static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__strides; +static PyObject *__pyx_n_s__suboffsets; +static PyObject *__pyx_n_s__type_num; +static PyObject *__pyx_n_s__work_module; +static PyObject *__pyx_n_s__wrapper_inner; +static PyObject *__pyx_int_5; +static PyObject *__pyx_int_15; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_8; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_13; +static PyObject *__pyx_k_tuple_14; +static PyObject *__pyx_k_tuple_16; + +/* "wrapper_inner.pyx":18 + * # Here is the Cython portion of the wrapper. + * # Important: this function must be declared with "api" keyword! + * cdef api void inner_work_1d(int num_x, double* data_ptr, double* answer_ptr): # <<<<<<<<<<<<<< + * + * print('\nHello from Cython inner_work_1d!') + */ + +static void inner_work_1d(int __pyx_v_num_x, double *__pyx_v_data_ptr, double *__pyx_v_answer_ptr) { + int __pyx_v_nd; + npy_intp *__pyx_v_dims; + int __pyx_v_typenum; + PyArrayObject *__pyx_v_data_np = 0; + double __pyx_v_sum; + npy_intp __pyx_t_1[1]; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + __Pyx_RefNannySetupContext("inner_work_1d"); + + /* "wrapper_inner.pyx":20 + * cdef api void inner_work_1d(int num_x, double* data_ptr, double* answer_ptr): + * + * print('\nHello from Cython inner_work_1d!') # <<<<<<<<<<<<<< + * + * # Convert input data into form useable by Python, with lots of help from Numpy. + */ + if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "wrapper_inner.pyx":25 + * + * # http://www.mail-archive.com/cython-dev@codespeak.net/msg05823.html + * cdef int nd = 1 # <<<<<<<<<<<<<< + * cdef np.npy_intp* dims = [num_x] # analogous to: double a[4] = {0.5, 0.3, 0.1, 0.1} + * cdef int typenum = np.NPY_DOUBLE + */ + __pyx_v_nd = 1; + + /* "wrapper_inner.pyx":26 + * # http://www.mail-archive.com/cython-dev@codespeak.net/msg05823.html + * cdef int nd = 1 + * cdef np.npy_intp* dims = [num_x] # analogous to: double a[4] = {0.5, 0.3, 0.1, 0.1} # <<<<<<<<<<<<<< + * cdef int typenum = np.NPY_DOUBLE + * + */ + __pyx_t_1[0] = ((npy_intp)__pyx_v_num_x); + __pyx_v_dims = __pyx_t_1; + + /* "wrapper_inner.pyx":27 + * cdef int nd = 1 + * cdef np.npy_intp* dims = [num_x] # analogous to: double a[4] = {0.5, 0.3, 0.1, 0.1} + * cdef int typenum = np.NPY_DOUBLE # <<<<<<<<<<<<<< + * + * cdef np.ndarray data_np = PyArray_SimpleNewFromData(nd, dims, typenum, data_ptr) + */ + __pyx_v_typenum = NPY_DOUBLE; + + /* "wrapper_inner.pyx":29 + * cdef int typenum = np.NPY_DOUBLE + * + * cdef np.ndarray data_np = PyArray_SimpleNewFromData(nd, dims, typenum, data_ptr) # <<<<<<<<<<<<<< + * + * # Do the work. + */ + __pyx_t_2 = PyArray_SimpleNewFromData(__pyx_v_nd, __pyx_v_dims, __pyx_v_typenum, ((void *)__pyx_v_data_ptr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_data_np = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "wrapper_inner.pyx":32 + * + * # Do the work. + * cdef double sum = work_module.do_awesome_work(data_np) # <<<<<<<<<<<<<< + * + * # # Convert work results into a form useable by the calling C++ application. + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__work_module); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__do_awesome_work); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__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[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_v_data_np)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_data_np)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_data_np)); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_sum = __pyx_t_5; + + /* "wrapper_inner.pyx":35 + * + * # # Convert work results into a form useable by the calling C++ application. + * answer_ptr[0] = sum # <<<<<<<<<<<<<< + * + * # Done. + */ + (__pyx_v_answer_ptr[0]) = __pyx_v_sum; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("wrapper_inner.inner_work_1d"); + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_data_np); + __Pyx_RefNannyFinishContext(); +} + +/* "wrapper_inner.pyx":40 + * + * + * cdef api void inner_work_2d(int num_x, int num_y, double* data_ptr, double* answer_ptr): # <<<<<<<<<<<<<< + * + * print('\nHello from Cython inner_work_2d!') + */ + +static void inner_work_2d(int __pyx_v_num_x, int __pyx_v_num_y, double *__pyx_v_data_ptr, double *__pyx_v_answer_ptr) { + int __pyx_v_nd; + npy_intp *__pyx_v_dims; + int __pyx_v_typenum; + PyArrayObject *__pyx_v_data_np = 0; + double __pyx_v_sum; + npy_intp __pyx_t_1[2]; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + __Pyx_RefNannySetupContext("inner_work_2d"); + + /* "wrapper_inner.pyx":42 + * cdef api void inner_work_2d(int num_x, int num_y, double* data_ptr, double* answer_ptr): + * + * print('\nHello from Cython inner_work_2d!') # <<<<<<<<<<<<<< + * + * # Convert input data into form useable by Python, with lots of help from Numpy. + */ + if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "wrapper_inner.pyx":45 + * + * # Convert input data into form useable by Python, with lots of help from Numpy. + * cdef int nd = 2 # <<<<<<<<<<<<<< + * cdef np.npy_intp* dims = [num_x, num_y] + * cdef int typenum = np.NPY_DOUBLE + */ + __pyx_v_nd = 2; + + /* "wrapper_inner.pyx":46 + * # Convert input data into form useable by Python, with lots of help from Numpy. + * cdef int nd = 2 + * cdef np.npy_intp* dims = [num_x, num_y] # <<<<<<<<<<<<<< + * cdef int typenum = np.NPY_DOUBLE + * + */ + __pyx_t_1[0] = ((npy_intp)__pyx_v_num_x); + __pyx_t_1[1] = ((npy_intp)__pyx_v_num_y); + __pyx_v_dims = __pyx_t_1; + + /* "wrapper_inner.pyx":47 + * cdef int nd = 2 + * cdef np.npy_intp* dims = [num_x, num_y] + * cdef int typenum = np.NPY_DOUBLE # <<<<<<<<<<<<<< + * + * cdef np.ndarray data_np = PyArray_SimpleNewFromData(nd, dims, typenum, data_ptr) + */ + __pyx_v_typenum = NPY_DOUBLE; + + /* "wrapper_inner.pyx":49 + * cdef int typenum = np.NPY_DOUBLE + * + * cdef np.ndarray data_np = PyArray_SimpleNewFromData(nd, dims, typenum, data_ptr) # <<<<<<<<<<<<<< + * + * # Do the work. + */ + __pyx_t_2 = PyArray_SimpleNewFromData(__pyx_v_nd, __pyx_v_dims, __pyx_v_typenum, ((void *)__pyx_v_data_ptr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_data_np = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "wrapper_inner.pyx":52 + * + * # Do the work. + * cdef double sum = work_module.do_awesome_work(data_np) # <<<<<<<<<<<<<< + * + * # # Convert work results into a form useable by the calling C++ application. + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__work_module); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__do_awesome_work); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__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[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_v_data_np)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_data_np)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_data_np)); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_sum = __pyx_t_5; + + /* "wrapper_inner.pyx":55 + * + * # # Convert work results into a form useable by the calling C++ application. + * answer_ptr[0] = sum # <<<<<<<<<<<<<< + * + * + */ + (__pyx_v_answer_ptr[0]) = __pyx_v_sum; + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_WriteUnraisable("wrapper_inner.inner_work_2d"); + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_data_np); + __Pyx_RefNannyFinishContext(); +} + +/* "wrapper_inner.pyx":64 + * + * + * def pure_py_test(): # <<<<<<<<<<<<<< + * + * print('\nHello from a pure Python function inside the Cython module.') + */ + +static PyObject *__pyx_pf_13wrapper_inner_pure_py_test(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_13wrapper_inner_pure_py_test = {__Pyx_NAMESTR("pure_py_test"), (PyCFunction)__pyx_pf_13wrapper_inner_pure_py_test, METH_NOARGS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_13wrapper_inner_pure_py_test(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_v_data; + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("pure_py_test"); + __pyx_self = __pyx_self; + __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); + + /* "wrapper_inner.pyx":66 + * def pure_py_test(): + * + * print('\nHello from a pure Python function inside the Cython module.') # <<<<<<<<<<<<<< + * + * data = np.ones(5) + */ + if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "wrapper_inner.pyx":68 + * print('\nHello from a pure Python function inside the Cython module.') + * + * data = np.ones(5) # <<<<<<<<<<<<<< + * work_module.do_awesome_work(data) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ones); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __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_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_data); + __pyx_v_data = __pyx_t_1; + __pyx_t_1 = 0; + + /* "wrapper_inner.pyx":69 + * + * data = np.ones(5) + * work_module.do_awesome_work(data) # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__work_module); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__do_awesome_work); 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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_data); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_data); + __Pyx_GIVEREF(__pyx_v_data); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 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("wrapper_inner.pure_py_test"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_data); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":188 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + __Pyx_RefNannySetupContext("__getbuffer__"); + if (__pyx_v_info == NULL) return 0; + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + + /* "numpy.pxd":194 + * # of flags + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":195 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":197 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = __pyx_v_self; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":199 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_2 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_2) { + + /* "numpy.pxd":200 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L5; + } + /*else*/ { + + /* "numpy.pxd":202 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L5:; + + /* "numpy.pxd":204 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_2 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_2) { + + /* "numpy.pxd":205 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_1 = __pyx_v_self; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_t_1), NPY_C_CONTIGUOUS)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = __pyx_t_2; + } + if (__pyx_t_4) { + + /* "numpy.pxd":206 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":208 + * raise ValueError(u"ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") + */ + __pyx_t_4 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_4) { + + /* "numpy.pxd":209 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = __pyx_v_self; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_t_1), NPY_F_CONTIGUOUS)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_4; + } + if (__pyx_t_3) { + + /* "numpy.pxd":210 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "numpy.pxd":212 + * raise ValueError(u"ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_t_1 = __pyx_v_self; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":213 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. This is allocated + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "numpy.pxd":214 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. This is allocated + * # as one block, strides first. + */ + if (__pyx_v_copy_shape) { + + /* "numpy.pxd":217 + * # Allocate new buffer for strides and shape info. This is allocated + * # as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + + /* "numpy.pxd":218 + * # as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "numpy.pxd":219 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "numpy.pxd":220 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + __pyx_t_1 = __pyx_v_self; + __Pyx_INCREF(__pyx_t_1); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_t_1))[__pyx_v_i]); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":221 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + __pyx_t_1 = __pyx_v_self; + __Pyx_INCREF(__pyx_t_1); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_t_1))[__pyx_v_i]); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + goto __pyx_L8; + } + /*else*/ { + + /* "numpy.pxd":223 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_t_1 = __pyx_v_self; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_t_1))); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":224 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_t_1 = __pyx_v_self; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_t_1))); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __pyx_L8:; + + /* "numpy.pxd":225 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "numpy.pxd":226 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_t_1 = __pyx_v_self; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":227 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_t_1 = __pyx_v_self; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_t_1))); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":230 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "numpy.pxd":231 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); + __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + + /* "numpy.pxd":235 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "numpy.pxd":237 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + __pyx_t_3 = (!__pyx_v_hasfields); + if (__pyx_t_3) { + __pyx_t_4 = (!__pyx_v_copy_shape); + __pyx_t_2 = __pyx_t_4; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "numpy.pxd":239 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":242 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = __pyx_v_self; + } + __pyx_L11:; + + /* "numpy.pxd":244 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + */ + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + + /* "numpy.pxd":245 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + */ + __pyx_v_t = __pyx_v_descr->type_num; + + /* "numpy.pxd":246 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_2 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_2) { + __pyx_t_3 = __pyx_v_little_endian; + } else { + __pyx_t_3 = __pyx_t_2; + } + if (!__pyx_t_3) { + + /* "numpy.pxd":247 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_2 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_2) { + __pyx_t_4 = (!__pyx_v_little_endian); + __pyx_t_7 = __pyx_t_4; + } else { + __pyx_t_7 = __pyx_t_2; + } + __pyx_t_2 = __pyx_t_7; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "numpy.pxd":248 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "numpy.pxd":249 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + __pyx_t_2 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__b; + goto __pyx_L14; + } + + /* "numpy.pxd":250 + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + __pyx_t_2 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__B; + goto __pyx_L14; + } + + /* "numpy.pxd":251 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + __pyx_t_2 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__h; + goto __pyx_L14; + } + + /* "numpy.pxd":252 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + __pyx_t_2 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__H; + goto __pyx_L14; + } + + /* "numpy.pxd":253 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + __pyx_t_2 = (__pyx_v_t == NPY_INT); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__i; + goto __pyx_L14; + } + + /* "numpy.pxd":254 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + __pyx_t_2 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__I; + goto __pyx_L14; + } + + /* "numpy.pxd":255 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + __pyx_t_2 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__l; + goto __pyx_L14; + } + + /* "numpy.pxd":256 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + __pyx_t_2 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__L; + goto __pyx_L14; + } + + /* "numpy.pxd":257 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + __pyx_t_2 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__q; + goto __pyx_L14; + } + + /* "numpy.pxd":258 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + __pyx_t_2 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__Q; + goto __pyx_L14; + } + + /* "numpy.pxd":259 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + __pyx_t_2 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__f; + goto __pyx_L14; + } + + /* "numpy.pxd":260 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + __pyx_t_2 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__d; + goto __pyx_L14; + } + + /* "numpy.pxd":261 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + __pyx_t_2 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__g; + goto __pyx_L14; + } + + /* "numpy.pxd":262 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + __pyx_t_2 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__Zf; + goto __pyx_L14; + } + + /* "numpy.pxd":263 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + __pyx_t_2 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__Zd; + goto __pyx_L14; + } + + /* "numpy.pxd":264 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + __pyx_t_2 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__Zg; + goto __pyx_L14; + } + + /* "numpy.pxd":265 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_2 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_2) { + __pyx_v_f = __pyx_k__O; + goto __pyx_L14; + } + /*else*/ { + + /* "numpy.pxd":267 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L14:; + + /* "numpy.pxd":268 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "numpy.pxd":269 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L12; + } + /*else*/ { + + /* "numpy.pxd":271 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "numpy.pxd":272 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "numpy.pxd":273 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "numpy.pxd":276 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + + /* "numpy.pxd":277 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = 0; + } + __pyx_L12:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __pyx_r = -1; + __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->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":279 + * f[0] = 0 # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + __Pyx_RefNannySetupContext("__releasebuffer__"); + + /* "numpy.pxd":280 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = __pyx_v_self; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "numpy.pxd":281 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":282 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_2 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_2) { + + /* "numpy.pxd":283 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L6; + } + __pyx_L6:; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":756 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + + /* "numpy.pxd":757 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 757; __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("numpy.PyArray_MultiIterNew1"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":759 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + + /* "numpy.pxd":760 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 760; __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("numpy.PyArray_MultiIterNew2"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":762 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + + /* "numpy.pxd":763 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __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("numpy.PyArray_MultiIterNew3"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":765 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + + /* "numpy.pxd":766 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 766; __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("numpy.PyArray_MultiIterNew4"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":768 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + + /* "numpy.pxd":769 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __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("numpy.PyArray_MultiIterNew5"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":771 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields; + PyObject *__pyx_v_childname; + PyObject *__pyx_v_new_offset; + PyObject *__pyx_v_t; + char *__pyx_r; + Py_ssize_t __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_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + long __pyx_t_10; + char *__pyx_t_11; + __Pyx_RefNannySetupContext("_util_dtypestring"); + __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_fields = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); + + /* "numpy.pxd":778 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":779 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":782 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (unlikely(__pyx_v_descr->names == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; + __Pyx_DECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":783 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "numpy.pxd":784 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { + PyObject* tuple = ((PyObject *)__pyx_v_fields); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "numpy.pxd":786 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "numpy.pxd":787 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":789 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_6) { + __pyx_t_7 = __pyx_v_little_endian; + } else { + __pyx_t_7 = __pyx_t_6; + } + if (!__pyx_t_7) { + + /* "numpy.pxd":790 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_6) { + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_6; + } + __pyx_t_6 = __pyx_t_9; + } else { + __pyx_t_6 = __pyx_t_7; + } + if (__pyx_t_6) { + + /* "numpy.pxd":791 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":801 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) break; + + /* "numpy.pxd":802 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "numpy.pxd":803 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f = (__pyx_v_f + 1); + + /* "numpy.pxd":804 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + } + + /* "numpy.pxd":806 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + + /* "numpy.pxd":808 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_6) { + + /* "numpy.pxd":809 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":810 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * + */ + __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_6) { + + /* "numpy.pxd":811 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "numpy.pxd":814 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } + + /* "numpy.pxd":815 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } + + /* "numpy.pxd":816 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } + + /* "numpy.pxd":817 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } + + /* "numpy.pxd":818 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } + + /* "numpy.pxd":819 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } + + /* "numpy.pxd":820 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } + + /* "numpy.pxd":821 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } + + /* "numpy.pxd":822 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } + + /* "numpy.pxd":823 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } + + /* "numpy.pxd":824 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } + + /* "numpy.pxd":825 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } + + /* "numpy.pxd":826 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } + + /* "numpy.pxd":827 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":828 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":829 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":830 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":832 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 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_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; + + /* "numpy.pxd":833 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L9; + } + /*else*/ { + + /* "numpy.pxd":837 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_11; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "numpy.pxd":838 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __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_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_child); + __Pyx_DECREF(__pyx_v_fields); + __Pyx_DECREF(__pyx_v_childname); + __Pyx_DECREF(__pyx_v_new_offset); + __Pyx_DECREF(__pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":953 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("set_array_base"); + + /* "numpy.pxd":955 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "numpy.pxd":956 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":958 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + __pyx_t_2 = __pyx_v_base; + __Pyx_INCREF(__pyx_t_2); + Py_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "numpy.pxd":959 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "numpy.pxd":960 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "numpy.pxd":961 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":963 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base"); + + /* "numpy.pxd":964 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "numpy.pxd":965 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":967 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __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("wrapper_inner"), + 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_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, + {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, + {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 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__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, + {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, + {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, + {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, + {&__pyx_n_s__do_awesome_work, __pyx_k__do_awesome_work, sizeof(__pyx_k__do_awesome_work), 0, 0, 1, 1}, + {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, + {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, + {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, + {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, + {&__pyx_n_s__ones, __pyx_k__ones, sizeof(__pyx_k__ones), 0, 0, 1, 1}, + {&__pyx_n_s__pure_py_test, __pyx_k__pure_py_test, sizeof(__pyx_k__pure_py_test), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, + {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, + {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, + {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, + {&__pyx_n_s__work_module, __pyx_k__work_module, sizeof(__pyx_k__work_module), 0, 0, 1, 1}, + {&__pyx_n_s__wrapper_inner, __pyx_k__wrapper_inner, sizeof(__pyx_k__wrapper_inner), 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[1]; __pyx_lineno = 206; __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[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "wrapper_inner.pyx":68 + * print('\nHello from a pure Python function inside the Cython module.') + * + * data = np.ones(5) # <<<<<<<<<<<<<< + * work_module.do_awesome_work(data) + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); + __Pyx_INCREF(__pyx_int_5); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, __pyx_int_5); + __Pyx_GIVEREF(__pyx_int_5); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "numpy.pxd":206 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "numpy.pxd":210 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); + PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); + + /* "numpy.pxd":248 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "numpy.pxd":787 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_k_tuple_13 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); + PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, ((PyObject *)__pyx_kp_u_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); + + /* "numpy.pxd":791 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); + PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); + + /* "numpy.pxd":811 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_15)); + PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_u_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); + __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 = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_5 = PyInt_FromLong(5); if (unlikely(!__pyx_int_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initwrapper_inner(void); /*proto*/ +PyMODINIT_FUNC initwrapper_inner(void) +#else +PyMODINIT_FUNC PyInit_wrapper_inner(void); /*proto*/ +PyMODINIT_FUNC PyInit_wrapper_inner(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __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"); + } + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_wrapper_inner(void)", __LINE__, __FILE__); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __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 = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __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("wrapper_inner"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __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 = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_wrapper_inner) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Function export code ---*/ + if (__Pyx_ExportFunction("inner_work_1d", (void (*)(void))inner_work_1d, "void (int, double *, double *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("inner_work_2d", (void (*)(void))inner_work_2d, "void (int, int, double *, double *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Type init code ---*/ + /*--- Type import code ---*/ + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "wrapper_inner.pyx":2 + * + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "wrapper_inner.pyx":5 + * cimport numpy as np + * + * np.import_array() # <<<<<<<<<<<<<< + * + * from libcpp.vector cimport vector + */ + import_array(); + + /* "wrapper_inner.pyx":9 + * from libcpp.vector cimport vector + * + * import work_module # <<<<<<<<<<<<<< + * + * # Declare any Numpy C-API functions that I want to use. + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__work_module), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__work_module, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "wrapper_inner.pyx":64 + * + * + * def pure_py_test(): # <<<<<<<<<<<<<< + * + * print('\nHello from a pure Python function inside the Cython module.') + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_13wrapper_inner_pure_py_test, NULL, __pyx_n_s__wrapper_inner); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pure_py_test, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "wrapper_inner.pyx":2 + * + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __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 = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "libc\stdio.pxd":1 + * # 7.19 Input/output # <<<<<<<<<<<<<< + * + * cdef extern from *: + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init wrapper_inner"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init wrapper_inner"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +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 PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) + PyErr_SetObject(PyExc_NameError, name); + return result; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + 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); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + 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; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + 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) { + 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)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + 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: + return; +} +#endif + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "too many values to unpack (expected %d)", (int)expected); + #else + "too many values to unpack (expected %zd)", expected); + #endif +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(index); + } +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { + 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; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +#if PY_MAJOR_VERSION < 3 +static PyObject *__Pyx_GetStdout(void) { + PyObject *f = PySys_GetObject((char *)"stdout"); + if (!f) { + PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); + } + return f; +} + +static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { + PyObject* v; + int i; + + if (!f) { + if (!(f = __Pyx_GetStdout())) + return -1; + } + for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { + if (PyFile_SoftSpace(f, 1)) { + if (PyFile_WriteString(" ", f) < 0) + return -1; + } + v = PyTuple_GET_ITEM(arg_tuple, i); + if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) + return -1; + if (PyString_Check(v)) { + char *s = PyString_AsString(v); + Py_ssize_t len = PyString_Size(v); + if (len > 0 && + isspace(Py_CHARMASK(s[len-1])) && + s[len-1] != ' ') + PyFile_SoftSpace(f, 0); + } + } + if (newline) { + if (PyFile_WriteString("\n", f) < 0) + return -1; + PyFile_SoftSpace(f, 0); + } + return 0; +} + +#else /* Python 3 has a print function */ + +static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { + PyObject* kwargs = 0; + PyObject* result = 0; + PyObject* end_string; + if (unlikely(!__pyx_print)) { + __pyx_print = __Pyx_GetAttrString(__pyx_b, "print"); + if (!__pyx_print) + return -1; + } + if (stream) { + kwargs = PyDict_New(); + if (unlikely(!kwargs)) + return -1; + if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0)) + goto bad; + if (!newline) { + end_string = PyUnicode_FromStringAndSize(" ", 1); + if (unlikely(!end_string)) + goto bad; + if (PyDict_SetItemString(kwargs, "end", end_string) < 0) { + Py_DECREF(end_string); + goto bad; + } + Py_DECREF(end_string); + } + } else if (!newline) { + if (unlikely(!__pyx_print_kwargs)) { + __pyx_print_kwargs = PyDict_New(); + if (unlikely(!__pyx_print_kwargs)) + return -1; + end_string = PyUnicode_FromStringAndSize(" ", 1); + if (unlikely(!end_string)) + return -1; + if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) { + Py_DECREF(end_string); + return -1; + } + Py_DECREF(end_string); + } + kwargs = __pyx_print_kwargs; + } + result = PyObject_Call(__pyx_print, arg_tuple, kwargs); + if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) + Py_DECREF(kwargs); + if (!result) + return -1; + Py_DECREF(result); + return 0; +bad: + if (kwargs != __pyx_print_kwargs) + Py_XDECREF(kwargs); + return -1; +} + +#endif + +#if PY_MAJOR_VERSION < 3 + +static int __Pyx_PrintOne(PyObject* f, PyObject *o) { + if (!f) { + if (!(f = __Pyx_GetStdout())) + return -1; + } + if (PyFile_SoftSpace(f, 0)) { + if (PyFile_WriteString(" ", f) < 0) + return -1; + } + if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) + return -1; + if (PyFile_WriteString("\n", f) < 0) + return -1; + return 0; + /* the line below is just to avoid compiler + * compiler warnings about unused functions */ + return __Pyx_Print(f, NULL, 0); +} + +#else /* Python 3 has a print function */ + +static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { + int res; + PyObject* arg_tuple = PyTuple_New(1); + if (unlikely(!arg_tuple)) + return -1; + Py_INCREF(o); + PyTuple_SET_ITEM(arg_tuple, 0, o); + res = __Pyx_Print(stream, arg_tuple, 1); + Py_DECREF(arg_tuple); + return res; +} + +#endif + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { + const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(Py_intptr_t) == sizeof(char)) || + (sizeof(Py_intptr_t) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(Py_intptr_t) == sizeof(int)) || + (sizeof(Py_intptr_t) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t), + little, !is_unsigned); + } +} + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +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 PyLong_AsUnsignedLong(x); + } else { + return 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 PyLong_AsUnsignedLongLong(x); + } else { + return 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 PyLong_AsUnsignedLong(x); + } else { + return 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 PyLong_AsUnsignedLongLong(x); + } else { + return 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 PyLong_AsUnsignedLong(x); + } else { + return 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 PyLong_AsUnsignedLongLong(x); + } else { + return 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 void __Pyx_WriteUnraisable(const char *name) { + 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_ExportFunction(const char *name, void (*f)(void), const char *sig) { + PyObject *d = 0; + PyObject *cobj = 0; + union { + void (*fp)(void); + void *p; + } tmp; + + d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__"); + if (!d) { + PyErr_Clear(); + d = PyDict_New(); + if (!d) + goto bad; + Py_INCREF(d); + if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0) + goto bad; + } + tmp.fp = f; +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + cobj = PyCapsule_New(tmp.p, sig, 0); +#else + cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); +#endif + if (!cobj) + goto bad; + if (PyDict_SetItemString(d, name, cobj) < 0) + goto bad; + Py_DECREF(cobj); + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(cobj); + Py_XDECREF(d); + return -1; +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + long size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + PyErr_Warn(NULL, warning); + #else + PyErr_WarnEx(NULL, warning, 0); + #endif + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #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_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 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,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) 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 = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + 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 */ diff --git a/samples/C/sgd_fast.c b/samples/C/sgd_fast.c new file mode 100644 index 00000000..f85b9592 --- /dev/null +++ b/samples/C/sgd_fast.c @@ -0,0 +1,15669 @@ +/* Generated by Cython 0.17.4 on Mon Jan 7 18:29:40 2013 */ + +#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 __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check + #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" + #define __Pyx_PyIndex_Check PyIndex_Check +#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__sklearn__linear_model__sgd_fast +#define __PYX_HAVE_API__sklearn__linear_model__sgd_fast +#include "math.h" +#include "stdio.h" +#include "stdlib.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.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; + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + + +static const char *__pyx_f[] = { + "sgd_fast.pyx", + "numpy.pxd", + "type.pxd", + "weight_vector.pxd", + "seq_dataset.pxd", +}; +#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; + + +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ +typedef npy_long __pyx_t_5numpy_int_t; + +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ +typedef npy_longlong __pyx_t_5numpy_long_t; + +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ +typedef npy_ulong __pyx_t_5numpy_uint_t; + +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +/* "sklearn/utils/weight_vector.pxd":10 + * + * + * ctypedef np.float64_t DOUBLE # <<<<<<<<<<<<<< + * ctypedef np.int32_t INTEGER + * + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5utils_13weight_vector_DOUBLE; + +/* "sklearn/utils/weight_vector.pxd":11 + * + * ctypedef np.float64_t DOUBLE + * ctypedef np.int32_t INTEGER # <<<<<<<<<<<<<< + * + * + */ +typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_5utils_13weight_vector_INTEGER; + +/* "sklearn/utils/seq_dataset.pxd":5 + * cimport numpy as np + * + * ctypedef np.float64_t DOUBLE # <<<<<<<<<<<<<< + * ctypedef np.int32_t INTEGER + * + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE; + +/* "sklearn/utils/seq_dataset.pxd":6 + * + * ctypedef np.float64_t DOUBLE + * ctypedef np.int32_t INTEGER # <<<<<<<<<<<<<< + * + * + */ +typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_5utils_11seq_dataset_INTEGER; + +/* "sklearn/linear_model/sgd_fast.pyx":25 + * + * + * ctypedef np.float64_t DOUBLE # <<<<<<<<<<<<<< + * ctypedef np.int32_t INTEGER + * + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE; + +/* "sklearn/linear_model/sgd_fast.pyx":26 + * + * ctypedef np.float64_t DOUBLE + * ctypedef np.int32_t INTEGER # <<<<<<<<<<<<<< + * + * + */ +typedef __pyx_t_5numpy_int32_t __pyx_t_7sklearn_12linear_model_8sgd_fast_INTEGER; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + + +/*--- Type declarations ---*/ +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction; +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression; +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber; +struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset; +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive; +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification; +struct __pyx_obj_7sklearn_5utils_11seq_dataset_CSRDataset; +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log; +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge; +struct __pyx_obj_7sklearn_5utils_11seq_dataset_ArrayDataset; +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge; +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber; +struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector; +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss; +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive; + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +/* "sklearn/linear_model/sgd_fast.pyx":46 + * # ---------------------------------------- + * + * cdef class LossFunction: # <<<<<<<<<<<<<< + * """Base class for convex loss functions""" + * + */ +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction { + PyObject_HEAD + struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_vtab; +}; + + +/* "sklearn/linear_model/sgd_fast.pyx":84 + * + * + * cdef class Regression(LossFunction): # <<<<<<<<<<<<<< + * """Base class for loss functions for regression""" + * + */ +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction __pyx_base; +}; + + +/* "sklearn/linear_model/sgd_fast.pyx":235 + * + * + * cdef class Huber(Regression): # <<<<<<<<<<<<<< + * """Huber regression loss + * + */ +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression __pyx_base; + double c; +}; + + +/* "sklearn/utils/seq_dataset.pxd":9 + * + * + * cdef class SequentialDataset: # <<<<<<<<<<<<<< + * cdef Py_ssize_t n_samples + * + */ +struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset { + PyObject_HEAD + struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_SequentialDataset *__pyx_vtab; + Py_ssize_t n_samples; +}; + + +/* "sklearn/linear_model/sgd_fast.pyx":271 + * + * + * cdef class EpsilonInsensitive(Regression): # <<<<<<<<<<<<<< + * """Epsilon-Insensitive loss (used by SVR). + * + */ +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression __pyx_base; + double epsilon; +}; + + +/* "sklearn/linear_model/sgd_fast.pyx":94 + * + * + * cdef class Classification(LossFunction): # <<<<<<<<<<<<<< + * """Base class for loss functions for classification""" + * + */ +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction __pyx_base; +}; + + +/* "sklearn/utils/seq_dataset.pxd":34 + * + * + * cdef class CSRDataset(SequentialDataset): # <<<<<<<<<<<<<< + * cdef int current_index + * cdef int stride + */ +struct __pyx_obj_7sklearn_5utils_11seq_dataset_CSRDataset { + struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset __pyx_base; + int current_index; + int stride; + __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *X_data_ptr; + __pyx_t_7sklearn_5utils_11seq_dataset_INTEGER *X_indptr_ptr; + __pyx_t_7sklearn_5utils_11seq_dataset_INTEGER *X_indices_ptr; + __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *Y_data_ptr; + PyArrayObject *feature_indices; + __pyx_t_7sklearn_5utils_11seq_dataset_INTEGER *feature_indices_ptr; + PyArrayObject *index; + __pyx_t_7sklearn_5utils_11seq_dataset_INTEGER *index_data_ptr; + __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *sample_weight_data; +}; + + +/* "sklearn/linear_model/sgd_fast.pyx":198 + * + * + * cdef class Log(Classification): # <<<<<<<<<<<<<< + * """Logistic regression loss for binary classification with y in {-1, 1}""" + * + */ +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification __pyx_base; +}; + + +/* "sklearn/linear_model/sgd_fast.pyx":134 + * + * + * cdef class Hinge(Classification): # <<<<<<<<<<<<<< + * """Hinge loss for binary classification tasks with y in {-1,1} + * + */ +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification __pyx_base; + double threshold; +}; + + +/* "sklearn/utils/seq_dataset.pxd":17 + * + * + * cdef class ArrayDataset(SequentialDataset): # <<<<<<<<<<<<<< + * cdef Py_ssize_t n_features + * cdef int current_index + */ +struct __pyx_obj_7sklearn_5utils_11seq_dataset_ArrayDataset { + struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset __pyx_base; + Py_ssize_t n_features; + int current_index; + int stride; + __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *X_data_ptr; + __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *Y_data_ptr; + PyArrayObject *feature_indices; + __pyx_t_7sklearn_5utils_11seq_dataset_INTEGER *feature_indices_ptr; + PyArrayObject *index; + __pyx_t_7sklearn_5utils_11seq_dataset_INTEGER *index_data_ptr; + __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *sample_weight_data; +}; + + +/* "sklearn/linear_model/sgd_fast.pyx":166 + * + * + * cdef class SquaredHinge(LossFunction): # <<<<<<<<<<<<<< + * """Squared Hinge loss for binary classification tasks with y in {-1,1} + * + */ +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction __pyx_base; + double threshold; +}; + + +/* "sklearn/linear_model/sgd_fast.pyx":104 + * + * + * cdef class ModifiedHuber(Classification): # <<<<<<<<<<<<<< + * """Modified Huber loss for binary classification with y in {-1, 1} + * + */ +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification __pyx_base; +}; + + +/* "sklearn/utils/weight_vector.pxd":14 + * + * + * cdef class WeightVector(object): # <<<<<<<<<<<<<< + * cdef np.ndarray w + * cdef DOUBLE *w_data_ptr + */ +struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector { + PyObject_HEAD + struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *__pyx_vtab; + PyArrayObject *w; + __pyx_t_7sklearn_5utils_13weight_vector_DOUBLE *w_data_ptr; + double wscale; + Py_ssize_t n_features; + double sq_norm; +}; + + +/* "sklearn/linear_model/sgd_fast.pyx":223 + * + * + * cdef class SquaredLoss(Regression): # <<<<<<<<<<<<<< + * """Squared loss traditional used in linear regression.""" + * cpdef double loss(self, double p, double y): + */ +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression __pyx_base; +}; + + +/* "sklearn/linear_model/sgd_fast.pyx":298 + * + * + * cdef class SquaredEpsilonInsensitive(Regression): # <<<<<<<<<<<<<< + * """Epsilon-Insensitive loss. + * + */ +struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression __pyx_base; + double epsilon; +}; + + + +/* "sklearn/linear_model/sgd_fast.pyx":46 + * # ---------------------------------------- + * + * cdef class LossFunction: # <<<<<<<<<<<<<< + * """Base class for convex loss functions""" + * + */ + +struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction { + double (*loss)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch); + double (*dloss)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_LossFunction; + + +/* "sklearn/linear_model/sgd_fast.pyx":84 + * + * + * cdef class Regression(LossFunction): # <<<<<<<<<<<<<< + * """Base class for loss functions for regression""" + * + */ + +struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Regression { + struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction __pyx_base; +}; +static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression; + + +/* "sklearn/linear_model/sgd_fast.pyx":223 + * + * + * cdef class SquaredLoss(Regression): # <<<<<<<<<<<<<< + * """Squared loss traditional used in linear regression.""" + * cpdef double loss(self, double p, double y): + */ + +struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredLoss { + struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Regression __pyx_base; +}; +static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredLoss; + + +/* "sklearn/linear_model/sgd_fast.pyx":94 + * + * + * cdef class Classification(LossFunction): # <<<<<<<<<<<<<< + * """Base class for loss functions for classification""" + * + */ + +struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Classification { + struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction __pyx_base; +}; +static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Classification; + + +/* "sklearn/linear_model/sgd_fast.pyx":104 + * + * + * cdef class ModifiedHuber(Classification): # <<<<<<<<<<<<<< + * """Modified Huber loss for binary classification with y in {-1, 1} + * + */ + +struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_ModifiedHuber { + struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Classification __pyx_base; +}; +static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_ModifiedHuber; + + +/* "sklearn/linear_model/sgd_fast.pyx":198 + * + * + * cdef class Log(Classification): # <<<<<<<<<<<<<< + * """Logistic regression loss for binary classification with y in {-1, 1}""" + * + */ + +struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Log { + struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Classification __pyx_base; +}; +static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Log *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Log; + + +/* "sklearn/linear_model/sgd_fast.pyx":298 + * + * + * cdef class SquaredEpsilonInsensitive(Regression): # <<<<<<<<<<<<<< + * """Epsilon-Insensitive loss. + * + */ + +struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive { + struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Regression __pyx_base; +}; +static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive; + + +/* "sklearn/utils/seq_dataset.pxd":9 + * + * + * cdef class SequentialDataset: # <<<<<<<<<<<<<< + * cdef Py_ssize_t n_samples + * + */ + +struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_SequentialDataset { + void (*next)(struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset *, __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE **, __pyx_t_7sklearn_5utils_11seq_dataset_INTEGER **, int *, __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *, __pyx_t_7sklearn_5utils_11seq_dataset_DOUBLE *); + void (*shuffle)(struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset *, PyObject *); +}; +static struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_SequentialDataset *__pyx_vtabptr_7sklearn_5utils_11seq_dataset_SequentialDataset; + + +/* "sklearn/utils/seq_dataset.pxd":17 + * + * + * cdef class ArrayDataset(SequentialDataset): # <<<<<<<<<<<<<< + * cdef Py_ssize_t n_features + * cdef int current_index + */ + +struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_ArrayDataset { + struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_SequentialDataset __pyx_base; +}; +static struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_ArrayDataset *__pyx_vtabptr_7sklearn_5utils_11seq_dataset_ArrayDataset; + + +/* "sklearn/utils/seq_dataset.pxd":34 + * + * + * cdef class CSRDataset(SequentialDataset): # <<<<<<<<<<<<<< + * cdef int current_index + * cdef int stride + */ + +struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_CSRDataset { + struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_SequentialDataset __pyx_base; +}; +static struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_CSRDataset *__pyx_vtabptr_7sklearn_5utils_11seq_dataset_CSRDataset; + + +/* "sklearn/linear_model/sgd_fast.pyx":271 + * + * + * cdef class EpsilonInsensitive(Regression): # <<<<<<<<<<<<<< + * """Epsilon-Insensitive loss (used by SVR). + * + */ + +struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive { + struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Regression __pyx_base; +}; +static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive; + + +/* "sklearn/linear_model/sgd_fast.pyx":166 + * + * + * cdef class SquaredHinge(LossFunction): # <<<<<<<<<<<<<< + * """Squared Hinge loss for binary classification tasks with y in {-1,1} + * + */ + +struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredHinge { + struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction __pyx_base; +}; +static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredHinge; + + +/* "sklearn/linear_model/sgd_fast.pyx":235 + * + * + * cdef class Huber(Regression): # <<<<<<<<<<<<<< + * """Huber regression loss + * + */ + +struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Huber { + struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Regression __pyx_base; +}; +static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Huber; + + +/* "sklearn/linear_model/sgd_fast.pyx":134 + * + * + * cdef class Hinge(Classification): # <<<<<<<<<<<<<< + * """Hinge loss for binary classification tasks with y in {-1,1} + * + */ + +struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Hinge { + struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Classification __pyx_base; +}; +static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Hinge; + + +/* "sklearn/utils/weight_vector.pxd":14 + * + * + * cdef class WeightVector(object): # <<<<<<<<<<<<<< + * cdef np.ndarray w + * cdef DOUBLE *w_data_ptr + */ + +struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector { + void (*add)(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *, __pyx_t_7sklearn_5utils_13weight_vector_DOUBLE *, __pyx_t_7sklearn_5utils_13weight_vector_INTEGER *, int, double); + double (*dot)(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *, __pyx_t_7sklearn_5utils_13weight_vector_DOUBLE *, __pyx_t_7sklearn_5utils_13weight_vector_INTEGER *, int); + void (*scale)(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *, double); + void (*reset_wscale)(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *); + double (*norm)(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *); +}; +static struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *__pyx_vtabptr_7sklearn_5utils_13weight_vector_WeightVector; +#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 int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*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 CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static void __Pyx_RaiseBufferFallbackError(void); /*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 CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name); + +static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/ +#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3 +static PyObject* __pyx_print = 0; +static PyObject* __pyx_print_kwargs = 0; +#endif + +static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/ + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +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 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*/ + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +static void* __Pyx_GetVtable(PyObject *dict); /*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 'libc.math' */ + +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from 'cpython.object' */ + +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ + +/* Module declarations from 'cython' */ + +/* Module declarations from 'sklearn.utils.weight_vector' */ +static PyTypeObject *__pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector = 0; + +/* Module declarations from 'sklearn.utils.seq_dataset' */ +static PyTypeObject *__pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5utils_11seq_dataset_ArrayDataset = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5utils_11seq_dataset_CSRDataset = 0; + +/* Module declarations from 'sklearn.linear_model.sgd_fast' */ +static PyTypeObject *__pyx_ptype_7sklearn_12linear_model_8sgd_fast_LossFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Regression = 0; +static PyTypeObject *__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Classification = 0; +static PyTypeObject *__pyx_ptype_7sklearn_12linear_model_8sgd_fast_ModifiedHuber = 0; +static PyTypeObject *__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Hinge = 0; +static PyTypeObject *__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredHinge = 0; +static PyTypeObject *__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Log = 0; +static PyTypeObject *__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredLoss = 0; +static PyTypeObject *__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Huber = 0; +static PyTypeObject *__pyx_ptype_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive = 0; +static PyTypeObject *__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive = 0; +static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_8sgd_fast_max(double, double); /*proto*/ +static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_8sgd_fast_min(double, double); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm(__pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE *, __pyx_t_7sklearn_12linear_model_8sgd_fast_INTEGER *, int); /*proto*/ +static void __pyx_f_7sklearn_12linear_model_8sgd_fast_l1penalty(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *, __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE *, __pyx_t_7sklearn_12linear_model_8sgd_fast_INTEGER *, int, double); /*proto*/ +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE = { "DOUBLE", NULL, sizeof(__pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE), { 0 }, 0, 'R', 0, 0 }; +#define __Pyx_MODULE_NAME "sklearn.linear_model.sgd_fast" +int __pyx_module_is_main_sklearn__linear_model__sgd_fast = 0; + +/* Implementation of 'sklearn.linear_model.sgd_fast' */ +static PyObject *__pyx_builtin_NotImplementedError; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_4__reduce__(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_threshold); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_threshold); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_4__reduce__(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_4__reduce__(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_c); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_epsilon); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_epsilon); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_weights, double __pyx_v_intercept, struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_loss, int __pyx_v_penalty_type, double __pyx_v_alpha, double __pyx_v_C, double __pyx_v_rho, struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset *__pyx_v_dataset, int __pyx_v_n_iter, int __pyx_v_fit_intercept, int __pyx_v_verbose, int __pyx_v_shuffle, PyObject *__pyx_v_seed, double __pyx_v_weight_pos, double __pyx_v_weight_neg, int __pyx_v_learning_rate, double __pyx_v_eta0, double __pyx_v_power_t, double __pyx_v_t, double __pyx_v_intercept_decay); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ +static char __pyx_k_1[] = "-- Epoch %d"; +static char __pyx_k_2[] = "Norm: %.2f, NNZs: %d, Bias: %.6f, T: %d, Avg. loss: %.6f"; +static char __pyx_k_3[] = "Total training time: %.2f seconds."; +static char __pyx_k_4[] = "floating-point under-/overflow occured."; +static char __pyx_k_6[] = "ndarray is not C contiguous"; +static char __pyx_k_8[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_10[] = "Non-native byte order not supported"; +static char __pyx_k_12[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_13[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_16[] = "Format string allocated too short."; +static char __pyx_k_20[] = "/scratch/apps/src/scikit-learn/sklearn/linear_model/sgd_fast.pyx"; +static char __pyx_k_21[] = "sklearn.linear_model.sgd_fast"; +static char __pyx_k__B[] = "B"; +static char __pyx_k__C[] = "C"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__c[] = "c"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__p[] = "p"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__t[] = "t"; +static char __pyx_k__u[] = "u"; +static char __pyx_k__w[] = "w"; +static char __pyx_k__y[] = "y"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__np[] = "np"; +static char __pyx_k__any[] = "any"; +static char __pyx_k__eta[] = "eta"; +static char __pyx_k__rho[] = "rho"; +static char __pyx_k__sys[] = "sys"; +static char __pyx_k__eta0[] = "eta0"; +static char __pyx_k__loss[] = "loss"; +static char __pyx_k__seed[] = "seed"; +static char __pyx_k__time[] = "time"; +static char __pyx_k__xnnz[] = "xnnz"; +static char __pyx_k__alpha[] = "alpha"; +static char __pyx_k__count[] = "count"; +static char __pyx_k__dloss[] = "dloss"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__epoch[] = "epoch"; +static char __pyx_k__isinf[] = "isinf"; +static char __pyx_k__isnan[] = "isnan"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__order[] = "order"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__shape[] = "shape"; +static char __pyx_k__zeros[] = "zeros"; +static char __pyx_k__n_iter[] = "n_iter"; +static char __pyx_k__update[] = "update"; +static char __pyx_k__dataset[] = "dataset"; +static char __pyx_k__epsilon[] = "epsilon"; +static char __pyx_k__float64[] = "float64"; +static char __pyx_k__nonzero[] = "nonzero"; +static char __pyx_k__power_t[] = "power_t"; +static char __pyx_k__shuffle[] = "shuffle"; +static char __pyx_k__sumloss[] = "sumloss"; +static char __pyx_k__t_start[] = "t_start"; +static char __pyx_k__verbose[] = "verbose"; +static char __pyx_k__weights[] = "weights"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__is_hinge[] = "is_hinge"; +static char __pyx_k__intercept[] = "intercept"; +static char __pyx_k__n_samples[] = "n_samples"; +static char __pyx_k__plain_sgd[] = "plain_sgd"; +static char __pyx_k__threshold[] = "threshold"; +static char __pyx_k__x_ind_ptr[] = "x_ind_ptr"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__n_features[] = "n_features"; +static char __pyx_k__q_data_ptr[] = "q_data_ptr"; +static char __pyx_k__weight_neg[] = "weight_neg"; +static char __pyx_k__weight_pos[] = "weight_pos"; +static char __pyx_k__x_data_ptr[] = "x_data_ptr"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__class_weight[] = "class_weight"; +static char __pyx_k__penalty_type[] = "penalty_type"; +static char __pyx_k__fit_intercept[] = "fit_intercept"; +static char __pyx_k__learning_rate[] = "learning_rate"; +static char __pyx_k__sample_weight[] = "sample_weight"; +static char __pyx_k__intercept_decay[] = "intercept_decay"; +static char __pyx_k__NotImplementedError[] = "NotImplementedError"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_u_10; +static PyObject *__pyx_kp_u_12; +static PyObject *__pyx_kp_u_13; +static PyObject *__pyx_kp_u_16; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_s_20; +static PyObject *__pyx_n_s_21; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_u_6; +static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_n_s__C; +static PyObject *__pyx_n_s__NotImplementedError; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__alpha; +static PyObject *__pyx_n_s__any; +static PyObject *__pyx_n_s__c; +static PyObject *__pyx_n_s__class_weight; +static PyObject *__pyx_n_s__count; +static PyObject *__pyx_n_s__dataset; +static PyObject *__pyx_n_s__dloss; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__epoch; +static PyObject *__pyx_n_s__epsilon; +static PyObject *__pyx_n_s__eta; +static PyObject *__pyx_n_s__eta0; +static PyObject *__pyx_n_s__fit_intercept; +static PyObject *__pyx_n_s__float64; +static PyObject *__pyx_n_s__i; +static PyObject *__pyx_n_s__intercept; +static PyObject *__pyx_n_s__intercept_decay; +static PyObject *__pyx_n_s__is_hinge; +static PyObject *__pyx_n_s__isinf; +static PyObject *__pyx_n_s__isnan; +static PyObject *__pyx_n_s__learning_rate; +static PyObject *__pyx_n_s__loss; +static PyObject *__pyx_n_s__n_features; +static PyObject *__pyx_n_s__n_iter; +static PyObject *__pyx_n_s__n_samples; +static PyObject *__pyx_n_s__nonzero; +static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__order; +static PyObject *__pyx_n_s__p; +static PyObject *__pyx_n_s__penalty_type; +static PyObject *__pyx_n_s__plain_sgd; +static PyObject *__pyx_n_s__power_t; +static PyObject *__pyx_n_s__q; +static PyObject *__pyx_n_s__q_data_ptr; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__rho; +static PyObject *__pyx_n_s__sample_weight; +static PyObject *__pyx_n_s__seed; +static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__shuffle; +static PyObject *__pyx_n_s__sumloss; +static PyObject *__pyx_n_s__sys; +static PyObject *__pyx_n_s__t; +static PyObject *__pyx_n_s__t_start; +static PyObject *__pyx_n_s__threshold; +static PyObject *__pyx_n_s__time; +static PyObject *__pyx_n_s__u; +static PyObject *__pyx_n_s__update; +static PyObject *__pyx_n_s__verbose; +static PyObject *__pyx_n_s__w; +static PyObject *__pyx_n_s__weight_neg; +static PyObject *__pyx_n_s__weight_pos; +static PyObject *__pyx_n_s__weights; +static PyObject *__pyx_n_s__x_data_ptr; +static PyObject *__pyx_n_s__x_ind_ptr; +static PyObject *__pyx_n_s__xnnz; +static PyObject *__pyx_n_s__y; +static PyObject *__pyx_n_s__zeros; +static PyObject *__pyx_int_15; +static PyObject *__pyx_k_tuple_5; +static PyObject *__pyx_k_tuple_7; +static PyObject *__pyx_k_tuple_9; +static PyObject *__pyx_k_tuple_11; +static PyObject *__pyx_k_tuple_14; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_17; +static PyObject *__pyx_k_tuple_18; +static PyObject *__pyx_k_codeobj_19; + +/* "sklearn/linear_model/sgd_fast.pyx":49 + * """Base class for convex loss functions""" + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * """Evaluate the loss function. + * + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_self, CYTHON_UNUSED double __pyx_v_p, CYTHON_UNUSED double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_1loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":64 + * The loss evaluated at `p` and `y`. + * """ + * raise NotImplementedError() # <<<<<<<<<<<<<< + * + * cpdef double dloss(self, double p, double y): + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __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_WriteUnraisable("sklearn.linear_model.sgd_fast.LossFunction.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss[] = "Evaluate the loss function.\n\n Parameters\n ----------\n p : double\n The prediction, p = w^T x\n y : double\n The true value (aka target)\n\n Returns\n -------\n double\n The loss evaluated at `p` and `y`.\n "; +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("loss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.LossFunction.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":49 + * """Base class for convex loss functions""" + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * """Evaluate the loss function. + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("loss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self->__pyx_vtab)->loss(__pyx_v_self, __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __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("sklearn.linear_model.sgd_fast.LossFunction.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":66 + * raise NotImplementedError() + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * """Evaluate the derivative of the loss function with respect to + * the prediction `p`. + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_dloss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_self, CYTHON_UNUSED double __pyx_v_p, CYTHON_UNUSED double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_3dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":81 + * The derivative of the loss function w.r.t. `p`. + * """ + * raise NotImplementedError() # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __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_WriteUnraisable("sklearn.linear_model.sgd_fast.LossFunction.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_12linear_model_8sgd_fast_12LossFunction_2dloss[] = "Evaluate the derivative of the loss function with respect to\n the prediction `p`.\n\n Parameters\n ----------\n p : double\n The prediction, p = w^T x\n y : double\n The true value (aka target)\n Returns\n -------\n double\n The derivative of the loss function w.r.t. `p`.\n "; +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.LossFunction.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_2dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":66 + * raise NotImplementedError() + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * """Evaluate the derivative of the loss function with respect to + * the prediction `p`. + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12LossFunction_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("dloss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self->__pyx_vtab)->dloss(__pyx_v_self, __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __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("sklearn.linear_model.sgd_fast.LossFunction.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":87 + * """Base class for loss functions for regression""" + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * raise NotImplementedError() + * + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_loss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_v_self, CYTHON_UNUSED double __pyx_v_p, CYTHON_UNUSED double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_1loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":88 + * + * cpdef double loss(self, double p, double y): + * raise NotImplementedError() # <<<<<<<<<<<<<< + * + * cpdef double dloss(self, double p, double y): + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __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_WriteUnraisable("sklearn.linear_model.sgd_fast.Regression.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("loss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Regression.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":87 + * """Base class for loss functions for regression""" + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * raise NotImplementedError() + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("loss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Regression *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __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("sklearn.linear_model.sgd_fast.Regression.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":90 + * raise NotImplementedError() + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * raise NotImplementedError() + * + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_dloss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_v_self, CYTHON_UNUSED double __pyx_v_p, CYTHON_UNUSED double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_3dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":91 + * + * cpdef double dloss(self, double p, double y): + * raise NotImplementedError() # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __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_WriteUnraisable("sklearn.linear_model.sgd_fast.Regression.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Regression.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_2dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":90 + * raise NotImplementedError() + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * raise NotImplementedError() + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_10Regression_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("dloss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Regression *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __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("sklearn.linear_model.sgd_fast.Regression.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":97 + * """Base class for loss functions for classification""" + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * raise NotImplementedError() + * + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_loss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_v_self, CYTHON_UNUSED double __pyx_v_p, CYTHON_UNUSED double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_1loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":98 + * + * cpdef double loss(self, double p, double y): + * raise NotImplementedError() # <<<<<<<<<<<<<< + * + * cpdef double dloss(self, double p, double y): + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __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_WriteUnraisable("sklearn.linear_model.sgd_fast.Classification.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("loss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Classification.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":97 + * """Base class for loss functions for classification""" + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * raise NotImplementedError() + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("loss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Classification *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __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("sklearn.linear_model.sgd_fast.Classification.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":100 + * raise NotImplementedError() + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * raise NotImplementedError() + * + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_dloss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_v_self, CYTHON_UNUSED double __pyx_v_p, CYTHON_UNUSED double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_3dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":101 + * + * cpdef double dloss(self, double p, double y): + * raise NotImplementedError() # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __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_WriteUnraisable("sklearn.linear_model.sgd_fast.Classification.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Classification.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_2dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":100 + * raise NotImplementedError() + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * raise NotImplementedError() + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_14Classification_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("dloss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Classification *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __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("sklearn.linear_model.sgd_fast.Classification.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":112 + * Stochastic Gradient Descent', ICML'04. + * """ + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * if z >= 1.0: + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_v_z; + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":113 + * """ + * cpdef double loss(self, double p, double y): + * cdef double z = p * y # <<<<<<<<<<<<<< + * if z >= 1.0: + * return 0.0 + */ + __pyx_v_z = (__pyx_v_p * __pyx_v_y); + + /* "sklearn/linear_model/sgd_fast.pyx":114 + * cpdef double loss(self, double p, double y): + * cdef double z = p * y + * if z >= 1.0: # <<<<<<<<<<<<<< + * return 0.0 + * elif z >= -1.0: + */ + __pyx_t_6 = (__pyx_v_z >= 1.0); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":115 + * cdef double z = p * y + * if z >= 1.0: + * return 0.0 # <<<<<<<<<<<<<< + * elif z >= -1.0: + * return (1.0 - z) * (1.0 - z) + */ + __pyx_r = 0.0; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "sklearn/linear_model/sgd_fast.pyx":116 + * if z >= 1.0: + * return 0.0 + * elif z >= -1.0: # <<<<<<<<<<<<<< + * return (1.0 - z) * (1.0 - z) + * else: + */ + __pyx_t_6 = (__pyx_v_z >= -1.0); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":117 + * return 0.0 + * elif z >= -1.0: + * return (1.0 - z) * (1.0 - z) # <<<<<<<<<<<<<< + * else: + * return -4.0 * z + */ + __pyx_r = ((1.0 - __pyx_v_z) * (1.0 - __pyx_v_z)); + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "sklearn/linear_model/sgd_fast.pyx":119 + * return (1.0 - z) * (1.0 - z) + * else: + * return -4.0 * z # <<<<<<<<<<<<<< + * + * cpdef double dloss(self, double p, double y): + */ + __pyx_r = (-4.0 * __pyx_v_z); + goto __pyx_L0; + } + __pyx_L3:; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.ModifiedHuber.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("loss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.ModifiedHuber.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":112 + * Stochastic Gradient Descent', ICML'04. + * """ + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * if z >= 1.0: + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("loss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __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("sklearn.linear_model.sgd_fast.ModifiedHuber.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":121 + * return -4.0 * z + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * if z >= 1.0: + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_dloss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_v_z; + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_3dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":122 + * + * cpdef double dloss(self, double p, double y): + * cdef double z = p * y # <<<<<<<<<<<<<< + * if z >= 1.0: + * return 0.0 + */ + __pyx_v_z = (__pyx_v_p * __pyx_v_y); + + /* "sklearn/linear_model/sgd_fast.pyx":123 + * cpdef double dloss(self, double p, double y): + * cdef double z = p * y + * if z >= 1.0: # <<<<<<<<<<<<<< + * return 0.0 + * elif z >= -1.0: + */ + __pyx_t_6 = (__pyx_v_z >= 1.0); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":124 + * cdef double z = p * y + * if z >= 1.0: + * return 0.0 # <<<<<<<<<<<<<< + * elif z >= -1.0: + * return 2.0 * (1.0 - z) * -y + */ + __pyx_r = 0.0; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "sklearn/linear_model/sgd_fast.pyx":125 + * if z >= 1.0: + * return 0.0 + * elif z >= -1.0: # <<<<<<<<<<<<<< + * return 2.0 * (1.0 - z) * -y + * else: + */ + __pyx_t_6 = (__pyx_v_z >= -1.0); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":126 + * return 0.0 + * elif z >= -1.0: + * return 2.0 * (1.0 - z) * -y # <<<<<<<<<<<<<< + * else: + * return -4.0 * y + */ + __pyx_r = ((2.0 * (1.0 - __pyx_v_z)) * (-__pyx_v_y)); + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "sklearn/linear_model/sgd_fast.pyx":128 + * return 2.0 * (1.0 - z) * -y + * else: + * return -4.0 * y # <<<<<<<<<<<<<< + * + * def __reduce__(self): + */ + __pyx_r = (-4.0 * __pyx_v_y); + goto __pyx_L0; + } + __pyx_L3:; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.ModifiedHuber.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.ModifiedHuber.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_2dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":121 + * return -4.0 * z + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * if z >= 1.0: + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("dloss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __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("sklearn.linear_model.sgd_fast.ModifiedHuber.dloss", __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_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_4__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":130 + * return -4.0 * y + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return ModifiedHuber, () + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_4__reduce__(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *__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("__reduce__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":131 + * + * def __reduce__(self): + * return ModifiedHuber, () # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_ModifiedHuber))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_ModifiedHuber))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_ModifiedHuber))); + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_empty_tuple)); + __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); + __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_AddTraceback("sklearn.linear_model.sgd_fast.ModifiedHuber.__reduce__", __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_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_threshold; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__threshold,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 (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__threshold); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + if (values[0]) { + __pyx_v_threshold = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_threshold == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "sklearn/linear_model/sgd_fast.pyx":147 + * cdef double threshold + * + * def __init__(self, double threshold=1.0): # <<<<<<<<<<<<<< + * self.threshold = threshold + * + */ + __pyx_v_threshold = ((double)1.0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Hinge.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge___init__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self), __pyx_v_threshold); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_threshold) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":148 + * + * def __init__(self, double threshold=1.0): + * self.threshold = threshold # <<<<<<<<<<<<<< + * + * cpdef double loss(self, double p, double y): + */ + __pyx_v_self->threshold = __pyx_v_threshold; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":150 + * self.threshold = threshold + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * if z <= self.threshold: + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_v_z; + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_3loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":151 + * + * cpdef double loss(self, double p, double y): + * cdef double z = p * y # <<<<<<<<<<<<<< + * if z <= self.threshold: + * return (self.threshold - z) + */ + __pyx_v_z = (__pyx_v_p * __pyx_v_y); + + /* "sklearn/linear_model/sgd_fast.pyx":152 + * cpdef double loss(self, double p, double y): + * cdef double z = p * y + * if z <= self.threshold: # <<<<<<<<<<<<<< + * return (self.threshold - z) + * return 0.0 + */ + __pyx_t_6 = (__pyx_v_z <= __pyx_v_self->threshold); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":153 + * cdef double z = p * y + * if z <= self.threshold: + * return (self.threshold - z) # <<<<<<<<<<<<<< + * return 0.0 + * + */ + __pyx_r = (__pyx_v_self->threshold - __pyx_v_z); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "sklearn/linear_model/sgd_fast.pyx":154 + * if z <= self.threshold: + * return (self.threshold - z) + * return 0.0 # <<<<<<<<<<<<<< + * + * cpdef double dloss(self, double p, double y): + */ + __pyx_r = 0.0; + goto __pyx_L0; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.Hinge.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("loss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Hinge.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_2loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":150 + * self.threshold = threshold + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * if z <= self.threshold: + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("loss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __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("sklearn.linear_model.sgd_fast.Hinge.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":156 + * return 0.0 + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * if z <= self.threshold: + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_v_z; + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_5dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":157 + * + * cpdef double dloss(self, double p, double y): + * cdef double z = p * y # <<<<<<<<<<<<<< + * if z <= self.threshold: + * return -y + */ + __pyx_v_z = (__pyx_v_p * __pyx_v_y); + + /* "sklearn/linear_model/sgd_fast.pyx":158 + * cpdef double dloss(self, double p, double y): + * cdef double z = p * y + * if z <= self.threshold: # <<<<<<<<<<<<<< + * return -y + * return 0.0 + */ + __pyx_t_6 = (__pyx_v_z <= __pyx_v_self->threshold); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":159 + * cdef double z = p * y + * if z <= self.threshold: + * return -y # <<<<<<<<<<<<<< + * return 0.0 + * + */ + __pyx_r = (-__pyx_v_y); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "sklearn/linear_model/sgd_fast.pyx":160 + * if z <= self.threshold: + * return -y + * return 0.0 # <<<<<<<<<<<<<< + * + * def __reduce__(self): + */ + __pyx_r = 0.0; + goto __pyx_L0; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.Hinge.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Hinge.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_4dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":156 + * return 0.0 + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * if z <= self.threshold: + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("dloss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __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("sklearn.linear_model.sgd_fast.Hinge.dloss", __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_7sklearn_12linear_model_8sgd_fast_5Hinge_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_6__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":162 + * return 0.0 + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return Hinge, (self.threshold,) + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Hinge_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *__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("__reduce__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":163 + * + * def __reduce__(self): + * return Hinge, (self.threshold,) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->threshold); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __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 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Hinge))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Hinge))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Hinge))); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((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("sklearn.linear_model.sgd_fast.Hinge.__reduce__", __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_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_threshold; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__threshold,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 (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__threshold); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + } + if (values[0]) { + __pyx_v_threshold = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_threshold == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "sklearn/linear_model/sgd_fast.pyx":179 + * cdef double threshold + * + * def __init__(self, double threshold=1.0): # <<<<<<<<<<<<<< + * self.threshold = threshold + * + */ + __pyx_v_threshold = ((double)1.0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredHinge.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge___init__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self), __pyx_v_threshold); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_threshold) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":180 + * + * def __init__(self, double threshold=1.0): + * self.threshold = threshold # <<<<<<<<<<<<<< + * + * cpdef double loss(self, double p, double y): + */ + __pyx_v_self->threshold = __pyx_v_threshold; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":182 + * self.threshold = threshold + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = self.threshold - p * y + * if z > 0: + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_v_z; + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":183 + * + * cpdef double loss(self, double p, double y): + * cdef double z = self.threshold - p * y # <<<<<<<<<<<<<< + * if z > 0: + * return z * z + */ + __pyx_v_z = (__pyx_v_self->threshold - (__pyx_v_p * __pyx_v_y)); + + /* "sklearn/linear_model/sgd_fast.pyx":184 + * cpdef double loss(self, double p, double y): + * cdef double z = self.threshold - p * y + * if z > 0: # <<<<<<<<<<<<<< + * return z * z + * return 0.0 + */ + __pyx_t_6 = (__pyx_v_z > 0.0); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":185 + * cdef double z = self.threshold - p * y + * if z > 0: + * return z * z # <<<<<<<<<<<<<< + * return 0.0 + * + */ + __pyx_r = (__pyx_v_z * __pyx_v_z); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "sklearn/linear_model/sgd_fast.pyx":186 + * if z > 0: + * return z * z + * return 0.0 # <<<<<<<<<<<<<< + * + * cpdef double dloss(self, double p, double y): + */ + __pyx_r = 0.0; + goto __pyx_L0; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.SquaredHinge.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("loss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredHinge.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_2loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":182 + * self.threshold = threshold + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = self.threshold - p * y + * if z > 0: + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("loss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __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("sklearn.linear_model.sgd_fast.SquaredHinge.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":188 + * return 0.0 + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = self.threshold - p * y + * if z > 0: + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_v_z; + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_5dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":189 + * + * cpdef double dloss(self, double p, double y): + * cdef double z = self.threshold - p * y # <<<<<<<<<<<<<< + * if z > 0: + * return -2 * y * z + */ + __pyx_v_z = (__pyx_v_self->threshold - (__pyx_v_p * __pyx_v_y)); + + /* "sklearn/linear_model/sgd_fast.pyx":190 + * cpdef double dloss(self, double p, double y): + * cdef double z = self.threshold - p * y + * if z > 0: # <<<<<<<<<<<<<< + * return -2 * y * z + * return 0.0 + */ + __pyx_t_6 = (__pyx_v_z > 0.0); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":191 + * cdef double z = self.threshold - p * y + * if z > 0: + * return -2 * y * z # <<<<<<<<<<<<<< + * return 0.0 + * + */ + __pyx_r = ((-2.0 * __pyx_v_y) * __pyx_v_z); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "sklearn/linear_model/sgd_fast.pyx":192 + * if z > 0: + * return -2 * y * z + * return 0.0 # <<<<<<<<<<<<<< + * + * def __reduce__(self): + */ + __pyx_r = 0.0; + goto __pyx_L0; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.SquaredHinge.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredHinge.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_4dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":188 + * return 0.0 + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = self.threshold - p * y + * if z > 0: + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("dloss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __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("sklearn.linear_model.sgd_fast.SquaredHinge.dloss", __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_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_6__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":194 + * return 0.0 + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return SquaredHinge, (self.threshold,) + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *__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("__reduce__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":195 + * + * def __reduce__(self): + * return SquaredHinge, (self.threshold,) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->threshold); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __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 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredHinge))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredHinge))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredHinge))); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((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("sklearn.linear_model.sgd_fast.SquaredHinge.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":201 + * """Logistic regression loss for binary classification with y in {-1, 1}""" + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * # approximately equal and saves the computation of the log + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_loss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_v_z; + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_1loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":202 + * + * cpdef double loss(self, double p, double y): + * cdef double z = p * y # <<<<<<<<<<<<<< + * # approximately equal and saves the computation of the log + * if z > 18: + */ + __pyx_v_z = (__pyx_v_p * __pyx_v_y); + + /* "sklearn/linear_model/sgd_fast.pyx":204 + * cdef double z = p * y + * # approximately equal and saves the computation of the log + * if z > 18: # <<<<<<<<<<<<<< + * return exp(-z) + * if z < -18: + */ + __pyx_t_6 = (__pyx_v_z > 18.0); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":205 + * # approximately equal and saves the computation of the log + * if z > 18: + * return exp(-z) # <<<<<<<<<<<<<< + * if z < -18: + * return -z + */ + __pyx_r = exp((-__pyx_v_z)); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "sklearn/linear_model/sgd_fast.pyx":206 + * if z > 18: + * return exp(-z) + * if z < -18: # <<<<<<<<<<<<<< + * return -z + * return log(1.0 + exp(-z)) + */ + __pyx_t_6 = (__pyx_v_z < -18.0); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":207 + * return exp(-z) + * if z < -18: + * return -z # <<<<<<<<<<<<<< + * return log(1.0 + exp(-z)) + * + */ + __pyx_r = (-__pyx_v_z); + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "sklearn/linear_model/sgd_fast.pyx":208 + * if z < -18: + * return -z + * return log(1.0 + exp(-z)) # <<<<<<<<<<<<<< + * + * cpdef double dloss(self, double p, double y): + */ + __pyx_r = log((1.0 + exp((-__pyx_v_z)))); + goto __pyx_L0; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.Log.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("loss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Log.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":201 + * """Logistic regression loss for binary classification with y in {-1, 1}""" + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * # approximately equal and saves the computation of the log + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("loss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Log *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __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("sklearn.linear_model.sgd_fast.Log.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":210 + * return log(1.0 + exp(-z)) + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * # approximately equal and saves the computation of the log + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_dloss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_v_z; + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_3dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":211 + * + * cpdef double dloss(self, double p, double y): + * cdef double z = p * y # <<<<<<<<<<<<<< + * # approximately equal and saves the computation of the log + * if z > 18.0: + */ + __pyx_v_z = (__pyx_v_p * __pyx_v_y); + + /* "sklearn/linear_model/sgd_fast.pyx":213 + * cdef double z = p * y + * # approximately equal and saves the computation of the log + * if z > 18.0: # <<<<<<<<<<<<<< + * return exp(-z) * -y + * if z < -18.0: + */ + __pyx_t_6 = (__pyx_v_z > 18.0); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":214 + * # approximately equal and saves the computation of the log + * if z > 18.0: + * return exp(-z) * -y # <<<<<<<<<<<<<< + * if z < -18.0: + * return -y + */ + __pyx_r = (exp((-__pyx_v_z)) * (-__pyx_v_y)); + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "sklearn/linear_model/sgd_fast.pyx":215 + * if z > 18.0: + * return exp(-z) * -y + * if z < -18.0: # <<<<<<<<<<<<<< + * return -y + * return -y / (exp(z) + 1.0) + */ + __pyx_t_6 = (__pyx_v_z < -18.0); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":216 + * return exp(-z) * -y + * if z < -18.0: + * return -y # <<<<<<<<<<<<<< + * return -y / (exp(z) + 1.0) + * + */ + __pyx_r = (-__pyx_v_y); + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "sklearn/linear_model/sgd_fast.pyx":217 + * if z < -18.0: + * return -y + * return -y / (exp(z) + 1.0) # <<<<<<<<<<<<<< + * + * def __reduce__(self): + */ + __pyx_r = ((-__pyx_v_y) / (exp(__pyx_v_z) + 1.0)); + goto __pyx_L0; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.Log.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Log.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_2dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":210 + * return log(1.0 + exp(-z)) + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z = p * y + * # approximately equal and saves the computation of the log + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("dloss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Log *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __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("sklearn.linear_model.sgd_fast.Log.dloss", __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_7sklearn_12linear_model_8sgd_fast_3Log_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_4__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":219 + * return -y / (exp(z) + 1.0) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return Log, () + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_3Log_4__reduce__(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *__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("__reduce__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":220 + * + * def __reduce__(self): + * return Log, () # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Log))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Log))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Log))); + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_empty_tuple)); + __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); + __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_AddTraceback("sklearn.linear_model.sgd_fast.Log.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":225 + * cdef class SquaredLoss(Regression): + * """Squared loss traditional used in linear regression.""" + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * return 0.5 * (p - y) * (p - y) + * + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":226 + * """Squared loss traditional used in linear regression.""" + * cpdef double loss(self, double p, double y): + * return 0.5 * (p - y) * (p - y) # <<<<<<<<<<<<<< + * + * cpdef double dloss(self, double p, double y): + */ + __pyx_r = ((0.5 * (__pyx_v_p - __pyx_v_y)) * (__pyx_v_p - __pyx_v_y)); + goto __pyx_L0; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.SquaredLoss.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("loss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredLoss.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":225 + * cdef class SquaredLoss(Regression): + * """Squared loss traditional used in linear regression.""" + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * return 0.5 * (p - y) * (p - y) + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("loss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredLoss *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __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("sklearn.linear_model.sgd_fast.SquaredLoss.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":228 + * return 0.5 * (p - y) * (p - y) + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * return p - y + * + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_dloss(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_3dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":229 + * + * cpdef double dloss(self, double p, double y): + * return p - y # <<<<<<<<<<<<<< + * + * def __reduce__(self): + */ + __pyx_r = (__pyx_v_p - __pyx_v_y); + goto __pyx_L0; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.SquaredLoss.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_3dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredLoss.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_2dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":228 + * return 0.5 * (p - y) * (p - y) + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * return p - y + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_2dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("dloss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredLoss *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __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("sklearn.linear_model.sgd_fast.SquaredLoss.dloss", __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_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_5__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_4__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":231 + * return p - y + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return SquaredLoss, () + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_4__reduce__(CYTHON_UNUSED struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *__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("__reduce__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":232 + * + * def __reduce__(self): + * return SquaredLoss, () # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredLoss))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredLoss))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredLoss))); + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_empty_tuple)); + __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); + __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_AddTraceback("sklearn.linear_model.sgd_fast.SquaredLoss.__reduce__", __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_pw_7sklearn_12linear_model_8sgd_fast_5Huber_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_c; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__c,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__c)) != 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[0]; __pyx_lineno = 246; __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_c = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_c == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + 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[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Huber.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber___init__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self), __pyx_v_c); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":246 + * cdef double c + * + * def __init__(self, double c): # <<<<<<<<<<<<<< + * self.c = c + * + */ + +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_c) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":247 + * + * def __init__(self, double c): + * self.c = c # <<<<<<<<<<<<<< + * + * cpdef double loss(self, double p, double y): + */ + __pyx_v_self->c = __pyx_v_c; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":249 + * self.c = c + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double r = p - y + * cdef double abs_r = abs(r) + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_v_r; + double __pyx_v_abs_r; + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_3loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":250 + * + * cpdef double loss(self, double p, double y): + * cdef double r = p - y # <<<<<<<<<<<<<< + * cdef double abs_r = abs(r) + * if abs_r <= self.c: + */ + __pyx_v_r = (__pyx_v_p - __pyx_v_y); + + /* "sklearn/linear_model/sgd_fast.pyx":251 + * cpdef double loss(self, double p, double y): + * cdef double r = p - y + * cdef double abs_r = abs(r) # <<<<<<<<<<<<<< + * if abs_r <= self.c: + * return 0.5 * r * r + */ + __pyx_v_abs_r = fabs(__pyx_v_r); + + /* "sklearn/linear_model/sgd_fast.pyx":252 + * cdef double r = p - y + * cdef double abs_r = abs(r) + * if abs_r <= self.c: # <<<<<<<<<<<<<< + * return 0.5 * r * r + * else: + */ + __pyx_t_6 = (__pyx_v_abs_r <= __pyx_v_self->c); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":253 + * cdef double abs_r = abs(r) + * if abs_r <= self.c: + * return 0.5 * r * r # <<<<<<<<<<<<<< + * else: + * return self.c * abs_r - (0.5 * self.c * self.c) + */ + __pyx_r = ((0.5 * __pyx_v_r) * __pyx_v_r); + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "sklearn/linear_model/sgd_fast.pyx":255 + * return 0.5 * r * r + * else: + * return self.c * abs_r - (0.5 * self.c * self.c) # <<<<<<<<<<<<<< + * + * cpdef double dloss(self, double p, double y): + */ + __pyx_r = ((__pyx_v_self->c * __pyx_v_abs_r) - ((0.5 * __pyx_v_self->c) * __pyx_v_self->c)); + goto __pyx_L0; + } + __pyx_L3:; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.Huber.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("loss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Huber.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_2loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":249 + * self.c = c + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double r = p - y + * cdef double abs_r = abs(r) + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("loss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __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("sklearn.linear_model.sgd_fast.Huber.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":257 + * return self.c * abs_r - (0.5 * self.c * self.c) + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double r = p - y + * cdef double abs_r = abs(r) + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_v_r; + double __pyx_v_abs_r; + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_5dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":258 + * + * cpdef double dloss(self, double p, double y): + * cdef double r = p - y # <<<<<<<<<<<<<< + * cdef double abs_r = abs(r) + * if abs_r <= self.c: + */ + __pyx_v_r = (__pyx_v_p - __pyx_v_y); + + /* "sklearn/linear_model/sgd_fast.pyx":259 + * cpdef double dloss(self, double p, double y): + * cdef double r = p - y + * cdef double abs_r = abs(r) # <<<<<<<<<<<<<< + * if abs_r <= self.c: + * return r + */ + __pyx_v_abs_r = fabs(__pyx_v_r); + + /* "sklearn/linear_model/sgd_fast.pyx":260 + * cdef double r = p - y + * cdef double abs_r = abs(r) + * if abs_r <= self.c: # <<<<<<<<<<<<<< + * return r + * elif r > 0.0: + */ + __pyx_t_6 = (__pyx_v_abs_r <= __pyx_v_self->c); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":261 + * cdef double abs_r = abs(r) + * if abs_r <= self.c: + * return r # <<<<<<<<<<<<<< + * elif r > 0.0: + * return self.c + */ + __pyx_r = __pyx_v_r; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "sklearn/linear_model/sgd_fast.pyx":262 + * if abs_r <= self.c: + * return r + * elif r > 0.0: # <<<<<<<<<<<<<< + * return self.c + * else: + */ + __pyx_t_6 = (__pyx_v_r > 0.0); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":263 + * return r + * elif r > 0.0: + * return self.c # <<<<<<<<<<<<<< + * else: + * return -self.c + */ + __pyx_r = __pyx_v_self->c; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "sklearn/linear_model/sgd_fast.pyx":265 + * return self.c + * else: + * return -self.c # <<<<<<<<<<<<<< + * + * def __reduce__(self): + */ + __pyx_r = (-__pyx_v_self->c); + goto __pyx_L0; + } + __pyx_L3:; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.Huber.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.Huber.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_4dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":257 + * return self.c * abs_r - (0.5 * self.c * self.c) + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double r = p - y + * cdef double abs_r = abs(r) + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("dloss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __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("sklearn.linear_model.sgd_fast.Huber.dloss", __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_7sklearn_12linear_model_8sgd_fast_5Huber_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_6__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":267 + * return -self.c + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return Huber, (self.c,) + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_5Huber_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *__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("__reduce__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":268 + * + * def __reduce__(self): + * return Huber, (self.c,) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->c); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __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 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Huber))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Huber))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Huber))); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((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("sklearn.linear_model.sgd_fast.Huber.__reduce__", __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_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_epsilon; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__epsilon,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__epsilon)) != 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[0]; __pyx_lineno = 279; __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_epsilon = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + 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[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.EpsilonInsensitive.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive___init__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self), __pyx_v_epsilon); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":279 + * cdef double epsilon + * + * def __init__(self, double epsilon): # <<<<<<<<<<<<<< + * self.epsilon = epsilon + * + */ + +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_epsilon) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":280 + * + * def __init__(self, double epsilon): + * self.epsilon = epsilon # <<<<<<<<<<<<<< + * + * cpdef double loss(self, double p, double y): + */ + __pyx_v_self->epsilon = __pyx_v_epsilon; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":282 + * self.epsilon = epsilon + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double ret = abs(y - p) - self.epsilon + * return ret if ret > 0 else 0 + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_v_ret; + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_3loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":283 + * + * cpdef double loss(self, double p, double y): + * cdef double ret = abs(y - p) - self.epsilon # <<<<<<<<<<<<<< + * return ret if ret > 0 else 0 + * + */ + __pyx_v_ret = (fabs((__pyx_v_y - __pyx_v_p)) - __pyx_v_self->epsilon); + + /* "sklearn/linear_model/sgd_fast.pyx":284 + * cpdef double loss(self, double p, double y): + * cdef double ret = abs(y - p) - self.epsilon + * return ret if ret > 0 else 0 # <<<<<<<<<<<<<< + * + * cpdef double dloss(self, double p, double y): + */ + if ((__pyx_v_ret > 0.0)) { + __pyx_t_5 = __pyx_v_ret; + } else { + __pyx_t_5 = 0; + } + __pyx_r = __pyx_t_5; + goto __pyx_L0; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.EpsilonInsensitive.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("loss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.EpsilonInsensitive.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_2loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":282 + * self.epsilon = epsilon + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double ret = abs(y - p) - self.epsilon + * return ret if ret > 0 else 0 + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("loss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __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("sklearn.linear_model.sgd_fast.EpsilonInsensitive.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":286 + * return ret if ret > 0 else 0 + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * if y - p > self.epsilon: + * return -1 + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_5dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":287 + * + * cpdef double dloss(self, double p, double y): + * if y - p > self.epsilon: # <<<<<<<<<<<<<< + * return -1 + * elif p - y > self.epsilon: + */ + __pyx_t_6 = ((__pyx_v_y - __pyx_v_p) > __pyx_v_self->epsilon); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":288 + * cpdef double dloss(self, double p, double y): + * if y - p > self.epsilon: + * return -1 # <<<<<<<<<<<<<< + * elif p - y > self.epsilon: + * return 1 + */ + __pyx_r = -1.0; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "sklearn/linear_model/sgd_fast.pyx":289 + * if y - p > self.epsilon: + * return -1 + * elif p - y > self.epsilon: # <<<<<<<<<<<<<< + * return 1 + * else: + */ + __pyx_t_6 = ((__pyx_v_p - __pyx_v_y) > __pyx_v_self->epsilon); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":290 + * return -1 + * elif p - y > self.epsilon: + * return 1 # <<<<<<<<<<<<<< + * else: + * return 0 + */ + __pyx_r = 1.0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "sklearn/linear_model/sgd_fast.pyx":292 + * return 1 + * else: + * return 0 # <<<<<<<<<<<<<< + * + * def __reduce__(self): + */ + __pyx_r = 0.0; + goto __pyx_L0; + } + __pyx_L3:; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.EpsilonInsensitive.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.EpsilonInsensitive.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_4dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":286 + * return ret if ret > 0 else 0 + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * if y - p > self.epsilon: + * return -1 + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("dloss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __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("sklearn.linear_model.sgd_fast.EpsilonInsensitive.dloss", __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_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_6__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":294 + * return 0 + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return EpsilonInsensitive, (self.epsilon,) + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *__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("__reduce__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":295 + * + * def __reduce__(self): + * return EpsilonInsensitive, (self.epsilon,) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->epsilon); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __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 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive))); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((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("sklearn.linear_model.sgd_fast.EpsilonInsensitive.__reduce__", __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_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_epsilon; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__epsilon,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__epsilon)) != 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[0]; __pyx_lineno = 306; __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_epsilon = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_epsilon == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + 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[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredEpsilonInsensitive.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive___init__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self), __pyx_v_epsilon); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":306 + * cdef double epsilon + * + * def __init__(self, double epsilon): # <<<<<<<<<<<<<< + * self.epsilon = epsilon + * + */ + +static int __pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive___init__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_epsilon) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":307 + * + * def __init__(self, double epsilon): + * self.epsilon = epsilon # <<<<<<<<<<<<<< + * + * cpdef double loss(self, double p, double y): + */ + __pyx_v_self->epsilon = __pyx_v_epsilon; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":309 + * self.epsilon = epsilon + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double ret = abs(y - p) - self.epsilon + * return ret * ret if ret > 0 else 0 + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_v_ret; + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("loss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__loss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_3loss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":310 + * + * cpdef double loss(self, double p, double y): + * cdef double ret = abs(y - p) - self.epsilon # <<<<<<<<<<<<<< + * return ret * ret if ret > 0 else 0 + * + */ + __pyx_v_ret = (fabs((__pyx_v_y - __pyx_v_p)) - __pyx_v_self->epsilon); + + /* "sklearn/linear_model/sgd_fast.pyx":311 + * cpdef double loss(self, double p, double y): + * cdef double ret = abs(y - p) - self.epsilon + * return ret * ret if ret > 0 else 0 # <<<<<<<<<<<<<< + * + * cpdef double dloss(self, double p, double y): + */ + if ((__pyx_v_ret > 0.0)) { + __pyx_t_5 = (__pyx_v_ret * __pyx_v_ret); + } else { + __pyx_t_5 = 0; + } + __pyx_r = __pyx_t_5; + goto __pyx_L0; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.SquaredEpsilonInsensitive.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_3loss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("loss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "loss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("loss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredEpsilonInsensitive.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_2loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":309 + * self.epsilon = epsilon + * + * cpdef double loss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double ret = abs(y - p) - self.epsilon + * return ret * ret if ret > 0 else 0 + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_2loss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("loss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.loss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __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("sklearn.linear_model.sgd_fast.SquaredEpsilonInsensitive.loss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":313 + * return ret * ret if ret > 0 else 0 + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z + * z = y - p + */ + +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y, int __pyx_skip_dispatch) { + double __pyx_v_z; + double __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dloss", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overriden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__dloss); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_5dloss)) { + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "sklearn/linear_model/sgd_fast.pyx":315 + * cpdef double dloss(self, double p, double y): + * cdef double z + * z = y - p # <<<<<<<<<<<<<< + * if z > self.epsilon: + * return -2 * (z - self.epsilon) + */ + __pyx_v_z = (__pyx_v_y - __pyx_v_p); + + /* "sklearn/linear_model/sgd_fast.pyx":316 + * cdef double z + * z = y - p + * if z > self.epsilon: # <<<<<<<<<<<<<< + * return -2 * (z - self.epsilon) + * elif z < self.epsilon: + */ + __pyx_t_6 = (__pyx_v_z > __pyx_v_self->epsilon); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":317 + * z = y - p + * if z > self.epsilon: + * return -2 * (z - self.epsilon) # <<<<<<<<<<<<<< + * elif z < self.epsilon: + * return 2 * (-z - self.epsilon) + */ + __pyx_r = (-2.0 * (__pyx_v_z - __pyx_v_self->epsilon)); + goto __pyx_L0; + goto __pyx_L3; + } + + /* "sklearn/linear_model/sgd_fast.pyx":318 + * if z > self.epsilon: + * return -2 * (z - self.epsilon) + * elif z < self.epsilon: # <<<<<<<<<<<<<< + * return 2 * (-z - self.epsilon) + * else: + */ + __pyx_t_6 = (__pyx_v_z < __pyx_v_self->epsilon); + if (__pyx_t_6) { + + /* "sklearn/linear_model/sgd_fast.pyx":319 + * return -2 * (z - self.epsilon) + * elif z < self.epsilon: + * return 2 * (-z - self.epsilon) # <<<<<<<<<<<<<< + * else: + * return 0 + */ + __pyx_r = (2.0 * ((-__pyx_v_z) - __pyx_v_self->epsilon)); + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "sklearn/linear_model/sgd_fast.pyx":321 + * return 2 * (-z - self.epsilon) + * else: + * return 0 # <<<<<<<<<<<<<< + * + * def __reduce__(self): + */ + __pyx_r = 0.0; + goto __pyx_L0; + } + __pyx_L3:; + + __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_WriteUnraisable("sklearn.linear_model.sgd_fast.SquaredEpsilonInsensitive.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_5dloss(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + double __pyx_v_p; + double __pyx_v_y; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dloss (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__p,&__pyx_n_s__y,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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__p)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dloss") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_p = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_y = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_y == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dloss", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.SquaredEpsilonInsensitive.dloss", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_4dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self), __pyx_v_p, __pyx_v_y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":313 + * return ret * ret if ret > 0 else 0 + * + * cpdef double dloss(self, double p, double y): # <<<<<<<<<<<<<< + * cdef double z + * z = y - p + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_4dloss(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__pyx_v_self, double __pyx_v_p, double __pyx_v_y) { + 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("dloss", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.dloss(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_self), __pyx_v_p, __pyx_v_y, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __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("sklearn.linear_model.sgd_fast.SquaredEpsilonInsensitive.dloss", __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_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_7__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_6__reduce__(((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":323 + * return 0 + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return SquaredEpsilonInsensitive, (self.epsilon,) + * + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_6__reduce__(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *__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("__reduce__", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":324 + * + * def __reduce__(self): + * return SquaredEpsilonInsensitive, (self.epsilon,) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->epsilon); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __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 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive))); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((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("sklearn.linear_model.sgd_fast.SquaredEpsilonInsensitive.__reduce__", __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_7sklearn_12linear_model_8sgd_fast_1plain_sgd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_12linear_model_8sgd_fast_plain_sgd[] = "Plain SGD for generic loss functions and penalties.\n\n Parameters\n ----------\n weights : ndarray[double, ndim=1]\n The allocated coef_ vector.\n intercept : double\n The initial intercept.\n loss : LossFunction\n A concrete ``LossFunction`` object.\n penalty_type : int\n The penalty 2 for L2, 1 for L1, and 3 for Elastic-Net.\n alpha : float\n The regularization parameter.\n rho : float\n The elastic net hyperparameter.\n dataset : SequentialDataset\n A concrete ``SequentialDataset`` object.\n n_iter : int\n The number of iterations (epochs).\n fit_intercept : int\n Whether or not to fit the intercept (1 or 0).\n verbose : int\n Print verbose output; 0 for quite.\n shuffle : int\n Whether to shuffle the training data before each epoch.\n weight_pos : float\n The weight of the positive class.\n weight_neg : float\n The weight of the negative class.\n seed : int or RandomState object\n The seed of the pseudo random number generator to use when\n shuffling the data\n learning_rate : int\n The learning rate:\n (1) constant, eta = eta0\n (2) optimal, eta = 1.0/(t+t0)\n (3) inverse scaling, eta = eta0 / pow(t, power_t)\n (4) Passive Agressive-I, eta = min(alpha, loss/norm(x))\n (5) Passive Agressive-II, eta = 1.0 / (norm(x) + 0.5*alpha)\n eta0 : double\n The initial learning rate.\n power_t : double\n The exponent for inverse scaling learning rate.\n t : double\n Initial state of the learning rate. This value is equal to the\n iteration count except when the learning rate is set to `optimal`.\n Default: 1.0.\n\n Returns\n -------\n weights : array, shape=[n_features]\n The fitted weight vector.\n intercept : float\n The fitted intercept term.\n\n "; +static PyMethodDef __pyx_mdef_7sklearn_12linear_model_8sgd_fast_1plain_sgd = {__Pyx_NAMESTR("plain_sgd"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_1plain_sgd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_12linear_model_8sgd_fast_plain_sgd)}; +static PyObject *__pyx_pw_7sklearn_12linear_model_8sgd_fast_1plain_sgd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_weights = 0; + double __pyx_v_intercept; + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_loss = 0; + int __pyx_v_penalty_type; + double __pyx_v_alpha; + double __pyx_v_C; + double __pyx_v_rho; + struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset *__pyx_v_dataset = 0; + int __pyx_v_n_iter; + int __pyx_v_fit_intercept; + int __pyx_v_verbose; + int __pyx_v_shuffle; + PyObject *__pyx_v_seed = 0; + double __pyx_v_weight_pos; + double __pyx_v_weight_neg; + int __pyx_v_learning_rate; + double __pyx_v_eta0; + double __pyx_v_power_t; + double __pyx_v_t; + double __pyx_v_intercept_decay; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("plain_sgd (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__weights,&__pyx_n_s__intercept,&__pyx_n_s__loss,&__pyx_n_s__penalty_type,&__pyx_n_s__alpha,&__pyx_n_s__C,&__pyx_n_s__rho,&__pyx_n_s__dataset,&__pyx_n_s__n_iter,&__pyx_n_s__fit_intercept,&__pyx_n_s__verbose,&__pyx_n_s__shuffle,&__pyx_n_s__seed,&__pyx_n_s__weight_pos,&__pyx_n_s__weight_neg,&__pyx_n_s__learning_rate,&__pyx_n_s__eta0,&__pyx_n_s__power_t,&__pyx_n_s__t,&__pyx_n_s__intercept_decay,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__weights)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercept)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__loss)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__penalty_type)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__rho)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dataset)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 8: + if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n_iter)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 9: + if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fit_intercept)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 10: + if (likely((values[10] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__verbose)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 10); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 11: + if (likely((values[11] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shuffle)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 11); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 12: + if (likely((values[12] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__seed)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 12); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 13: + if (likely((values[13] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight_pos)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 13); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 14: + if (likely((values[14] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weight_neg)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 14); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 15: + if (likely((values[15] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__learning_rate)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 15); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 16: + if (likely((values[16] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eta0)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 16); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 17: + if (likely((values[17] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__power_t)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, 17); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 18: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__t); + if (value) { values[18] = value; kw_args--; } + } + case 19: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercept_decay); + if (value) { values[19] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "plain_sgd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __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); + 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_weights = ((PyArrayObject *)values[0]); + __pyx_v_intercept = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_intercept == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_loss = ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)values[2]); + __pyx_v_penalty_type = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_penalty_type == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_C = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_C == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_rho = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_rho == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_dataset = ((struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset *)values[7]); + __pyx_v_n_iter = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_n_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_fit_intercept = __Pyx_PyInt_AsInt(values[9]); if (unlikely((__pyx_v_fit_intercept == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_verbose = __Pyx_PyInt_AsInt(values[10]); if (unlikely((__pyx_v_verbose == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_shuffle = __Pyx_PyInt_AsInt(values[11]); if (unlikely((__pyx_v_shuffle == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_seed = values[12]; + __pyx_v_weight_pos = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_weight_pos == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_weight_neg = __pyx_PyFloat_AsDouble(values[14]); if (unlikely((__pyx_v_weight_neg == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_learning_rate = __Pyx_PyInt_AsInt(values[15]); if (unlikely((__pyx_v_learning_rate == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eta0 = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_eta0 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_power_t = __pyx_PyFloat_AsDouble(values[17]); if (unlikely((__pyx_v_power_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (values[18]) { + __pyx_v_t = __pyx_PyFloat_AsDouble(values[18]); if (unlikely((__pyx_v_t == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "sklearn/linear_model/sgd_fast.pyx":339 + * int learning_rate, double eta0, + * double power_t, + * double t=1.0, # <<<<<<<<<<<<<< + * double intercept_decay=1.0): + * """Plain SGD for generic loss functions and penalties. + */ + __pyx_v_t = ((double)1.0); + } + if (values[19]) { + __pyx_v_intercept_decay = __pyx_PyFloat_AsDouble(values[19]); if (unlikely((__pyx_v_intercept_decay == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "sklearn/linear_model/sgd_fast.pyx":340 + * double power_t, + * double t=1.0, + * double intercept_decay=1.0): # <<<<<<<<<<<<<< + * """Plain SGD for generic loss functions and penalties. + * + */ + __pyx_v_intercept_decay = ((double)1.0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("plain_sgd", 0, 18, 20, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.plain_sgd", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_loss), __pyx_ptype_7sklearn_12linear_model_8sgd_fast_LossFunction, 1, "loss", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dataset), __pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset, 1, "dataset", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(__pyx_self, __pyx_v_weights, __pyx_v_intercept, __pyx_v_loss, __pyx_v_penalty_type, __pyx_v_alpha, __pyx_v_C, __pyx_v_rho, __pyx_v_dataset, __pyx_v_n_iter, __pyx_v_fit_intercept, __pyx_v_verbose, __pyx_v_shuffle, __pyx_v_seed, __pyx_v_weight_pos, __pyx_v_weight_neg, __pyx_v_learning_rate, __pyx_v_eta0, __pyx_v_power_t, __pyx_v_t, __pyx_v_intercept_decay); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":327 + * + * + * def plain_sgd(np.ndarray[DOUBLE, ndim=1, mode='c'] weights, # <<<<<<<<<<<<<< + * double intercept, + * LossFunction loss, + */ + +static PyObject *__pyx_pf_7sklearn_12linear_model_8sgd_fast_plain_sgd(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_weights, double __pyx_v_intercept, struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *__pyx_v_loss, int __pyx_v_penalty_type, double __pyx_v_alpha, double __pyx_v_C, double __pyx_v_rho, struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset *__pyx_v_dataset, int __pyx_v_n_iter, int __pyx_v_fit_intercept, int __pyx_v_verbose, int __pyx_v_shuffle, PyObject *__pyx_v_seed, double __pyx_v_weight_pos, double __pyx_v_weight_neg, int __pyx_v_learning_rate, double __pyx_v_eta0, double __pyx_v_power_t, double __pyx_v_t, double __pyx_v_intercept_decay) { + Py_ssize_t __pyx_v_n_samples; + Py_ssize_t __pyx_v_n_features; + struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *__pyx_v_w = 0; + __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE *__pyx_v_x_data_ptr; + __pyx_t_7sklearn_12linear_model_8sgd_fast_INTEGER *__pyx_v_x_ind_ptr; + int __pyx_v_xnnz; + double __pyx_v_eta; + double __pyx_v_p; + double __pyx_v_update; + double __pyx_v_sumloss; + __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE __pyx_v_y; + __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE __pyx_v_sample_weight; + double __pyx_v_class_weight; + unsigned int __pyx_v_count; + unsigned int __pyx_v_epoch; + CYTHON_UNUSED unsigned int __pyx_v_i; + int __pyx_v_is_hinge; + PyArrayObject *__pyx_v_q = 0; + __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE *__pyx_v_q_data_ptr; + double __pyx_v_u; + PyObject *__pyx_v_t_start = NULL; + __Pyx_LocalBuf_ND __pyx_pybuffernd_q; + __Pyx_Buffer __pyx_pybuffer_q; + __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; + __Pyx_Buffer __pyx_pybuffer_weights; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyArrayObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + unsigned int __pyx_t_13; + unsigned int __pyx_t_14; + PyObject *__pyx_t_15 = NULL; + int __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + int __pyx_t_19; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("plain_sgd", 0); + __pyx_pybuffer_q.pybuffer.buf = NULL; + __pyx_pybuffer_q.refcount = 0; + __pyx_pybuffernd_q.data = NULL; + __pyx_pybuffernd_q.rcbuffer = &__pyx_pybuffer_q; + __pyx_pybuffer_weights.pybuffer.buf = NULL; + __pyx_pybuffer_weights.refcount = 0; + __pyx_pybuffernd_weights.data = NULL; + __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; + + /* "sklearn/linear_model/sgd_fast.pyx":400 + * + * # get the data information into easy vars + * cdef Py_ssize_t n_samples = dataset.n_samples # <<<<<<<<<<<<<< + * cdef Py_ssize_t n_features = weights.shape[0] + * + */ + __pyx_t_1 = __pyx_v_dataset->n_samples; + __pyx_v_n_samples = __pyx_t_1; + + /* "sklearn/linear_model/sgd_fast.pyx":401 + * # get the data information into easy vars + * cdef Py_ssize_t n_samples = dataset.n_samples + * cdef Py_ssize_t n_features = weights.shape[0] # <<<<<<<<<<<<<< + * + * cdef WeightVector w = WeightVector(weights) + */ + __pyx_v_n_features = (__pyx_v_weights->dimensions[0]); + + /* "sklearn/linear_model/sgd_fast.pyx":403 + * cdef Py_ssize_t n_features = weights.shape[0] + * + * cdef WeightVector w = WeightVector(weights) # <<<<<<<<<<<<<< + * + * cdef DOUBLE * x_data_ptr = NULL + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_weights)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_weights)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_weights)); + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_w = ((struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "sklearn/linear_model/sgd_fast.pyx":405 + * cdef WeightVector w = WeightVector(weights) + * + * cdef DOUBLE * x_data_ptr = NULL # <<<<<<<<<<<<<< + * cdef INTEGER * x_ind_ptr = NULL + * + */ + __pyx_v_x_data_ptr = NULL; + + /* "sklearn/linear_model/sgd_fast.pyx":406 + * + * cdef DOUBLE * x_data_ptr = NULL + * cdef INTEGER * x_ind_ptr = NULL # <<<<<<<<<<<<<< + * + * # helper variable + */ + __pyx_v_x_ind_ptr = NULL; + + /* "sklearn/linear_model/sgd_fast.pyx":410 + * # helper variable + * cdef int xnnz + * cdef double eta = 0.0 # <<<<<<<<<<<<<< + * cdef double p = 0.0 + * cdef double update = 0.0 + */ + __pyx_v_eta = 0.0; + + /* "sklearn/linear_model/sgd_fast.pyx":411 + * cdef int xnnz + * cdef double eta = 0.0 + * cdef double p = 0.0 # <<<<<<<<<<<<<< + * cdef double update = 0.0 + * cdef double sumloss = 0.0 + */ + __pyx_v_p = 0.0; + + /* "sklearn/linear_model/sgd_fast.pyx":412 + * cdef double eta = 0.0 + * cdef double p = 0.0 + * cdef double update = 0.0 # <<<<<<<<<<<<<< + * cdef double sumloss = 0.0 + * cdef DOUBLE y = 0.0 + */ + __pyx_v_update = 0.0; + + /* "sklearn/linear_model/sgd_fast.pyx":413 + * cdef double p = 0.0 + * cdef double update = 0.0 + * cdef double sumloss = 0.0 # <<<<<<<<<<<<<< + * cdef DOUBLE y = 0.0 + * cdef DOUBLE sample_weight + */ + __pyx_v_sumloss = 0.0; + + /* "sklearn/linear_model/sgd_fast.pyx":414 + * cdef double update = 0.0 + * cdef double sumloss = 0.0 + * cdef DOUBLE y = 0.0 # <<<<<<<<<<<<<< + * cdef DOUBLE sample_weight + * cdef double class_weight = 1.0 + */ + __pyx_v_y = 0.0; + + /* "sklearn/linear_model/sgd_fast.pyx":416 + * cdef DOUBLE y = 0.0 + * cdef DOUBLE sample_weight + * cdef double class_weight = 1.0 # <<<<<<<<<<<<<< + * cdef unsigned int count = 0 + * cdef unsigned int epoch = 0 + */ + __pyx_v_class_weight = 1.0; + + /* "sklearn/linear_model/sgd_fast.pyx":417 + * cdef DOUBLE sample_weight + * cdef double class_weight = 1.0 + * cdef unsigned int count = 0 # <<<<<<<<<<<<<< + * cdef unsigned int epoch = 0 + * cdef unsigned int i = 0 + */ + __pyx_v_count = 0; + + /* "sklearn/linear_model/sgd_fast.pyx":418 + * cdef double class_weight = 1.0 + * cdef unsigned int count = 0 + * cdef unsigned int epoch = 0 # <<<<<<<<<<<<<< + * cdef unsigned int i = 0 + * cdef int is_hinge = isinstance(loss, Hinge) + */ + __pyx_v_epoch = 0; + + /* "sklearn/linear_model/sgd_fast.pyx":419 + * cdef unsigned int count = 0 + * cdef unsigned int epoch = 0 + * cdef unsigned int i = 0 # <<<<<<<<<<<<<< + * cdef int is_hinge = isinstance(loss, Hinge) + * + */ + __pyx_v_i = 0; + + /* "sklearn/linear_model/sgd_fast.pyx":420 + * cdef unsigned int epoch = 0 + * cdef unsigned int i = 0 + * cdef int is_hinge = isinstance(loss, Hinge) # <<<<<<<<<<<<<< + * + * # q vector is only used for L1 regularization + */ + __pyx_t_3 = ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_12linear_model_8sgd_fast_Hinge)); + __Pyx_INCREF(__pyx_t_3); + __pyx_t_4 = __Pyx_TypeCheck(((PyObject *)__pyx_v_loss), __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_is_hinge = __pyx_t_4; + + /* "sklearn/linear_model/sgd_fast.pyx":423 + * + * # q vector is only used for L1 regularization + * cdef np.ndarray[DOUBLE, ndim = 1, mode = "c"] q = None # <<<<<<<<<<<<<< + * cdef DOUBLE * q_data_ptr = NULL + * if penalty_type == L1 or penalty_type == ELASTICNET: + */ + __pyx_t_5 = ((PyArrayObject *)Py_None); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { + __pyx_v_q = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_q.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_q.diminfo[0].strides = __pyx_pybuffernd_q.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q.diminfo[0].shape = __pyx_pybuffernd_q.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_5 = 0; + __Pyx_INCREF(Py_None); + __pyx_v_q = ((PyArrayObject *)Py_None); + + /* "sklearn/linear_model/sgd_fast.pyx":424 + * # q vector is only used for L1 regularization + * cdef np.ndarray[DOUBLE, ndim = 1, mode = "c"] q = None + * cdef DOUBLE * q_data_ptr = NULL # <<<<<<<<<<<<<< + * if penalty_type == L1 or penalty_type == ELASTICNET: + * q = np.zeros((n_features,), dtype=np.float64, order="c") + */ + __pyx_v_q_data_ptr = NULL; + + /* "sklearn/linear_model/sgd_fast.pyx":425 + * cdef np.ndarray[DOUBLE, ndim = 1, mode = "c"] q = None + * cdef DOUBLE * q_data_ptr = NULL + * if penalty_type == L1 or penalty_type == ELASTICNET: # <<<<<<<<<<<<<< + * q = np.zeros((n_features,), dtype=np.float64, order="c") + * q_data_ptr = q.data + */ + switch (__pyx_v_penalty_type) { + case 1: + case 3: + + /* "sklearn/linear_model/sgd_fast.pyx":426 + * cdef DOUBLE * q_data_ptr = NULL + * if penalty_type == L1 or penalty_type == ELASTICNET: + * q = np.zeros((n_features,), dtype=np.float64, order="c") # <<<<<<<<<<<<<< + * q_data_ptr = q.data + * cdef double u = 0.0 + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_n_features); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); + __Pyx_GIVEREF(__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 = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__float64); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__c)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer); + __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_9 < 0)) { + PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_q.rcbuffer->pybuffer, (PyObject*)__pyx_v_q, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_C_CONTIGUOUS, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12); + } + } + __pyx_pybuffernd_q.diminfo[0].strides = __pyx_pybuffernd_q.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_q.diminfo[0].shape = __pyx_pybuffernd_q.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_q)); + __pyx_v_q = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; + + /* "sklearn/linear_model/sgd_fast.pyx":427 + * if penalty_type == L1 or penalty_type == ELASTICNET: + * q = np.zeros((n_features,), dtype=np.float64, order="c") + * q_data_ptr = q.data # <<<<<<<<<<<<<< + * cdef double u = 0.0 + * + */ + __pyx_v_q_data_ptr = ((__pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE *)__pyx_v_q->data); + break; + } + + /* "sklearn/linear_model/sgd_fast.pyx":428 + * q = np.zeros((n_features,), dtype=np.float64, order="c") + * q_data_ptr = q.data + * cdef double u = 0.0 # <<<<<<<<<<<<<< + * + * if penalty_type == L2: + */ + __pyx_v_u = 0.0; + + /* "sklearn/linear_model/sgd_fast.pyx":432 + * if penalty_type == L2: + * rho = 1.0 + * elif penalty_type == L1: # <<<<<<<<<<<<<< + * rho = 0.0 + * + */ + switch (__pyx_v_penalty_type) { + + /* "sklearn/linear_model/sgd_fast.pyx":430 + * cdef double u = 0.0 + * + * if penalty_type == L2: # <<<<<<<<<<<<<< + * rho = 1.0 + * elif penalty_type == L1: + */ + case 2: + + /* "sklearn/linear_model/sgd_fast.pyx":431 + * + * if penalty_type == L2: + * rho = 1.0 # <<<<<<<<<<<<<< + * elif penalty_type == L1: + * rho = 0.0 + */ + __pyx_v_rho = 1.0; + break; + + /* "sklearn/linear_model/sgd_fast.pyx":432 + * if penalty_type == L2: + * rho = 1.0 + * elif penalty_type == L1: # <<<<<<<<<<<<<< + * rho = 0.0 + * + */ + case 1: + + /* "sklearn/linear_model/sgd_fast.pyx":433 + * rho = 1.0 + * elif penalty_type == L1: + * rho = 0.0 # <<<<<<<<<<<<<< + * + * eta = eta0 + */ + __pyx_v_rho = 0.0; + break; + } + + /* "sklearn/linear_model/sgd_fast.pyx":435 + * rho = 0.0 + * + * eta = eta0 # <<<<<<<<<<<<<< + * + * t_start = time() + */ + __pyx_v_eta = __pyx_v_eta0; + + /* "sklearn/linear_model/sgd_fast.pyx":437 + * eta = eta0 + * + * t_start = time() # <<<<<<<<<<<<<< + * for epoch in range(n_iter): + * if verbose > 0: + */ + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__time); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_v_t_start = __pyx_t_6; + __pyx_t_6 = 0; + + /* "sklearn/linear_model/sgd_fast.pyx":438 + * + * t_start = time() + * for epoch in range(n_iter): # <<<<<<<<<<<<<< + * if verbose > 0: + * print("-- Epoch %d" % (epoch + 1)) + */ + __pyx_t_9 = __pyx_v_n_iter; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_9; __pyx_t_13+=1) { + __pyx_v_epoch = __pyx_t_13; + + /* "sklearn/linear_model/sgd_fast.pyx":439 + * t_start = time() + * for epoch in range(n_iter): + * if verbose > 0: # <<<<<<<<<<<<<< + * print("-- Epoch %d" % (epoch + 1)) + * if shuffle: + */ + __pyx_t_4 = (__pyx_v_verbose > 0); + if (__pyx_t_4) { + + /* "sklearn/linear_model/sgd_fast.pyx":440 + * for epoch in range(n_iter): + * if verbose > 0: + * print("-- Epoch %d" % (epoch + 1)) # <<<<<<<<<<<<<< + * if shuffle: + * dataset.shuffle(seed) + */ + __pyx_t_6 = PyInt_FromLong((__pyx_v_epoch + 1)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_6); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "sklearn/linear_model/sgd_fast.pyx":441 + * if verbose > 0: + * print("-- Epoch %d" % (epoch + 1)) + * if shuffle: # <<<<<<<<<<<<<< + * dataset.shuffle(seed) + * for i in range(n_samples): + */ + if (__pyx_v_shuffle) { + + /* "sklearn/linear_model/sgd_fast.pyx":442 + * print("-- Epoch %d" % (epoch + 1)) + * if shuffle: + * dataset.shuffle(seed) # <<<<<<<<<<<<<< + * for i in range(n_samples): + * dataset.next( & x_data_ptr, & x_ind_ptr, & xnnz, & y, + */ + ((struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_SequentialDataset *)__pyx_v_dataset->__pyx_vtab)->shuffle(__pyx_v_dataset, __pyx_v_seed); + goto __pyx_L6; + } + __pyx_L6:; + + /* "sklearn/linear_model/sgd_fast.pyx":443 + * if shuffle: + * dataset.shuffle(seed) + * for i in range(n_samples): # <<<<<<<<<<<<<< + * dataset.next( & x_data_ptr, & x_ind_ptr, & xnnz, & y, + * & sample_weight) + */ + __pyx_t_1 = __pyx_v_n_samples; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_1; __pyx_t_14+=1) { + __pyx_v_i = __pyx_t_14; + + /* "sklearn/linear_model/sgd_fast.pyx":445 + * for i in range(n_samples): + * dataset.next( & x_data_ptr, & x_ind_ptr, & xnnz, & y, + * & sample_weight) # <<<<<<<<<<<<<< + * + * p = w.dot(x_data_ptr, x_ind_ptr, xnnz) + intercept + */ + ((struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_SequentialDataset *)__pyx_v_dataset->__pyx_vtab)->next(__pyx_v_dataset, (&__pyx_v_x_data_ptr), (&__pyx_v_x_ind_ptr), (&__pyx_v_xnnz), (&__pyx_v_y), (&__pyx_v_sample_weight)); + + /* "sklearn/linear_model/sgd_fast.pyx":447 + * & sample_weight) + * + * p = w.dot(x_data_ptr, x_ind_ptr, xnnz) + intercept # <<<<<<<<<<<<<< + * + * if learning_rate == OPTIMAL: + */ + __pyx_v_p = (((struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_w->__pyx_vtab)->dot(__pyx_v_w, __pyx_v_x_data_ptr, __pyx_v_x_ind_ptr, __pyx_v_xnnz) + __pyx_v_intercept); + + /* "sklearn/linear_model/sgd_fast.pyx":451 + * if learning_rate == OPTIMAL: + * eta = 1.0 / (alpha * t) + * elif learning_rate == INVSCALING: # <<<<<<<<<<<<<< + * eta = eta0 / pow(t, power_t) + * + */ + switch (__pyx_v_learning_rate) { + + /* "sklearn/linear_model/sgd_fast.pyx":449 + * p = w.dot(x_data_ptr, x_ind_ptr, xnnz) + intercept + * + * if learning_rate == OPTIMAL: # <<<<<<<<<<<<<< + * eta = 1.0 / (alpha * t) + * elif learning_rate == INVSCALING: + */ + case 2: + + /* "sklearn/linear_model/sgd_fast.pyx":450 + * + * if learning_rate == OPTIMAL: + * eta = 1.0 / (alpha * t) # <<<<<<<<<<<<<< + * elif learning_rate == INVSCALING: + * eta = eta0 / pow(t, power_t) + */ + __pyx_v_eta = (1.0 / (__pyx_v_alpha * __pyx_v_t)); + break; + + /* "sklearn/linear_model/sgd_fast.pyx":451 + * if learning_rate == OPTIMAL: + * eta = 1.0 / (alpha * t) + * elif learning_rate == INVSCALING: # <<<<<<<<<<<<<< + * eta = eta0 / pow(t, power_t) + * + */ + case 3: + + /* "sklearn/linear_model/sgd_fast.pyx":452 + * eta = 1.0 / (alpha * t) + * elif learning_rate == INVSCALING: + * eta = eta0 / pow(t, power_t) # <<<<<<<<<<<<<< + * + * if verbose > 0: + */ + __pyx_v_eta = (__pyx_v_eta0 / pow(__pyx_v_t, __pyx_v_power_t)); + break; + } + + /* "sklearn/linear_model/sgd_fast.pyx":454 + * eta = eta0 / pow(t, power_t) + * + * if verbose > 0: # <<<<<<<<<<<<<< + * sumloss += loss.loss(p, y) + * + */ + __pyx_t_4 = (__pyx_v_verbose > 0); + if (__pyx_t_4) { + + /* "sklearn/linear_model/sgd_fast.pyx":455 + * + * if verbose > 0: + * sumloss += loss.loss(p, y) # <<<<<<<<<<<<<< + * + * if y > 0.0: + */ + __pyx_v_sumloss = (__pyx_v_sumloss + ((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_loss->__pyx_vtab)->loss(__pyx_v_loss, __pyx_v_p, __pyx_v_y, 0)); + goto __pyx_L9; + } + __pyx_L9:; + + /* "sklearn/linear_model/sgd_fast.pyx":457 + * sumloss += loss.loss(p, y) + * + * if y > 0.0: # <<<<<<<<<<<<<< + * class_weight = weight_pos + * else: + */ + __pyx_t_4 = (__pyx_v_y > 0.0); + if (__pyx_t_4) { + + /* "sklearn/linear_model/sgd_fast.pyx":458 + * + * if y > 0.0: + * class_weight = weight_pos # <<<<<<<<<<<<<< + * else: + * class_weight = weight_neg + */ + __pyx_v_class_weight = __pyx_v_weight_pos; + goto __pyx_L10; + } + /*else*/ { + + /* "sklearn/linear_model/sgd_fast.pyx":460 + * class_weight = weight_pos + * else: + * class_weight = weight_neg # <<<<<<<<<<<<<< + * + * if learning_rate == PA1: + */ + __pyx_v_class_weight = __pyx_v_weight_neg; + } + __pyx_L10:; + + /* "sklearn/linear_model/sgd_fast.pyx":467 + * continue + * update = min(C, loss.loss(p, y) / update) + * elif learning_rate == PA2: # <<<<<<<<<<<<<< + * update = sqnorm(x_data_ptr, x_ind_ptr, xnnz) + * update = loss.loss(p, y) / (update + 0.5 / C) + */ + switch (__pyx_v_learning_rate) { + + /* "sklearn/linear_model/sgd_fast.pyx":462 + * class_weight = weight_neg + * + * if learning_rate == PA1: # <<<<<<<<<<<<<< + * update = sqnorm(x_data_ptr, x_ind_ptr, xnnz) + * if update == 0: + */ + case 4: + + /* "sklearn/linear_model/sgd_fast.pyx":463 + * + * if learning_rate == PA1: + * update = sqnorm(x_data_ptr, x_ind_ptr, xnnz) # <<<<<<<<<<<<<< + * if update == 0: + * continue + */ + __pyx_v_update = __pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm(__pyx_v_x_data_ptr, __pyx_v_x_ind_ptr, __pyx_v_xnnz); + + /* "sklearn/linear_model/sgd_fast.pyx":464 + * if learning_rate == PA1: + * update = sqnorm(x_data_ptr, x_ind_ptr, xnnz) + * if update == 0: # <<<<<<<<<<<<<< + * continue + * update = min(C, loss.loss(p, y) / update) + */ + __pyx_t_4 = (__pyx_v_update == 0.0); + if (__pyx_t_4) { + + /* "sklearn/linear_model/sgd_fast.pyx":465 + * update = sqnorm(x_data_ptr, x_ind_ptr, xnnz) + * if update == 0: + * continue # <<<<<<<<<<<<<< + * update = min(C, loss.loss(p, y) / update) + * elif learning_rate == PA2: + */ + goto __pyx_L7_continue; + goto __pyx_L11; + } + __pyx_L11:; + + /* "sklearn/linear_model/sgd_fast.pyx":466 + * if update == 0: + * continue + * update = min(C, loss.loss(p, y) / update) # <<<<<<<<<<<<<< + * elif learning_rate == PA2: + * update = sqnorm(x_data_ptr, x_ind_ptr, xnnz) + */ + __pyx_v_update = __pyx_f_7sklearn_12linear_model_8sgd_fast_min(__pyx_v_C, (((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_loss->__pyx_vtab)->loss(__pyx_v_loss, __pyx_v_p, __pyx_v_y, 0) / __pyx_v_update)); + break; + + /* "sklearn/linear_model/sgd_fast.pyx":467 + * continue + * update = min(C, loss.loss(p, y) / update) + * elif learning_rate == PA2: # <<<<<<<<<<<<<< + * update = sqnorm(x_data_ptr, x_ind_ptr, xnnz) + * update = loss.loss(p, y) / (update + 0.5 / C) + */ + case 5: + + /* "sklearn/linear_model/sgd_fast.pyx":468 + * update = min(C, loss.loss(p, y) / update) + * elif learning_rate == PA2: + * update = sqnorm(x_data_ptr, x_ind_ptr, xnnz) # <<<<<<<<<<<<<< + * update = loss.loss(p, y) / (update + 0.5 / C) + * else: + */ + __pyx_v_update = __pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm(__pyx_v_x_data_ptr, __pyx_v_x_ind_ptr, __pyx_v_xnnz); + + /* "sklearn/linear_model/sgd_fast.pyx":469 + * elif learning_rate == PA2: + * update = sqnorm(x_data_ptr, x_ind_ptr, xnnz) + * update = loss.loss(p, y) / (update + 0.5 / C) # <<<<<<<<<<<<<< + * else: + * update = -eta * loss.dloss(p, y) + */ + __pyx_v_update = (((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_loss->__pyx_vtab)->loss(__pyx_v_loss, __pyx_v_p, __pyx_v_y, 0) / (__pyx_v_update + (0.5 / __pyx_v_C))); + break; + default: + + /* "sklearn/linear_model/sgd_fast.pyx":471 + * update = loss.loss(p, y) / (update + 0.5 / C) + * else: + * update = -eta * loss.dloss(p, y) # <<<<<<<<<<<<<< + * + * if learning_rate >= PA1: + */ + __pyx_v_update = ((-__pyx_v_eta) * ((struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction *)__pyx_v_loss->__pyx_vtab)->dloss(__pyx_v_loss, __pyx_v_p, __pyx_v_y, 0)); + break; + } + + /* "sklearn/linear_model/sgd_fast.pyx":473 + * update = -eta * loss.dloss(p, y) + * + * if learning_rate >= PA1: # <<<<<<<<<<<<<< + * if is_hinge: + * # classification + */ + __pyx_t_4 = (__pyx_v_learning_rate >= 4); + if (__pyx_t_4) { + + /* "sklearn/linear_model/sgd_fast.pyx":474 + * + * if learning_rate >= PA1: + * if is_hinge: # <<<<<<<<<<<<<< + * # classification + * update *= y + */ + if (__pyx_v_is_hinge) { + + /* "sklearn/linear_model/sgd_fast.pyx":476 + * if is_hinge: + * # classification + * update *= y # <<<<<<<<<<<<<< + * elif y - p < 0: + * # regression + */ + __pyx_v_update = (__pyx_v_update * __pyx_v_y); + goto __pyx_L13; + } + + /* "sklearn/linear_model/sgd_fast.pyx":477 + * # classification + * update *= y + * elif y - p < 0: # <<<<<<<<<<<<<< + * # regression + * update *= -1 + */ + __pyx_t_4 = ((__pyx_v_y - __pyx_v_p) < 0.0); + if (__pyx_t_4) { + + /* "sklearn/linear_model/sgd_fast.pyx":479 + * elif y - p < 0: + * # regression + * update *= -1 # <<<<<<<<<<<<<< + * + * update *= class_weight * sample_weight + */ + __pyx_v_update = (__pyx_v_update * -1.0); + goto __pyx_L13; + } + __pyx_L13:; + goto __pyx_L12; + } + __pyx_L12:; + + /* "sklearn/linear_model/sgd_fast.pyx":481 + * update *= -1 + * + * update *= class_weight * sample_weight # <<<<<<<<<<<<<< + * + * if update != 0.0: + */ + __pyx_v_update = (__pyx_v_update * (__pyx_v_class_weight * __pyx_v_sample_weight)); + + /* "sklearn/linear_model/sgd_fast.pyx":483 + * update *= class_weight * sample_weight + * + * if update != 0.0: # <<<<<<<<<<<<<< + * w.add(x_data_ptr, x_ind_ptr, xnnz, update) + * if fit_intercept == 1: + */ + __pyx_t_4 = (__pyx_v_update != 0.0); + if (__pyx_t_4) { + + /* "sklearn/linear_model/sgd_fast.pyx":484 + * + * if update != 0.0: + * w.add(x_data_ptr, x_ind_ptr, xnnz, update) # <<<<<<<<<<<<<< + * if fit_intercept == 1: + * intercept += update * intercept_decay + */ + ((struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_w->__pyx_vtab)->add(__pyx_v_w, __pyx_v_x_data_ptr, __pyx_v_x_ind_ptr, __pyx_v_xnnz, __pyx_v_update); + + /* "sklearn/linear_model/sgd_fast.pyx":485 + * if update != 0.0: + * w.add(x_data_ptr, x_ind_ptr, xnnz, update) + * if fit_intercept == 1: # <<<<<<<<<<<<<< + * intercept += update * intercept_decay + * if penalty_type >= L2: + */ + __pyx_t_4 = (__pyx_v_fit_intercept == 1); + if (__pyx_t_4) { + + /* "sklearn/linear_model/sgd_fast.pyx":486 + * w.add(x_data_ptr, x_ind_ptr, xnnz, update) + * if fit_intercept == 1: + * intercept += update * intercept_decay # <<<<<<<<<<<<<< + * if penalty_type >= L2: + * w.scale(1.0 - (rho * eta * alpha)) + */ + __pyx_v_intercept = (__pyx_v_intercept + (__pyx_v_update * __pyx_v_intercept_decay)); + goto __pyx_L15; + } + __pyx_L15:; + goto __pyx_L14; + } + __pyx_L14:; + + /* "sklearn/linear_model/sgd_fast.pyx":487 + * if fit_intercept == 1: + * intercept += update * intercept_decay + * if penalty_type >= L2: # <<<<<<<<<<<<<< + * w.scale(1.0 - (rho * eta * alpha)) + * + */ + __pyx_t_4 = (__pyx_v_penalty_type >= 2); + if (__pyx_t_4) { + + /* "sklearn/linear_model/sgd_fast.pyx":488 + * intercept += update * intercept_decay + * if penalty_type >= L2: + * w.scale(1.0 - (rho * eta * alpha)) # <<<<<<<<<<<<<< + * + * if penalty_type == L1 or penalty_type == ELASTICNET: + */ + ((struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_w->__pyx_vtab)->scale(__pyx_v_w, (1.0 - ((__pyx_v_rho * __pyx_v_eta) * __pyx_v_alpha))); + goto __pyx_L16; + } + __pyx_L16:; + + /* "sklearn/linear_model/sgd_fast.pyx":490 + * w.scale(1.0 - (rho * eta * alpha)) + * + * if penalty_type == L1 or penalty_type == ELASTICNET: # <<<<<<<<<<<<<< + * u += ((1.0 - rho) * eta * alpha) + * l1penalty(w, q_data_ptr, x_ind_ptr, xnnz, u) + */ + switch (__pyx_v_penalty_type) { + case 1: + case 3: + + /* "sklearn/linear_model/sgd_fast.pyx":491 + * + * if penalty_type == L1 or penalty_type == ELASTICNET: + * u += ((1.0 - rho) * eta * alpha) # <<<<<<<<<<<<<< + * l1penalty(w, q_data_ptr, x_ind_ptr, xnnz, u) + * t += 1 + */ + __pyx_v_u = (__pyx_v_u + (((1.0 - __pyx_v_rho) * __pyx_v_eta) * __pyx_v_alpha)); + + /* "sklearn/linear_model/sgd_fast.pyx":492 + * if penalty_type == L1 or penalty_type == ELASTICNET: + * u += ((1.0 - rho) * eta * alpha) + * l1penalty(w, q_data_ptr, x_ind_ptr, xnnz, u) # <<<<<<<<<<<<<< + * t += 1 + * count += 1 + */ + __pyx_f_7sklearn_12linear_model_8sgd_fast_l1penalty(__pyx_v_w, __pyx_v_q_data_ptr, __pyx_v_x_ind_ptr, __pyx_v_xnnz, __pyx_v_u); + break; + } + + /* "sklearn/linear_model/sgd_fast.pyx":493 + * u += ((1.0 - rho) * eta * alpha) + * l1penalty(w, q_data_ptr, x_ind_ptr, xnnz, u) + * t += 1 # <<<<<<<<<<<<<< + * count += 1 + * + */ + __pyx_v_t = (__pyx_v_t + 1.0); + + /* "sklearn/linear_model/sgd_fast.pyx":494 + * l1penalty(w, q_data_ptr, x_ind_ptr, xnnz, u) + * t += 1 + * count += 1 # <<<<<<<<<<<<<< + * + * # report epoch information + */ + __pyx_v_count = (__pyx_v_count + 1); + __pyx_L7_continue:; + } + + /* "sklearn/linear_model/sgd_fast.pyx":497 + * + * # report epoch information + * if verbose > 0: # <<<<<<<<<<<<<< + * print("Norm: %.2f, NNZs: %d, " + * "Bias: %.6f, T: %d, Avg. loss: %.6f" % (w.norm(), + */ + __pyx_t_4 = (__pyx_v_verbose > 0); + if (__pyx_t_4) { + + /* "sklearn/linear_model/sgd_fast.pyx":499 + * if verbose > 0: + * print("Norm: %.2f, NNZs: %d, " + * "Bias: %.6f, T: %d, Avg. loss: %.6f" % (w.norm(), # <<<<<<<<<<<<<< + * weights.nonzero()[0].shape[0], + * intercept, count, + */ + __pyx_t_8 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_w->__pyx_vtab)->norm(__pyx_v_w)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + + /* "sklearn/linear_model/sgd_fast.pyx":500 + * print("Norm: %.2f, NNZs: %d, " + * "Bias: %.6f, T: %d, Avg. loss: %.6f" % (w.norm(), + * weights.nonzero()[0].shape[0], # <<<<<<<<<<<<<< + * intercept, count, + * sumloss / count)) + */ + __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_weights), __pyx_n_s__nonzero); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "sklearn/linear_model/sgd_fast.pyx":501 + * "Bias: %.6f, T: %d, Avg. loss: %.6f" % (w.norm(), + * weights.nonzero()[0].shape[0], + * intercept, count, # <<<<<<<<<<<<<< + * sumloss / count)) + * print("Total training time: %.2f seconds." % (time() - t_start)) + */ + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_intercept); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_count); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + + /* "sklearn/linear_model/sgd_fast.pyx":502 + * weights.nonzero()[0].shape[0], + * intercept, count, + * sumloss / count)) # <<<<<<<<<<<<<< + * print("Total training time: %.2f seconds." % (time() - t_start)) + * + */ + __pyx_t_7 = PyFloat_FromDouble((__pyx_v_sumloss / __pyx_v_count)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_15 = PyTuple_New(5); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_15, 3, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_15, 4, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_8 = 0; + __pyx_t_6 = 0; + __pyx_t_3 = 0; + __pyx_t_2 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + + /* "sklearn/linear_model/sgd_fast.pyx":503 + * intercept, count, + * sumloss / count)) + * print("Total training time: %.2f seconds." % (time() - t_start)) # <<<<<<<<<<<<<< + * + * # floating-point under-/overflow check. + */ + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__time); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_15 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Subtract(__pyx_t_15, __pyx_v_t_start); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), __pyx_t_7); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_15)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + goto __pyx_L17; + } + __pyx_L17:; + + /* "sklearn/linear_model/sgd_fast.pyx":506 + * + * # floating-point under-/overflow check. + * if np.any(np.isinf(weights)) or np.any(np.isnan(weights)) \ # <<<<<<<<<<<<<< + * or np.isnan(intercept) or np.isinf(intercept): + * raise ValueError("floating-point under-/overflow occured.") + */ + __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_7 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__any); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_15, __pyx_n_s__isinf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(((PyObject *)__pyx_v_weights)); + PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_v_weights)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_weights)); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_4) { + + /* "sklearn/linear_model/sgd_fast.pyx":507 + * # floating-point under-/overflow check. + * if np.any(np.isinf(weights)) or np.any(np.isnan(weights)) \ + * or np.isnan(intercept) or np.isinf(intercept): # <<<<<<<<<<<<<< + * raise ValueError("floating-point under-/overflow occured.") + * + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_15 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "sklearn/linear_model/sgd_fast.pyx":506 + * + * # floating-point under-/overflow check. + * if np.any(np.isinf(weights)) or np.any(np.isnan(weights)) \ # <<<<<<<<<<<<<< + * or np.isnan(intercept) or np.isinf(intercept): + * raise ValueError("floating-point under-/overflow occured.") + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__isnan); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__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 = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_weights)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_weights)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_weights)); + __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __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 = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_16) { + + /* "sklearn/linear_model/sgd_fast.pyx":507 + * # floating-point under-/overflow check. + * if np.any(np.isinf(weights)) or np.any(np.isnan(weights)) \ + * or np.isnan(intercept) or np.isinf(intercept): # <<<<<<<<<<<<<< + * raise ValueError("floating-point under-/overflow occured.") + * + */ + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__isnan); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_intercept); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_17 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_17) { + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__isinf); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_intercept); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_15, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_19 = __pyx_t_18; + } else { + __pyx_t_19 = __pyx_t_17; + } + __pyx_t_17 = __pyx_t_19; + } else { + __pyx_t_17 = __pyx_t_16; + } + __pyx_t_16 = __pyx_t_17; + } else { + __pyx_t_16 = __pyx_t_4; + } + if (__pyx_t_16) { + + /* "sklearn/linear_model/sgd_fast.pyx":508 + * if np.any(np.isinf(weights)) or np.any(np.isnan(weights)) \ + * or np.isnan(intercept) or np.isinf(intercept): + * raise ValueError("floating-point under-/overflow occured.") # <<<<<<<<<<<<<< + * + * w.reset_wscale() + */ + __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 = 508; __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 = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L18; + } + __pyx_L18:; + } + + /* "sklearn/linear_model/sgd_fast.pyx":510 + * raise ValueError("floating-point under-/overflow occured.") + * + * w.reset_wscale() # <<<<<<<<<<<<<< + * + * return weights, intercept + */ + ((struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector *)__pyx_v_w->__pyx_vtab)->reset_wscale(__pyx_v_w); + + /* "sklearn/linear_model/sgd_fast.pyx":512 + * w.reset_wscale() + * + * return weights, intercept # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_intercept); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __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 = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_weights)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_weights)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_weights)); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__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_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_15); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("sklearn.linear_model.sgd_fast.plain_sgd", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_q.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_w); + __Pyx_XDECREF((PyObject *)__pyx_v_q); + __Pyx_XDECREF(__pyx_v_t_start); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":515 + * + * + * cdef inline double max(double a, double b): # <<<<<<<<<<<<<< + * return a if a >= b else b + * + */ + +static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_8sgd_fast_max(double __pyx_v_a, double __pyx_v_b) { + double __pyx_r; + __Pyx_RefNannyDeclarations + double __pyx_t_1; + __Pyx_RefNannySetupContext("max", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":516 + * + * cdef inline double max(double a, double b): + * return a if a >= b else b # <<<<<<<<<<<<<< + * + * + */ + if ((__pyx_v_a >= __pyx_v_b)) { + __pyx_t_1 = __pyx_v_a; + } else { + __pyx_t_1 = __pyx_v_b; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":519 + * + * + * cdef inline double min(double a, double b): # <<<<<<<<<<<<<< + * return a if a <= b else b + * + */ + +static CYTHON_INLINE double __pyx_f_7sklearn_12linear_model_8sgd_fast_min(double __pyx_v_a, double __pyx_v_b) { + double __pyx_r; + __Pyx_RefNannyDeclarations + double __pyx_t_1; + __Pyx_RefNannySetupContext("min", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":520 + * + * cdef inline double min(double a, double b): + * return a if a <= b else b # <<<<<<<<<<<<<< + * + * cdef double sqnorm(DOUBLE * x_data_ptr, INTEGER * x_ind_ptr, int xnnz): + */ + if ((__pyx_v_a <= __pyx_v_b)) { + __pyx_t_1 = __pyx_v_a; + } else { + __pyx_t_1 = __pyx_v_b; + } + __pyx_r = __pyx_t_1; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":522 + * return a if a <= b else b + * + * cdef double sqnorm(DOUBLE * x_data_ptr, INTEGER * x_ind_ptr, int xnnz): # <<<<<<<<<<<<<< + * cdef double x_norm = 0.0 + * cdef int j + */ + +static double __pyx_f_7sklearn_12linear_model_8sgd_fast_sqnorm(__pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE *__pyx_v_x_data_ptr, CYTHON_UNUSED __pyx_t_7sklearn_12linear_model_8sgd_fast_INTEGER *__pyx_v_x_ind_ptr, int __pyx_v_xnnz) { + double __pyx_v_x_norm; + int __pyx_v_j; + double __pyx_v_z; + double __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("sqnorm", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":523 + * + * cdef double sqnorm(DOUBLE * x_data_ptr, INTEGER * x_ind_ptr, int xnnz): + * cdef double x_norm = 0.0 # <<<<<<<<<<<<<< + * cdef int j + * cdef double z + */ + __pyx_v_x_norm = 0.0; + + /* "sklearn/linear_model/sgd_fast.pyx":526 + * cdef int j + * cdef double z + * for j in range(xnnz): # <<<<<<<<<<<<<< + * z = x_data_ptr[j] + * x_norm += z * z + */ + __pyx_t_1 = __pyx_v_xnnz; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_j = __pyx_t_2; + + /* "sklearn/linear_model/sgd_fast.pyx":527 + * cdef double z + * for j in range(xnnz): + * z = x_data_ptr[j] # <<<<<<<<<<<<<< + * x_norm += z * z + * return x_norm + */ + __pyx_v_z = (__pyx_v_x_data_ptr[__pyx_v_j]); + + /* "sklearn/linear_model/sgd_fast.pyx":528 + * for j in range(xnnz): + * z = x_data_ptr[j] + * x_norm += z * z # <<<<<<<<<<<<<< + * return x_norm + * + */ + __pyx_v_x_norm = (__pyx_v_x_norm + (__pyx_v_z * __pyx_v_z)); + } + + /* "sklearn/linear_model/sgd_fast.pyx":529 + * z = x_data_ptr[j] + * x_norm += z * z + * return x_norm # <<<<<<<<<<<<<< + * + * cdef void l1penalty(WeightVector w, DOUBLE * q_data_ptr, + */ + __pyx_r = __pyx_v_x_norm; + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/linear_model/sgd_fast.pyx":531 + * return x_norm + * + * cdef void l1penalty(WeightVector w, DOUBLE * q_data_ptr, # <<<<<<<<<<<<<< + * INTEGER * x_ind_ptr, int xnnz, double u): + * """Apply the L1 penalty to each updated feature + */ + +static void __pyx_f_7sklearn_12linear_model_8sgd_fast_l1penalty(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector *__pyx_v_w, __pyx_t_7sklearn_12linear_model_8sgd_fast_DOUBLE *__pyx_v_q_data_ptr, __pyx_t_7sklearn_12linear_model_8sgd_fast_INTEGER *__pyx_v_x_ind_ptr, int __pyx_v_xnnz, double __pyx_v_u) { + double __pyx_v_z; + int __pyx_v_j; + int __pyx_v_idx; + double __pyx_v_wscale; + double *__pyx_v_w_data_ptr; + __Pyx_RefNannyDeclarations + double __pyx_t_1; + __pyx_t_7sklearn_5utils_13weight_vector_DOUBLE *__pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + __Pyx_RefNannySetupContext("l1penalty", 0); + + /* "sklearn/linear_model/sgd_fast.pyx":538 + * [Tsuruoka, Y., Tsujii, J., and Ananiadou, S., 2009]. + * """ + * cdef double z = 0.0 # <<<<<<<<<<<<<< + * cdef int j = 0 + * cdef int idx = 0 + */ + __pyx_v_z = 0.0; + + /* "sklearn/linear_model/sgd_fast.pyx":539 + * """ + * cdef double z = 0.0 + * cdef int j = 0 # <<<<<<<<<<<<<< + * cdef int idx = 0 + * cdef double wscale = w.wscale + */ + __pyx_v_j = 0; + + /* "sklearn/linear_model/sgd_fast.pyx":540 + * cdef double z = 0.0 + * cdef int j = 0 + * cdef int idx = 0 # <<<<<<<<<<<<<< + * cdef double wscale = w.wscale + * cdef double * w_data_ptr = w.w_data_ptr + */ + __pyx_v_idx = 0; + + /* "sklearn/linear_model/sgd_fast.pyx":541 + * cdef int j = 0 + * cdef int idx = 0 + * cdef double wscale = w.wscale # <<<<<<<<<<<<<< + * cdef double * w_data_ptr = w.w_data_ptr + * for j in range(xnnz): + */ + __pyx_t_1 = __pyx_v_w->wscale; + __pyx_v_wscale = __pyx_t_1; + + /* "sklearn/linear_model/sgd_fast.pyx":542 + * cdef int idx = 0 + * cdef double wscale = w.wscale + * cdef double * w_data_ptr = w.w_data_ptr # <<<<<<<<<<<<<< + * for j in range(xnnz): + * idx = x_ind_ptr[j] + */ + __pyx_t_2 = __pyx_v_w->w_data_ptr; + __pyx_v_w_data_ptr = __pyx_t_2; + + /* "sklearn/linear_model/sgd_fast.pyx":543 + * cdef double wscale = w.wscale + * cdef double * w_data_ptr = w.w_data_ptr + * for j in range(xnnz): # <<<<<<<<<<<<<< + * idx = x_ind_ptr[j] + * z = w_data_ptr[idx] + */ + __pyx_t_3 = __pyx_v_xnnz; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_j = __pyx_t_4; + + /* "sklearn/linear_model/sgd_fast.pyx":544 + * cdef double * w_data_ptr = w.w_data_ptr + * for j in range(xnnz): + * idx = x_ind_ptr[j] # <<<<<<<<<<<<<< + * z = w_data_ptr[idx] + * if (wscale * w_data_ptr[idx]) > 0.0: + */ + __pyx_v_idx = (__pyx_v_x_ind_ptr[__pyx_v_j]); + + /* "sklearn/linear_model/sgd_fast.pyx":545 + * for j in range(xnnz): + * idx = x_ind_ptr[j] + * z = w_data_ptr[idx] # <<<<<<<<<<<<<< + * if (wscale * w_data_ptr[idx]) > 0.0: + * w_data_ptr[idx] = max( + */ + __pyx_v_z = (__pyx_v_w_data_ptr[__pyx_v_idx]); + + /* "sklearn/linear_model/sgd_fast.pyx":546 + * idx = x_ind_ptr[j] + * z = w_data_ptr[idx] + * if (wscale * w_data_ptr[idx]) > 0.0: # <<<<<<<<<<<<<< + * w_data_ptr[idx] = max( + * 0.0, w_data_ptr[idx] - ((u + q_data_ptr[idx]) / wscale)) + */ + __pyx_t_5 = ((__pyx_v_wscale * (__pyx_v_w_data_ptr[__pyx_v_idx])) > 0.0); + if (__pyx_t_5) { + + /* "sklearn/linear_model/sgd_fast.pyx":547 + * z = w_data_ptr[idx] + * if (wscale * w_data_ptr[idx]) > 0.0: + * w_data_ptr[idx] = max( # <<<<<<<<<<<<<< + * 0.0, w_data_ptr[idx] - ((u + q_data_ptr[idx]) / wscale)) + * + */ + (__pyx_v_w_data_ptr[__pyx_v_idx]) = __pyx_f_7sklearn_12linear_model_8sgd_fast_max(0.0, ((__pyx_v_w_data_ptr[__pyx_v_idx]) - ((__pyx_v_u + (__pyx_v_q_data_ptr[__pyx_v_idx])) / __pyx_v_wscale))); + goto __pyx_L5; + } + + /* "sklearn/linear_model/sgd_fast.pyx":550 + * 0.0, w_data_ptr[idx] - ((u + q_data_ptr[idx]) / wscale)) + * + * elif (wscale * w_data_ptr[idx]) < 0.0: # <<<<<<<<<<<<<< + * w_data_ptr[idx] = min( + * 0.0, w_data_ptr[idx] + ((u - q_data_ptr[idx]) / wscale)) + */ + __pyx_t_5 = ((__pyx_v_wscale * (__pyx_v_w_data_ptr[__pyx_v_idx])) < 0.0); + if (__pyx_t_5) { + + /* "sklearn/linear_model/sgd_fast.pyx":551 + * + * elif (wscale * w_data_ptr[idx]) < 0.0: + * w_data_ptr[idx] = min( # <<<<<<<<<<<<<< + * 0.0, w_data_ptr[idx] + ((u - q_data_ptr[idx]) / wscale)) + * + */ + (__pyx_v_w_data_ptr[__pyx_v_idx]) = __pyx_f_7sklearn_12linear_model_8sgd_fast_min(0.0, ((__pyx_v_w_data_ptr[__pyx_v_idx]) + ((__pyx_v_u - (__pyx_v_q_data_ptr[__pyx_v_idx])) / __pyx_v_wscale))); + goto __pyx_L5; + } + __pyx_L5:; + + /* "sklearn/linear_model/sgd_fast.pyx":554 + * 0.0, w_data_ptr[idx] + ((u - q_data_ptr[idx]) / wscale)) + * + * q_data_ptr[idx] += (wscale * (w_data_ptr[idx] - z)) # <<<<<<<<<<<<<< + */ + __pyx_t_6 = __pyx_v_idx; + (__pyx_v_q_data_ptr[__pyx_t_6]) = ((__pyx_v_q_data_ptr[__pyx_t_6]) + (__pyx_v_wscale * ((__pyx_v_w_data_ptr[__pyx_v_idx]) - __pyx_v_z))); + } + + __Pyx_RefNannyFinishContext(); +} + +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__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_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + 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); + } + + /* "numpy.pxd":200 + * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":204 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":206 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); + + /* "numpy.pxd":208 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":209 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L4; + } + /*else*/ { + + /* "numpy.pxd":211 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L4:; + + /* "numpy.pxd":213 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { + + /* "numpy.pxd":214 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __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[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":217 + * raise ValueError(u"ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") + */ + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { + + /* "numpy.pxd":218 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __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[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":221 + * raise ValueError(u"ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); + + /* "numpy.pxd":222 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "numpy.pxd":223 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + */ + if (__pyx_v_copy_shape) { + + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); + + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "numpy.pxd":229 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); + + /* "numpy.pxd":230 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); + } + goto __pyx_L7; + } + /*else*/ { + + /* "numpy.pxd":232 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); + + /* "numpy.pxd":233 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); + } + __pyx_L7:; + + /* "numpy.pxd":234 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "numpy.pxd":235 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); + + /* "numpy.pxd":236 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); + + /* "numpy.pxd":239 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "numpy.pxd":240 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "numpy.pxd":244 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "numpy.pxd":246 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":248 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L10; + } + /*else*/ { + + /* "numpy.pxd":251 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __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_L10:; + + /* "numpy.pxd":253 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "numpy.pxd":254 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + */ + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; + + /* "numpy.pxd":255 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "numpy.pxd":256 + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_7 = __pyx_t_3; + } else { + __pyx_t_7 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __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[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + __pyx_t_1 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__b; + goto __pyx_L13; + } + + /* "numpy.pxd":259 + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__B; + goto __pyx_L13; + } + + /* "numpy.pxd":260 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + __pyx_t_1 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__h; + goto __pyx_L13; + } + + /* "numpy.pxd":261 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + __pyx_t_1 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__H; + goto __pyx_L13; + } + + /* "numpy.pxd":262 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + __pyx_t_1 = (__pyx_v_t == NPY_INT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__i; + goto __pyx_L13; + } + + /* "numpy.pxd":263 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__I; + goto __pyx_L13; + } + + /* "numpy.pxd":264 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__l; + goto __pyx_L13; + } + + /* "numpy.pxd":265 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__L; + goto __pyx_L13; + } + + /* "numpy.pxd":266 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__q; + goto __pyx_L13; + } + + /* "numpy.pxd":267 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Q; + goto __pyx_L13; + } + + /* "numpy.pxd":268 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__f; + goto __pyx_L13; + } + + /* "numpy.pxd":269 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__d; + goto __pyx_L13; + } + + /* "numpy.pxd":270 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__g; + goto __pyx_L13; + } + + /* "numpy.pxd":271 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zf; + goto __pyx_L13; + } + + /* "numpy.pxd":272 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zd; + goto __pyx_L13; + } + + /* "numpy.pxd":273 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zg; + goto __pyx_L13; + } + + /* "numpy.pxd":274 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__O; + goto __pyx_L13; + } + /*else*/ { + + /* "numpy.pxd":276 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_12), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __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_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L13:; + + /* "numpy.pxd":277 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "numpy.pxd":278 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":280 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "numpy.pxd":281 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "numpy.pxd":282 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = c'^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "numpy.pxd":285 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + + /* "numpy.pxd":286 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = '\x00'; + } + __pyx_L11:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__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_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__", 0); + + /* "numpy.pxd":289 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); + if (__pyx_t_1) { + + /* "numpy.pxd":290 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":291 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":292 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L4; + } + __pyx_L4:; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":768 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + 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("PyArray_MultiIterNew1", 0); + + /* "numpy.pxd":769 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __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("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":771 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + 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("PyArray_MultiIterNew2", 0); + + /* "numpy.pxd":772 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __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("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":774 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + 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("PyArray_MultiIterNew3", 0); + + /* "numpy.pxd":775 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __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("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":777 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + 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("PyArray_MultiIterNew4", 0); + + /* "numpy.pxd":778 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __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("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":780 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + 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("PyArray_MultiIterNew5", 0); + + /* "numpy.pxd":781 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __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("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":783 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child = 0; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *(*__pyx_t_6)(PyObject *); + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":791 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":794 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":795 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "numpy.pxd":796 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #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 = 796; __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[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __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_L5_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_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_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[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + + /* "numpy.pxd":798 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __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[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "numpy.pxd":801 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; + } else { + __pyx_t_8 = __pyx_t_7; + } + if (!__pyx_t_8) { + + /* "numpy.pxd":802 + * + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; + } else { + __pyx_t_10 = __pyx_t_7; + } + __pyx_t_7 = __pyx_t_10; + } else { + __pyx_t_7 = __pyx_t_8; + } + if (__pyx_t_7) { + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __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[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "numpy.pxd":813 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_7) break; + + /* "numpy.pxd":814 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "numpy.pxd":815 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f = (__pyx_v_f + 1); + + /* "numpy.pxd":816 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); + } + + /* "numpy.pxd":818 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); + + /* "numpy.pxd":820 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { + + /* "numpy.pxd":821 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":822 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * + */ + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __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[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "numpy.pxd":826 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 98; + goto __pyx_L13; + } + + /* "numpy.pxd":827 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 66; + goto __pyx_L13; + } + + /* "numpy.pxd":828 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 104; + goto __pyx_L13; + } + + /* "numpy.pxd":829 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 72; + goto __pyx_L13; + } + + /* "numpy.pxd":830 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 105; + goto __pyx_L13; + } + + /* "numpy.pxd":831 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 73; + goto __pyx_L13; + } + + /* "numpy.pxd":832 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 108; + goto __pyx_L13; + } + + /* "numpy.pxd":833 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 76; + goto __pyx_L13; + } + + /* "numpy.pxd":834 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 113; + goto __pyx_L13; + } + + /* "numpy.pxd":835 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 81; + goto __pyx_L13; + } + + /* "numpy.pxd":836 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 102; + goto __pyx_L13; + } + + /* "numpy.pxd":837 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 100; + goto __pyx_L13; + } + + /* "numpy.pxd":838 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 103; + goto __pyx_L13; + } + + /* "numpy.pxd":839 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":840 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":841 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":842 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 79; + goto __pyx_L13; + } + /*else*/ { + + /* "numpy.pxd":844 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_12), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 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_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L13:; + + /* "numpy.pxd":845 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":849 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; + } + __pyx_L11:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":850 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + 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_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":965 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base", 0); + + /* "numpy.pxd":967 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "numpy.pxd":968 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":970 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "numpy.pxd":971 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "numpy.pxd":972 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "numpy.pxd":973 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "numpy.pxd":976 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "numpy.pxd":977 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":979 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction __pyx_vtable_7sklearn_12linear_model_8sgd_fast_LossFunction; + +static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_LossFunction(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *p; + PyObject *o = (*t->tp_alloc)(t, 0); + if (!o) return 0; + p = ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *)o); + p->__pyx_vtab = __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_LossFunction; + return o; +} + +static void __pyx_tp_dealloc_7sklearn_12linear_model_8sgd_fast_LossFunction(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_LossFunction[] = { + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12LossFunction_3dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_12linear_model_8sgd_fast_12LossFunction_2dloss)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_LossFunction = { + 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_LossFunction = { + 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_LossFunction = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_LossFunction = { + #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_7sklearn_12linear_model_8sgd_fast_LossFunction = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("sklearn.linear_model.sgd_fast.LossFunction"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7sklearn_12linear_model_8sgd_fast_LossFunction, /*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_LossFunction, /*tp_as_number*/ + &__pyx_tp_as_sequence_LossFunction, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_LossFunction, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_LossFunction, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Base class for convex loss functions"), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7sklearn_12linear_model_8sgd_fast_LossFunction, /*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*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_LossFunction, /*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_7sklearn_12linear_model_8sgd_fast_Regression __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Regression; + +static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Regression(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *p; + PyObject *o = __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_LossFunction(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction*)__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression; + return o; +} + +static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_Regression[] = { + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_10Regression_3dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Regression = { + 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_Regression = { + 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_Regression = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Regression = { + #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_7sklearn_12linear_model_8sgd_fast_Regression = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("sklearn.linear_model.sgd_fast.Regression"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Regression), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7sklearn_12linear_model_8sgd_fast_LossFunction, /*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_Regression, /*tp_as_number*/ + &__pyx_tp_as_sequence_Regression, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Regression, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Regression, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Base class for loss functions for regression"), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7sklearn_12linear_model_8sgd_fast_Regression, /*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*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Regression, /*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_7sklearn_12linear_model_8sgd_fast_Classification __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Classification; + +static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Classification(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *p; + PyObject *o = __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_LossFunction(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction*)__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Classification; + return o; +} + +static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_Classification[] = { + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_14Classification_3dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Classification = { + 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_Classification = { + 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_Classification = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Classification = { + #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_7sklearn_12linear_model_8sgd_fast_Classification = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("sklearn.linear_model.sgd_fast.Classification"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Classification), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7sklearn_12linear_model_8sgd_fast_LossFunction, /*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_Classification, /*tp_as_number*/ + &__pyx_tp_as_sequence_Classification, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Classification, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Classification, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Base class for loss functions for classification"), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7sklearn_12linear_model_8sgd_fast_Classification, /*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*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Classification, /*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_7sklearn_12linear_model_8sgd_fast_ModifiedHuber __pyx_vtable_7sklearn_12linear_model_8sgd_fast_ModifiedHuber; + +static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_ModifiedHuber(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *p; + PyObject *o = __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_LossFunction(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction*)__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_ModifiedHuber; + return o; +} + +static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_ModifiedHuber[] = { + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_3dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_5__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ModifiedHuber = { + 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_ModifiedHuber = { + 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_ModifiedHuber = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ModifiedHuber = { + #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_7sklearn_12linear_model_8sgd_fast_ModifiedHuber = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("sklearn.linear_model.sgd_fast.ModifiedHuber"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_ModifiedHuber), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7sklearn_12linear_model_8sgd_fast_LossFunction, /*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_ModifiedHuber, /*tp_as_number*/ + &__pyx_tp_as_sequence_ModifiedHuber, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ModifiedHuber, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ModifiedHuber, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Modified Huber loss for binary classification with y in {-1, 1}\n\n This is equivalent to quadratically smoothed SVM with gamma = 2.\n\n See T. Zhang 'Solving Large Scale Linear Prediction Problems Using\n Stochastic Gradient Descent', ICML'04.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7sklearn_12linear_model_8sgd_fast_ModifiedHuber, /*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*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_ModifiedHuber, /*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_7sklearn_12linear_model_8sgd_fast_Hinge __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Hinge; + +static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Hinge(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *p; + PyObject *o = __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_LossFunction(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction*)__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Hinge; + return o; +} + +static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_Hinge[] = { + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_3loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_5dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_7__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Hinge = { + 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_Hinge = { + 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_Hinge = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Hinge = { + #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_7sklearn_12linear_model_8sgd_fast_Hinge = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("sklearn.linear_model.sgd_fast.Hinge"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Hinge), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7sklearn_12linear_model_8sgd_fast_LossFunction, /*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_Hinge, /*tp_as_number*/ + &__pyx_tp_as_sequence_Hinge, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Hinge, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Hinge, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Hinge loss for binary classification tasks with y in {-1,1}\n\n Parameters\n ----------\n\n threshold : float > 0.0\n Margin threshold. When threshold=1.0, one gets the loss used by SVM.\n When threshold=0.0, one gets the loss used by the Perceptron.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7sklearn_12linear_model_8sgd_fast_Hinge, /*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_pw_7sklearn_12linear_model_8sgd_fast_5Hinge_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Hinge, /*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_7sklearn_12linear_model_8sgd_fast_SquaredHinge __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredHinge; + +static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_SquaredHinge(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *p; + PyObject *o = __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_LossFunction(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction*)__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredHinge; + return o; +} + +static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_SquaredHinge[] = { + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_3loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_5dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_7__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_SquaredHinge = { + 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_SquaredHinge = { + 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_SquaredHinge = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_SquaredHinge = { + #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_7sklearn_12linear_model_8sgd_fast_SquaredHinge = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("sklearn.linear_model.sgd_fast.SquaredHinge"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredHinge), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7sklearn_12linear_model_8sgd_fast_LossFunction, /*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_SquaredHinge, /*tp_as_number*/ + &__pyx_tp_as_sequence_SquaredHinge, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SquaredHinge, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_SquaredHinge, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Squared Hinge loss for binary classification tasks with y in {-1,1}\n\n Parameters\n ----------\n\n threshold : float > 0.0\n Margin threshold. When threshold=1.0, one gets the loss used by\n (quadratically penalized) SVM.\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7sklearn_12linear_model_8sgd_fast_SquaredHinge, /*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_pw_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_SquaredHinge, /*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_7sklearn_12linear_model_8sgd_fast_Log __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Log; + +static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Log(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *p; + PyObject *o = __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_LossFunction(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction*)__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Log; + return o; +} + +static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_Log[] = { + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_3dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_3Log_5__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Log = { + 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_Log = { + 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_Log = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Log = { + #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_7sklearn_12linear_model_8sgd_fast_Log = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("sklearn.linear_model.sgd_fast.Log"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Log), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7sklearn_12linear_model_8sgd_fast_LossFunction, /*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_Log, /*tp_as_number*/ + &__pyx_tp_as_sequence_Log, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Log, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Log, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Logistic regression loss for binary classification with y in {-1, 1}"), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7sklearn_12linear_model_8sgd_fast_Log, /*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*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Log, /*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_7sklearn_12linear_model_8sgd_fast_SquaredLoss __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredLoss; + +static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_SquaredLoss(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *p; + PyObject *o = __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_LossFunction(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction*)__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredLoss; + return o; +} + +static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_SquaredLoss[] = { + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_1loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_3dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_5__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_SquaredLoss = { + 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_SquaredLoss = { + 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_SquaredLoss = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_SquaredLoss = { + #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_7sklearn_12linear_model_8sgd_fast_SquaredLoss = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("sklearn.linear_model.sgd_fast.SquaredLoss"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredLoss), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7sklearn_12linear_model_8sgd_fast_LossFunction, /*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_SquaredLoss, /*tp_as_number*/ + &__pyx_tp_as_sequence_SquaredLoss, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SquaredLoss, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_SquaredLoss, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Squared loss traditional used in linear regression."), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7sklearn_12linear_model_8sgd_fast_SquaredLoss, /*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*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_SquaredLoss, /*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_7sklearn_12linear_model_8sgd_fast_Huber __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Huber; + +static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Huber(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *p; + PyObject *o = __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_LossFunction(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction*)__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Huber; + return o; +} + +static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_Huber[] = { + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_3loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_5dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_5Huber_7__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Huber = { + 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_Huber = { + 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_Huber = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Huber = { + #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_7sklearn_12linear_model_8sgd_fast_Huber = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("sklearn.linear_model.sgd_fast.Huber"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_Huber), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7sklearn_12linear_model_8sgd_fast_LossFunction, /*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_Huber, /*tp_as_number*/ + &__pyx_tp_as_sequence_Huber, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Huber, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Huber, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Huber regression loss\n\n Variant of the SquaredLoss that is robust to outliers (quadratic near zero,\n linear in for large errors).\n\n http://en.wikipedia.org/wiki/Huber_Loss_Function\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7sklearn_12linear_model_8sgd_fast_Huber, /*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_pw_7sklearn_12linear_model_8sgd_fast_5Huber_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_Huber, /*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_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive __pyx_vtable_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive; + +static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *p; + PyObject *o = __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_LossFunction(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction*)__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive; + return o; +} + +static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive[] = { + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_3loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_5dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_7__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_EpsilonInsensitive = { + 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_EpsilonInsensitive = { + 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_EpsilonInsensitive = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_EpsilonInsensitive = { + #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_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("sklearn.linear_model.sgd_fast.EpsilonInsensitive"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7sklearn_12linear_model_8sgd_fast_LossFunction, /*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_EpsilonInsensitive, /*tp_as_number*/ + &__pyx_tp_as_sequence_EpsilonInsensitive, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_EpsilonInsensitive, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_EpsilonInsensitive, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Epsilon-Insensitive loss (used by SVR).\n\n loss = max(0, |y - p| - epsilon)\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive, /*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_pw_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive, /*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_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive; + +static PyObject *__pyx_tp_new_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *p; + PyObject *o = __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_LossFunction(t, a, k); + if (!o) return 0; + p = ((struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_12linear_model_8sgd_fast_LossFunction*)__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive; + return o; +} + +static PyMethodDef __pyx_methods_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive[] = { + {__Pyx_NAMESTR("loss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_3loss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("dloss"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_5dloss, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_7__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_SquaredEpsilonInsensitive = { + 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_SquaredEpsilonInsensitive = { + 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_SquaredEpsilonInsensitive = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_SquaredEpsilonInsensitive = { + #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_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("sklearn.linear_model.sgd_fast.SquaredEpsilonInsensitive"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7sklearn_12linear_model_8sgd_fast_LossFunction, /*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_SquaredEpsilonInsensitive, /*tp_as_number*/ + &__pyx_tp_as_sequence_SquaredEpsilonInsensitive, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_SquaredEpsilonInsensitive, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_SquaredEpsilonInsensitive, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + __Pyx_DOCSTR("Epsilon-Insensitive loss.\n\n loss = max(0, |y - p| - epsilon)^2\n "), /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive, /*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_pw_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive, /*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("sgd_fast"), + 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_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, + {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, + {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, + {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 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_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1}, + {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 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__alpha, __pyx_k__alpha, sizeof(__pyx_k__alpha), 0, 0, 1, 1}, + {&__pyx_n_s__any, __pyx_k__any, sizeof(__pyx_k__any), 0, 0, 1, 1}, + {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1}, + {&__pyx_n_s__class_weight, __pyx_k__class_weight, sizeof(__pyx_k__class_weight), 0, 0, 1, 1}, + {&__pyx_n_s__count, __pyx_k__count, sizeof(__pyx_k__count), 0, 0, 1, 1}, + {&__pyx_n_s__dataset, __pyx_k__dataset, sizeof(__pyx_k__dataset), 0, 0, 1, 1}, + {&__pyx_n_s__dloss, __pyx_k__dloss, sizeof(__pyx_k__dloss), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__epoch, __pyx_k__epoch, sizeof(__pyx_k__epoch), 0, 0, 1, 1}, + {&__pyx_n_s__epsilon, __pyx_k__epsilon, sizeof(__pyx_k__epsilon), 0, 0, 1, 1}, + {&__pyx_n_s__eta, __pyx_k__eta, sizeof(__pyx_k__eta), 0, 0, 1, 1}, + {&__pyx_n_s__eta0, __pyx_k__eta0, sizeof(__pyx_k__eta0), 0, 0, 1, 1}, + {&__pyx_n_s__fit_intercept, __pyx_k__fit_intercept, sizeof(__pyx_k__fit_intercept), 0, 0, 1, 1}, + {&__pyx_n_s__float64, __pyx_k__float64, sizeof(__pyx_k__float64), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, + {&__pyx_n_s__intercept, __pyx_k__intercept, sizeof(__pyx_k__intercept), 0, 0, 1, 1}, + {&__pyx_n_s__intercept_decay, __pyx_k__intercept_decay, sizeof(__pyx_k__intercept_decay), 0, 0, 1, 1}, + {&__pyx_n_s__is_hinge, __pyx_k__is_hinge, sizeof(__pyx_k__is_hinge), 0, 0, 1, 1}, + {&__pyx_n_s__isinf, __pyx_k__isinf, sizeof(__pyx_k__isinf), 0, 0, 1, 1}, + {&__pyx_n_s__isnan, __pyx_k__isnan, sizeof(__pyx_k__isnan), 0, 0, 1, 1}, + {&__pyx_n_s__learning_rate, __pyx_k__learning_rate, sizeof(__pyx_k__learning_rate), 0, 0, 1, 1}, + {&__pyx_n_s__loss, __pyx_k__loss, sizeof(__pyx_k__loss), 0, 0, 1, 1}, + {&__pyx_n_s__n_features, __pyx_k__n_features, sizeof(__pyx_k__n_features), 0, 0, 1, 1}, + {&__pyx_n_s__n_iter, __pyx_k__n_iter, sizeof(__pyx_k__n_iter), 0, 0, 1, 1}, + {&__pyx_n_s__n_samples, __pyx_k__n_samples, sizeof(__pyx_k__n_samples), 0, 0, 1, 1}, + {&__pyx_n_s__nonzero, __pyx_k__nonzero, sizeof(__pyx_k__nonzero), 0, 0, 1, 1}, + {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1}, + {&__pyx_n_s__p, __pyx_k__p, sizeof(__pyx_k__p), 0, 0, 1, 1}, + {&__pyx_n_s__penalty_type, __pyx_k__penalty_type, sizeof(__pyx_k__penalty_type), 0, 0, 1, 1}, + {&__pyx_n_s__plain_sgd, __pyx_k__plain_sgd, sizeof(__pyx_k__plain_sgd), 0, 0, 1, 1}, + {&__pyx_n_s__power_t, __pyx_k__power_t, sizeof(__pyx_k__power_t), 0, 0, 1, 1}, + {&__pyx_n_s__q, __pyx_k__q, sizeof(__pyx_k__q), 0, 0, 1, 1}, + {&__pyx_n_s__q_data_ptr, __pyx_k__q_data_ptr, sizeof(__pyx_k__q_data_ptr), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__rho, __pyx_k__rho, sizeof(__pyx_k__rho), 0, 0, 1, 1}, + {&__pyx_n_s__sample_weight, __pyx_k__sample_weight, sizeof(__pyx_k__sample_weight), 0, 0, 1, 1}, + {&__pyx_n_s__seed, __pyx_k__seed, sizeof(__pyx_k__seed), 0, 0, 1, 1}, + {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__shuffle, __pyx_k__shuffle, sizeof(__pyx_k__shuffle), 0, 0, 1, 1}, + {&__pyx_n_s__sumloss, __pyx_k__sumloss, sizeof(__pyx_k__sumloss), 0, 0, 1, 1}, + {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, + {&__pyx_n_s__t, __pyx_k__t, sizeof(__pyx_k__t), 0, 0, 1, 1}, + {&__pyx_n_s__t_start, __pyx_k__t_start, sizeof(__pyx_k__t_start), 0, 0, 1, 1}, + {&__pyx_n_s__threshold, __pyx_k__threshold, sizeof(__pyx_k__threshold), 0, 0, 1, 1}, + {&__pyx_n_s__time, __pyx_k__time, sizeof(__pyx_k__time), 0, 0, 1, 1}, + {&__pyx_n_s__u, __pyx_k__u, sizeof(__pyx_k__u), 0, 0, 1, 1}, + {&__pyx_n_s__update, __pyx_k__update, sizeof(__pyx_k__update), 0, 0, 1, 1}, + {&__pyx_n_s__verbose, __pyx_k__verbose, sizeof(__pyx_k__verbose), 0, 0, 1, 1}, + {&__pyx_n_s__w, __pyx_k__w, sizeof(__pyx_k__w), 0, 0, 1, 1}, + {&__pyx_n_s__weight_neg, __pyx_k__weight_neg, sizeof(__pyx_k__weight_neg), 0, 0, 1, 1}, + {&__pyx_n_s__weight_pos, __pyx_k__weight_pos, sizeof(__pyx_k__weight_pos), 0, 0, 1, 1}, + {&__pyx_n_s__weights, __pyx_k__weights, sizeof(__pyx_k__weights), 0, 0, 1, 1}, + {&__pyx_n_s__x_data_ptr, __pyx_k__x_data_ptr, sizeof(__pyx_k__x_data_ptr), 0, 0, 1, 1}, + {&__pyx_n_s__x_ind_ptr, __pyx_k__x_ind_ptr, sizeof(__pyx_k__x_ind_ptr), 0, 0, 1, 1}, + {&__pyx_n_s__xnnz, __pyx_k__xnnz, sizeof(__pyx_k__xnnz), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, + {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_NotImplementedError = __Pyx_GetName(__pyx_b, __pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __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[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __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); + + /* "sklearn/linear_model/sgd_fast.pyx":508 + * if np.any(np.isinf(weights)) or np.any(np.isnan(weights)) \ + * or np.isnan(intercept) or np.isinf(intercept): + * raise ValueError("floating-point under-/overflow occured.") # <<<<<<<<<<<<<< + * + * w.reset_wscale() + */ + __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_7); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); + PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_kp_u_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_9); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_11); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); + PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_14); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); + PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_15 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_kp_u_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_17); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_u_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + + /* "sklearn/linear_model/sgd_fast.pyx":327 + * + * + * def plain_sgd(np.ndarray[DOUBLE, ndim=1, mode='c'] weights, # <<<<<<<<<<<<<< + * double intercept, + * LossFunction loss, + */ + __pyx_k_tuple_18 = PyTuple_New(41); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_18); + __Pyx_INCREF(((PyObject *)__pyx_n_s__weights)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_n_s__weights)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weights)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__intercept)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 1, ((PyObject *)__pyx_n_s__intercept)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__intercept)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__loss)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 2, ((PyObject *)__pyx_n_s__loss)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__loss)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__penalty_type)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 3, ((PyObject *)__pyx_n_s__penalty_type)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__penalty_type)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__alpha)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 4, ((PyObject *)__pyx_n_s__alpha)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alpha)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 5, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__rho)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 6, ((PyObject *)__pyx_n_s__rho)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rho)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dataset)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 7, ((PyObject *)__pyx_n_s__dataset)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dataset)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_iter)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 8, ((PyObject *)__pyx_n_s__n_iter)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_iter)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fit_intercept)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 9, ((PyObject *)__pyx_n_s__fit_intercept)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fit_intercept)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__verbose)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 10, ((PyObject *)__pyx_n_s__verbose)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__verbose)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__shuffle)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 11, ((PyObject *)__pyx_n_s__shuffle)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__shuffle)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__seed)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 12, ((PyObject *)__pyx_n_s__seed)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__seed)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__weight_pos)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 13, ((PyObject *)__pyx_n_s__weight_pos)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weight_pos)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__weight_neg)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 14, ((PyObject *)__pyx_n_s__weight_neg)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__weight_neg)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__learning_rate)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 15, ((PyObject *)__pyx_n_s__learning_rate)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__learning_rate)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__eta0)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 16, ((PyObject *)__pyx_n_s__eta0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__eta0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__power_t)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 17, ((PyObject *)__pyx_n_s__power_t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__power_t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 18, ((PyObject *)__pyx_n_s__t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__intercept_decay)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 19, ((PyObject *)__pyx_n_s__intercept_decay)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__intercept_decay)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_samples)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 20, ((PyObject *)__pyx_n_s__n_samples)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_samples)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n_features)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 21, ((PyObject *)__pyx_n_s__n_features)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n_features)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__w)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 22, ((PyObject *)__pyx_n_s__w)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x_data_ptr)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 23, ((PyObject *)__pyx_n_s__x_data_ptr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x_data_ptr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x_ind_ptr)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 24, ((PyObject *)__pyx_n_s__x_ind_ptr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x_ind_ptr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__xnnz)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 25, ((PyObject *)__pyx_n_s__xnnz)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__xnnz)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__eta)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 26, ((PyObject *)__pyx_n_s__eta)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__eta)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__p)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 27, ((PyObject *)__pyx_n_s__p)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__update)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 28, ((PyObject *)__pyx_n_s__update)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__update)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__sumloss)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 29, ((PyObject *)__pyx_n_s__sumloss)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sumloss)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 30, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__sample_weight)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 31, ((PyObject *)__pyx_n_s__sample_weight)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sample_weight)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__class_weight)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 32, ((PyObject *)__pyx_n_s__class_weight)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__class_weight)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__count)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 33, ((PyObject *)__pyx_n_s__count)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__count)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__epoch)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 34, ((PyObject *)__pyx_n_s__epoch)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__epoch)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 35, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__is_hinge)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 36, ((PyObject *)__pyx_n_s__is_hinge)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__is_hinge)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__q)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 37, ((PyObject *)__pyx_n_s__q)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__q)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__q_data_ptr)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 38, ((PyObject *)__pyx_n_s__q_data_ptr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__q_data_ptr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__u)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 39, ((PyObject *)__pyx_n_s__u)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__u)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t_start)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 40, ((PyObject *)__pyx_n_s__t_start)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t_start)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + __pyx_k_codeobj_19 = (PyObject*)__Pyx_PyCode_New(20, 0, 41, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_20, __pyx_n_s__plain_sgd, 327, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __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_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__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 initsgd_fast(void); /*proto*/ +PyMODINIT_FUNC initsgd_fast(void) +#else +PyMODINIT_FUNC PyInit_sgd_fast(void); /*proto*/ +PyMODINIT_FUNC PyInit_sgd_fast(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = 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_sgd_fast(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("sgd_fast"), __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[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "sklearn.linear_model.sgd_fast")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.linear_model.sgd_fast", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __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[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_sklearn__linear_model__sgd_fast) { + 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 ---*/ + __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_LossFunction = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_LossFunction; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_LossFunction.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_loss; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_LossFunction.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_12LossFunction_dloss; + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_LossFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_LossFunction.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_LossFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "LossFunction", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_LossFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_12linear_model_8sgd_fast_LossFunction = &__pyx_type_7sklearn_12linear_model_8sgd_fast_LossFunction; + __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_Regression; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Regression.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_LossFunction; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Regression.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_loss; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Regression.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_10Regression_dloss; + __pyx_type_7sklearn_12linear_model_8sgd_fast_Regression.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_LossFunction; + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_Regression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_Regression.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Regression", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_Regression) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Regression = &__pyx_type_7sklearn_12linear_model_8sgd_fast_Regression; + __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Classification = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_Classification; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Classification.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_LossFunction; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Classification.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_loss; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Classification.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_14Classification_dloss; + __pyx_type_7sklearn_12linear_model_8sgd_fast_Classification.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_LossFunction; + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_Classification) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_Classification.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Classification) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Classification", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_Classification) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Classification = &__pyx_type_7sklearn_12linear_model_8sgd_fast_Classification; + __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_ModifiedHuber = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_ModifiedHuber; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_ModifiedHuber.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Classification; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_ModifiedHuber.__pyx_base.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_loss; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_ModifiedHuber.__pyx_base.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_13ModifiedHuber_dloss; + __pyx_type_7sklearn_12linear_model_8sgd_fast_ModifiedHuber.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Classification; + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_ModifiedHuber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_ModifiedHuber.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_ModifiedHuber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ModifiedHuber", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_ModifiedHuber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_12linear_model_8sgd_fast_ModifiedHuber = &__pyx_type_7sklearn_12linear_model_8sgd_fast_ModifiedHuber; + __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Hinge = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_Hinge; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Hinge.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Classification; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Hinge.__pyx_base.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_loss; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Hinge.__pyx_base.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_5Hinge_dloss; + __pyx_type_7sklearn_12linear_model_8sgd_fast_Hinge.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Classification; + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_Hinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_Hinge.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Hinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Hinge", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_Hinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Hinge = &__pyx_type_7sklearn_12linear_model_8sgd_fast_Hinge; + __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredHinge = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredHinge; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredHinge.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_LossFunction; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredHinge.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_loss; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredHinge.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_12SquaredHinge_dloss; + __pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredHinge.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_LossFunction; + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredHinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredHinge.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredHinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "SquaredHinge", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredHinge) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredHinge = &__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredHinge; + __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Log = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_Log; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Log.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Classification; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Log.__pyx_base.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_loss; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Log.__pyx_base.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_3Log_dloss; + __pyx_type_7sklearn_12linear_model_8sgd_fast_Log.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Classification; + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_Log) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_Log.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Log) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Log", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_Log) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Log = &__pyx_type_7sklearn_12linear_model_8sgd_fast_Log; + __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredLoss = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredLoss; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredLoss.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredLoss.__pyx_base.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_loss; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredLoss.__pyx_base.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_11SquaredLoss_dloss; + __pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredLoss.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Regression; + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredLoss) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredLoss.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredLoss) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "SquaredLoss", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredLoss) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredLoss = &__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredLoss; + __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Huber = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_Huber; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Huber.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Huber.__pyx_base.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_loss; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_Huber.__pyx_base.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_5Huber_dloss; + __pyx_type_7sklearn_12linear_model_8sgd_fast_Huber.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Regression; + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_Huber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_Huber.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Huber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Huber", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_Huber) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Huber = &__pyx_type_7sklearn_12linear_model_8sgd_fast_Huber; + __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive.__pyx_base.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_loss; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive.__pyx_base.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_18EpsilonInsensitive_dloss; + __pyx_type_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Regression; + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "EpsilonInsensitive", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive = &__pyx_type_7sklearn_12linear_model_8sgd_fast_EpsilonInsensitive; + __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive = &__pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive.__pyx_base = *__pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_Regression; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive.__pyx_base.__pyx_base.loss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_loss; + __pyx_vtable_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive.__pyx_base.__pyx_base.dloss = (double (*)(struct __pyx_obj_7sklearn_12linear_model_8sgd_fast_LossFunction *, double, double, int __pyx_skip_dispatch))__pyx_f_7sklearn_12linear_model_8sgd_fast_25SquaredEpsilonInsensitive_dloss; + __pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive.tp_base = __pyx_ptype_7sklearn_12linear_model_8sgd_fast_Regression; + if (PyType_Ready(&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive.tp_dict, __pyx_vtabptr_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "SquaredEpsilonInsensitive", (PyObject *)&__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive = &__pyx_type_7sklearn_12linear_model_8sgd_fast_SquaredEpsilonInsensitive; + /*--- Type import code ---*/ + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector = __Pyx_ImportType("sklearn.utils.weight_vector", "WeightVector", sizeof(struct __pyx_obj_7sklearn_5utils_13weight_vector_WeightVector), 1); if (unlikely(!__pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5utils_13weight_vector_WeightVector = (struct __pyx_vtabstruct_7sklearn_5utils_13weight_vector_WeightVector*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5utils_13weight_vector_WeightVector->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5utils_13weight_vector_WeightVector)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset = __Pyx_ImportType("sklearn.utils.seq_dataset", "SequentialDataset", sizeof(struct __pyx_obj_7sklearn_5utils_11seq_dataset_SequentialDataset), 1); if (unlikely(!__pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5utils_11seq_dataset_SequentialDataset = (struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_SequentialDataset*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5utils_11seq_dataset_SequentialDataset->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5utils_11seq_dataset_SequentialDataset)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5utils_11seq_dataset_ArrayDataset = __Pyx_ImportType("sklearn.utils.seq_dataset", "ArrayDataset", sizeof(struct __pyx_obj_7sklearn_5utils_11seq_dataset_ArrayDataset), 1); if (unlikely(!__pyx_ptype_7sklearn_5utils_11seq_dataset_ArrayDataset)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5utils_11seq_dataset_ArrayDataset = (struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_ArrayDataset*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5utils_11seq_dataset_ArrayDataset->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5utils_11seq_dataset_ArrayDataset)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5utils_11seq_dataset_CSRDataset = __Pyx_ImportType("sklearn.utils.seq_dataset", "CSRDataset", sizeof(struct __pyx_obj_7sklearn_5utils_11seq_dataset_CSRDataset), 1); if (unlikely(!__pyx_ptype_7sklearn_5utils_11seq_dataset_CSRDataset)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5utils_11seq_dataset_CSRDataset = (struct __pyx_vtabstruct_7sklearn_5utils_11seq_dataset_CSRDataset*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5utils_11seq_dataset_CSRDataset->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5utils_11seq_dataset_CSRDataset)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "sklearn/linear_model/sgd_fast.pyx":11 + * + * + * import numpy as np # <<<<<<<<<<<<<< + * import sys + * from time import time + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "sklearn/linear_model/sgd_fast.pyx":12 + * + * import numpy as np + * import sys # <<<<<<<<<<<<<< + * from time import time + * + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "sklearn/linear_model/sgd_fast.pyx":13 + * import numpy as np + * import sys + * from time import time # <<<<<<<<<<<<<< + * + * from libc.math cimport exp, log, sqrt, pow, fabs + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__time)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__time)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__time)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__time), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__time); + if (__pyx_t_1 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__time); + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__time, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __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; + + /* "sklearn/linear_model/sgd_fast.pyx":22 + * from sklearn.utils.seq_dataset cimport SequentialDataset + * + * np.import_array() # <<<<<<<<<<<<<< + * + * + */ + import_array(); + + /* "sklearn/linear_model/sgd_fast.pyx":327 + * + * + * def plain_sgd(np.ndarray[DOUBLE, ndim=1, mode='c'] weights, # <<<<<<<<<<<<<< + * double intercept, + * LossFunction loss, + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_8sgd_fast_1plain_sgd, NULL, __pyx_n_s_21); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__plain_sgd, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "sklearn/linear_model/sgd_fast.pyx":1 + * # encoding: utf-8 # <<<<<<<<<<<<<< + * # cython: cdivision=True + * # cython: boundscheck=False + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init sklearn.linear_model.sgd_fast", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init sklearn.linear_model.sgd_fast"); + } + __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 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 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 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 void __Pyx_RaiseBufferFallbackError(void) { + PyErr_Format(PyExc_ValueError, + "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); +} + +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 void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +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; +} + +#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_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__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 (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } + #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 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 void __Pyx_RaiseImportError(PyObject *name) { +#if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_ImportError, "cannot import name %.230s", + PyString_AsString(name)); +#else + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); +#endif +} + +#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 +static PyObject *__Pyx_GetStdout(void) { + PyObject *f = PySys_GetObject((char *)"stdout"); + if (!f) { + PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); + } + return f; +} +static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { + int i; + if (!f) { + if (!(f = __Pyx_GetStdout())) + return -1; + } + Py_INCREF(f); + for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { + PyObject* v; + if (PyFile_SoftSpace(f, 1)) { + if (PyFile_WriteString(" ", f) < 0) + goto error; + } + v = PyTuple_GET_ITEM(arg_tuple, i); + if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) + goto error; + if (PyString_Check(v)) { + char *s = PyString_AsString(v); + Py_ssize_t len = PyString_Size(v); + if (len > 0 && + isspace(Py_CHARMASK(s[len-1])) && + s[len-1] != ' ') + PyFile_SoftSpace(f, 0); + } + } + if (newline) { + if (PyFile_WriteString("\n", f) < 0) + goto error; + PyFile_SoftSpace(f, 0); + } + Py_DECREF(f); + return 0; +error: + Py_DECREF(f); + return -1; +} +#else /* Python 3 has a print function */ +static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { + PyObject* kwargs = 0; + PyObject* result = 0; + PyObject* end_string; + if (unlikely(!__pyx_print)) { + __pyx_print = __Pyx_GetAttrString(__pyx_b, "print"); + if (!__pyx_print) + return -1; + } + if (stream) { + kwargs = PyDict_New(); + if (unlikely(!kwargs)) + return -1; + if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0)) + goto bad; + if (!newline) { + end_string = PyUnicode_FromStringAndSize(" ", 1); + if (unlikely(!end_string)) + goto bad; + if (PyDict_SetItemString(kwargs, "end", end_string) < 0) { + Py_DECREF(end_string); + goto bad; + } + Py_DECREF(end_string); + } + } else if (!newline) { + if (unlikely(!__pyx_print_kwargs)) { + __pyx_print_kwargs = PyDict_New(); + if (unlikely(!__pyx_print_kwargs)) + return -1; + end_string = PyUnicode_FromStringAndSize(" ", 1); + if (unlikely(!end_string)) + return -1; + if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) { + Py_DECREF(end_string); + return -1; + } + Py_DECREF(end_string); + } + kwargs = __pyx_print_kwargs; + } + result = PyObject_Call(__pyx_print, arg_tuple, kwargs); + if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) + Py_DECREF(kwargs); + if (!result) + return -1; + Py_DECREF(result); + return 0; +bad: + if (kwargs != __pyx_print_kwargs) + Py_XDECREF(kwargs); + return -1; +} +#endif + +#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 +static int __Pyx_PrintOne(PyObject* f, PyObject *o) { + if (!f) { + if (!(f = __Pyx_GetStdout())) + return -1; + } + Py_INCREF(f); + if (PyFile_SoftSpace(f, 0)) { + if (PyFile_WriteString(" ", f) < 0) + goto error; + } + if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) + goto error; + if (PyFile_WriteString("\n", f) < 0) + goto error; + Py_DECREF(f); + return 0; +error: + Py_DECREF(f); + return -1; + /* the line below is just to avoid C compiler + * warnings about unused functions */ + return __Pyx_Print(f, NULL, 0); +} +#else /* Python 3 has a print function */ +static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { + int res; + PyObject* arg_tuple = PyTuple_Pack(1, o); + if (unlikely(!arg_tuple)) + return -1; + res = __Pyx_Print(stream, arg_tuple, 1); + Py_DECREF(arg_tuple); + return res; +} +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +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 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; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + py_name = __Pyx_PyIdentifier_FromString(class_name); + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif + } + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + +static void* __Pyx_GetVtable(PyObject *dict) { + void* ptr; + PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); + if (!ob) + goto bad; +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + ptr = PyCapsule_GetPointer(ob, 0); +#else + ptr = PyCObject_AsVoidPtr(ob); +#endif + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +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 */ diff --git a/samples/Forth/KataDiversion.fth b/samples/Forth/KataDiversion.fth new file mode 100644 index 00000000..e20f40d7 --- /dev/null +++ b/samples/Forth/KataDiversion.fth @@ -0,0 +1,79 @@ +\ KataDiversion in Forth + +\ -- utils + +\ empty the stack +: EMPTY + DEPTH 0 <> IF BEGIN + DROP DEPTH 0 = + UNTIL + THEN ; + +\ power +: ** ( n1 n2 -- n1_pow_n2 ) 1 SWAP ?DUP IF 0 DO OVER * LOOP THEN NIP ; + +\ compute the highest power of 2 below N. +\ e.g. : 31 -> 16, 4 -> 4 +: MAXPOW2 ( n -- log2_n ) DUP 1 < IF 1 ABORT" Maxpow2 need a positive value." + ELSE DUP 1 = IF 1 + ELSE + 1 >R + BEGIN ( n |R: i=1) + DUP DUP I - 2 * + ( n n 2*[n-i]) + R> 2 * >R ( … |R: i*2) + > ( n n>2*[n-i] ) + UNTIL + R> 2 / + THEN + THEN NIP ; + +\ -- kata + +\ test if the given N has two adjacent 1 bits +\ e.g. : 11 -> 1011 -> -1 +\ 9 -> 1001 -> 0 +: ?NOT-TWO-ADJACENT-1-BITS ( n -- bool ) + \ the word uses the following algorithm : + \ (stack|return stack) + \ ( A N | X ) A: 0, X: N LOG2 + \ loop: if N-X > 0 then A++ else A=0 ; X /= 2 + \ return 0 if A=2 + \ if X=1 end loop and return -1 + 0 SWAP DUP DUP 0 <> IF + MAXPOW2 >R + BEGIN + DUP I - 0 >= IF + SWAP DUP 1 = IF 1+ SWAP + ELSE DROP 1 SWAP I - + THEN + ELSE NIP 0 SWAP + THEN + OVER + 2 = + I 1 = OR + R> 2 / >R + UNTIL + R> 2DROP + 2 <> + ELSE 2DROP INVERT + THEN ; + +\ return the maximum number which can be made with N (given number) bits +: MAX-NB ( n -- m ) DUP 1 < IF DROP 0 ( 0 ) + ELSE + DUP IF DUP 2 SWAP ** NIP 1 - ( 2**n - 1 ) + THEN + THEN ; + + +\ return the number of numbers which can be made with N (given number) bits +\ or less, and which have not two adjacent 1 bits. +\ see http://www.codekata.com/2007/01/code_kata_fifte.html +: HOW-MANY-NB-NOT-TWO-ADJACENT-1-BITS ( n -- m ) + DUP 1 < IF DUP 0 + ELSE + 0 SWAP + MAX-NB 1 + 0 DO I ?NOT-TWO-ADJACENT-1-BITS - LOOP + THEN ; + diff --git a/samples/Forth/block.fth b/samples/Forth/block.fth new file mode 100644 index 00000000..3c079b4b --- /dev/null +++ b/samples/Forth/block.fth @@ -0,0 +1,42 @@ +( Block words. ) + +variable blk +variable current-block + +: block ( n -- addr ) + current-block ! 0 ; + +: buffer ( n -- addr ) + current-block ! 0 ; + +\ evaluate (extended semantics) +\ flush ( -- ) + +: load ( ... n -- ... ) + dup current-block ! + blk ! + save-input + 0 >in ! + blk @ block ''source ! 1024 ''#source ! + ( interpret ) + restore-input ; + +\ save-buffers ( -- ) +\ update ( -- ) + +( Block extension words. ) + +\ empty-buffers ( -- ) + +variable scr + +: list ( n -- ) + dup scr ! + dup current-block ! + block 1024 bounds do i @ emit loop ; + +\ refill (extended semantics) + +: thru ( x y -- ) +1 swap do i load loop ; + +\ \ (extended semantics) diff --git a/samples/Forth/core-ext.fth b/samples/Forth/core-ext.fth new file mode 100644 index 00000000..d90832dc --- /dev/null +++ b/samples/Forth/core-ext.fth @@ -0,0 +1,136 @@ +\ -*- forth -*- Copyright 2004, 2013 Lars Brinkhoff + +\ Kernel: #tib +\ TODO: .r + +: .( ( "" -- ) + [char] ) parse type ; immediate + +: 0<> ( n -- flag ) 0 <> ; + +: 0> ( n -- flag ) 0 > ; + +\ Kernel: 2>r + +: 2r> ( -- x1 x2 ) ( R: x1 x2 -- ) r> r> r> rot >r swap ; + +: 2r@ ( -- x1 x2 ) ( R: x1 x2 -- x1 x2 ) 2r> 2dup 2>r ; + +: :noname align here 0 c, 15 allot lastxt dup @ , ! + [ ' enter >code @ ] literal , 0 , ] lastxt @ ; + +\ Kernel: <> + +\ : ?do ( n1 n2 -- ) ( R: -- loop-sys ) ( C: -- do-sys ) +\ here postpone 2>r unresolved branch here ; + +: again ( -- ) ( C: dest -- ) + postpone branch , ; immediate + +: string+ ( caddr -- addr ) + count + aligned ; + +: (c") ( -- caddr ) ( R: ret1 -- ret2 ) + r> dup string+ >r ; + +: c" ( "" -- caddr ) + postpone (c") [char] " parse dup c, string, ; immediate + +: case ( -- ) ( C: -- case-sys ) + 0 ; + +: compile, ( xt -- ) + , ; + +\ TODO: convert + +: endcase ( x -- ) ( C: case-sys -- ) + 0 do postpone then loop + postpone drop ; + +: endof ( -- ) ( C: case-sys1 of-sys -- case-sys2 ) + postpone else swap 1+ ; + +\ TODO: erase +\ TODO: expect + +: false ( -- 0 ) + 0 ; + +: hex ( -- ) + 16 base ! ; + +\ TODO: marker +\ Kernel: nip + +: of ( x x -- | x y -- x ) ( C: -- of-sys ) + postpone over postpone = postpone if postpone drop ; + +\ Kernel: pad +\ Kernel: parse + +: pick ( xn ... x0 n -- xn ... x0 xn ) + 2 + cells 'SP @ + @ ; + +: query ( -- ) + tib ''source ! #tib ''#source ! 0 'source-id ! + refill drop ; + +\ Kernel: refill +\ Kernel: restore-input + +\ TODO: roll ( xn xn-1 ... x0 n -- xn-1 ... x0 xn ) ; + +\ Kernel: save-input +\ Kernel: source-id +\ TODO: span +\ Kernel: tib + +: to ( x "word" -- ) + ' >body , ; + +: true ( -- -1 ) + -1 ; + +: tuck ( x y -- y x y ) + swap over ; + +\ TODO: u.r + +: u> ( x y -- flag ) + 2dup u< if 2drop false else <> then ; + +\ TODO: unused + +: value ( x "word" -- ) + create , + does> ( -- x ) + @ ; + +: within over - >r - r> u< ; + +\ TODO: [compile] + +\ Kernel: \ + +\ ---------------------------------------------------------------------- + +( Forth2012 core extension words. ) + +\ TODO: action-of + +\ TODO: buffer: + +: defer create ['] abort , does> @ execute ; + +: defer! ( xt2 xt1 -- ) >body ! ; + +: defer@ ( xt1 -- xt2 ) >body @ ; + +\ TODO: holds + +: is ( xt "word" -- ) ' defer! ; + +\ TODO: parse-name + +\ TODO: s\" diff --git a/samples/Forth/core.fth b/samples/Forth/core.fth new file mode 100644 index 00000000..4a13e217 --- /dev/null +++ b/samples/Forth/core.fth @@ -0,0 +1,252 @@ +: immediate lastxt @ dup c@ negate swap c! ; + +: \ source nip >in ! ; immediate \ Copyright 2004, 2012 Lars Brinkhoff + +: char \ ( "word" -- char ) + bl-word here 1+ c@ ; + +: ahead here 0 , ; + +: resolve here swap ! ; + +: ' bl-word here find 0branch [ ahead ] exit [ resolve ] 0 ; + +: postpone-nonimmediate [ ' literal , ' compile, ] literal , ; + +: create dovariable_code header, reveal ; + +create postponers + ' postpone-nonimmediate , + ' abort , + ' , , + +: word \ ( char "string" -- caddr ) + drop bl-word here ; + +: postpone \ ( C: "word" -- ) + bl word find 1+ cells postponers + @ execute ; immediate + +: unresolved \ ( C: "word" -- orig ) + postpone postpone postpone ahead ; immediate + +: chars \ ( n1 -- n2 ) + ; + +: else \ ( -- ) ( C: orig1 -- orig2 ) + unresolved branch swap resolve ; immediate + +: if \ ( flag -- ) ( C: -- orig ) + unresolved 0branch ; immediate + +: then \ ( -- ) ( C: orig -- ) + resolve ; immediate + +: [char] \ ( "word" -- ) + char postpone literal ; immediate + +: (does>) lastxt @ dodoes_code over >code ! r> swap >does ! ; + +: does> postpone (does>) ; immediate + +: begin \ ( -- ) ( C: -- dest ) + here ; immediate + +: while \ ( x -- ) ( C: dest -- orig dest ) + unresolved 0branch swap ; immediate + +: repeat \ ( -- ) ( C: orig dest -- ) + postpone branch , resolve ; immediate + +: until \ ( x -- ) ( C: dest -- ) + postpone 0branch , ; immediate + +: recurse lastxt @ compile, ; immediate + +: pad \ ( -- addr ) + here 1024 + ; + +: parse \ ( char "string" -- addr n ) + pad >r begin + source? if else 0 0 then + while + r@ c! r> 1+ >r + repeat 2drop pad r> over - ; + +: ( \ ( "string" -- ) + [ char ) ] literal parse 2drop ; immediate + \ TODO: If necessary, refill and keep parsing. + +: string, ( addr n -- ) + here over allot align swap cmove ; + +: (s") ( -- addr n ) ( R: ret1 -- ret2 ) + r> dup @ swap cell+ 2dup + aligned >r swap ; + +create squote 128 allot + +: s" ( "string" -- addr n ) + state @ if + postpone (s") [char] " parse dup , string, + else + [char] " parse >r squote r@ cmove squote r> + then ; immediate + +: (abort") ( ... addr n -- ) ( R: ... -- ) + cr type cr abort ; + +: abort" ( ... x "string" -- ) ( R: ... -- ) + postpone if postpone s" postpone (abort") postpone then ; immediate + +\ ---------------------------------------------------------------------- + +( Core words. ) + +\ TODO: # +\ TODO: #> +\ TODO: #s + +: and ( x y -- x&y ) nand invert ; + +: * 1 2>r 0 swap begin r@ while + r> r> swap 2dup dup + 2>r and if swap over + swap then dup + + repeat r> r> 2drop drop ; + +\ TODO: */mod + +: +loop ( -- ) ( C: nest-sys -- ) + postpone (+loop) postpone 0branch , postpone unloop ; immediate + +: space bl emit ; + +: ?.- dup 0 < if [char] - emit negate then ; + +: digit [char] 0 + emit ; + +: (.) base @ /mod ?dup if recurse then digit ; + +: ." ( "string" -- ) postpone s" postpone type ; immediate + +: . ( x -- ) ?.- (.) space ; + +: postpone-number ( caddr -- ) + 0 0 rot count >number dup 0= if + 2drop nip + postpone (literal) postpone (literal) postpone , + postpone literal postpone , + else + ." Undefined: " type cr abort + then ; + +' postpone-number postponers cell+ ! + +: / ( x y -- x/y ) /mod nip ; + +: 0< ( n -- flag ) 0 < ; + +: 1- ( n -- n-1 ) -1 + ; + +: 2! ( x1 x2 addr -- ) swap over ! cell+ ! ; + +: 2* ( n -- 2n ) dup + ; + +\ Kernel: 2/ + +: 2@ ( addr -- x1 x2 ) dup cell+ @ swap @ ; + +\ Kernel: 2drop +\ Kernel: 2dup + +\ TODO: 2over ( x1 x2 x3 x4 -- x1 x2 x3 x4 x1 x2 ) +\ 3 pick 3 pick ; + +\ TODO: 2swap + +\ TODO: <# + +: abs ( n -- |n| ) + dup 0< if negate then ; + +\ TODO: accept + +: c, ( n -- ) + here c! 1 chars allot ; + +: char+ ( n1 -- n2 ) + 1+ ; + +: constant create , does> @ ; + +: decimal ( -- ) + 10 base ! ; + +: depth ( -- n ) + data_stack 100 cells + 'SP @ - /cell / 2 - ; + +: do ( n1 n2 -- ) ( R: -- loop-sys ) ( C: -- do-sys ) + postpone 2>r here ; immediate + +\ TODO: environment? +\ TODO: evaluate +\ TODO: fill +\ TODO: fm/mod ) +\ TODO: hold + +: j ( -- x1 ) ( R: x1 x2 x3 -- x1 x2 x3 ) + 'RP @ 3 cells + @ ; + +\ TODO: leave + +: loop ( -- ) ( C: nest-sys -- ) + postpone 1 postpone (+loop) + postpone 0branch , + postpone unloop ; immediate + +: lshift begin ?dup while 1- swap dup + swap repeat ; + +: rshift 1 begin over while dup + swap 1- swap repeat nip + 2>r 0 1 begin r@ while + r> r> 2dup swap dup + 2>r and if swap over + swap then dup + + repeat r> r> 2drop drop ; + +: max ( x y -- max[x,y] ) + 2dup > if drop else nip then ; + +\ Kernel: min +\ TODO: mod +\ TODO: move + +: (quit) ( R: ... -- ) + return_stack 100 cells + 'RP ! + 0 'source-id ! tib ''source ! #tib ''#source ! + postpone [ + begin + refill + while + interpret state @ 0= if ." ok" cr then + repeat + bye ; + +' (quit) ' quit >body cell+ ! + +\ TODO: s>d +\ TODO: sign +\ TODO: sm/rem + +: spaces ( n -- ) + 0 do space loop ; + +\ TODO: u. + +: signbit ( -- n ) -1 1 rshift invert ; + +: xor ( x y -- x^y ) 2dup nand >r r@ nand swap r> nand nand ; + +: u< ( x y -- flag ) signbit xor swap signbit xor > ; + +\ TODO: um/mod + +: variable ( "word" -- ) + create /cell allot ; + +: ['] \ ( C: "word" -- ) + ' postpone literal ; immediate diff --git a/samples/Forth/tools.fth b/samples/Forth/tools.fth new file mode 100644 index 00000000..b08a29fe --- /dev/null +++ b/samples/Forth/tools.fth @@ -0,0 +1,133 @@ +\ -*- forth -*- Copyright 2004, 2013 Lars Brinkhoff + +( Tools words. ) + +: .s ( -- ) + [char] < emit depth (.) ." > " + 'SP @ >r r@ depth 1- cells + + begin + dup r@ <> + while + dup @ . + /cell - + repeat r> 2drop ; + +: ? @ . ; + +: c? c@ . ; + +: dump bounds do i ? /cell +loop cr ; + +: cdump bounds do i c? loop cr ; + +: again postpone branch , ; immediate + +: see-find ( caddr -- end xt ) + >r here lastxt @ + begin + dup 0= abort" Undefined word" + dup r@ word= if r> drop exit then + nip dup >nextxt + again ; + +: cabs ( char -- |char| ) dup 127 > if 256 swap - then ; + +: xt. ( xt -- ) + ( >name ) count cabs type ; + +: xt? ( xt -- flag ) + >r lastxt @ begin + ?dup + while + dup r@ = if r> 2drop -1 exit then + >nextxt + repeat r> drop 0 ; + +: disassemble ( x -- ) + dup xt? if + ( >name ) count + dup 127 > if ." postpone " then + cabs type + else + . + then ; + +: .addr dup . ; + +: see-line ( addr -- ) + cr ." ( " .addr ." ) " @ disassemble ; + +: see-word ( end xt -- ) + >r ." : " r@ xt. + r@ >body do i see-line /cell +loop + ." ;" r> c@ 127 > if ." immediate" then ; + +: see bl word see-find see-word cr ; + +: #body bl word see-find >body - ; + +: type-word ( end xt -- flag ) + xt. space drop 0 ; + +: traverse-dictionary ( in.. xt -- out.. ) + \ xt execution: ( in.. end xt2 -- in.. 0 | in.. end xt2 -- out.. true ) + >r here lastxt @ begin + ?dup + while + r> 2dup >r >r execute + if r> r> 2drop exit then + r> dup >nextxt + repeat r> 2drop ; + +: words ( -- ) + ['] type-word traverse-dictionary cr ; + +\ ---------------------------------------------------------------------- + +( Tools extension words. ) + +\ ;code + +\ assembler + +\ in kernel: bye + +\ code + +\ cs-pick + +\ cs-roll + +\ editor + +: forget ' dup >nextxt lastxt ! 'here ! reveal ; + +\ Kernel: state + +\ [else] + +\ [if] + +\ [then] + +\ ---------------------------------------------------------------------- + +( Forth2012 tools extension words. ) + +\ TODO: n>r + +\ TODO: nr> + +\ TODO: synonym + +: [undefined] bl-word find nip 0= ; immediate + +: [defined] postpone [undefined] invert ; immediate + +\ ---------------------------------------------------------------------- + +: @+ ( addr -- addr+/cell x ) dup cell+ swap @ ; + +: !+ ( x addr -- addr+/cell ) tuck ! cell+ ; + +: -rot swap >r swap r> ; diff --git a/samples/INI/filenames/.editorconfig b/samples/INI/filenames/.editorconfig new file mode 100644 index 00000000..b73ae712 --- /dev/null +++ b/samples/INI/filenames/.editorconfig @@ -0,0 +1,10 @@ +; editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/samples/Lasso/database.inc b/samples/Lasso/database.inc deleted file mode 100644 index 1757cc07..00000000 --- a/samples/Lasso/database.inc +++ /dev/null @@ -1,1351 +0,0 @@ -settable: removed reference for -table -2009-09-18 JS Syntax adjustments for Lasso 9 -2009-06-26 JS ->nextrecord: Added deprecation warning -2009-05-15 JS ->field: corrected the verification of the -index parameter -2009-01-09 JS Added a check before calling resultset_count so it will not break in Lasso versions before 8.5 -2009-01-09 JS ->_unknowntag: fixed incorrect debug_trace -2008-12-03 JS ->addrecord: improved how keyvalue is returned when adding records -2008-12-03 JS ->addrecord: inserting a generated keyvalue can now be suppressed by specifying -keyvalue=false -2008-12-03 JS ->saverecord and ->deleterecord will now use the current keyvalue (if any), so -keyvalue will not have to be specified in that case. -2008-11-25 JS ->field and ->recorddata will no longer touch current_record if it was zero -2008-11-24 JS ->field: Added -index parameter to be able to access any occurrence of the same field name -2008-11-24 JS Added -> records that returns a new data type knop_databaserows -2008-11-24 JS ->resultset_count: added support for -inlinename. -2008-11-24 JS Changed ->nextrecord to ->next. ->nextrecord remains supported for backwards compatibility. -2008-11-14 JS ->nextrecord resets the record pointer when reaching the last record -2008-11-13 JS ->recorddata now honors the current record pointer (as incremented by -nextrecord) -2008-11-13 JS ->recorddata: added -recordindex parameter so a specific record can be returned instead of the first found. -2008-10-30 JS ->getrecord now REALLY works with integer keyvalues (double oops) - I thought I fixed it 2008-05-28 but misplaced a paren... -2008-09-26 JS Added -> resultset_count corresponding to the same Lasso tag, so [resultset]...[/resultset] can now be used through the use of inlinename. -2008-09-10 JS -> getrecord, ->saverecord, ->deleterecord: Corrected handling of lock user to work better with knop_user -2008-07-09 JS ->saverecord: -keeplock now updates the lock timestamp -2008-05-28 JS ->getrecord now works with integer keyvalues (oops) -2008-05-27 JS ->get returns a new datatype knop_databaserow -2008-05-27 JS Added ->size and ->get so a database object can be iterated. When iterating each row is returned as an array of field values. -2008-05-27 JS Addedd ->nextrecord that increments the recordpointer each time it is called until the last record in the found set is reached. Returns true as long as there are more records. Useful in a while loop - see example below -2008-05-27 JS Implemented record pointer 'current_record'. The record pointer is reset for each new query. -2008-05-27 JS ->field: added -recordindex to get data from any record in the current found set -2008-05-27 JS Added ->_unknowntag as shortcut to field -2008-05-26 JS Removed onassign since it causes touble -2008-05-26 JS Extended field_names to return the field names for any specified table, return field names also for db objects that have never been used for a database query and optionally return field types -2008-01-29 JS ->getrecord now supports -sql. Make sure that the SQL statement includes the relevant keyfield (and lockfield if locking is used). -2008-01-10 JS ->capturesearchvars: error_code and error_msg was mysteriously not set after database operations that caused errors. -2008-01-08 JS ->saverecord: added flag -keeplock to be able to save a locked record without releasing the lock -2007-12-15 JS Adding support for knop_user in record locking is in progress. Done for ->oncreate and ->getrecord. -2007-12-11 JS Moved error_code and error_msg to knop_base -2007-12-11 JS Added documentation as -description to most member tags, to be used by the new ->help tag -2007-12-11 JS Moved ->help to knop_base -2007-12-10 JS Added ->settable to be able to copy an existing database object and properly set a new table name for it. Faster than creating a new instance from scratch. -2007-12-03 JS Corrected shown_first once again, hoping it's right this time -2007-11-29 JS Added support for field_names and corresponding member tag ->field_names -2007-11-05 JS Added var name to trace output -2007-10-26 JS ->capturesearchvars: corrected shown_first when no records found -2007-10-26 JS ->oncreate: added default value "keyfield" if the -keyfield parameter is not specified -2007-09-06 JS Corrected self -> 'tagtime' typo -2007-06-18 JS Added tag timer to most member tags -2007-06-13 JS added inheritance from knop_base -2007-06-11 JC added handling of xhtml output -2007-05-30 JS Changed recordid_value to keyfield_value and -recordid to -keyvalue -2007-05-28 JS ->oncreate: Added clearing of current error at beginning of tag -2007-04-19 JS Corrected the handling of -maxrecords and -skiprecords for SQL selects that have LIMIT specified -2007-04-19 JS Improved handling of foundrows so it finds any whitespace around SQL keywords, instead of just plain spaces -2007-04-18 JS ->select now populates recorddata with all the fields for the first found record. Previously it only populated recorddata when there was 1 found record. -2007-04-12 JS ->oncreate: Added authentication inline around Database_TableNames../Database_TableNames -2007-04-10 JS ->oncreate: Improved validation of table name (table_realname can sometimes be null even for valid table names) -2007-04-03 JS Changed namespace from mt_ to knop_ -2007-02-02 JS Improved reporting of Lasso error messaged in error_msg -2007-01-30 JS Added real error codes and additional error data for some errors (like record locked) -2007-01-30 JS Changed -keyvalue parameters to copy value instead of pass as reference, to not cause problems when using keyvalue from the same db object as is being updated, for example $db->(saverecord: -keyvalue=$db->keyvalue) -2007-01-26 JS Adjusted affectedrecord_keyvalue so it's only captured for -add and -update -2007-01-23 JS Supports -uselimit (or querys that use LIMIT) and still gets proper searchresult vars (using a separate COUNT(*) query) - may not always get the right result for example for queries with GROUP BY -2007-01-23 JS -keyfield can be specified for saverecord to override the default -2007-01-23 JS Changed name of ->updaterecord to ->saverecord -2007-01-23 JS Fixed bug where keyfield was missing as returnfield when looking up locked record for deleterecord -2007-01-23 JS Added ->field -2007-01-19 JS Added maxrecords_value and skiprecords_value to searchresultvars -2007-01-18 JS Added affectedrecord_keyvalue to make it possible to highlight affected record in record list (grid) - - -TODO: -Allow -keyfield to be specified for ->addrecord and ->deleterecord -Add some Active Record similar functionality for editing -Look at making it so -table can be set dynamically instead of fixed at oncreate, to eliminate the need for one db object for each table. This can cause problems with record locks and how they interact with knop_user -datetime_create and datetime_mod, and also user_create and user_mod. - Use default field names but allow to override at oncreate, and verify them at oncreate before trying to use them. - - -*/ - - // instance variables - // these variables are set once - local: 'database'=string, - 'table'=string, - 'table_realname'=string, // the actual table name, to be used in SQL statements (in case the table name is aliased in Lasso) - 'username'=string, - 'password'=string, - 'db_connect'=array, - 'host'=array, // add support for inline host method - 'datasource_name'=string, - 'isfilemaker'=false, - 'lock_expires'=1800, // seconds before a record lock expires - 'lock_seed'=knop_seed, // encryption seed for the record lock - 'error_lang'=(knop_lang: -default='en', -fallback), - 'user'=null, // knop_user that will be used for record locking - 'databaserows_map'=map; // map to hold databaserows for each inlinename - - // these variables are set for each query - local: 'inlinename'=string, // the inlinename that holds the result of the latest db operation - 'keyfield'=string, - 'keyvalue'=null, - 'affectedrecord_keyvalue'=null, // keyvalue of last added or updated record (not reset by other db actions) - 'lockfield'=string, - 'lockvalue'=null, - 'lockvalue_encrypted'=null, - 'timestampfield'=string, // for optimistic locking - 'timestampvalue'=string, - 'searchparams'=string, // the resulting pair array used in the database action - 'querytime'=integer, // query time in ms - // 'tagtime'=integer, moved to knop_base - 'recorddata'=map, // for single record results, a map of all returned db fields - 'error_data'=map, // additional data for certain errors - 'message'=string, // user message for normal result - 'current_record'=integer, // index of the current record to get field values from a specific record - 'field_names_map'=map, - 'resultset_count_map'=map; // resultset_count stored for each inlinename - // these vars have directly corresponding Lasso tags so they can be set programatically - local: 'searchresultvars'=(array: 'action_statement', 'found_count', 'shown_first', - 'shown_last', 'shown_count', 'field_names', 'records_array', 'maxrecords_value', 'skiprecords_value'); - iterate: #searchresultvars, (local: 'resultvar'); - local(#resultvar = null); - /iterate; - - local: 'errors_error_data'=(map: 7010, 7012, 7013, 7016, 7018, 7019); // these error codes can have more info in error_data map - - define_tag: 'oncreate', - -required='database', - -required='table', - -optional='host', // add support for inline host method - -optional='username', - -optional='password', - -optional='keyfield', - -optional='lockfield', - -optional='user', - -optional='validate'; // validate the database connection info (adds the overhead of making a test connection to the database) - local: 'timer'=knop_timer; - - // reset error - error_code = 0; - error_msg = error_noerror; - - // validate database and table names to make sure they exist in Lasso - (self -> 'datasource_name') = Lasso_DatasourceModuleName: #database; - fail_if: error_code != 0, error_code, error_msg; - - // store params as instance variables - local_defined('database') ? (self -> 'database') = @#database; - local_defined('table') ? (self -> 'table') = @#table; - local_defined('host') ? (self -> 'host') = @#host; // add support for inline host method - local_defined('username') ? (self -> 'username') = @#username; - local_defined('password') ? (self -> 'password') = @#password; - local_defined('lockfield') ? (self -> 'lockfield') = @#lockfield; - local_defined('user') ? (self -> 'user') = @#user; - // param has default value - (self -> 'keyfield') = (local_defined('keyfield') - ? @#keyfield // use parameter value - | 'keyfield'); // use default value - - - // build inline connection array - local_defined('database') ? (self -> 'db_connect') -> insert('-database' = @#database); - local_defined('table') ? (self -> 'db_connect') -> insert('-table' = @#table); - local_defined('host') ? (self -> 'db_connect') -> insert('-host' = @#host); // add support for inline host method - local_defined('username') ? (self -> 'db_connect') -> insert('-username' = @#username); - local_defined('password') ? (self -> 'db_connect') -> insert('-password' = @#password); - - (self -> 'table_realname') = (table_realname: #database, #table); - if: (self -> 'table_realname') == null; - // verify that the table exists even if table_realname is null - inline: (self -> 'db_connect'); - Database_TableNames: #database; - if: Database_TableNameItem == #table; - (self -> 'table_realname') = #table; - loop_abort; - /if; - /Database_TableNames; - /inline; - /if; - fail_if: (self -> 'table_realname') == null, 7001, self -> error_msg(7001); // The specified table was not found - - if: (local_defined: 'validate'); - // validate db connection - inline: (self -> 'db_connect'); - fail_if: error_code != 0, error_code, error_msg; - /inline; - /if; - - if: Lasso_DatasourceIsFilemaker: #database || Lasso_DatasourceIsFilemakerSA: #database; - (self -> 'isfilemaker') = true; - /if; - (self -> 'debug_trace') -> (insert: tag_name + ': creating database object on ' + (self -> 'datasource_name') +', isfilemaker: ' + (self -> 'isfilemaker') + ' at ' + (date -> (format: '%Q %T'))); - - self -> 'tagtime_tagname'=tag_name; - self -> 'tagtime'=integer: #timer; // cast to integer to trigger onconvert and to "stop timer" - - /define_tag; - - /* - define_tag: 'onassign', -required='value', -description='Internal, needed to restore references when ctype is defined as prototype'; - // recreate references here - (self -> 'user') = @(#value -> 'user'); - /define_tag; - */ - - define_tag('_unknowntag', -description='Shortcut to field'); - if((self -> 'field_names_map') >> tag_name); - return(self -> field(tag_name)); - else; - //fail(-9948, self -> type + '->' + tag_name + ' not known.'); - (self -> 'debug_trace') -> insert(self -> type + '->' + tag_name + ' not known.'); - /if; - /define_tag; - - define_tag: 'settable', -description='Changes the current table for a database object. Useful to be able to create \ - database objects faster by copying an existing object and just change the table name. This is a little bit faster \ - than creating a new instance from scratch, but no table validation is performed. Only do this to add database \ - objects for tables within the same database as the original database object. ', - -required='table', -type='string'; - local: 'timer'=knop_timer; - - (self -> 'error_code')=0; - (self -> 'error_msg')=string; - (self -> 'table_realname') = #table; - (self -> 'db_connect') -> removeall(#table); - (self -> 'db_connect') -> (insert: '-table' = #table); - (self -> 'table_realname') = (table_realname: self -> 'database', #table); - if: (self -> 'table_realname') == null; - // verify that the table exists even if table_realname is null - inline: (self -> 'db_connect'); - Database_TableNames: (self -> 'database'); - if: Database_TableNameItem == #table; - (self -> 'table_realname') = #table; - loop_abort; - /if; - /Database_TableNames; - /inline; - /if; - fail_if: (self -> 'table_realname') == null, 7001, self -> error_msg(7001); // The specified table was not found - self -> 'tagtime_tagname'=tag_name; - self -> 'tagtime'=integer: #timer; // cast to integer to trigger onconvert and to "stop timer" - /define_tag; - - define_tag: 'select', -description='perform database query, either Lasso-style pair array or SQL statement.\ - ->recorddata returns a map with all the fields for the first found record. \ - If multiple records are returned, the records can be accessed either through ->inlinename or ->records_array.\n\ - Parameters:\n\ - -search (optional array) Lasso-style search parameters in pair array\n\ - -sql (optional string) Raw sql query\n\ - -keyfield (optional) Overrides default keyfield, if any\n\ - -keyvalue (optional)\n\ - -inlinename (optional) Defaults to autocreated inlinename', - -optional='search', -type='array', - -optional='sql', -type='string', - -optional='keyfield', - -optional='keyvalue', -copy, - -optional='inlinename', -copy; - - knop_debug(self->type + ' -> ' + tag_name, -open, -type=self->type); - handle; - //knop_debug(-close, -witherrors, -type=self->type); - knop_debug('Done with ' + self->type + ' -> ' + tag_name, -close, -witherrors, -time); - /handle; - local: 'timer'=knop_timer; - - // clear all search result vars - self -> reset; - - local: '_search'=(local: 'search'), - '_sql'=(local: 'sql'); - if: #_search -> type != 'array'; - #_search = array; - /if; - if: #_sql != '' && (self -> 'isfilemaker'); - #_sql=''; - fail: 7009, self -> error_msg(7009); // sql can not be used with filemaker - /if; - // inlinename defaults to a random string - (self -> 'inlinename') = ((local: 'inlinename') != '' ? #inlinename | 'inline_' + knop_unique); - #_search -> (removeall: -inlinename); - #_search -> (insert: -inlinename=(self -> 'inlinename')); - - // remove all database actions from the search array - #_search -> (removeall: -search) & (removeall: -add) & (removeall: -delete) & (removeall: -update) - & (removeall: -sql) & (removeall: -nothing) & (removeall: -show) - // & (removeall: -table) // table is ok to override - & (removeall: -database); - - if: (local: 'sql') != '' && (string_findregexp: #sql, -find='\\bLIMIT\\b', -ignorecase) -> size; - (self -> 'debug_trace') -> (insert: tag_name + ': grabbing -maxrecords and -skiprecords from search array'); - // store maxrecords and skiprecords for later use - if: #_search >> '-maxrecords'; - (self -> 'maxrecords_value') = #_search -> (find: '-maxrecords') -> last -> value; - (self -> 'debug_trace') -> (insert: tag_name + ': -maxrecords value found in search array ' + (self -> 'maxrecords_value')); - /if; - if: #_search >> '-skiprecords'; - (self -> 'skiprecords_value') = #_search -> (find: '-skiprecords') -> last -> value; - (self -> 'debug_trace') -> (insert: tag_name + ': -skiprecords value found in search array ' + (self -> 'skiprecords_value')); - /if; - // remove skiprecords from the actual search parameters since it will conflict with LIMIT - #_search -> (removeall: '-skiprecords'); - /if; - - if: !(local_defined: 'keyfield') && (self -> 'keyfield') != ''; - local: 'keyfield'=(self -> 'keyfield'); - /if; - if: (local: 'keyfield') != ''; - #_search -> (removeall: '-keyfield'); - if: !(self -> 'isfilemaker'); - #_search -> (insert: '-keyfield'=#keyfield); - /if; - if: (local: 'keyvalue') != ''; - #_search -> (removeall: '-keyvalue'); - if: (self -> 'isfilemaker'); - #_search -> (insert: '-op'='eq'); - #_search -> (insert: #keyfield=#keyvalue); - else; - #_search -> (insert: '-keyvalue'=#keyvalue); - /if; - /if; - /if; - - // add sql action or normal search action - if: #_sql != ''; - #_search -> (insert: '-sql'=#_sql); - else; - #_search -> (insert: '-search'); - /if; - // perform database query, put connection parameters last to override any provided by the search parameters - //(self -> 'debug_trace') -> (insert: tag_name + ': search ' + #_search); - local: 'querytimer'=knop_timer; - inline: #_search,(self -> 'db_connect'); - (self -> 'querytime') = integer: #querytimer; - (self -> 'searchparams') = #_search; - (self -> 'debug_trace') -> (insert: tag_name ': action_statement ' + action_statement); - knop_debug(action_statement, -sql); - knop_debug(found_count ' found'); - self -> capturesearchvars; - /inline; - - self -> 'tagtime_tagname'=tag_name; - self -> 'tagtime'=integer: #timer; // cast to integer to trigger onconvert and to "stop timer" - (self -> 'debug_trace') -> (insert: tag_name + ': found ' (self -> 'found_count') + ' records in ' + (self -> 'querytime') + ' ms, tag time ' + (self -> 'tagtime') + ' ms, ' + (self -> error_msg) + ' ' + (self -> error_code)); - /define_tag; - - - define_tag: 'addrecord', -description='Add a new record to the database. A random string keyvalue will be generated unless a -keyvalue is specified. \n\ - Parameters:\n\ - -fields (required array) Lasso-style field values in pair array\n\ - -keyvalue (optional) If -keyvalue is specified, it must not already exist in the database. Specify -keyvalue=false to prevent generating a keyvalue. \n\ - -inlinename (optional) Defaults to autocreated inlinename', - -required='fields', -type='array', - -optional='keyvalue', -copy, - -optional='inlinename'; - local: 'timer'=knop_timer; - - // clear all search result vars - self -> reset; - local: '_fields'=#fields; - - // remove all database actions from the search array - #_fields -> (removeall: '-search') & (removeall: '-add') & (removeall: '-delete') & (removeall: '-update') - & (removeall: '-sql') & (removeall: '-nothing') & (removeall: '-show') - // & (removeall: '-table') // table is ok to override - & (removeall: '-database'); - - inline: (self -> 'db_connect'); // connection wrapper - if: (local: 'keyvalue') != '' && (local: 'keyvalue') !== false && (self -> 'keyfield')!=''; - // look for existing keyvalue - inline: -op='eq', (self -> 'keyfield')=#keyvalue, - -maxrecords=1, - -returnfield=(self -> 'keyfield'), - -search; - if: found_count > 0; - (self -> 'error_code') = 7017; // duplicate keyvalue - else; - (self -> 'keyvalue') = #keyvalue; - /if; - /inline; - /if; - - - if: (self -> 'error_code') == 0; - // proceed to add record - - if: (self -> 'keyfield') != ''; - if: (local: 'keyvalue') == '' && (local: 'keyvalue') !== false; - (self -> 'debug_trace') -> (insert: tag_name + ': generating keyvalue'); - // create unique keyvalue - (self -> 'keyvalue')=knop_unique; - /if; - #_fields -> (removeall: (self -> 'keyfield')); - #_fields -> (removeall: '-keyfield') & (removeall: '-keyvalue'); - #_fields -> (insert: '-keyfield'=(self -> 'keyfield')); - if: (local: 'keyvalue') !== false; - #_fields -> (insert: (self -> 'keyfield')=(self -> 'keyvalue')); - /if; - /if; - - // inlinename defaults to a random string - (self -> 'inlinename') = ((local: 'inlinename') != '' ? #inlinename | 'inline_' + knop_unique); - #_fields -> (removeall: '-inlinename'); - #_fields -> (insert: '-inlinename'=(self -> 'inlinename')); - - local: 'querytimer'=knop_timer; - inline: #_fields, -add; - (self -> 'querytime') = integer: #querytimer; - (self -> 'searchparams') = #_fields; - - self -> capturesearchvars; - if: error_code != 0; - (self -> 'keyvalue') = null; - /if; - /inline; - /if; - /inline; - self -> 'tagtime_tagname'=tag_name; - self -> 'tagtime'=integer: #timer; // cast to integer to trigger onconvert and to "stop timer" - (self -> 'debug_trace') -> (insert: tag_name + ': ' + (self -> error_msg) + ' ' + (self -> error_code) - + ' keyvalue ' + (self -> 'keyvalue') + ' ' + (self -> 'tagtime') + ' ms'); - /define_tag; - - - define_tag: 'getrecord', -description='Returns a single specific record from the database, optionally locking the record. \ - If the keyvalue matches multiple records, an error is returned. \n\ - Parameters:\n\ - -keyvalue (optional) Uses a previously set keyvalue if not specified. If no keyvalue is available, an error is returned unless -sql is used. \n\ - -keyfield (optional) Temporarily override of keyfield specified at oncreate\n\ - -inlinename (optional) Defaults to autocreated inlinename\n\ - -lock (optional flag) If flag is specified, a record lock will be set\n\ - -user (optional) The user who is locking the record (required if using lock)\n\ - -sql (optional) SQL statement to use instead of keyvalue. Must include the keyfield (and lockfield of locking is used).', - -optional='keyvalue', -copy, - -optional='keyfield', - -optional='inlinename', -copy, - -optional='lock', - -optional='user', -copy, - -optional='sql', -type='string'; - local: 'timer'=knop_timer; - - local: '_sql'=(local: 'sql'); - - if: #_sql != '' && (self -> 'isfilemaker'); - #_sql=''; - fail: 7009, self -> error_msg(7009); // sql can not be used with filemaker - /if; - - // get existing record pointer if any - if: #_sql -> size == 0 && !(local_defined: 'keyvalue'); - local: 'keyvalue'=(self -> 'keyvalue'); - else: !(local_defined: 'keyvalue'); - local: 'keyvalue'=string; - /if; - - // clear all search result vars - self -> reset; - - fail_if: !(local_defined: 'keyfield') && (self -> 'keyfield') == '', 7002, self -> error_msg(7002); // Keyfield not specified - if: (local_defined: 'lock') && #lock != false; - fail_if: (self -> 'lockfield') == '', 7003, self -> error_msg(7003); // Lockfield must be specified to get record with lock - if: !(local_defined: 'user') && ((self -> 'user') != '' || (self -> 'user') -> isa('user')); - // use user from database object - local('user' = (self -> 'user')); - /if; - fail_if: (local: 'user') == '' && !((local: 'user') -> isa('user')), 7004, self -> error_msg(7004); // User must be specified to get record with lock - (self -> 'debug_trace') -> insert(tag_name ': user is type ' + (#user -> type) + ', isa(user) = ' + (#user -> isa('user')) ); - if: #user -> isa('user'); - #user= #user -> id_user; - fail_if: #user == '', 7004, self -> error_msg(7004); // User must be logged in to get record with lock - /if; - (self -> 'debug_trace') -> insert(tag_name ': user id is ' + #user); - /if; - if: !(local_defined: 'keyfield') && (self -> 'keyfield') != ''; - local: 'keyfield'=(self -> 'keyfield'); - /if; - if: #_sql -> size == 0 && string(#keyvalue) -> size == 0; - (self -> 'error_code') = 7007; // keyvalue missing - /if; - if: (self -> 'error_code') == 0; - inline: (self -> 'db_connect'); // connection wrapper - - if: #_sql -> size; - self -> (select: -sql=#_sql, -inlinename=(local: 'inlinename')); - #keyvalue = (self -> 'keyvalue'); - else; - self -> (select: -keyfield=#keyfield, -keyvalue=#keyvalue, -inlinename=(local: 'inlinename')); - /if; - if: (self -> field_names) !>> #keyfield; - (self -> 'error_code') = 7020; // Keyfield not present in query - /if; - if: (self -> field_names) !>> (self -> 'lockfield') && (local_defined: 'lock') && #lock != false; - (self -> 'error_code') = 7021; // Lockfield not present in query - /if; - - if: (self -> 'found_count') == 0 && (self -> 'error_code') == 0; - (self -> 'error_code') = -1728; - else: (self -> 'found_count') > 1 && (self -> 'error_code') == 0; - self -> reset; - (self -> 'error_code') = 7008; // keyvalue not unique - /if; - - - // handle record locking - if: (self -> 'error_code') == 0 && (local_defined: 'lock') && #lock != false; - // check for current lock - if: (self -> 'lockvalue') != ''; - // there is a lock already set, check if it has expired or if it is the same user - local: 'lockvalue'=(self -> 'lockvalue') -> (split: '|'); - local: 'lock_timestamp'=date: (#lockvalue->size > 1 ? #lockvalue -> (get: 2) | null); - local: 'lock_user'=#lockvalue -> first; - if: (date - #lock_timestamp) -> seconds < (self -> 'lock_expires') - && #lock_user != #user; - // the lock is still valid and it is locked by another user - // this is not a real error, more a warning condition - (self -> 'error_code') = 7010; - (self -> 'error_data') = (map: 'user' = #lock_user, 'timestamp' = #lock_timestamp); - (self -> 'keyvalue') = null; - (self -> 'debug_trace') -> (insert: tag_name ': record ' + #keyvalue + ' was already locked by ' + #lock_user + '.'); - /if; - /if; - if: (self -> 'error_code') == 0; - // go ahead and lock record - (self -> 'lockvalue') = #user + '|' + (date -> format: '%Q %T'); - (self -> 'lockvalue_encrypted') = (encrypt_blowfish: (self -> 'lockvalue'), -seed=(self -> 'lock_seed')); - local: 'keyvalue_temp'=#keyvalue; - if: (self -> 'isfilemaker'); - // find internal keyvalue - inline: -op='eq', #keyfield=#keyvalue, - -search; - if: found_count == 1; - #keyvalue_temp=keyfield_value; - (self -> 'debug_trace') -> (insert: tag_name + ': will set record lock for FileMaker record id ' + keyfield_value + ' ' + error_msg + ' ' + error_code); - else; - (self -> 'debug_trace') -> (insert: tag_name + ': could not get record id for FileMaker record, ' found_count + ' found ' + + error_msg + ' ' + error_code); - /if; - /inline; - /if; - inline: -keyfield=#keyfield, - -keyvalue=#keyvalue_temp, - (self -> 'lockfield')=(self -> 'lockvalue'), - -update; - if: error_code; - (self -> 'error_code') = 7012; // could not set record lock - (self -> 'error_data') = (map: 'error_code'=error_code, 'error_msg'=error_msg); - (self -> 'lockvalue') = null; - (self -> 'lockvalue_encrypted') = null; - (self -> 'keyvalue') = null; - else; - // lock was set ok - (self -> 'debug_trace') -> (insert: tag_name + ': set record lock ' + (self -> 'lockvalue') + ' ' + (self -> 'lockvalue_encrypted')); - if: (self -> 'user') -> isa('user'); - // tell user it has locked a record in this db object - (self -> 'user') -> addlock(-dbname=self -> varname); - /if; - /if; - /inline; - /if; - /if; - - /inline; - /if; - self -> 'tagtime_tagname'=tag_name; - self -> 'tagtime'=integer: #timer; // cast to integer to trigger onconvert and to "stop timer" - (self -> 'debug_trace') -> (insert: tag_name + ': ' + (self -> error_msg) + ' ' + (self -> error_code) + ' ' + (self -> 'tagtime') + ' ms'); - /define_tag; - - - define_tag: 'saverecord', -description='Updates a specific database record. \n\ - Parameters:\n\ - -fields (required array) Lasso-style field values in pair array\n\ - -keyfield (optional) Keyfield is ignored if lockvalue is specified\n\ - -keyvalue (optional) Keyvalue is ignored if lockvalue is specified\n\ - -lockvalue (optional) Either keyvalue or lockvalue must be specified\n\ - -keeplock (optional flag) Avoid clearing the record lock when saving. Updates the lock timestamp.\n\' - -user (optional) If lockvalue is specified, user must be specified as well\n\ - -inlinename (optional) Defaults to autocreated inlinename', - -required='fields', -type='array', - -optional='keyfield', - -optional='keyvalue', -copy, - -optional='lockvalue', -copy, - -optional='keeplock', - -optional='user', -copy, - -optional='inlinename', -copy; - - local: 'timer'=knop_timer; - - if(!local_defined('keyvalue') && string(self -> 'keyvalue') -> size); - // use current record's keyvalue if any - local('keyvalue'=(self -> 'keyvalue')); - /if; - - // clear all search result vars - self -> reset; - - fail_if: !(local_defined: 'keyvalue') && !(local_defined: 'lockvalue'), 7005, self -> error_msg(7005); // Either keyvalue or lockvalue must be specified for update or delete - fail_if: (local_defined: 'keyvalue') && (self -> 'keyfield') == '' && (local: 'keyfield') == '', 7002, self -> error_msg(7002); // Keyfield not specified - if: (local_defined: 'lockvalue'); - fail_if: (self -> 'lockfield') == '', 7003, self -> error_msg(7003); // Lockfield not specified - if: !(local_defined: 'user') && ((self -> 'user') != '' || (self -> 'user') -> isa('user')); - // use user from database object - local('user' = (self -> 'user')); - /if; - fail_if: (local: 'user') == '' && !((local: 'user') -> isa('user')), 7004, self -> error_msg(7004); - (self -> 'debug_trace') -> insert(tag_name ': user is type ' + (#user -> type) + ', isa(user) = ' + (#user -> isa('user')) ); - if: #user -> isa('user'); - #user= #user -> id_user; - fail_if: #user == '', 7004, self -> error_msg(7004); // User must be logged in to get record with lock - /if; - (self -> 'debug_trace') -> insert(tag_name ': user id is ' + #user); - /if; - - !(local_defined: 'keyfield') ? local: 'keyfield'=self -> 'keyfield'; - - local: '_fields'=#fields; - - // remove all database actions from the search array - #_fields -> (removeall: '-search') & (removeall: '-add') & (removeall: '-delete') & (removeall: '-update') - & (removeall: '-sql') & (removeall: '-nothing') & (removeall: '-show') - // & (removeall: '-table') // table is ok to override - & (removeall: '-database'); - #_fields -> (removeall: '-keyfield') & (removeall: '-keyvalue'); - - inline: (self -> 'db_connect'); // connection wrapper - - // handle record locking - if: (self -> 'error_code') == 0 && (local: 'lockvalue') != ''; - - // first check if record was locked by someone else, and that lock is still valid - local: 'lock'=(decrypt_blowfish: #lockvalue, -seed=(self -> 'lock_seed')) -> (split: '|'); - local: 'lock_timestamp'=date: (#lock->size > 1 ? (#lock -> (get: 2)) | null); - local: 'lock_user'=#lock -> first; - if: (date - #lock_timestamp) -> seconds < (self -> 'lock_expires') - && #lock_user != #user; - // the lock is still valid and it is locked by another user - (self -> 'error_code') = 7010; - (self -> 'error_data') = (map: 'user' = #lock_user, 'timestamp' = #lock_timestamp); - /if; - - // check that the current lock is still valid - if: (self -> 'error_code') == 0; - inline: -op='eq', (self -> 'lockfield')=#lock -> (join: '|'), - -maxrecords=1, - -returnfield=(self -> 'lockfield'), - -returnfield=(self -> 'keyfield'), - -search; - if: error_code == 0 && found_count != 1; - // lock is not valid any more - (self -> 'error_code') = 7011; // Update failed, record lock not valid any more - else: error_code != 0; - (self -> 'error_code') = 7018; // Update error - (self -> 'error_data') = (map: 'error_code'=error_code, 'error_msg'=error_msg); - else; - // lock OK, grab keyvalue for update - local: 'keyvalue'=(field: (self -> 'keyfield')); - /if; - /inline; - /if; - - if: (self -> 'error_code') == 0; - // go ahead and release record lock by clearing the field value in the update fields array - #_fields -> (removeall: (self -> 'lockfield')); - if: ((local_defined: 'keeplock') && #keeplock != false); - // update the lock timestamp - (self -> 'lockvalue') = #user + '|' + (date -> format: '%Q %T'); - (self -> 'lockvalue_encrypted') = (encrypt_blowfish: (self -> 'lockvalue'), -seed=(self -> 'lock_seed')); - #_fields -> (insert: (self -> 'lockfield')=(self -> 'lockvalue')); - else; - #_fields -> (insert: (self -> 'lockfield') = ''); - /if; - /if; - - /if; - - if: (self -> 'error_code') == 0 && (local: 'keyvalue') != ''; - if: (self -> 'isfilemaker'); - inline: -op='eq', #keyfield=#keyvalue, -search; - if: found_count == 1; - #_fields -> (insert: '-keyvalue'=keyfield_value); - (self -> 'debug_trace') -> (insert: tag_name + ': FileMaker record id ' + keyfield_value); - /if; - /inline; - else; - #_fields -> (insert: '-keyfield'=#keyfield); - #_fields -> (insert: '-keyvalue'=#keyvalue); - /if; - /if; - - - - if: (#_fields >> '-keyfield' && #_fields -> (find: '-keyfield') -> first -> value != '' || (self -> 'isfilemaker')) - && #_fields >> '-keyvalue' && #_fields -> (find: '-keyvalue') -> first -> value != ''; - // ok to update - else: (self -> 'error_code') == 0; - (self -> 'error_code') = 7006; // Update failed, keyfield or keyvalue missing'; - /if; - - // update record - if: (self -> 'error_code') == 0; - - // inlinename defaults to a random string - (self -> 'inlinename') = ((local: 'inlinename') != '' ? #inlinename | 'inline_' + knop_unique); - #_fields -> (removeall: '-inlinename'); - #_fields -> (insert: '-inlinename'=(self -> 'inlinename')); - - local: 'querytimer'=knop_timer; - inline: #_fields, -update; - (self -> 'querytime') = integer: #querytimer; - (self -> 'searchparams') = #_fields; - self -> capturesearchvars; - /inline; - /if; - /inline; - - self -> 'tagtime_tagname'=tag_name; - self -> 'tagtime'=integer: #timer; // cast to integer to trigger onconvert and to "stop timer" - (self -> 'debug_trace') -> (insert: tag_name + ': ' + (self -> 'keyvalue') + ' '+ (self -> error_msg) + ' ' + (self -> error_code) + ' ' + (self -> 'tagtime') + ' ms'); - /define_tag; - - - define_tag: 'deleterecord', -description='Deletes a specific database record. \n\ - Parameters:\n\ - -keyvalue (optional) Keyvalue is ignored if lockvalue is specified\n\ - -lockvalue (optional) Either keyvalue or lockvalue must be specified\n\ - -user (optional) If lockvalue is specified, user must be specified as well', - -optional='keyvalue', -copy, - -optional='lockvalue', -copy, - -optional='user'; - local: 'timer'=knop_timer; - - if(!local_defined('keyvalue') && string(self -> 'keyvalue') -> size); - // use current record's keyvalue if any - local('keyvalue'=(self -> 'keyvalue')); - /if; - - // clear all search result vars - self -> reset; - - fail_if: !(local_defined: 'keyvalue') && !(local_defined: 'lockvalue'), 7005, self -> error_msg(7005); // Either keyvalue or lockvalue must be specified for update or delete - fail_if: (local_defined: 'keyvalue') && (self -> 'keyfield') == '', 7002, self -> error_msg(7002); // Keyfield not specified - if: (local_defined: 'lockvalue'); - fail_if: (self -> 'lockfield') == '', 7003, self -> error_msg(7003); // Lockfield not specified - if: !(local_defined: 'user') && ((self -> 'user') != '' || (self -> 'user') -> isa('user')); - // use user from database object - local('user' = (self -> 'user')); - /if; - fail_if: (local: 'user') == '' && !((local: 'user') -> isa('user')), 7004, self -> error_msg(7004); - (self -> 'debug_trace') -> insert(tag_name ': user is type ' + (#user -> type) + ', isa(user) = ' + (#user -> isa('user')) ); - if: #user -> isa('user'); - #user= #user -> id_user; - fail_if: #user == '', 7004, self -> error_msg(7004); // User must be logged in to get record with lock - /if; - (self -> 'debug_trace') -> insert(tag_name ': user id is ' + #user); - /if; - - local: '_fields'=array; - - inline: (self -> 'db_connect'); // connection wrapper - - // handle record locking - if: (self -> 'error_code') == 0 && (local: 'lockvalue') != ''; - - // first check if record was locked by someone else, and that lock is still valid - local: 'lockvalue'=(decrypt_blowfish: #lockvalue, -seed=(self -> 'lock_seed')) -> (split: '|'); - local: 'lock_timestamp'=date: (#lockvalue->size > 1 ? #lockvalue -> (get: 2) | null); - local: 'lock_user'=(#lockvalue -> first); - if: (date - #lock_timestamp) -> seconds < (self -> 'lock_expires') - && #lock_user != #user; - // the lock is still valid and it is locked by another user - (self -> 'error_code') = 7010; // Delete failed, record locked - (self -> 'error_data') = (map: 'user' = #lock_user, 'timestamp' = #lock_timestamp); - /if; - - // check that the current lock is still valid - if: (self -> 'error_code') == 0; - inline: -op='eq', (self -> 'lockfield')=#lockvalue -> (join: '|'), - -maxrecords=1, - -returnfield=(self -> 'lockfield'), - -returnfield=(self -> 'keyfield'), - -search; - if: error_code == 0 && found_count != 1; - // lock is not valid any more - (self -> 'error_code') = 7011; // Delete failed, record lock not valid any more'; - else: error_code != 0; - (self -> 'error_code') = 7019; // delete error - (self -> 'error_data') = (map: 'error_code'=error_code, 'error_msg'=error_msg); - else; - // lock OK, grab keyvalue for update - local: 'keyvalue'=(field: (self -> 'keyfield')); - (self -> 'debug_trace') -> (insert: tag_name + ': got keyvalue ' + #keyvalue + ' for keyfield ' + (self -> 'keyfield')); - /if; - /inline; - /if; - - /if; - - if: (self -> 'error_code') == 0 && (local: 'keyvalue') != ''; - if: (self -> 'isfilemaker'); - inline: -op='eq', (self -> 'keyfield')=#keyvalue, -search; - if: found_count == 1; - #_fields -> (insert: '-keyvalue'=keyfield_value); - (self -> 'debug_trace') -> (insert: tag_name + ': FileMaker record id ' + keyfield_value); - /if; - /inline; - else; - #_fields -> (insert: '-keyfield'=(self -> 'keyfield')); - #_fields -> (insert: '-keyvalue'=#keyvalue); - /if; - /if; - - (self -> 'debug_trace') -> (insert: tag_name + ': will delete record with params ' + #_fields); - - if: (#_fields >> '-keyfield' && #_fields -> (find: '-keyfield') -> first -> value != '' || (self -> 'isfilemaker')) - && #_fields >> '-keyvalue' && #_fields -> (find: '-keyvalue') -> first -> value != ''; - // ok to delete - else; - (self -> 'error_code') = 7006; // Delete failed, keyfield or keyvalue missing - /if; - - // delete record - if: (self -> 'error_code') == 0; - - local: 'querytimer'=knop_timer; - inline: #_fields, -delete; - (self -> 'querytime') = integer: #querytimer; - (self -> 'searchparams') = #_fields; - - self -> capturesearchvars; - - /inline; - /if; - /inline; - - self -> 'tagtime_tagname'=tag_name; - self -> 'tagtime'=integer: #timer; // cast to integer to trigger onconvert and to "stop timer" - (self -> 'debug_trace') -> (insert: tag_name + ': ' + (self -> error_msg) + ' ' + (self -> error_code) + ' ' + (self -> 'tagtime') + ' ms'); - /define_tag; - - - define_tag: 'clearlocks', -description='Release all record locks for the specified user, suitable to use when showing record list. \n\ - Parameters:\n\ - -user (required) The user to unlock records for', - -required='user'; - // release all record locks for the specified user, suitable to use when showing record list - local: 'timer'=knop_timer; - - fail_if: (self -> 'lockfield') == '', 7003, self -> error_msg(7003); // Lockfield not specified - fail_if: #user == '', 7004, self -> error_msg(7004); // User not specified - - if: (self -> 'isfilemaker'); - inline: (self -> 'db_connect'), - -maxrecords=all, - (self -> 'lockfield')='"' + #user + '|"', - -search; - if: found_count > 0; - (self -> 'debug_trace') -> (insert: tag_name + ': clearing locks for ' + #user + ' in ' + found_count + ' FileMaker records ' + error_msg + ' ' + error_code); - records; - inline: -keyvalue=keyfield_value, - (self -> 'lockfield')='', - -update; - if: error_code; - (self -> 'error_code') = 7013; // Clearlocks failed - (self -> 'error_data') = (map: 'error_code'=error_code, 'error_msg'=error_msg); - (self -> 'debug_trace') -> (insert: tag_name + ': error when clearing lock on FileMaker record ' + keyfield_value + ' ' + error_msg + ' ' + error_code); - return; - /if; - /inline; - /records; - else: error_code; - (self -> 'error_code') = 7013; // Clearlocks failed - (self -> 'error_data') = (map: 'error_code'=error_code, 'error_msg'=error_msg); - /if; - /inline; - else; - inline: (self -> 'db_connect'), - -sql='UPDATE `' + (self -> 'table_realname') + '` SET `' + (self -> 'lockfield') + '`="" WHERE `' + (self -> 'lockfield') - + '` LIKE "' + (encode_sql: #user) + '|%"'; - if: error_code != 0; - (self -> 'error_code') = 7013; // Clearlocks failed - (self -> 'error_data') = (map: 'error_code'=error_code, 'error_msg'=error_msg); - /if; - /inline; - (self -> 'debug_trace') -> (insert: tag_name + ': clearing all locks for ' + #user + ' ' + (self -> error_msg) + ' ' + (self -> error_code)); - /if; - self -> 'tagtime_tagname'=tag_name; - self -> 'tagtime'=integer: #timer; // cast to integer to trigger onconvert and to "stop timer" - /define_tag; - - define_tag: 'action_statement'; return: (self -> 'action_statement'); /define_tag; - define_tag: 'found_count'; return: (self -> 'found_count'); /define_tag; - define_tag: 'shown_count'; return: (self -> 'shown_count'); /define_tag; - define_tag: 'shown_first'; return: (self -> 'shown_first'); /define_tag; - define_tag: 'shown_last'; return: (self -> 'shown_last'); /define_tag; - define_tag: 'maxrecords_value'; return: (self -> 'maxrecords_value'); /define_tag; - define_tag: 'skiprecords_value'; return: (self -> 'skiprecords_value'); /define_tag; - define_tag: 'keyfield'; return: (self -> 'keyfield'); /define_tag; - define_tag: 'keyvalue'; return: (self -> 'keyvalue'); /define_tag; - define_tag: 'lockfield'; return: (self -> 'lockfield'); /define_tag; - define_tag: 'lockvalue'; return: (self -> 'lockvalue'); /define_tag; - define_tag: 'lockvalue_encrypted'; return: (self -> 'lockvalue_encrypted'); /define_tag; - define_tag: 'querytime'; return: (self -> 'querytime'); /define_tag; - define_tag: 'inlinename'; return: (self -> 'inlinename'); /define_tag; - define_tag: 'searchparams'; return: (self -> 'searchparams'); /define_tag; - define_tag: 'resultset_count', - -optional='inlinename'; - !local_defined('inlinename') ? local('inlinename'=(self -> 'inlinename')); - return((self -> 'resultset_count_map') -> find(#inlinename)); - /define_tag; - - define_tag('recorddata', -description='A map containing all fields, only available for single record results', - -optional='recordindex', -copy); - !local_defined('recordindex') ? local('recordindex'=(self -> 'current_record')); - #recordindex < 1 ? #recordindex = 1; - if(#recordindex == 1); - // return default (i.e. first) record - return(self -> 'recorddata'); - else; - local('recorddata'=map); - iterate(self -> field_names, local('field_name')); - #recorddata -> insert(#field_name = (self -> 'records_array' -> get(#recordindex) - -> get(self -> 'field_names_map' -> find(#field_name)))); - /iterate; - return(#recorddata); - /if; - /define_tag; - - define_tag: 'records_array'; return: (self -> 'records_array'); /define_tag; - - define_tag('field_names', -description='Returns an array of the field names from the last database query. If no database query has been performed, a "-show" request is performed. \n\ - Parameters: \n\ - -table (optional) Return the field names for the specified table\n\ - -types (optional flag) If specified, returns a pair array with fieldname and corresponding Lasso data type', - -optional='table', - -optional='types'); - !local_defined('table') ? local('table'=(self -> 'table')); - local('field_names'=(self -> 'field_names')); - if(#field_names -> size == 0 || (local_defined('types') && #types != false)); - #field_names=array; - if(local_defined('types') && #types != false); - local('types_mapping'=map('text'='string', 'number'='decimal', 'date/time'='date')); - /if; - inline(self->'db_connect', -table=#table, -show); - if(local_defined('types') && #types != false); - loop(field_name(-count)); - #field_names -> insert(field_name(loop_count) = #types_mapping->find(field_name(loop_count, -type))); - /loop; - else; - #field_names=field_names; - /if; - /inline; - /if; - return(@#field_names); - /define_tag; - - define_tag('table_names', -description='Returns an array with all table names for the database'); - local('table_names'=array); - inline(self -> 'db_connect'); - Database_TableNames(self -> 'database'); - #table_names -> insert(Database_TableNameItem); - /Database_TableNames; - /inline; - return(@#table_names); - /define_tag; - - define_tag: 'error_data', -description='Returns more info for those errors that provide such'; - if: (self -> 'errors_error_data') >> (self -> error_code); - return: (self -> 'error_data'); - else; - return: map; - /if; - /define_tag; - - define_tag('size'); - return(self -> 'shown_count'); - /define_tag; - - define_tag('get', -required='index'); - return(knop_databaserow( - -record_array=(self -> 'records_array' -> get(#index)), - -field_names=(self -> 'field_names'))); - /define_tag; - - define_tag('records', -description='Returns all found records as a knop_databaserows object', - -optional='inlinename'); - !local_defined('inlinename') ? local('inlinename'=(self -> 'inlinename')); - if((self -> 'databaserows_map') !>> #inlinename); - // create knop_databaserows on demand - (self -> 'databaserows_map') -> insert(#inlinename = knop_databaserows( - -records_array=(self -> 'records_array'), - -field_names=(self -> 'field_names')) - ); - /if; - return(@((self -> 'databaserows_map') -> find(#inlinename))); - /define_tag; - - define_tag('field', -description='A shortcut to return a specific field from a single record result', - -required='fieldname', - -optional='recordindex', - -optional='index'); - !local_defined('recordindex') ? local('recordindex'=(self -> 'current_record')); - #recordindex < 1 ? #recordindex = 1; - !local_defined('index') ? local('index'=1); - if(#recordindex == 1 && #index == 1); - // return first field occurrence from the default (i.e. first) record - return((self -> 'recorddata') -> find(#fieldname)); - else(self -> 'field_names_map' >> #fieldname - && #recordindex >= 1 - && #recordindex <= (self -> 'records_array') -> size); - // return specific record - if(#index==1); - // return first ocurrence of field name through the index map - this is faster - return(self -> 'records_array' -> get(#recordindex) -> get(self -> 'field_names_map' -> find(#fieldname))); - else; - // return another occurrence of the field - this is slightly slower - local('indexmatches'=(self -> 'field_names') -> findposition(#fieldname)); - if(#index >= 1 && #index <= #indexmatches -> size); - return(self -> 'records_array' -> get(#recordindex) -> get(#indexmatches -> get(#index))); - /if; - /if; - /if; - /define_tag; - - define_tag('next', -description='Increments the record pointer, returns true if there are more records to show, false otherwise.\n\ - Useful as an alternative to a regular records loop:\n\ - \t$database -> select;\n\ - \twhile: $database -> next;\n\ - \t\t$database -> field(\'name\');\'
\';\n\ - \t/while;'); - if((self -> 'current_record') < (self -> 'shown_count')); - (self -> 'current_record') += 1; - return(true); - else; - // reset record pointer - (self -> 'current_record') = 0; - return(false); - /if; - /define_tag; - - define_tag('nextrecord', -description='Deprecated synonym for ->next'); - (self -> 'debug_trace') -> insert('*** DEPRECATION WARNING *** ' + tag_name + ' is deprecated, use ->next instead '); - return(self -> next); - /define_tag; - - define_tag: 'trace', - -optional='html', - -optional='xhtml'; - - local: 'endslash' = ((self -> (xhtml: params)) ? ' /' | ''); - - local: 'eol'=(local_defined: 'html') || #endslash -> size ? '\n' | '\n'; - - return: #eol + 'Debug trace for database $' + (self -> varname) + ' (' (self -> 'database') '.' (self -> 'table') + ')' + #eol - + (self -> 'debug_trace') -> (join: #eol) + #eol; - - /define_tag; - - - // =========== Internal member tags =============== - - define_tag: 'reset', -description='Internal, reset all search result vars'; - // reset all search result vars - // searchresultvars - (self -> 'action_statement') = null; - (self -> 'found_count') = null; - (self -> 'shown_first') = null; - (self -> 'shown_last') = null; - (self -> 'shown_count') = null; - (self -> 'field_names') = null; - (self -> 'records_array') = null; - (self -> 'maxrecords_value') = null; - (self -> 'skiprecords_value') = null; - - (self -> 'inlinename')=string; - (self -> 'keyvalue')=null; - (self -> 'lockvalue')=null; - (self -> 'lockvalue_encrypted')=null; - (self -> 'timestampfield')=string; - (self -> 'timestampvalue')=string; - (self -> 'searchparams')=string; - (self -> 'querytime')=integer; - (self -> 'recorddata')=map; - (self -> 'message')=string; - (self -> 'current_record')=0; - (self -> 'field_names_map')=map; - - (self -> 'error_code')=0; - (self -> 'error_msg')=string; - /define_tag; - - define_tag: 'capturesearchvars', -description='Internal'; - // internal member tag - - // capture various result variables like found_count, shown_first, shown_last, shown_count - // searchresultvars - (self -> 'action_statement') = action_statement; - (self -> 'found_count') = found_count; - (self -> 'shown_first') = shown_first; - (self -> 'shown_last') = shown_last; - (self -> 'shown_count') = shown_count; - (self -> 'field_names') = field_names; - (self -> 'records_array') = records_array; - - !((self -> 'maxrecords_value') > 0) ? (self -> 'maxrecords_value') = maxrecords_value; - !((self -> 'skiprecords_value') > 0) ? (self -> 'skiprecords_value') = skiprecords_value; - - lasso_tagexists('resultset_count') ? (self -> 'resultset_count_map') -> insert((self -> 'inlinename')=resultset_count); - iterate(field_names, local('field_name')); - (self -> 'field_names_map') !>> #field_name - ? (self -> 'field_names_map') -> insert(#field_name=loop_count); - /iterate; - - (self -> 'error_code') = error_code; - error_code && error_msg -> size ? (self -> 'error_msg') = error_msg; - - - // handle queries that use LIMIT - if: !(self -> 'isfilemaker') && (string_findregexp: action_statement, -find= '\\sLIMIT\\s', -ignorecase) -> size; - (self -> 'debug_trace') -> (insert: tag_name + ': old found_count, shown_first and shown_last ' + (self -> 'found_count') + ' '+ (self -> 'shown_first') + ' '+ (self -> 'shown_last')); - (self -> 'found_count') = knop_foundrows; - // adjust shown_first and shown_last - (self -> 'shown_first') = ((self -> 'found_count') ? (self -> 'skiprecords_value') + 1 | 0); - (self -> 'shown_last') = integer(math_min(((self -> 'skiprecords_value') + (self -> 'maxrecords_value')), (self -> 'found_count'))); - (self -> 'debug_trace') -> (insert: tag_name + ': new found_count, shown_first and shown_last ' + (self -> 'found_count') + ' '+ (self -> 'shown_first') + ' '+ (self -> 'shown_last')); - /if; - - // capture some variables for single record results - if: found_count <= 1 // -update gives found_count 0 but still has one record result - && error_code == 0; - if((self -> 'keyfield') != '' && string(field(self -> 'keyfield')) -> size); - (self -> 'keyvalue')=field(self -> 'keyfield'); - else: (self -> 'keyfield') != '' && (self -> 'keyvalue') == '' && !(self -> 'isfilemaker'); - (self -> 'keyvalue')=keyfield_value; - /if; - if: lasso_currentaction == 'add' || lasso_currentaction == 'update'; - (self -> 'affectedrecord_keyvalue') = (self -> 'keyvalue'); - /if; - if: (self -> 'lockfield') != ''; - (self -> 'lockvalue')=(field: (self -> 'lockfield')); - (self -> 'lockvalue_encrypted')=(encrypt_blowfish: (field: (self -> 'lockfield')), -seed=(self -> 'lock_seed')); - /if; - /if; - if: error_code == 0; - // populate recorddata with field values from the first found record - iterate: field_names, local: 'field_name'; - (self -> 'recorddata') !>> #field_name - ? (self -> 'recorddata') -> (insert: #field_name = (field: #field_name) ); - /iterate; - else; - (self -> 'debug_trace') -> (insert: tag_name + ': ' + error_msg); - /if; - (self -> 'debug_trace') -> (insert: tag_name + ': found_count ' + (self -> 'found_count') + ' ' + (self -> 'keyfield') + ' '+ (field: (self -> 'keyfield')) + ' keyfield_value ' + keyfield_value + ' keyvalue ' + (self -> 'keyvalue') + ' fieldcount ' + (field_name: -count)); - - /define_tag; - -/define_type; - - -define_type('databaserows', - -namespace='knop_'); - local('version'='2009-01-08', - 'description'='Custom type to return all record rows from knop_database. Used as output for knop_database->records. '); -/* - -CHANGE NOTES -2009-01-08 JS ->_unknowntag: Added -index parameter -2008-11-24 JS Created the type - - -*/ - - local('records_array'=array, - 'field_names'=array, - 'field_names_map'=map, - 'current_record'=integer); - - define_tag('oncreate', -description='Create a record rows object. \n\ - Parameters:\n\ - -records_array (array) Array of arrays with field values for all fields for each record of all found records - -field_names (array) Array with all the field names', - -required='records_array', - -required='field_names'); - self -> 'records_array'=#records_array; - self -> 'field_names'=#field_names; - // store indexes to first occurrence of each field name for faster access - iterate(#field_names, local('field_name')); - (self -> 'field_names_map') !>> #field_name - ? (self -> 'field_names_map') -> insert(#field_name=loop_count); - /iterate; - /define_tag; - - define_tag('_unknowntag', -description='Shortcut to field', - -optional='index'); - !local_defined('index') ? local('index'=1); - if(self -> 'field_names' >> tag_name); - return(self -> field(tag_name(-index=#index))); - else; - //fail: -9948, self -> type + '->' + tag_name + ' not known.'; - /if; - /define_tag; - - define_tag('onconvert', -description='Output the current record as a plain array of field values'); - !local_defined('recordindex') ? local('recordindex'=(self -> 'current_record')); - #recordindex < 1 ? #recordindex = 1; - if(#recordindex >= 1 - && #recordindex <= (self -> 'records_array' -> size)); - return(self -> 'records_array' -> get(#recordindex)); - /if; - /define_tag; - - define_tag('size'); - return(self -> 'records_array' -> size); - /define_tag; - - define_tag('get', -required='index'); - return(knop_databaserow(-record_array=(self -> 'records_array' -> get(#index)), -field_names=(self -> 'field_names'))); - /define_tag; - - define_tag('field', -description='Return an individual field value', - -required='fieldname', - -optional='recordindex', - -optional='index'); - !local_defined('recordindex') ? local('recordindex'=(self -> 'current_record')); - #recordindex < 1 ? #recordindex = 1; - !local_defined('index') ? local('index'=1); - if(self -> 'field_names_map' >> #fieldname - && #recordindex >= 1 - && #recordindex <= (self -> 'records_array') -> size); - // return specific record - if(#index==1); - // return first ocurrence of field name through the index map - this is faster - return(self -> 'records_array' -> get(#recordindex) -> get(self -> 'field_names_map' -> find(#fieldname))); - else; - // return another occurrence of the field - this is slightly slower - local('indexmatches'=(self -> 'field_names') -> findposition(#fieldname)); - if(#index >= 1 && #index <= #indexmatches -> size); - return(self -> 'records_array' -> get(#recordindex) -> get(#indexmatches -> get(#index))); - /if; - /if; - /if; - /define_tag; - - define_tag('summary_header', -description='Returns true if the specified field name has changed since the previous record, or if we are at the first record', - -required='fieldname'); - local('recordindex'=(self -> 'current_record')); - #recordindex < 1 ? #recordindex = 1; - if(#recordindex == 1 // first record - || self -> field(#fieldname) != self -> field(#fieldname, -recordindex=(#recordindex - 1)) ); // different than previous record (look behind) - return(true); - else; - return(false); - /if; - /define_tag; - - define_tag('summary_footer', -description='Returns true if the specified field name will change in the following record, or if we are at the last record', - -required='fieldname'); - local('recordindex'=(self -> 'current_record')); - #recordindex < 1 ? #recordindex = 1; - if(#recordindex == (self -> 'records_array') -> size // last record - || self -> field(#fieldname) != self -> field(#fieldname, -recordindex=(#recordindex + 1)) ); // different than next record (look ahead) - return(true); - else; - return(false); - /if; - /define_tag; - - - define_tag('next', -description='Increments the record pointer, returns true if there are more records to show, false otherwise.'); - if((self -> 'current_record') < (self -> 'records_array') -> size); - (self -> 'current_record') += 1; - return(true); - else; - // reset record pointer - (self -> 'current_record') = 0; - return(false); - /if; - /define_tag; -/define_type; - - - -define_type('databaserow', - -namespace='knop_', - //-prototype, // prototype prevents the namespace from unloading without restart - ); - local: 'version'='2009-01-08', - 'description'='Custom type to return individual record rows from knop_database. Used as output for knop_database->get. '; -/* - -CHANGE NOTES -2009-01-08 JS ->_unknowntag: Added -index parameter -2008-11-24 JS ->field: Added -index parameter to be able to access any occurrence of the same field name -2008-05-29 JS Removed -prototype since it prevents unloading the namespace. It is recommended to turn it on for best performance -2008-05-27 JS Created the type - - -*/ - local('record_array'=array, - 'field_names'=array); - - define_tag('oncreate', -description='Create a record row object. \n\ - Parameters:\n\ - -record_array (array) Array with field values for all fields for the record - -field_names (array) Array with all the field names, should be same size as -record_array', - -required='record_array', - -required='field_names'); - self -> 'record_array'=#record_array; - self -> 'field_names'=#field_names; - /define_tag; - - define_tag('_unknowntag', -description='Shortcut to field', - -optional='index'); - !local_defined('index') ? local('index'=1); - if(self -> 'field_names' >> tag_name); - return(self -> field(tag_name, -index=#index)); - else; - //fail: -9948, self -> type + '->' + tag_name + ' not known.'; - /if; - /define_tag; - - define_tag('onconvert', -description='Output the record as a plain array of field values'); - return(self -> 'record_array'); - /define_tag; - - - define_tag('field', -description='Return an individual field value', - -required='fieldname', - -optional='index'); - !local_defined('index') ? local('index'=1); - if(self -> 'field_names' >> #fieldname); - // return any occurrence of the field - local('indexmatches'=(self -> 'field_names') -> findposition(#fieldname)); - if(#index >= 1 && #index <= #indexmatches -> size); - return((self -> 'record_array') -> get(#indexmatches -> get(#index))); - /if; - /if; - /define_tag; - - -/define_type; -?> diff --git a/samples/Literate CoffeeScript/scope.litcoffee b/samples/Literate CoffeeScript/scope.litcoffee new file mode 100644 index 00000000..62b99b7d --- /dev/null +++ b/samples/Literate CoffeeScript/scope.litcoffee @@ -0,0 +1,117 @@ +The **Scope** class regulates lexical scoping within CoffeeScript. As you +generate code, you create a tree of scopes in the same shape as the nested +function bodies. Each scope knows about the variables declared within it, +and has a reference to its parent enclosing scope. In this way, we know which +variables are new and need to be declared with `var`, and which are shared +with external scopes. + +Import the helpers we plan to use. + + {extend, last} = require './helpers' + + exports.Scope = class Scope + +The `root` is the top-level **Scope** object for a given file. + + @root: null + +Initialize a scope with its parent, for lookups up the chain, +as well as a reference to the **Block** node it belongs to, which is +where it should declare its variables, and a reference to the function that +it belongs to. + + constructor: (@parent, @expressions, @method) -> + @variables = [{name: 'arguments', type: 'arguments'}] + @positions = {} + Scope.root = this unless @parent + +Adds a new variable or overrides an existing one. + + add: (name, type, immediate) -> + return @parent.add name, type, immediate if @shared and not immediate + if Object::hasOwnProperty.call @positions, name + @variables[@positions[name]].type = type + else + @positions[name] = @variables.push({name, type}) - 1 + +When `super` is called, we need to find the name of the current method we're +in, so that we know how to invoke the same method of the parent class. This +can get complicated if super is being called from an inner function. +`namedMethod` will walk up the scope tree until it either finds the first +function object that has a name filled in, or bottoms out. + + namedMethod: -> + return @method if @method.name or !@parent + @parent.namedMethod() + +Look up a variable name in lexical scope, and declare it if it does not +already exist. + + find: (name) -> + return yes if @check name + @add name, 'var' + no + +Reserve a variable name as originating from a function parameter for this +scope. No `var` required for internal references. + + parameter: (name) -> + return if @shared and @parent.check name, yes + @add name, 'param' + +Just check to see if a variable has already been declared, without reserving, +walks up to the root scope. + + check: (name) -> + !!(@type(name) or @parent?.check(name)) + +Generate a temporary variable name at the given index. + + temporary: (name, index) -> + if name.length > 1 + '_' + name + if index > 1 then index - 1 else '' + else + '_' + (index + parseInt name, 36).toString(36).replace /\d/g, 'a' + +Gets the type of a variable. + + type: (name) -> + return v.type for v in @variables when v.name is name + null + +If we need to store an intermediate result, find an available name for a +compiler-generated variable. `_var`, `_var2`, and so on... + + freeVariable: (name, reserve=true) -> + index = 0 + index++ while @check((temp = @temporary name, index)) + @add temp, 'var', yes if reserve + temp + +Ensure that an assignment is made at the top of this scope +(or at the top-level scope, if requested). + + assign: (name, value) -> + @add name, {value, assigned: yes}, yes + @hasAssignments = yes + +Does this scope have any declared variables? + + hasDeclarations: -> + !!@declaredVariables().length + +Return the list of variables first declared in this scope. + + declaredVariables: -> + realVars = [] + tempVars = [] + for v in @variables when v.type is 'var' + (if v.name.charAt(0) is '_' then tempVars else realVars).push v.name + realVars.sort().concat tempVars.sort() + +Return the list of assignments that are supposed to be made at the top +of this scope. + + assignedVariables: -> + "#{v.name} = #{v.type.value}" for v in @variables when v.type.assigned + diff --git a/samples/Logos/example.xm b/samples/Logos/example.xm new file mode 100644 index 00000000..39753e23 --- /dev/null +++ b/samples/Logos/example.xm @@ -0,0 +1,28 @@ +%hook ABC +- (id)a:(B)b { + %log; + return %orig(nil); +} +%end + +%subclass DEF: NSObject +- (id)init { + [%c(RuntimeAccessibleClass) alloc]; + return nil; +} +%end + +%group OptionalHooks +%hook ABC +- (void)release { + [self retain]; + %orig; +} +%end +%end + +%ctor { + %init; + if(OptionalCondition) + %init(OptionalHooks); +} diff --git a/samples/Matlab/Check_plot.m b/samples/Matlab/Check_plot.m new file mode 100644 index 00000000..1f79e01b --- /dev/null +++ b/samples/Matlab/Check_plot.m @@ -0,0 +1,12 @@ +x_0=linspace(0,100,101); +vx_0=linspace(0,100,101); +z=zeros(101,101); +for i=1:101 + for j=1:101 + z(i,j)=x_0(i)*vx_0(j); + end +end + +figure +pcolor(x_0,vx_0,z) +shading flat \ No newline at end of file diff --git a/samples/Matlab/FTLEH.m b/samples/Matlab/FTLEH.m new file mode 100644 index 00000000..12bab16c --- /dev/null +++ b/samples/Matlab/FTLEH.m @@ -0,0 +1,149 @@ +tic +clear all +%% Choice of the mass parameter +mu=0.1; + +%% Computation of Lagrangian Points +[xl1,yl1,xl2,yl2,xl3,yl3,xl4,yl4,xl5,yl5] = Lagr(mu); + +%% Computation of initial total energy +E_L1=-Omega(xl1,yl1,mu); +E=E_L1+0.03715; % Offset as in figure 2.2 "LCS in the ER3BP" + +%% Initial conditions range +x_0_min=-0.8; +x_0_max=-0.2; + +vx_0_min=-2; +vx_0_max=2; + +y_0=0; + +% Elements for grid definition +n=200; + +% Dimensionless integrating time +T=2; + +% Grid initializing +[x_0,vx_0]=ndgrid(linspace(x_0_min,x_0_max,n),linspace(vx_0_min,vx_0_max,n)); +vy_0=sqrt(2*E+2*Omega(x_0,y_0,mu)-vx_0.^2); + +% Kinetic energy computation +E_cin=E+Omega(x_0,y_0,mu); + +%% Transforming into Hamiltonian variables +px_0=vx_0-y_0; +py_0=vy_0+x_0; + +% Inizializing +x_T=zeros(n,n); +y_T=zeros(n,n); +px_T=zeros(n,n); +py_T=zeros(n,n); +filtro=ones(n,n); +E_T=zeros(n,n); +a=zeros(n,n); % matrix of numbers of integration steps for each integration +np=0; % number of integrated points + +fprintf(' con n = %i\n',n) + +%% Energy tolerance setting +energy_tol=inf; + +%% Computation of the Jacobian of the system +options=odeset('Jacobian',@cr3bp_jac); + +%% Parallel integration of equations of motion +parfor i=1:n + for j=1:n + if E_cin(i,j)>0 && isreal(vy_0(i,j)) % Check for real velocity and positive Kinetic energy + [t,Y]=ode45(@fH,[0 T],[x_0(i,j); y_0; px_0(i,j); py_0(i,j)],options); + % Try to obtain the name of the solver for a following use +% sol=ode45(@f,[0 T],[x_0(i,j); y_0; vx_0(i,j); vy_0(i,j)],options); +% Y=sol.y'; +% solver=sol.solver; + a(i,j)=length(Y); + %Saving solutions + x_T(i,j)=Y(a(i,j),1); + px_T(i,j)=Y(a(i,j),3); + y_T(i,j)=Y(a(i,j),2); + py_T(i,j)=Y(a(i,j),4); + %Computation of final total energy and difference with + %initial one + E_T(i,j)=EnergyH(x_T(i,j),y_T(i,j),px_T(i,j),py_T(i,j),mu); + delta_E=abs(E_T(i,j)-E); + if delta_E > energy_tol; %Check of total energy conservation + fprintf(' Ouch! Wrong Integration: i,j=(%i,%i)\n E_T=%.2f \n delta_E=%.2f\n\n',i,j,E_T(i,j),delta_E); + filtro(i,j)=2; %Saving position of the point + end + np=np+1; + else + filtro(i,j)=0; % 1=interesting point; 0=non-sense point; 2= bad integration point + end + end +end + +t_integrazione=toc; +fprintf(' n = %i\n',n) +fprintf(' energy_tol = %.2f\n',energy_tol) +fprintf('total \t%i\n',n^2) +fprintf('nunber \t%i\n',np) +fprintf('time to integrate \t%.2f s\n',t_integr) + +%% Back to Lagrangian variables +vx_T=px_T+y_T; +vy_T=py_T-x_T; +%% FTLE Computation +fprintf('adesso calcolo ftle\n') +tic +dphi=zeros(2,2); +ftle=zeros(n-2,n-2); + +for i=2:n-1 + for j=2:n-1 + if filtro(i,j) && ... % Check for interesting point + filtro(i,j-1) && ... + filtro(i,j+1) && ... + filtro(i-1,j) && ... + filtro(i+1,j) + + dphi(1,1)=(x_T(i-1,j)-x_T(i+1,j))/(x_0(i-1,j)-x_0(i+1,j)); + + dphi(1,2)=(x_T(i,j-1)-x_T(i,j+1))/(vx_0(i,j-1)-vx_0(i,j+1)); + + dphi(2,1)=(vx_T(i-1,j)-vx_T(i+1,j))/(x_0(i-1,j)-x_0(i+1,j)); + + dphi(2,2)=(vx_T(i,j-1)-vx_T(i,j+1))/(vx_0(i,j-1)-vx_0(i,j+1)); + + if filtro(i,j)==2 % Manual setting to visualize bad integrated points + ftle(i-1,j-1)=-Inf; + else + ftle(i-1,j-1)=1/(2*T)*log(max(abs(eig(dphi'*dphi)))); + end + end + end +end + +%% Plotting results +% figure +% plot(t,Y) +% figure +% plot(Y(:,1),Y(:,2)) +% figure + +xx=linspace(x_0_min,x_0_max,n); +vvx=linspace(vx_0_min,vx_0_max,n); +[x,vx]=ndgrid(xx(2:n-1),vvx(2:n-1)); +figure +pcolor(x,vx,ftle) +shading flat + +t_ftle=toc; +fprintf('tempo per integrare \t%.2f s\n',t_integrazione) +fprintf('tempo per calcolare ftle \t%.2f s\n',t_ftle) + +% save(['var_' num2str(n) '_' num2str(clock(4)]) + +nome=['var_xvx_', 'ode00', '_n',num2str(n),'_e',num2str(energy_tol),'_H']; +save(nome) \ No newline at end of file diff --git a/samples/Matlab/FTLE_reg.m b/samples/Matlab/FTLE_reg.m new file mode 100644 index 00000000..37376be2 --- /dev/null +++ b/samples/Matlab/FTLE_reg.m @@ -0,0 +1,178 @@ +tic +clear all +%% Elements for grid definition +n=100; + +%% Dimensionless integrating time +T=2; + +%% Choice of the mass parameter +mu=0.1; + +%% Computation of Lagrangian Points +[xl1,yl1,xl2,yl2,xl3,yl3,xl4,yl4,xl5,yl5] = Lagr(mu); + +%% Computation of initial total energy +E_L1=-Omega(xl1,yl1,mu); +C_L1=-2*E_L1; % C_L1 = 3.6869532299 from Szebehely +E=E_L1+0.03715; % Offset as in figure 2.2 "LCS in the ER3BP" + +%% Initial conditions range +x_0_min=-0.8; +x_0_max=-0.2; + +vx_0_min=-2; +vx_0_max=2; + +y_0=0; + +% Grid initializing +[x_0,vx_0]=ndgrid(linspace(x_0_min,x_0_max,n),linspace(vx_0_min,vx_0_max,n)); +vy_0=sqrt(2*E+2.*Omega(x_0,y_0,mu)-vx_0.^2); +% Kinetic energy computation +E_cin=E+Omega(x_0,y_0,mu); + +% Inizializing +x_T=zeros(n,n); +y_T=zeros(n,n); +vx_T=zeros(n,n); +vy_T=zeros(n,n); +filtro=ones(n,n); +E_T=zeros(n,n); +delta_E=zeros(n,n); +a=zeros(n,n); % matrix of numbers of integration steps for each integration +np=0; % number of integrated points + +fprintf('integro con n = %i\n',n) + +%% Energy tolerance setting +energy_tol=0.1; + +%% Setting the options for the integrator +RelTol=1e-12;AbsTol=1e-12; % From Short +% RelTol=1e-13;AbsTol=1e-22; % From JD James Mireles +% RelTol=3e-14;AbsTol=1e-16; % HIGH accuracy from Ross +options=odeset('AbsTol',AbsTol,'RelTol',RelTol); +%% Parallel integration of equations of motion +h=waitbar(0,'','Name','Integration in progress, please wait!'); +S=zeros(n,n); +r1=zeros(n,n); +r2=zeros(n,n); +g=zeros(n,n); +for i=1:n + waitbar(i/n,h,sprintf('Computing i=%i',i)); + parfor j=1:n + r1(i,j)=sqrt((x_0(i,j)+mu).^2+y_0.^2); + r2(i,j)=sqrt((x_0(i,j)-1+mu).^2+y_0.^2); + g(i,j)=((1-mu)./(r1(i,j).^3)+mu./(r2(i,j).^3)); + if E_cin(i,j)>0 && isreal(vy_0(i,j)) % Check for real velocity and positive Kinetic energy + S(i,j)=g(i,j)*T; + [s,Y]=ode45(@f_reg,[0 S(i,j)],[x_0(i,j); y_0; vx_0(i,j); vy_0(i,j)],options,mu); + a(i,j)=length(Y); +% if s(a(i,j)) < 2 +% filtro(i,j)=3; +% end + % Saving solutions + x_T(i,j)=Y(a(i,j),1); + vx_T(i,j)=Y(a(i,j),3); + y_T(i,j)=Y(a(i,j),2); + vy_T(i,j)=Y(a(i,j),4); + + % Computation of final total energy and difference with + % initial one + E_T(i,j)=Energy(x_T(i,j),y_T(i,j),vx_T(i,j),vy_T(i,j),mu); + delta_E(i,j)=abs(E_T(i,j)-E); + if delta_E(i,j) > energy_tol; % Check of total energy conservation + fprintf(' Ouch! Wrong Integration: i,j=(%i,%i)\n E_T=%.2f \n delta_E=%f\n\n',i,j,E_T(i,j),delta_E(i,j)); + filtro(i,j)=2; % Saving position of the point + end + np=np+1; + else + filtro(i,j)=0; % 1 = interesting point; 0 = non-sense point; 2 = bad integration point + end + end +end +close(h); +t_integrazione=toc; +%% +filtro_1=filtro; +for i=2:n-1 + for j=2:n-1 + if filtro(i,j)==2 || filtro (i,j)==3 + filtro_1(i,j)=2; + filtro_1(i+1,j)=2; + filtro_1(i-1,j)=2; + filtro_1(i,j+1)=2; + filtro_1(i,j-1)=2; + end + end +end + +fprintf('integato con n = %i\n',n) +fprintf('integato con energy_tol = %f\n',energy_tol) +fprintf('numero punti totali \t%i\n',n^2) +fprintf('numero punti integrati \t%i\n',np) +fprintf('tempo per integrare \t%.2f s\n',t_integrazione) + +%% FTLE Computation +fprintf('adesso calcolo ftle\n') +tic +dphi=zeros(2,2); +ftle=zeros(n-2,n-2); +ftle_norm=zeros(n-2,n-2); + +ds_x=(x_0_max-x_0_min)/(n-1); +ds_vx=(vx_0_max-vx_0_min)/(n-1); + +for i=2:n-1 + for j=2:n-1 + if filtro_1(i,j) && ... % Check for interesting point + filtro_1(i,j-1) && ... + filtro_1(i,j+1) && ... + filtro_1(i-1,j) && ... + filtro_1(i+1,j) + % La direzione dello spostamento la decide il denominatore + + % TODO spiegarsi teoricamente come mai la matrice pu� + % essere ridotta a 2x2 + dphi(1,1)=(x_T(i+1,j)-x_T(i-1,j))/(2*ds_x); %(x_0(i-1,j)-x_0(i+1,j)); + + dphi(1,2)=(x_T(i,j+1)-x_T(i,j-1))/(2*ds_vx); %(vx_0(i,j-1)-vx_0(i,j+1)); + + dphi(2,1)=(vx_T(i+1,j)-vx_T(i-1,j))/(2*ds_x); %(x_0(i-1,j)-x_0(i+1,j)); + + dphi(2,2)=(vx_T(i,j+1)-vx_T(i,j-1))/(2*ds_vx); %(vx_0(i,j-1)-vx_0(i,j+1)); + + if filtro_1(i,j)==2 % Manual setting to visualize bad integrated points + ftle(i-1,j-1)=0; + else + ftle(i-1,j-1)=(1/abs(T))*log(max(sqrt(abs(eig(dphi*dphi'))))); + ftle_norm(i-1,j-1)=(1/abs(T))*log(norm(dphi)); + end + end + end +end + +%% Plotting results +% figure +% plot(t,Y) +% figure +% plot(Y(:,1),Y(:,2)) +% figure + +xx=linspace(x_0_min,x_0_max,n); +vvx=linspace(vx_0_min,vx_0_max,n); +[x,vx]=ndgrid(xx(2:n-1),vvx(2:n-1)); +figure +pcolor(x,vx,ftle) +shading flat + +t_ftle=toc; +fprintf('tempo per integrare \t%.2f s\n',t_integrazione) +fprintf('tempo per calcolare ftle \t%.2f s\n',t_ftle) + +% ora=fstringf %TODO +% save(['var_' num2str(n) '_' num2str(clock(4)]) + +nome=['var_xvx_', 'ode00', '_n',num2str(n)]; +save(nome) \ No newline at end of file diff --git a/samples/Matlab/Integrate1.m b/samples/Matlab/Integrate1.m new file mode 100644 index 00000000..8f894cda --- /dev/null +++ b/samples/Matlab/Integrate1.m @@ -0,0 +1,40 @@ +function [ x_T, y_T, vx_T, e_T, filter ] = Integrate_FILE( x_0, y_0, vx_0, e_0, T, N, mu, options) +%Integrate +% This function performs Runge-Kutta-Fehlberg integration for given +% initial conditions to compute FILE +nx=length(x_0); +ny=length(y_0); +nvx=length(vx_0); +ne=length(e_0); +vy_0=zeros(nx,ny,nvx,ne); +x_T=zeros(nx,ny,nvx,ne); +y_T=zeros(nx,ny,nvx,ne); +vx_T=zeros(nx,ny,nvx,ne); +vy_T=zeros(nx,ny,nvx,ne); +e_T=zeros(nx,ny,nvx,ne); +%% Look for phisically meaningful points +filter=zeros(nx,ny,nvx,ne); %0=meaningless point 1=meaningful point + +%% Integrate only meaningful points +h=waitbar(0,'','Name','Integration in progress, please wait!'); +for i=1:nx + waitbar(i/nx,h,sprintf('Computing i=%i',i)); + for j=1:ny + parfor k=1:nvx + for l=1:ne + vy_0(i,j,k,l)=sqrt(2*Potential(x_0(i),y_0(j),mu)+2*e_0(l)-vx_0(k)^2); + if isreal(vy_0(i,j,k,l)) + filter(i,j,k,l)=1; + ci=[x_0(i), y_0(j), vx_0(k), vy_0(i,j,k,l)]; + [t,Y,te,ye,ie]=ode45(@f,[0 T], ci, options, mu); + x_T(i,j,k,l)=ye(N+1,1); + y_T(i,j,k,l)=ye(N+1,2); + vx_T(i,j,k,l)=ye(N+1,3); + vy_T(i,j,k,l)=ye(N+1,4); + e_T(i,j,k,l)=0.5*(vx_T(i,j,k,l)^2+vy_T(i,j,k,l)^2)-Potential(x_T(i,j,k,l),y_T(i,j,k,l),mu); + end + end + end + end +end +close(h); diff --git a/samples/Matlab/Integrate2.m b/samples/Matlab/Integrate2.m new file mode 100644 index 00000000..10e8bea3 --- /dev/null +++ b/samples/Matlab/Integrate2.m @@ -0,0 +1,60 @@ +function [ x_T, y_T, vx_T, e_T, filter, delta_e ] = Integrate_FTLE_Gawlick_ell( x_0, y_0, vx_0, e_0, T, mu, ecc, nu, options) +%Integrate +% This function performs Runge-Kutta-Fehlberg integration for given +% initial conditions to compute FTLE to obtain the image in the Gawlick's +% article "Lagrangian Coherent Structures in the Elliptic Restricted +% Three-Body Problem". +nx=length(x_0); +ny=length(y_0); +nvx=length(vx_0); +ne=length(e_0); +vy_0=zeros(nx,ny,nvx,ne); +x_T=zeros(nx,ny,nvx,ne); +y_T=zeros(nx,ny,nvx,ne); +vx_T=zeros(nx,ny,nvx,ne); +vy_T=zeros(nx,ny,nvx,ne); +e_T=zeros(nx,ny,nvx,ne); +delta_e=zeros(nx,ny,nvx,ne); +%% Look for phisically meaningful points +filter=zeros(nx,ny,nvx,ne); %0=meaningless point 1=meaningful point +useful=ones(nx,ny,nvx,ne); +%% Integrate only useful points +useful(:,1,:,1)=0; +useful(:,1,:,3)=0; +useful(:,3,:,1)=0; +useful(:,3,:,3)=0; + +%% Integrate only meaningful points +h=waitbar(0,'','Name','Integration in progress, please wait!'); +for i=1:nx + waitbar(i/nx,h,sprintf('Computing i=%i',i)); + for j=1:ny + parfor k=1:nvx + for l=1:ne + if useful(i,j,k,l) + vy_0(i,j,k,l)=-sqrt(2*(Omega(x_0(i),y_0(j),mu)/(1+ecc*cos(nu)))+2*e_0(l)-vx_0(k)^2); + if isreal(vy_0(i,j,k,l)) + filter(i,j,k,l)=1; + + ci=[x_0(i), y_0(j), vx_0(k), vy_0(i,j,k,l)]; + [t,Y]=ode45(@f_ell,[0 T], ci, options, mu, ecc); + + if abs(t(end)) < abs(T) % Consider also negative time + filter(i,j,k,l)=3 + end + + x_T(i,j,k,l)=Y(end,1); + y_T(i,j,k,l)=Y(end,2); + vx_T(i,j,k,l)=Y(end,3); + vy_T(i,j,k,l)=Y(end,4); + e_T(i,j,k,l)=0.5*(vx_T(i,j,k,l)^2+vy_T(i,j,k,l)^2)-Omega(x_T(i,j,k,l),y_T(i,j,k,l),mu); + + % Compute the goodness of the integration + delta_e(i,j,k,l)=abs(e_T(i,j,k,l)-e_0(l)); + end + end + end + end + end +end +close(h); \ No newline at end of file diff --git a/samples/Matlab/Lagr.m b/samples/Matlab/Lagr.m new file mode 100644 index 00000000..5c4b2387 --- /dev/null +++ b/samples/Matlab/Lagr.m @@ -0,0 +1,28 @@ +function [xl1,yl1,xl2,yl2,xl3,yl3,xl4,yl4,xl5,yl5] = Lagr(mu) +% [xl1,yl1,xl2,yl2,xl3,yl3,xl4,yl4,xl5,yl5] = Lagr(mu) +% Lagr This function computes the coordinates of the Lagrangian points, +% given the mass parameter +yl1=0; +yl2=0; +yl3=0; +yl4=sqrt(3)/2; +yl5=-sqrt(3)/2; +c1=roots([1 mu-3 3-2*mu -mu 2*mu -mu]); +c2=roots([1 3-mu 3-2*mu -mu -2*mu -mu]); +c3=roots([1 2+mu 1+2*mu mu-1 2*mu-2 mu-1]); +xl1=0; +xl2=0; +for i=1:5 + if isreal(c1(i)) + xl1=1-mu-c1(i); + end + if isreal(c2(i)) + xl2=1-mu+c2(i); + end + if isreal(c3(i)) + xl3=-mu-c3(i); + end +end +xl4=0.5-mu; +xl5=xl4; +end \ No newline at end of file diff --git a/samples/Matlab/Lagrangian_points.m b/samples/Matlab/Lagrangian_points.m new file mode 100644 index 00000000..0e71e71b --- /dev/null +++ b/samples/Matlab/Lagrangian_points.m @@ -0,0 +1,16 @@ +% Plot dei Lagrangian points +n=5; +mu=linspace(0,0.5,n); +for i=1:n + [xl1,yl1,xl2,yl2,xl3,yl3,xl4,yl4,xl5,yl5] = Lagr(mu(i)); + figure (1) + hold all + plot(xl1, yl1, 's') + plot(xl2, yl2, 's') + plot(xl3, yl3, 's') + plot(xl4, yl4, 's') + plot(xl5, yl5, 's') + plot(-mu,0,'o') + plot(1-mu,0, 'o') + plot([-mu(i) xl4],[0 yl4]) +end \ No newline at end of file diff --git a/samples/Matlab/Poincare.m b/samples/Matlab/Poincare.m new file mode 100644 index 00000000..a9fb41f8 --- /dev/null +++ b/samples/Matlab/Poincare.m @@ -0,0 +1,18 @@ +clear +%% Initial Conditions +mu=0.012277471; +T=10; +N=5; +C=3.17; +x_0=0.30910452642073; +y_0=0.07738174525518; +vx_0=-0.72560796964234; +vy_0=sqrt(-C-vx_0^2+2*Potential(x_0,y_0,mu)); +k=0; +%% Integration +options=odeset('AbsTol',1e-22,'RelTol',1e-13,'Events',@cross_y); +[t,y,te,ye,ie]=ode113(@f,[0 T],[x_0; y_0; vx_0; vy_0],options,mu); + +figure +%plot(ye(:,1),ye(:,3),'rs') +plot(ye(:,1),0,'rs') \ No newline at end of file diff --git a/samples/Matlab/RK4.m b/samples/Matlab/RK4.m new file mode 100644 index 00000000..d21ea755 --- /dev/null +++ b/samples/Matlab/RK4.m @@ -0,0 +1,24 @@ +function x = RK4( fun, tspan, ci, mu ) +%RK4 4th-order Runge Kutta integrator +% Detailed explanation goes here +h=1e-5; +t=tspan(1); +T=tspan(length(tspan)); +dim=length(ci); +%x=zeros(l,dim); +x(:,1)=ci; +i=1; +while t= 1 + userSettings = varargin_to_structure(varargin); +else + userSettings = struct(); +end +% combine the defaults with the user settings +settings = overwrite_settings(defaultSettings, userSettings); + +% Will the system have the bare minimum states? +minStates = {'phi', 'delta', 'phiDot', 'deltaDot'}; +if sum(ismember(settings.states, minStates)) < 4 + error(['You have not specified the minimum set of states. Please ' ... + 'include at least phi, delta, phiDot, and deltaDot']) +end + +% Have state derivatives been specified that can't be computed with the +% specified states? +keepStates = find(ismember(states, settings.states)); +removeStates = find(~ismember(states, settings.states)); +for row = keepStates' + for col = removeStates' + if abs(A(row, col)) > 1e-10 + s = sprintf(['It is not possible to compute the derivative ' ... + 'of state %s because it depends on state %s'], ... + states{row}, states{col}); + error(s) + end + end +end + +removeInputs = find(~ismember(inputs, settings.inputs)); + +% Have outputs been specified that can't be computed with the specified +% states and inputs? +keepOutputs = find(ismember(outputs, settings.outputs)); +for row = keepOutputs' + for col = removeStates' + if abs(C(row, col)) > 1e-10 + s = sprintf(['It is not possible to keep output %s because ' ... + 'it depends on state %s'], outputs{row}, ... + states{col}); + error(s) + end + end + for col = removeInputs' + if abs(D(row, col)) > 1e-10 + s = sprintf(['It is not possible to keep output %s because ' ... + 'it depends on input %s'], outputs{row}, ... + inputs{col}); + error(s) + end + end +end + +removeOutputs = find(~ismember(outputs, settings.outputs)); + +A(removeStates, :) = []; +A(:, removeStates) = []; + +B(removeStates, :) = []; +B(:, removeInputs) = []; + +C(removeOutputs, :) = []; +C(:, removeStates) = []; + +D(removeOutputs, :) = []; +D(:, removeInputs) = []; + +states(removeStates) = []; +inputs(removeInputs) = []; +outputs(removeOutputs) = []; + +% build the ss structure +bicycle = ss(A, B, C, D, ... + 'StateName', states, ... + 'OutputName', outputs, ... + 'InputName', inputs); diff --git a/samples/Matlab/convert_variable.m b/samples/Matlab/convert_variable.m new file mode 100644 index 00000000..aff2199f --- /dev/null +++ b/samples/Matlab/convert_variable.m @@ -0,0 +1,68 @@ +function [name, order] = convert_variable(variable, output) +% Returns the name and order of the given variable in the output type. +% +% Parameters +% ---------- +% variable : string +% A variable name. +% output : string. +% Either `moore`, `meijaard`, `data`. +% +% Returns +% ------- +% name : string +% The variable name in the given output type. +% order : double +% The order of the variable in the list. + +[coordinates, speeds, inputs] = get_variables(); + +columns = {'data', 'meijaard', 'moore'}; + +if find(ismember(coordinates, variable)) + + [order, ~] = find(ismember(coordinates, variable)); + name = coordinates{order, find(ismember(columns, output))}; + +elseif find(ismember(speeds, variable)) + + [order, ~] = find(ismember(speeds, variable)); + name = speeds{order, find(ismember(columns, output))}; + +elseif find(ismember(inputs, variable)) + + [order, ~] = find(ismember(inputs, variable)); + name = inputs{order, find(ismember(columns, output))}; + +else + error('Beep: Done typed yo variable name wrong') +end + +function [coordinates, speeds, inputs] = get_variables() + +coordinates = {'LongitudinalRearContact', 'xP', 'q1'; + 'LateralRearContact', 'yP','q2'; + 'YawAngle', 'psi','q3'; + 'RollAngle', 'phi','q4'; + 'PitchAngle', 'thetaB','q5'; + 'RearWheelAngle', 'thetaR','q6'; + 'SteerAngle', 'delta','q7'; + 'FrontWheelAngle', 'thetaF','q8'; + 'LongitudinalFrontContact', 'xQ','q9'; + 'LateralFrontContact', 'yQ', 'q10'}; + +speeds = {'LongitudinalRearContactRate', 'xPDot', 'u1'; + 'LateralRearContactRate', 'yPDot', 'u2'; + 'YawRate', 'psiDot', 'u3'; + 'RollRate', 'phiDot', 'u4'; + 'PitchRate', 'thetaDot', 'u5'; + 'RearWheelRate', 'thetaRDot', 'u6'; + 'SteerRate', 'deltaDot', 'u7'; + 'FrontWheelRate', 'thetaFDot','u8'; + 'LongitudinalFrontContactRate', 'xQDot', 'u9'; + 'LateralFrontContactRate', 'yQDot', 'u10'}; + +inputs = {'RollTorque', 'tPhi', 'T4'; + 'RearWheelTorque', 'tThetaR', 'T6'; + 'SteerTorque', 'tDelta', 'T7'; + 'PullForce', 'fB', 'F'}; diff --git a/samples/Matlab/create_ieee_paper_plots.m b/samples/Matlab/create_ieee_paper_plots.m new file mode 100644 index 00000000..0c4fd8d9 --- /dev/null +++ b/samples/Matlab/create_ieee_paper_plots.m @@ -0,0 +1,1119 @@ +function create_ieee_paper_plots(data, rollData) +% Creates all of the figures for the IEEE paper. +% +% Parameters +% ---------- +% data : structure +% A structure contating the data from generate_data.m for all of the bicycles +% and speeds for the IEEE paper. +% rollData : structure +% The data for a single bicycle at a single speed with roll torque as the +% input. + +global goldenRatio +% used for figure width to height ratio +goldenRatio = (1 + sqrt(5)) / 2; + +% create a plot directory if one doesn't already exist +if exist('plots/', 'dir') ~= 7 + mkdir('plots/') +end + +% Define some linestyles and colors for each of the six bicycles +linestyles = {'-', '-', '-.', ... + '--', '-.', '--'}; +colors = {'k', ... + [0.5, 0.5, 0.5], ... + [0.5, 0.5, 0.5], ... + 'k', ... + 'k', ... + [0.5, 0.5, 0.5]}; + +loop_shape_example(data.Benchmark.Medium, 'Steer') +loop_shape_example(rollData, 'Roll') +plot_io_roll(rollData, 'Distance') +plot_io_roll(rollData, 'Time') +open_loop_all_bikes(data, linestyles, colors) +handling_all_bikes(data, rollData, linestyles, colors) +path_plots(data, linestyles, colors) +var = {'delta', 'phi', 'psi', 'Tdelta'}; +io = {'output', 'output', 'output', 'input'}; +typ = {'Distance', 'Time'}; +for i = 1:length(var) + for j = 1:length(typ) + plot_io(var{i}, io{i}, typ{j}, data, linestyles, colors) + end +end +phase_portraits(data.Benchmark.Medium) +eigenvalues(data, linestyles, colors) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function loop_shape_example(bikeData, input) +% Creates the example loop shaping for the bicycle at medium speed. +% +% Parameters +% ---------- +% bikeData : structure +% Contains data for a single bicycle at a single speed. +% input : string +% 'Steer' or 'Roll' depending on what input was used to control the bicycle. + +global goldenRatio + +% closed loop bode plots +figure() +figWidth = 5.0; +figHeight = figWidth / goldenRatio; +set(gcf, ... + 'Color', [1, 1, 1], ... + 'PaperOrientation', 'portrait', ... + 'PaperUnits', 'inches', ... + 'PaperPositionMode', 'manual', ... + 'OuterPosition', [424, 305 - 50, 518, 465], ... + 'PaperPosition', [0, 0, figWidth, figHeight], ... + 'PaperSize', [figWidth, figHeight]) + +freq = {0.1, 20.0}; + +hold all + +closedLoops = bikeData.closedLoops; + +% make sure all bode plots display 'rad/s' instead of 'rad/sec' +bops = bodeoptions; +bops.FreqUnits = 'rad/s'; + +if strcmp(input, 'Steer') + linestyles = {'', '', '-.', '-.', '-', '-.', '-.', '-'}; + gray = [0.6, 0.6, 0.6]; + colors = {'k', 'k', 'k', gray, 'k', 'k', gray, 'k'}; + % the closed delta loop + deltaNum = closedLoops.Delta.num; + deltaDen = closedLoops.Delta.den; + bodeplot(tf(deltaNum, deltaDen), freq, bops); + % a typical neuromuscular model + neuroNum = 2722.5; + neuroDen = [1, 13.96, 311.85, 2722.5]; + bodeplot(tf(neuroNum, neuroDen), freq, bops); + whichLines = 5:-1:3; +elseif strcmp(input, 'Roll') + linestyles = {'', '', '-', '-'}; + colors = {'k', 'k', 'k', 'k'}; + whichLines = 4:-1:2; +else + error('Bad input, use Steer or Roll') +end + +% the closed phi dot loop +phiDotNum = closedLoops.PhiDot.num; +phiDotDen = closedLoops.PhiDot.den; +closedBode = bodeplot(tf(phiDotNum, phiDotDen), freq, bops); + +hold off + +% clean it up +opts = getoptions(closedBode); +if strcmp(input, 'Steer') + opts.YLim = {[-45, 20], [-360, 90]}; +else + opts.YLim = {[-30, 10], [-180, 90]}; +end +opts.PhaseMatching = 'on'; +opts.PhaseMatchingValue = 0; +opts.Title.String = ''; +setoptions(closedBode, opts) + +% find all the lines in the current figure +lines = findobj(gcf, 'type', 'line'); +for i = 3:length(lines) + set(lines(i), 'LineStyle', linestyles{i}, ... + 'Color', colors{i}, ... + 'LineWidth', 2.0) +end + +% there seems to be a bug such that the xlabel is too low, this is a hack to +% get it to work +raise = 0.05; +plotAxes = findobj(gcf, 'type', 'axes'); +set(plotAxes, 'XColor', 'k', 'YColor', 'k') +curPos1 = get(plotAxes(1), 'Position'); +curPos2 = get(plotAxes(2), 'Position'); +set(plotAxes(1), 'Position', curPos1 + [0, raise, 0, 0]) +set(plotAxes(2), 'Position', curPos2 + [0, raise, 0, 0]) +xLab = get(plotAxes(1), 'Xlabel'); +set(xLab, 'Units', 'normalized') +set(xLab, 'Position', get(xLab, 'Position') + [0, raise + 0.05, 0]) + +% make the tick labels smaller +set(plotAxes, 'Fontsize', 8) +if strcmp(input, 'Steer') + legWords = {'$\delta$ Loop', + 'Neuromuscular model from [27]', + '$\dot{\phi}$ Loop'}; +elseif strcmp(input, 'Roll') + legWords = {'$\dot{\phi}$ Loop'}; +end +closeLeg = legend(lines(whichLines), ... + legWords, ... + 'Location', 'Southwest', ... + 'Interpreter', 'Latex', ... + 'Fontsize', 8); + +% add the annotation showing a 10 dB peak +if strcmp(input, 'Steer') + axes(plotAxes(2)) + db1 = text(2.7, 5.0, '~10dB'); + db2 = text(2.5, -10.0, '~10dB'); + set([db1, db2], 'Fontsize', 8) + dArrow1 = annotation('doublearrow', ... + [0.7, 0.7], ... + [0.755 + raise, 0.818 + raise]); + annotation('line', [0.69, 0.87], [0.818 + raise, 0.818 + raise]) + dArrow2 = annotation('doublearrow', ... + [0.685, 0.685], ... + [0.665 + raise, 0.725 + raise]); + annotation('line', [0.675, 0.87], [0.725 + raise, 0.725 + raise]) + set([dArrow1, dArrow2], 'Head1width', 3, 'Head1length', 3, ... + 'Head2width', 3, 'Head2length', 3) +else + axes(plotAxes(2)) + db1 = text(0.67, -3.7, '~10dB'); + set(db1, 'Fontsize', 8) + dArrow = annotation('doublearrow', ... + [0.5, 0.5], ... + [0.697 + raise, 0.795 + raise]); + set(dArrow, 'Head1width', 3, 'Head1length', 3, ... + 'Head2width', 3, 'Head2length', 3) + annotation('line', [0.49, 0.75], [0.795 + raise, 0.795 + raise]) +end + +filename = ['benchmark' input 'Closed']; +pathToFile = ['plots' filesep filename]; +print(gcf, '-deps2c', '-loose', [pathToFile '.eps']) +fix_ps_linestyle([pathToFile '.eps']) + +% open loop plots +figure() +set(gcf, ... + 'Color', [1, 1, 1], ... + 'PaperOrientation', 'portrait', ... + 'PaperUnits', 'inches', ... + 'PaperPositionMode', 'manual', ... + 'PaperPosition', [0, 0, figWidth, figHeight], ... + 'PaperSize', [figWidth, figHeight]) + +openLoops = bikeData.openLoops; + +hold all + +num = openLoops.Phi.num; +den = openLoops.Phi.den; +bodeplot(tf(num, den), freq, bops); + +num = openLoops.Psi.num; +den = openLoops.Psi.den; +bodeplot(tf(num, den), freq, bops); + +num = openLoops.Y.num; +den = openLoops.Y.den; +openBode = bodeplot(tf(num, den), freq, bops); + +hold off + +% clean it up +opts = getoptions(openBode); +opts.Title.String = ''; +opts.YLim = {[-80, 20], [-540, -60]}; +opts.PhaseMatching = 'on'; +opts.PhaseMatchingValue = 0; +setoptions(openBode, opts) + +% find all the lines in the current figure +lines = findobj(gcf, 'type', 'line'); +linestyles = {'', '', '-.', '-', '--', '-.', '-', '--'}; +for i = 3:length(lines) + set(lines(i), 'LineStyle', linestyles{i}, ... + 'Color', 'k', ... + 'LineWidth', 2.0) +end + + +plotAxes = findobj(gcf, 'type', 'axes'); +set(plotAxes, 'Fontsize', 8, 'XColor', 'k', 'YColor', 'k') +closeLeg = legend(lines(8:-1:6), ... + {'$\phi$ Loop', '$\psi$ Loop','$y$ Loop'}, ... + 'Location', 'Southwest', ... + 'Interpreter', 'Latex'); + +% add zero crossing lines +%axes(plotAxes(1)) +%line([0.1, 20], [-180, -180], 'Color', 'k') +axes(plotAxes(2)) +line([0.1, 20], [0, 0], 'Color', 'k') + +% add some lines and labels for the cross over frequencies +if strcmp(input, 'Steer') + wc = 2; + wShift = [0.42, 0.35, 0.175]; +else strcmp(input, 'Roll') + wc = 1.5; + wShift = [0.31, 0.26, 0.1325]; +end +axes(plotAxes(2)) +hold on +gray = [0.5, 0.5, 0.5]; + +line([wc, wc], [-40, 0], 'Color', gray) +text(wc - wShift(1), -43, ['$\omega_c=' num2str(wc) '$'], ... + 'Interpreter', 'Latex', 'Fontsize', 8) + +line([wc / 2, wc / 2], [-30, 0], 'Color', gray) +text(wc / 2 - wShift(2), -33, ['$\omega_c/2=' num2str(wc / 2) '$'], ... + 'Interpreter', 'Latex', 'Fontsize', 8) + +line([wc / 4, wc / 4], [-20, 0], 'Color', gray) +text(wc / 4 - wShift(3), -23, ['$\omega_c/4=' num2str(wc / 4) '$'], ... + 'Interpreter', 'Latex', 'Fontsize', 8) + +hold off + +curPos1 = get(plotAxes(1), 'Position'); +curPos2 = get(plotAxes(2), 'Position'); +set(plotAxes(1), 'Position', curPos1 + [0, raise, 0, 0]) +set(plotAxes(2), 'Position', curPos2 + [0, raise, 0, 0]) +xLab = get(plotAxes(1), 'Xlabel'); +set(xLab, 'Units', 'normalized') +set(xLab, 'Position', get(xLab, 'Position') + [0, raise + 0.05, 0]) + +filename = ['benchmark' input 'Open.eps']; +pathToFile = ['plots' filesep filename]; +print(gcf, '-deps2c', '-loose', pathToFile) +fix_ps_linestyle(pathToFile) + +% handling qualities plot +num = bikeData.handlingMetric.num; +den = bikeData.handlingMetric.den; +w = linspace(0.01, 20, 200); +[mag, phase, freq] = bode(tf(num, den), w); +figure() +set(gcf, ... + 'Color', [1, 1, 1], ... + 'PaperOrientation', 'portrait', ... + 'PaperUnits', 'inches', ... + 'PaperPositionMode', 'manual', ... + 'PaperPosition', [0, 0, figWidth, figHeight], ... + 'PaperSize', [figWidth, figHeight]) + +hold on + +metricLine = plot(freq, mag(:)', 'k-', 'Linewidth', 2.0); +level1 = line([0, 20], [5, 5]); +level2 = line([0, 20], [8, 8]); +set(level1, 'Color', 'k', 'Linestyle', '--', 'Linewidth', 2.0) +set(level2, 'Color', 'k', 'Linestyle', '--', 'Linewidth', 2.0) + +ylim([0, 10]); + +ylabel('Handling Quality Metric') +xlabel('Frequency (rad/s)') +text(3, 3, 'Level 1') +text(3, 6.5, 'Level 2') +text(3, 9, 'Level 3') +box on + +filename = ['benchmark' input 'Handling.eps']; +pathToFile = ['plots' filesep filename]; +print(gcf, '-deps2', '-loose', pathToFile) +fix_ps_linestyle(pathToFile) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function open_loop_all_bikes(data, linestyles, colors) +% Creates open loop Bode plots of all the bikes. + +global goldenRatio + +bikes = fieldnames(data); + +figure() +figWidth = 5.0; +figHeight = figWidth / goldenRatio; +set(gcf, ... + 'Color', [1, 1, 1], ... + 'PaperOrientation', 'portrait', ... + 'PaperUnits', 'inches', ... + 'PaperPositionMode', 'manual', ... + 'PaperPosition', [0, 0, figWidth, figHeight], ... + 'PaperSize', [figWidth, figHeight]) + +freq = {0.1, 20.0}; + +% make sure all bode plots display 'rad/s' instead of 'rad/sec' +bops = bodeoptions; +bops.FreqUnits = 'rad/s'; + +hold all +for i = 2:length(bikes) + num = data.(bikes{i}).Medium.openLoops.Phi.num; + den = data.(bikes{i}).Medium.openLoops.Phi.den; + openBode = bodeplot(tf(num, den), freq, bops); +end +hold off + +% clean it up +opts = getoptions(openBode); +%opts.Title.String = '$\phi$ Open Loop Bode Diagrams at 5 m/s'; +opts.Title.String = ''; +%opts.Title.Interpreter = 'Latex'; +opts.YLim = {[-30, 10], [-540, -90]}; +opts.PhaseMatching = 'on'; +opts.PhaseMatchingValue = 0; +setoptions(openBode, opts) + +% find all the lines in the current figure +plotAxes = findobj(gcf, 'type', 'axes'); +magLines = findobj(plotAxes(2), 'type', 'line'); +phaseLines = findobj(plotAxes(1), 'type', 'line'); + +for i = 2:length(magLines) + set(magLines(i), ... + 'LineStyle', linestyles{i - 1}, ... + 'Color', colors{i - 1}, ... + 'LineWidth', 1.0) + set(phaseLines(i), ... + 'LineStyle', linestyles{i - 1}, ... + 'Color', colors{i - 1}, ... + 'LineWidth', 1.0) +end + +closeLeg = legend(magLines(2:7), ... + {'1', '2', '3', '4', '5', '6'}, ... + 'Location', 'Southwest', ... + 'Fontsize', 8); + +set(plotAxes, 'YColor', 'k', 'XColor', 'k', 'Fontsize', 8) + +% add a zero lines +axes(plotAxes(1)) +line([0.1, 20], [-180, -180], 'Color', 'k') +axes(plotAxes(2)) +line([0.1, 20], [0, 0], 'Color', 'k') + +% raise the axes cause the xlabel is cut off +raise = 0.05; +curPos1 = get(plotAxes(1), 'Position'); +curPos2 = get(plotAxes(2), 'Position'); +set(plotAxes(1), 'Position', curPos1 + [0, raise, 0, 0]) +set(plotAxes(2), 'Position', curPos2 + [0, raise, 0, 0]) +xLab = get(plotAxes(1), 'Xlabel'); +set(xLab, 'Units', 'normalized') +set(xLab, 'Position', get(xLab, 'Position') + [0, raise + 0.05, 0]) + +filename = 'openBode.eps'; +pathToFile = ['plots' filesep filename]; +print(pathToFile, '-deps2c', '-loose') +fix_ps_linestyle(pathToFile) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function handling_all_bikes(data, rollData, linestyles, colors) +% Creates handling quality metric for all bikes. +% +% Parameters +% ---------- +% data : structure +% Contains data for all bikes a the three speeds for steer input. +% rollData : structure +% Contains the data for the benchmark bike with roll input at medium speed. +% linestyles : cell array +% Linestyle strings, one for each of the six bikes. +% colors : cell array +% Colorspecs for each of the six bikes. + +global goldenRatio + +bikes = fieldnames(data); +figure() +figWidth = 5.0; +figHeight = figWidth / goldenRatio; +set(gcf, ... + 'Color', [1, 1, 1], ... + 'PaperOrientation', 'portrait', ... + 'PaperUnits', 'inches', ... + 'PaperPositionMode', 'manual', ... + 'PaperPosition', [0, 0, figWidth, figHeight], ... + 'PaperSize', [figWidth, figHeight]) + +w = linspace(0.01, 20, 200); +speedNames = fieldnames(data.Browser); +fillColors = {[0.82, 0.82, 0.82] + [0.68, 0.68, 0.68] + [0.95, 0.95, 0.95]}; +hold all + +% plot the background area for each family of curves +for j = 1:length(speedNames) + % get the max values for the set of curves + magnitudes = zeros(length(w), length(bikes) - 1); + for i = 2:length(bikes) + num = data.(bikes{i}).(speedNames{j}).handlingMetric.num; + den = data.(bikes{i}).(speedNames{j}).handlingMetric.den; + [mag, phase, freq] = bode(tf(num, den), w); + magnitudes(:, i - 1) = mag(:)'; + end + maxMag = max(magnitudes, [], 2); + % fill the area under the curve + area(freq, maxMag, ... + 'Facecolor', fillColors{j}, ... + 'Edgecolor', 'none') +end + +% this makes sure that the edges of the fill area don't cover the axes +set(gca, 'Layer', 'top') + +% plot the actual curves +for j = 1:length(speedNames) + metricLines = zeros(length(bikes) - 1, 1); + for i = 2:length(bikes) + num = data.(bikes{i}).(speedNames{j}).handlingMetric.num; + den = data.(bikes{i}).(speedNames{j}).handlingMetric.den; + [mag, phase, freq] = bode(tf(num, den), w); + metricLines(i - 1) = plot(freq, mag(:)', ... + 'Color', colors{i - 1}, ... + 'Linestyle', linestyles{i - 1}, ... + 'Linewidth', 2.0); + end +end + +% add the roll input bike +num = rollData.handlingMetric.num; +den = rollData.handlingMetric.den; +[mag, phase, freq] = bode(tf(num, den), w); +rollLine = plot(freq, mag(:)', 'k', 'Linewidth', 2.0, 'Linestyle', ':'); + +hold off + +% move the roll input line down so it shows on the legend +chil = get(gca, 'Children'); +legLines = [chil(end:-1:14)', rollLine]; +legend(legLines, [{'2.5 m/s', '5.0 m/s', '7.5 m/s'}, ... + {'1', '2', '3', '4', '5', '6', 'Hands-free @ 5 m/s'}], ... + 'Fontsize', 8) + +ylim([0, 20]); +level1 = line([0, 20], [5, 5]); +level2 = line([0, 20], [8, 8]); +set(level1, 'Color', 'k', 'Linestyle', '--', 'Linewidth', 1.0) +set(level2, 'Color', 'k', 'Linestyle', '--', 'Linewidth', 1.0) +ylabel('Handling Quality Metric') +xlabel('Frequency (rad/s)') +text(3.1, 4.3, 'Level 1') +text(1.9, 6.5, 'Level 2') +text(3, 15, 'Level 3') +box on + +set(gca, 'YColor', 'k') + +filename = 'handling.eps'; +pathToFile = ['plots' filesep filename]; +print(pathToFile, '-deps2c', '-loose') +fix_ps_linestyle(pathToFile) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function path_plots(data, linestyles, colors) +% Creates a plot of the path tracking for all bikes at all speeds. + +global goldenRatio + +bikes = fieldnames(data); +speedNames = fieldnames(data.Browser); + +figure() +figWidth = 5.0; +figHeight = figWidth / goldenRatio; +set(gcf, ... + 'Color', [1, 1, 1], ... + 'PaperOrientation', 'portrait', ... + 'PaperUnits', 'inches', ... + 'PaperPositionMode', 'manual', ... + 'PaperPosition', [0, 0, figWidth, figHeight], ... + 'PaperSize', [figWidth, figHeight]) + +hold all + +% shifts the paths by this many meters +shift = [0, 15, 35]; +for j = 1:length(speedNames) + time = data.(bikes{2}).(speedNames{j}).time; + path = data.(bikes{2}).(speedNames{j}).path; + speed = data.(bikes{2}).(speedNames{j}).speed; + plot(time * speed + shift(j), -path * j, 'k-') + for i = 2:length(bikes) + x = data.(bikes{i}).(speedNames{j}).outputs(:, 17); + x = x + shift(j); + y = data.(bikes{i}).(speedNames{j}).outputs(:, 18); + plot(x, -y * j, ... + 'Linestyle', linestyles{i - 1}, ... + 'Color', colors{i - 1}, ... + 'Linewidth', 0.75) + end + [minPath, minPathI] = min(-path * j); + dis = time * speed + shift(j); + lab = sprintf('%1.1f m/s', speed); + text(dis(minPathI) - 15, minPath - 0.4, lab) +end + +hold off + +% change the y tick labels to positive and to reflect the 2 meter width +set(gca, 'YTick', [-7, -6, -4, -2, 0, 1]) +set(gca, 'YTickLabel', {'', '2', '2', '2', '0', ''}) + +xlim([30 200]) +box on +legend(['Path', {'1', '2', '3', '4', '5', '6'}], ... + 'Fontsize', 8, 'Location', 'Southeast') +xlabel('Distance (m)') +ylabel('Lateral Deviation (m)') +filename = 'paths.eps'; +pathToFile = ['plots' filesep filename]; +print(pathToFile, '-deps2c', '-loose') +fix_ps_linestyle(pathToFile) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function plot_io(variable, io, xAxis, data, linestyles, colors) +% Creates a plot of the time histories of a particular output or input variable +% for three different speeds with either time or distance on the x axis. +% +% Parameters +% ---------- +% variable : string +% The name of the variable you'd like to plot. +% io : string +% 'input' for input and 'output' for output. +% data : structure +% Data for a set of bicycles, the first being the benchmark bicycle. +% xAxis : string +% 'Distance' or 'Time' on the x axis. +% linestyles : cell array +% An array of linestyle types, one for each bicycle. +% colors : cell array +% An array of colors, one for each bicycle. + +global goldenRatio + +if strcmp(io, 'input') + names = {'Tphi', + 'Tdelta', + 'F'}; + prettyNames = {'$T_\phi$', + '$T_\delta$', + '$F$'}; + units = {'(N-m)', + '(N-m)', + '(N)'}; +elseif strcmp(io, 'output') + names = {'xP', + 'yP', + 'psi', + 'phi', + 'thetaP', + 'thetaR', + 'delta', + 'thetaF', + 'xPDot', + 'ypDot', + 'psiDot', + 'phiDot', + 'thetaPDot', + 'thetaRDot', + 'deltaDot', + 'thetaFDot', + 'xQ', + 'yQ'}; + prettyNames = {'$x_P$', + '$y_P$', + '$\psi$', + '$\phi$', + '$\theta_P$', + '$\theta_R$', + '$\delta$', + '$\theta_F$', + '$\dot{x}_P$', + '$\dot{y}_P$', + '$\dot{\psi}$', + '$\dot{\phi}$', + '$\dot{\theta}_P$', + '$\dot{\theta}_R$', + '$\dot{\delta}$', + '$\dot{\theta}_F$', + '$x_Q$', + '$y_Q$'}; + units = {'(m)', + '(m)', + '(rad)', + '(rad)', + '(rad)', + '(rad)', + '(rad)', + '(rad)', + '(m/s)', + '(m/s)', + '(rad/s)', + '(rad/s)', + '(rad/s)', + '(rad/s)', + '(rad/s)', + '(rad/s)', + '(m)', + '(m)'}; +else + error('Please choose i or o') +end + +index = find(ismember(names, variable) == 1); + +bikes = fieldnames(data); +speedNames = fieldnames(data.Browser); + +figure() +figWidth = 5.0; +figHeight = figWidth / goldenRatio; +set(gcf, ... + 'Color', [1, 1, 1], ... + 'PaperOrientation', 'portrait', ... + 'PaperUnits', 'inches', ... + 'PaperPositionMode', 'manual', ... + 'PaperPosition', [0, 0, figWidth, figHeight], ... + 'PaperSize', [figWidth, figHeight]) + +% find the maximum value of the variable +maxValue = 0; +for i = 2:length(bikes) + for j = 1:length(speedNames) + oneSpeed = data.(bikes{i}).(speedNames{j}); + history = oneSpeed.([io 's'])(:, index); + if max(history) > maxValue + maxValue = max(history); + end + end +end + +m = round(maxValue * 100) / 100; +pad = 0.15 * m; +yShift = [0, 2 * (m + pad), 4 * (m + pad)]; + +% shifts the paths by this many meters along the x axis +xShift = [0, 15, 35]; +hold all +for j = 1:length(speedNames) + for i = 2:length(bikes) + oneSpeed = data.(bikes{i}).(speedNames{j}); + time = oneSpeed.time; + speed = oneSpeed.speed; + distance = time * speed + xShift(j); + % time history of the value + history = oneSpeed.([io 's'])(:, index) + yShift(j); + if strcmp(xAxis, 'Distance') + xData = distance; + textX = 165; + elseif strcmp(xAxis, 'Time') + xData = time; + textX = 2; + else + error('Choose Time or Distance, no other') + end + plot(xData, history, ... + 'Linestyle', linestyles{i - 1}, ... + 'Color', colors{i - 1}, ... + 'Linewidth', 0.75) + end + % add labels for the speeds + text(textX, yShift(j) + 4 * pad, [num2str(speed) ' m/s']) +end + +ylim([-m - pad, yShift(3) + m + pad]) +set(gca, 'YTick', ... + [-m, yShift(1), m, ... + yShift(2) - m, yShift(2), yShift(2) + m, ... + yShift(3) - m, yShift(3), yShift(3) + m]) +ticks = {num2str(-m), '0', num2str(m)}; +set(gca, 'YTickLabel', [ticks, ticks ticks]) + +if strcmp(xAxis, 'Distance') + xlabel('Distance (m)') + xLimits = [35, 190]; + xlim(xLimits) + loc = 'Northwest'; +else + xlabel('Time (s)') + xLimits = [0, 50]; + xlim(xLimits) + loc = 'Northeast'; +end +l1 = line(xLimits, [yShift(1) + m + pad, yShift(1) + m + pad]); +l2 = line(xLimits, [yShift(2) + m + pad, yShift(2) + m + pad]); +set([l1, l2], 'Color', 'k') +hold off +set(gca, 'Fontsize', 8) +first = [prettyNames{index} ' ' units{index}]; +ylabel(first, 'Interpreter', 'Latex') +box on +legend({'1', '2', '3', '4', '5', '6'}, 'Fontsize', 8, 'Location', loc) + +% if it is the steer angle plot for distance, add a magnifier for the +% countersteer +if strcmp(variable, 'delta') && strcmp(xAxis, 'Distance') + % Specify the position and the size of the rectangle + x_r = 37; y_r = 0; w_r = 4; h_r = 0.01; + rectangle('Position', [x_r-w_r/2, y_r-h_r/2, w_r, h_r], ... + 'EdgeColor', 'k'); + % Specify the position and the size of the 2. axis + x_a = 0.2; y_a = 0.29; w_a = 0.15; h_a = w_a * h_r / w_r * 20 / 0.05; + ax = axes('Units', 'Normalized', ... + 'Position', [x_a, y_a, w_a, h_a], ... + 'XTick', [], ... + 'YTick', [], ... + 'Box', 'on', ... + 'LineWidth', 0.5, ... + 'Color', 'w'); + hold on + j = 1; + for i = 2:length(bikes) + oneSpeed = data.(bikes{i}).(speedNames{j}); + time = oneSpeed.time; + speed = oneSpeed.speed; + distance = time * speed + xShift(j); + % time history of the value + history = oneSpeed.([io 's'])(:, index) + yShift(j); + plot(distance, history, ... + 'Linestyle', linestyles{i - 1}, ... + 'Color', colors{i - 1}, ... + 'Linewidth', 0.75) + end + hold off + axis([x_r-w_r/2, x_r+w_r/2, y_r-h_r/2, y_r+h_r/2]); + text(35.3, -0.003, 'Countersteer', 'Fontsize', 8) + % bottom left + annotation('line', [x_a, 0.129], [y_a, 0.235]) + % top left + annotation('line', [x_a, 0.132], [y_a + h_a, 0.26]) + % bottom right + annotation('line', [x_a + w_a, 0.15], [y_a, 0.235]) + % top right + annotation('line', [x_a, 0.15], [y_a + 0.02, 0.26]) +end + +% save the file +filename = [variable xAxis '.eps']; +print(['plots' filesep filename], '-deps2c', '-loose') +fix_ps_linestyle(['plots' filesep filename]) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function plot_io_roll(rollData, xAxis) + +global goldenRatio + +% closed loop bode plots +figure() +figWidth = 5.0; +figHeight = figWidth / goldenRatio; +set(gcf, ... + 'Color', [1, 1, 1], ... + 'PaperOrientation', 'portrait', ... + 'PaperUnits', 'inches', ... + 'PaperPositionMode', 'manual', ... + 'PaperPosition', [0, 0, figWidth, figHeight], ... + 'PaperSize', [figWidth, figHeight]) + +speed = rollData.speed; +time = rollData.time; +path = rollData.path; +frontWheel = rollData.outputs(:, 18); +rollAngle = rollData.outputs(:, 4); +steerAngle = rollData.outputs(:, 7); +rollTorque = rollData.inputs(:, 1); + +% plot the path +subplot(2, 1, 1) +hold all +if strcmp(xAxis, 'Distance') + plot(speed * time, -path, 'k-', 'Linewidth', 1.0) + plot(speed * time, -frontWheel, 'k:', 'Linewidth', 1.0) + xlabel('Distance (m)') + xlim([30, 150]) +elseif strcmp(xAxis, 'Time') + plot(time, -path, 'k-', 'Linewidth', 1.0) + plot(time, -frontWheel, 'k:', 'Linewidth', 1.0) + xlabel('Time (s)') + xlim([30 / speed, 150 / speed]) +else + error('Bad xAxis, choose Distance or Time') +end +hold off +box on +ylabel('Lateral Deviation (m)') +ylim([-2.2, 0.2]) +set(gca, 'YTickLabel', {'2', '1', '0'}) +legend({'Path'}, ... + 'Interpreter', 'Latex', ... + 'Fontsize', 8, ... + 'Location', 'Southeast') + +subplot(2, 1, 2) +hold all +if strcmp(xAxis, 'Distance') + plot(speed * time, rollAngle, 'k-', 'Linewidth', 1.0) + [ax, h1, h2] = plotyy(speed * time, steerAngle, speed * time, rollTorque); + xlabel('Distance (m)') + xlim(ax(1), [30, 150]) + xlim(ax(2), [30, 150]) +elseif strcmp(xAxis, 'Time') + plot(time, rollAngle, 'k-', 'Linewidth', 1.0) + [ax, h1, h2] = plotyy(time, steerAngle, time, rollTorque); + xlabel('Time (s)') + xlim(ax(1), [30 / speed, 150 / speed]) + xlim(ax(2), [30 / speed, 150 / speed]) +else + error('Bad xAxis, choose Distance or Time') +end +hold off +box on + +set(get(ax(1), 'Ylabel'), ... + 'String', 'Angle (rad)', ... + 'Color', 'k') +set(get(ax(2), 'Ylabel'), ... + 'String', 'Torque (N-m)', ... + 'Color', 'k') +set(ax, 'YColor', 'k', 'Fontsize', 8) +set(h1, 'Linestyle', '--', 'Color', 'k', 'Linewidth', 1.0) +set(h2, 'Linestyle', '-.', 'Color', 'k', 'Linewidth', 1.0) +legend({'$\phi$', '$\delta$', '$T_\phi$'}, ... + 'Interpreter', 'Latex', ... + 'Fontsize', 8, ... + 'Location', 'Northeast') + +if strcmp(xAxis, 'Distance') + axes(ax(2)) + % magnifier rectangle + x_r = 38; y_r = 0; w_r = 10; h_r = 0.3; + rectangle('Position', [x_r-w_r/2, y_r-h_r/2, w_r, h_r], ... + 'EdgeColor', 'k'); + % magnify it + x_a = 0.14; y_a = 0.432; w_a = 0.28; h_a = 0.12; + inset = axes('Units', 'Normalized', ... + 'Position', [x_a, y_a, w_a, h_a], ... + 'Box', 'on', ... + 'LineWidth', 0.5, ... + 'Color', [0.8, 0.8, 0.8]); + hold on + plot(inset, time, rollAngle, 'k-', 'Linewidth', 1.0) + [ax, h1, h2] = plotyy(inset, time, steerAngle, time, rollTorque); + set(ax, 'XTick', [], ... + 'YTick', [], ... + 'YColor', 'k') + set(h1, 'Linestyle', '--', 'Color', 'k', 'Linewidth', 1.0) + set(h2, 'Linestyle', '-.', 'Color', 'k', 'Linewidth', 1.0) + axis(ax(1), [7, 8.5, -0.0025, 0.0025]) + axis(ax(2), [7, 8.5, -0.0025 / 0.02, 0.0025 / 0.02]) + + % draw some lines connecting the corners + annotation('line', [x_a, 0.149], [y_a, 0.287]) + annotation('line', [x_a + w_a, 0.213], [y_a, 0.287]) + annotation('textbox', [0.26, 0.47, 0.1, 0.02], ... + 'String', 'Countersteer', ... + 'Fontsize', 8, ... + 'Edgecolor', 'none') +end + +filename = ['roll' xAxis '.eps']; +print(gcf, ['plots' filesep filename], '-deps2c', '-loose') +fix_ps_linestyle(['plots' filesep filename]) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function phase_portraits(bikeData) +% Creates four phase portrait plots to demonstrate the effects on the phase +% portraits when adjusting the gains. + +global goldenRatio + +figure() +figWidth = 6.0; +figHeight = figWidth / goldenRatio; +set(gcf, ... + 'Color', [1, 1, 1], ... + 'PaperOrientation', 'portrait', ... + 'PaperUnits', 'inches', ... + 'PaperPositionMode', 'manual', ... + 'OuterPosition', [424, 305 - 50, 518, 465], ... + 'PaperPosition', [0, 0, figWidth, figHeight], ... + 'PaperSize', [figWidth, figHeight]) + +% this is the gain multiplier for the non-nominal plot +gainChanges = [1.2, 1, 1, 1, 1; + 1, 1.2, 1, 1, 1; + 1, 1, 1.2, 1, 1; + 1, 1, 1.2, 0.8, 0.8]; + +loopNames = {'kDelta', 'kPhiDot', 'kPhi', 'kPhi'}; +% the x and y indices for each plot +xy = [7, 15; + 4, 12; + 4, 12; + 4, 12]; +% where to get the x and y data from +xySource = {'outputs', 'outputsDot', 'outputs', 'outputs'}; + +% axis labels +xlabels = {'(a) $\delta$ (rad)', + '(b) $\dot{\phi}$ (rad/s)', + '(c) $\phi$ (rad)', + '(d) $\phi$ (rad)'}; +ylabels = {'$\dot{\delta}$ (rad/s)', + '$\ddot{\phi}$ (rad/s$^2$)', + '$\dot{\phi}$ (rad/s)', + '$\dot{\phi}$ (rad/s)'}; + +% legend starts +legends = {'$k_\delta$ = ', + '$k_{\dot{\phi}}$ = ', + '$k_\phi$ = ', + '$k_\phi$ = '}; +% how many decimals to show for each legend +floatSpec = {'%1.1f', '%1.3f', '%1.1f', '%1.1f'}; + +for i = 1:length(loopNames) + + display(sprintf('Calculating phase portrait %d', i)) + + % adjust the gains and get the data + twentyPercent = generate_data('Benchmark', 5.0, ... + 'gainMuls', gainChanges(i, :)); + subplot(2, 2, i) + hold on + + if i == 4 + display('Phase portrait 4 comparison data.') + nominalData = generate_data('Benchmark', 5.0, ... + 'gainMuls', [1, 1, 1, 0.8, 0.8]); + x = nominalData.(xySource{i})(:, xy(i, 1)); + y = nominalData.(xySource{i})(:, xy(i, 2)); + else + x = bikeData.(xySource{i})(:, xy(i, 1)); + y = bikeData.(xySource{i})(:, xy(i, 2)); + end + plot(x, y, 'k-', 'Linewidth', 1.0) + + x = twentyPercent.(xySource{i})(:, xy(i, 1)); + y = twentyPercent.(xySource{i})(:, xy(i, 2)); + plot(x, y, 'k--', 'Linewidth', 1.0) + + hold off + + box on + axis equal + xlabel(xlabels{i}, 'Interpreter', 'Latex', 'Fontsize', 8) + ylabel(ylabels{i}, 'Interpreter', 'Latex', 'Fontsize', 8) + + % make the legend + leg1 = sprintf(floatSpec{i}, bikeData.modelPar.(loopNames{i})); + leg2 = sprintf(floatSpec{i}, twentyPercent.modelPar.(loopNames{i})); + legend({[legends{i} leg1], [legends{i} leg2]} , ... + 'Interpreter', 'Latex', ... + 'Fontsize', 6) +end + +plotAxes = findobj(gcf, 'Type', 'Axes'); +set(plotAxes, 'Fontsize', 8) + +% save the plot +filename = 'phasePortraits.eps'; +print(gcf, ['plots' filesep filename], '-deps2c', '-loose') +fix_ps_linestyle(['plots' filesep filename]) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function eigenvalues(data, linestyles, colors) + +global goldenRatio + +figure() +figWidth = 5.0; +figHeight = figWidth / goldenRatio; +set(gcf, ... + 'Color', [1, 1, 1], ... + 'PaperOrientation', 'portrait', ... + 'PaperUnits', 'inches', ... + 'PaperPositionMode', 'manual', ... + 'PaperPosition', [0, 0, figWidth, figHeight], ... + 'PaperSize', [figWidth, figHeight]) + +bikes = fieldnames(data); +bikes(1) = []; +speeds = 0:0.1:10; +eVals = zeros(length(bikes), length(speeds), 11); +for i = 1:length(bikes) + % load the bicycle parameters + pathToParFile = ['parameters' filesep bikes{i} 'Par.txt']; + par = par_text_to_struct(pathToParFile); + str = 'Calculating eigenvalues for the %s bicycle and rider.'; + display(sprintf(str, bikes{i})) + for j = 1:length(speeds) + % calculate the A, B, C, and D matrices of the bicycle model + [A, B, C, D] = whipple_pull_force_abcd(par, speeds(j)); + eigenValues = eig(A); + eVals(i, j, :) = real(eig(A)); + end +end + +% reduce to the maximum values +zeroIndices = find(abs(eVals) <= 0.000001); +eVals(zeroIndices) = -100 * ones(size(zeroIndices)); +maxEvals = max(eVals, [], 3); + +lines = plot(speeds, maxEvals); + +for i = 1:length(lines) + set(lines(i), ... + 'Linestyle', linestyles{i}, ... + 'Color', colors{i}, ... + 'Linewidth', 1) +end + +legend({'1', '2', '3', '4', '5', '6'}) +xlabel('Speed (m/s)') +ylabel('Maximum real part of the eigenvalue (1/s)') + +% set the tick marks differently +%set(gca, 'XTick', 0:0.5:10) +%set(gca, 'XTickLabel', {'0', '', '1', '', ... + %'2', '2.5', '3', '', ... + %'4', '', '5.0', '', ... + %'6', '', '7', '7.5', ... + %'8', '', '9', '', '10'}) +% +% add some lines and labels for the speeds we looked at +hold on +maxLine = max(maxEvals, [], 1); +minLine = min(maxEvals, [], 1); +lines = zeros(4, 1); +speedInd = find(speeds == 2.5); +lines(1) = line([2.5, 2.5], ... + [minLine(speedInd) - 0.4, maxLine(speedInd) + 0.4]); +text(2, maxLine(speedInd) + 0.7, '2.5 m/s') +speedInd = find(speeds == 5.0); +lines(2) = line([5.0, 5.0], ... + [minLine(speedInd) - 0.4, maxLine(speedInd) + 0.4]); +text(4.5, maxLine(speedInd) + 0.7, '5.0 m/s') +speedInd = find(speeds == 7.5); +lines(3) = line([7.5, 7.5], ... + [minLine(speedInd) - 0.4, maxLine(speedInd) + 0.4]); +text(7, maxLine(speedInd) + 0.7, '7.5 m/s') + +lines(4) = line([0, 10], [0, 0]); +hold off + +set(lines, 'Color', 'k', 'Linewidth', 2) + +% save the plot +filename = 'eigenvalues.eps'; +print(gcf, ['plots' filesep filename], '-deps2c', '-loose') +fix_ps_linestyle(['plots' filesep filename]) diff --git a/samples/Matlab/distance.m b/samples/Matlab/distance.m new file mode 100644 index 00000000..67ae0426 --- /dev/null +++ b/samples/Matlab/distance.m @@ -0,0 +1,13 @@ +function [ value,isterminal,direction ] = distance( t,y,mu ) +% DISTANCE compute the distance from the attactors +% [ value,terminal,direction ] = distance( t,y ) + +d=1e-2; % FIXME + +% TODO mettere if se tolleranza D-d value=0 +D=sqrt((y(1)+mu).^2+y(2).^2); % distance from the largest primary + +value=d-D; +isterminal=1; +direction=0; +end \ No newline at end of file diff --git a/samples/Matlab/double_gyre.m b/samples/Matlab/double_gyre.m new file mode 100644 index 00000000..b0fc82e0 --- /dev/null +++ b/samples/Matlab/double_gyre.m @@ -0,0 +1,49 @@ +clear all +tic +% initialize integration time T, f(x,t), discretization size n ---------------- +T = 8; +x_min=0; +x_max=2; +y_min=0; +y_max=1; +n=50; % how many points per one measure unit (both in x and in y) +ds=1/(n-1); +x_res=(x_max-x_min)*n; +y_res=(y_max-y_min)*n; +grid_x=linspace(x_min,x_max,x_res); +grid_y=linspace(y_min,y_max,y_res); + +advected_x=zeros(x_res,y_res); +advected_y=zeros(x_res,y_res); +% integrate all initial points for t in [0,T] -------------------------------- +parfor i = 1:x_res + for j = 1:y_res + [t,X] = ode45(@dg,[0,T],[grid_x(i),grid_y(j)]); + % store advected positions as they would appear in (x,y) coords ------ + advected_x(i,j) = X(length(X(:,1)),1); + advected_y(i,j) = X(length(X(:,2)),2); + end +end +%% Compute FTLE +sigma=zeros(x_res,y_res); +% at each point in interior of grid, store FTLE ------------------------------ +for i = 2:x_res-1 + for j = 2:y_res-1 + % compute Jacobian phi ----------------------------------------------- + phi(1,1) = (advected_x(i+1,j)-advected_x(i-1,j))/(2*ds); + phi(1,2) = (advected_x(i,j-1)-advected_x(i,j+1))/(2*ds); + phi(2,1) = (advected_y(i+1,j)-advected_y(i-1,j))/(2*ds); + phi(2,2) = (advected_y(i,j-1)-advected_y(i,j+1))/(2*ds); + % find max eigenvalue of phi'*phi ------------------------------------ + lambda_max = max(abs(eig(phi'*phi))); + % store FTLE --------------------------------------------------------- + sigma(i,j) = log(lambda_max)/abs(2*T); + end +end +toc +%% plot FTLE field ------------------------------------------------------------ +figure +contourf(grid_x,grid_y,sigma'); +colorbar('location','EastOutside'); +axis equal +shading flat diff --git a/samples/Matlab/example.m b/samples/Matlab/example.m new file mode 100644 index 00000000..5547bdeb --- /dev/null +++ b/samples/Matlab/example.m @@ -0,0 +1,41 @@ +clear all +tic +% initialize integration time T, f(x,t), discretization size n ---------------- +T = 20; +f_x_t = inline('[v(2);-sin(v(1))]','t','v'); +grid_min = -3.4; +grid_max = 3.4; +grid_width = grid_max-grid_min; +n = 35; +grid_spacing = grid_min:(grid_width/(n-1)):grid_max; +advected_x=zeros(n,n); +advected_y=zeros(n,n); +% integrate all initial points for t in [0,T] -------------------------------- +for i = 1:n + for j = 1:n + [t,x] = ode45(f_x_t,[0,T],[grid_spacing(i),grid_spacing(j)]); + % store advected positions as they would appear in (x,y) coords ------ + advected_x(n-j+1,i) = x(length(x(:,1)),1); + advected_y(n-j+1,i) = x(length(x(:,2)),2); + end +end +sigma=zeros(n,n); +% at each point in interior of grid, store FTLE ------------------------------ +for i = 2:n-1 + for j = 2:n-1 + % compute Jacobian phi ----------------------------------------------- + phi(1,1) = (advected_x(i,j+1)-advected_x(i,j-1))/(2*grid_width/(n-1)); + phi(1,2) = (advected_x(i-1,j)-advected_x(i+1,j))/(2*grid_width/(n-1)); + phi(2,1) = (advected_y(i,j+1)-advected_y(i,j-1))/(2*grid_width/(n-1)); + phi(2,2) = (advected_y(i-1,j)-advected_y(i+1,j))/(2*grid_width/(n-1)); + % find max eigenvalue of phi'*phi ------------------------------------ + lambda_max = max(abs(eig(phi'*phi))); + % store FTLE --------------------------------------------------------- + sigma(i,j) = log(lambda_max)/abs(T); + end +end +toc +%% plot FTLE field ------------------------------------------------------------ +figure +contourf(grid_spacing,grid_spacing,sigma); +colorbar('location','EastOutside'); \ No newline at end of file diff --git a/samples/Matlab/fit_adapt.m b/samples/Matlab/fit_adapt.m new file mode 100644 index 00000000..426c2c63 --- /dev/null +++ b/samples/Matlab/fit_adapt.m @@ -0,0 +1,57 @@ +data = load_data('jason_adapt.mat'); + +t0 = 0; +t1 = 30; +t2 = 60; +t3 = 90; + +dataPlantOne = data(1:t1 / data.Ts); +dataAdapting = data(t1 / data.Ts:t2 / data.Ts); +dataPlantTwo = data(t2 / data.Ts:end); + +% k1, k2, k3, k4, tau, zetanm, wnm, zetafs, wfs + +% ron's guess +guessPlantOne = [4.85, 1.79, 20, 20, 0.2, 0.707, 10, 0.707, 65]; +% best solution from ron's guess +%guessPlantOne = [4.1129, 2.1327, 52.3747, 48.6997, 0.2, 0.707, 10, 0.707, 65]; +resultPlantOne = find_structural_gains(dataPlantOne, guessPlantOne, 1); +[yh, fit, x0] = compare(dataPlantOne, resultPlantOne.fit); +display(sprintf('The self validation VAF is %f.', fit(1, 1, 1))) + +% ron's guess +guessPlantTwo = [3.36, 9.49, 20, 0, 0.2, 0.707, 10, 0.707, 65]; +% best solution from ron's guess +%guessPlantTwo = [2.6686, 7.0431, 14.4623, 3.1532, 0.2, 0.707, 10, 0.707, 65]; +resultPlantTwo = find_structural_gains(dataPlantTwo, guessPlantTwo, 5); +[yh, fit, x0] = compare(dataPlantTwo, resultPlantTwo.fit); +display(sprintf('The self validation VAF is %f.', fit(1, 1, 1))) + +% compute the slope and offset for each gain for initial guesses +kP1 = resultPlantOne.fit.par(1:4); +kP2 = resultPlantTwo.fit.par(1:4); +gainSlopeOffset = [t1 * eye(4), eye(4); t2 * eye(4), eye(4)] \ [kP1; kP2]; + +aux.pars = guessPlantOne; % this only uses tau through wfs +aux.timeDelay = true; +aux.plantFirst = 1; % 1 / s +aux.plantSecond = 5; % 5 / (s + 10) +% compute the slope and offset of the plant for t1 < t < t2 +plantOneSlopeOffset = [t1, 1; t2, 1] \ [1; 0]; +plantTwoSlopeOffset = [t1, 1; t2, 1] \ [0; 1]; +aux.m = [plantOneSlopeOffset(1); plantTwoSlopeOffset(1)]; +aux.b = [plantOneSlopeOffset(2); plantTwoSlopeOffset(2)]; + +%[dx, y] = adapting_structural_model(45, ones(8, 1), 10, gainSlopeOffset, {aux}); + +% NOTE: 'FileArgument' has to be a cell array, the is why aux is in +% brackets. Also, if you pass the parameters in as a vector here, as I have, +% they get mapped to a structure and your ode file/function must accept each +% parameter as individual arguments. +mod = idnlgrey('adapting_structural_model', [1, 1, 8], gainSlopeOffset, ... + zeros(8, 1), 0, 'FileArgument', {aux}, 'InputName', 'thetac', ... + 'OutputName', 'theta'); + +fit = pem(dataAdapting, mod); + +compare(dataAdapting, fit); diff --git a/samples/Matlab/fit_adapt_linear.m b/samples/Matlab/fit_adapt_linear.m new file mode 100644 index 00000000..16764289 --- /dev/null +++ b/samples/Matlab/fit_adapt_linear.m @@ -0,0 +1,86 @@ +% This file identifies a series of models for a time varying plant. + +% k1, k2, k3, k4, tau, zetanm, wnm, zetafs, wfs + +%data = load_data('jason_adapt.mat'); +%filename = 'adapt'; +%guess.plantOne = [4.85, 1.79, 20, 20, 0.2, 0.707, 10, 0.707, 65]; +%guess.plantTwo = [3.36, 9.49, 20, 0, 0.2, 0.707, 10, 0.707, 65]; +%plantNum.plantOne = 1; +%plantNum.plantTwo = 5; + +data = load_data('adapt_hard.mat'); +filename = 'hard-adapt'; +guess.plantOne = [1.23, 0.354, 0.2, 20.0, 0.2, 0.707, 10, 0.707, 65]; +guess.plantTwo = [4.85, 1.79, 20, 20, 0.2, 0.707, 10, 0.707, 65]; +plantNum.plantOne = 6; +plantNum.plantTwo = 1; + +t = [0, 30, 40, 50, 60, 90]; + +sections = {'plantOne', 'adaptOne', 'adaptTwo', 'adaptThree', 'plantTwo'}; +for i = 1:length(sections) + secData.(sections{i}) = data(t(i) / data.Ts + 1:t(i + 1) / data.Ts); +end + +% compute the slope and offset for each gain for initial guesses +kP1 = guess.plantOne(1:4)'; +kP2 = guess.plantTwo(1:4)'; +gainSlopeOffset = [t(2) * eye(4), eye(4); t(5) * eye(4), eye(4)] \ [kP1; kP2]; +m = gainSlopeOffset(1:4); +b = gainSlopeOffset(5:8); + +for i = 1:length(sections) + + if strcmp(sections{i}, sections{1}) || strcmp(sections{i}, sections{end}) + display('boo') + else + if i > 1 + % use the best fit gains from the previous section + guess.(sections{i}) = result.(sections{i - 1}).fit.par; + else + currentGuess = m .* (t(i) + t(i + 1)) / 2 + b; + guess.(sections{i}) = [currentGuess', guess.plantOne(5:end)]; + end + percent = ((t(i) + t(i + 1)) / 2 - t(2)) / (t(5) - t(2)); + plantNum.(sections{i}) = {plantNum.plantOne, plantNum.plantTwo, percent}; + end + + result.(sections{i}) = find_structural_gains(secData.(sections{i}), ... + guess.(sections{i}), plantNum.(sections{i}), 'warning', false, ... + 'randomGuess', true); + + [yh, vaf, x0] = compare(secData.(sections{i}), result.(sections{i}).fit); + result.(sections{i}).vaf = vaf(1, 1, 1); + display(sprintf('The self validation VAF is %f.', vaf(1, 1, 1))) + + p = plantNum.(sections{i}); + if size(plantNum.(sections{i}), 2) > 1 + result.(sections{i}).plant = plant(p{:}); + else + result.(sections{i}).plant = plant(p); + end +end + +save(['data/' filename '-results.mat'], 'sections', 'guess', 'plantNum', 'result') + +for i = 1:length(sections) + result.(sections{i}).fig = figure; + compare(secData.(sections{i}), result.(sections{i}).fit); + saveas(result.(sections{i}).fig, ['plots/' filename '-' sections{i} '.png']) + [yh, fit, x0] = compare(secData.(sections{i}), result.(sections{i}).fit); + display('-----------------') + display('The task plant is:') + display(result.(sections{i}).plant) + display(sprintf('The order of the closed loop system is %u.', ... + size(result.(sections{i}).mod.A, 1))) + display(sprintf('The gain guesses: k1=%f, k2=%f, k3=%f, k4=%f', ... + result.(sections{i}).mod.par(1:4))) + display(sprintf('The identified gains: k1=%f+\\-%f, k2=%f+\\-%f, k3=%f+\\-%f, k4=%f+\\-%f', ... + result.(sections{i}).fit.par(1), result.(sections{i}).uncert(1), ... + result.(sections{i}).fit.par(2), result.(sections{i}).uncert(2), ... + result.(sections{i}).fit.par(3), result.(sections{i}).uncert(3), ... + result.(sections{i}).fit.par(4), result.(sections{i}).uncert(4))) + display(sprintf('The self validation VAF is %f.', ... + result.(sections{i}).vaf)) +end diff --git a/samples/Matlab/gpu_RKF45_FILE.m b/samples/Matlab/gpu_RKF45_FILE.m new file mode 100644 index 00000000..89280d1a --- /dev/null +++ b/samples/Matlab/gpu_RKF45_FILE.m @@ -0,0 +1,156 @@ +tic +clear +%% Range definition +n=200; + +mu=0.1; +[xl1,yl1,xl2,yl2,xl3,yl3,xl4,yl4,xl5,yl5]=Lagr(mu); +C_L1=2*Omega(xl1,yl1,mu); +E_0=-C_L1/2+0.03715; +Y_0=0; + +nx=n; +x_0_min=-0.8; +x_0_max=-0.15; +x_0=linspace(x_0_min, x_0_max, nx); +dx=(x_0_max-x_0_min)/(nx-1); + +nvx=n; +vx_0_min=-2; +vx_0_max=2; +vx_0=linspace(vx_0_min, vx_0_max, nvx); +dvx=(vx_0_max-vx_0_min)/(nvx-1); + +ny=3; +dy=(dx+dvx)/2; +y_0=[Y_0-dy Y_0 Y_0+dy]; + + + +ne=3; +de=dy; +e_0=[E_0-de E_0 E_0+de]; + +%% Definition of arrays of initial conditions + +%In this approach, only useful pints are stored and integrated + +m=1; +% x=zeros(1,nx*ny*nvx*ne); +% y=zeros(1,nx*ny*nvx*ne); +% vx=zeros(1,nx*ny*nvx*ne); +% e=zeros(1,nx*ny*nvx*ne); +% vy=zeros(1,nx*ny*nvx*ne); +filter=zeros(nx,3,nvx,3); + +for i=1:nx + for j=1:ny + for k=1:nvx + for l=1:ne + v_y=-sqrt(2*Omega(x_0(i),y_0(j),mu)+2*e_0(l)-vx_0(k)^2); + if ~((j~=2) && (l~=2)) && isreal(v_y) + x(m)=x_0(i); + y(m)=y_0(j); + vx(m)=vx_0(k); + e(m)=e_0(l); + vy(m)=v_y; + filter(i,j,k,l)=1; + m=m+1; + end + end + end + end +end + +%% Selection of useful points + +%% Data transfer to GPU +x_gpu=gpuArray(x); +y_gpu=gpuArray(y); +vx_gpu=gpuArray(vx); +vy_gpu=gpuArray(vy); + +%% Integration on GPU +N=1; +t0=0; + +[x_f,y_f,vx_f,vy_f]=arrayfun(@RKF45_FILE_gpu,t0,N,x_gpu,y_gpu,vx_gpu,vy_gpu,mu); + +%% Data back to CPU and GPU memory cleaning +clear x_gpu y_gpu vx_gpu vy_gpu +x_T=gather(x_f); +clear x_f +y_T=gather(y_f); +clear y_f +vx_T=gather(vx_f); +clear vx_f +vy_T=gather(vy_f); +clear vy_f + +%% Construction of matrix for FTLE computation + +X_T=zeros(nx,ny,nvx,ne); +Y_T=zeros(nx,ny,nvx,ne); +VX_T=zeros(nx,ny,nvx,ne); +VY_T=zeros(nx,ny,nvx,ne); +E_T=zeros(nx,ny,nvx,ne); +m=1; +for i=1:nx + for j=1:ny + for k=1:nvx + for l=1:ne + if filter(i,j,k,l)==1 + X_T(i,j,k,l)=x_T(m); + Y_T(i,j,k,l)=y_T(m); + VX_T(i,j,k,l)=vx_T(m); + VY_T(i,j,k,l)=vy_T(m); + E_T(i,j,k,l)=0.5*(VX_T(i,j,k,l)^2+VY_T(i,j,k,l)^2)-Omega(X_T(i,j,k,l),Y_T(i,j,k,l),mu); + m=m+1; + end + end + end + end +end + +%% Compute filter for FTLE +filter_ftle=filter; +for i=2:(nx-1) + for j=2:(ny-1) + for k=2:(nvx-1) + for l=2:(ne-1) + if filter(i,j,k,l)==0 || filter (i,j,k,l)==3 + filter_ftle(i,j,k,l)=0; + + filter_ftle(i+1,j,k,l)=0; + filter_ftle(i-1,j,k,l)=0; + + filter_ftle(i,j+1,k,l)=0; + filter_ftle(i,j-1,k,l)=0; + + filter_ftle(i,j,k+1,l)=0; + filter_ftle(i,j,k-1,l)=0; + + filter_ftle(i,j,k,l+1)=0; + filter_ftle(i,j,k,l-1)=0; + end + end + + end + end +end +%% FTLE computation + +[ftle, dphi]=Compute_FILE_gpu( X_T, Y_T, VX_T, E_T, dx, dy, dvx, de, N, filter_ftle); + +%% Plot results +figure +FTLE=squeeze(ftle(:,2,:,2)); +FTLE(1,:)=[]; +% FTLE(2,:)=[]; +FTLE(:,1)=[]; +% FTLE(:,2)=[]; +x_0(1)=[]; +vx_0(1)=[]; +pcolor(x_0, vx_0, FTLE') +shading flat +toc \ No newline at end of file diff --git a/samples/Matlab/ieee.m b/samples/Matlab/ieee.m new file mode 100644 index 00000000..a63afe44 --- /dev/null +++ b/samples/Matlab/ieee.m @@ -0,0 +1,13 @@ +% This script loads in the data used for the IEEE paper and creates the plots. +clc; close all; + +bikes = {'Benchmark', 'Browserins', 'Browser', 'Pista', ... + 'Fisher', 'Yellow', 'Yellowrev'}; + +data = load_bikes(bikes, 'Steer'); + +rollData = generate_data('Benchmark', 5.0, ... + 'input', 'Roll', ... + 'gains', [1, 55, 3.76, 0.413, 0.076]); + +create_ieee_paper_plots(data, rollData) diff --git a/samples/Matlab/lane_change.m b/samples/Matlab/lane_change.m new file mode 100644 index 00000000..75f06485 --- /dev/null +++ b/samples/Matlab/lane_change.m @@ -0,0 +1,56 @@ +function [x, y, t] = lane_change(start, width, slope, pathLength, speed, num, ... + type, varargin) +% Generates the time and coordinates for either a single or double lane change +% manuever at a particular speed. +% +% Parameters +% ---------- +% start : float +% The starting point along the x axis in meters. +% width : float +% The width of the lane deviation. +% slope : float +% The slope of the lane change. +% pathLength : float +% The length of path. +% speed : float +% Speed of travel. +% num : integer +% Number of time steps. +% type : string +% Either 'single' or 'double'. A double lane change return to x = 0. +% laneLength : float, optional +% Length of the lane for a double lane change. +% +% Returns +% ------- +% x : matrix, (num, 1) +% The longitudinal path. +% y : matrix, (num, 1) +% The lateral path. +% t : matrix, (num, 1) +% Time. + +x = 0:pathLength / num:pathLength; +x = x'; +t = x / speed; + +y = zeros(length(x), 1); +endOfSlope = width / slope + start; +slopeInd = find((x > start) & (x <= endOfSlope)); +y(slopeInd) = slope * (x(slopeInd) - start); +if strcmp(type, 'single') + theRest = slopeInd(end) + 1:length(y); + y(theRest) = width * ones(length(theRest), 1); +elseif strcmp(type, 'double'); + if length(varargin) < 1 + error('Double lane change needs length of lane.') + else + laneLength = varargin{1}; + startOfSlope = start + laneLength - width / slope; + lane = find((x > endOfSlope) & (x <= startOfSlope)); + y(lane) = width * ones(length(lane), 1); + downSlope = find((x > startOfSlope) & (x <= start + laneLength)); + y(downSlope) = slope * (start + laneLength - x(downSlope)); + end +end diff --git a/samples/Matlab/load_bikes.m b/samples/Matlab/load_bikes.m new file mode 100644 index 00000000..f71fd4ee --- /dev/null +++ b/samples/Matlab/load_bikes.m @@ -0,0 +1,55 @@ +function data = load_bikes(bikes, input) +% function data = load_bikes(bikes, input) +% Returns the data for a set of bicycles at three speeds. +% +% Parameters +% ---------- +% bikes : cell array +% A cell array that lists the bicyle short names. +% input : string +% 'Steer' or 'Roll' +% +% Returns +% ------- +% data : structure +% A structure containg a node for each bicycle and each speed. + +speeds = [2.5, 5.0, 7.5]; +speedNames = {'Slow', 'Medium', 'Fast'}; + +% these are the gains that were selected manually by Ron Hess, taken from +% the paper +gains.Benchmark.Slow = [22.0, -0.090, 23.3, 0.058, 0.195]; % place holder +gains.Browserins.Slow = [22.0, -0.090, 23.3, 0.058, 0.195]; +gains.Browser.Slow = [20.5, -0.086, 24.1, 0.053, 0.199]; +% the gains in the paper give an unstable bike, the uncommented one were the ones from his +% simulink model +gains.Pista.Slow = [22.3000,-0.1300,15.6410,0.0645,0.1990]; %[22.3, -0.130, 15.6, 0.662, 0.198]; +gains.Fisher.Slow = [23.0, -0.120, 17.7, 0.065, 0.198]; +gains.Yellow.Slow = [18.0, -0.110, 20.2, 0.062, 0.200]; +gains.Yellowrev.Slow = [48.0, -0.070, 27.9, 0.063, 0.191]; + +gains.Benchmark.Medium = [ 46.5, -0.052, 12.8, 0.177, 0.097]; +gains.Browserins.Medium = [ 48.0, -0.080, 9.03, 0.161, 0.097]; +gains.Browser.Medium = [ 43.0, -0.087, 8.50, 0.173, 0.100]; +gains.Pista.Medium = [ 49.0, -0.080, 8.06, 0.170, 0.101]; +gains.Fisher.Medium = [ 50.5, -0.084, 8.26, 0.168, 0.100]; +gains.Yellow.Medium = [ 39.0, -0.085, 8.61, 0.160, 0.101]; +gains.Yellowrev.Medium = [105.0, -0.070, 8.90, 0.165, 0.100]; + +gains.Benchmark.Fast = [ 74.0, -0.063, 6.31, 0.332, 0.065]; % place holder +gains.Browserins.Fast = [ 74.0, -0.063, 6.31, 0.332, 0.065]; +gains.Browser.Fast = [ 68.0, -0.060, 6.74, 0.330, 0.065]; +gains.Pista.Fast = [ 80.0, -0.058, 5.82, 0.321, 0.066]; +gains.Fisher.Fast = [ 82.0, -0.062, 5.83, 0.315, 0.065]; +gains.Yellow.Fast = [ 61.0, -0.063, 6.34, 0.345, 0.065]; +gains.Yellowrev.Fast = [170.0, -0.050, 6.45, 0.300, 0.066]; + +% load the data for all speeds for all the bikes +for i = 1:length(bikes) + for j = 1:length(speeds) + data.(bikes{i}).(speedNames{j}) = ... + generate_data(bikes{i}, speeds(j), 'input', input, ... + 'gains', gains.(bikes{i}).(speedNames{j})); + end +end diff --git a/samples/Matlab/load_data.m b/samples/Matlab/load_data.m new file mode 100644 index 00000000..e8c965db --- /dev/null +++ b/samples/Matlab/load_data.m @@ -0,0 +1,33 @@ +function data = load_data(filename, varargin) +% function data = load_data(filename, varargin) +% +% Returns an iddata object with the input thetac and output theta for the +% given file. +% +% Parameters +% ---------- +% filename : char +% Filename for the data file. +% varargin : char value pairs, optional +% sampleTime : double, default=0.0005 +% detread : boolean, default=true +% directory : char, default='data' + +parser = inputParser; +parser.addRequired('filename'); +parser.addParamValue('sampleTime', 0.0005); +parser.addParamValue('detrend', true); +parser.addParamValue('directory', 'data'); +parser.parse(filename, varargin{:}); +args = parser.Results; + +raw = load([args.directory filesep filename]); + +data = iddata(raw.theta, raw.theta_c, args.sampleTime, ... + 'InterSample', 'foh', ... + 'InputName', {'thetac'}, ... + 'OutputName', {'theta'}); + +if args.detrend + data = detrend(data); +end diff --git a/samples/Matlab/overwrite_settings.m b/samples/Matlab/overwrite_settings.m new file mode 100644 index 00000000..6cae4058 --- /dev/null +++ b/samples/Matlab/overwrite_settings.m @@ -0,0 +1,27 @@ +function settings = overwrite_settings(defaultSettings, overrideSettings) +% function settings = overwrite_settings(defaultSettings, overrideSettings) +% Returns the settings based on a combination of the defaults and the override settings. +% +% Parameters +% ---------- +% defaultSettings : structure +% A structure with all of the default settings. +% overrideSettings : structure +% Contains any settings that should override the defaults. +% +% Returns +% ------- +% settings : structure +% A stucture containing the overrideSettings and any defaults that weren't +% supplied in the overrideSettings. + +% add the default options if not specified by the user +overrideNames = fieldnames(overrideSettings); +defaultNames = fieldnames(defaultSettings); +notGiven = setxor(overrideNames, defaultNames); +settings = overrideSettings; +if length(notGiven) > 0 + for i = 1:length(notGiven) + settings.(notGiven{i}) = defaultSettings.(notGiven{i}); + end +end diff --git a/samples/Matlab/par_text_to_struct.m b/samples/Matlab/par_text_to_struct.m new file mode 100644 index 00000000..4c7de350 --- /dev/null +++ b/samples/Matlab/par_text_to_struct.m @@ -0,0 +1,27 @@ +function par = par_text_to_struct(pathToFile) +% function par = par_text_to_struct(pathToFile) +% Returns a structure of the parameters that were stored in a csv text file. +% +% Parameters +% ---------- +% pathToFile : string +% Path to a text file containing the benchmark parameters for a single +% bicycle. The parameters should be on seperate lines and take this form: +% +% c = 0.08+/-0.01 +% lam = 0.31 +% +% Returns +% ------- +% par : structure +% A structure containing the bicycle parameters. + +fid = fopen(pathToFile); +data = textscan(fid, '%s %s', 'delimiter', '='); +fclose(fid); +names = strtrim(data{1}); +vals = strtrim(regexp(data{2}, '+/-', 'split')); +for i = 1:length(names) + v = vals{i}; + par.(names{i}) = str2num(v{1}); +end diff --git a/samples/Matlab/plant.m b/samples/Matlab/plant.m new file mode 100644 index 00000000..0a597d57 --- /dev/null +++ b/samples/Matlab/plant.m @@ -0,0 +1,75 @@ +function Yc = plant(varargin) +% function Yc = plant(varargin) +% +% Returns the system plant given a number. +% +% Parameters +% ---------- +% varargin : variable +% Either supply a single argument {num} or three arguments {num1, num2, +% ratio}. If a single argument is supplied, then one of the six transfer +% functions will be chosen from the list. If three arguments are chosen, a +% parallel sum of the two plants will be returned. +% +% Option 1 +% -------- +% num : integer, {1, 2, 3, 4, 5, 6} +% A number between 1 and 6 corresponding to the five plants. +% Option 2 +% -------- +% num1 : integer, {1, 2, 3, 4, 5, 6} +% A number between 1 and 6 corresponding to the five plants. +% num2 : integer, {1, 2, 3, 4, 5, 6} +% A number between 1 and 6 corresponding to the five plants. +% percent : double +% The percentage multiplier of the first plant. Should be between 0 +% and 1. The percentage multiplier of the second plant will be 1 - +% percent. +% +% Returns +% ------- +% Either a single plant or a parallel sum of scaled plants. +% +% Option 1 +% -------- +% Yc : transfer function +% 1 : 1 / s +% 2 : 1 / s(s + 1) +% 3 : 1 / s(s + 0.2) +% 4 : 10 / (s + 10) +% 5 : 5 / (s + 10) +% 6 : 10 / (s^2 +.2 * s) +% +% Option 2 +% -------- +% Yc : transfer function +% Yc = percent * Yc1 + (1 - percent) * Yc2, where Yc1 and Yc2 are plants +% from the list shown in Option 1. + +if size(varargin, 2) > 1 + if 0 <= varargin{3} & varargin{3} <= 1 + Yc = parallel(varargin{3} * choose_plant(varargin{1}), ... + (1 - varargin{3}) * choose_plant(varargin{2})); + else + error('Ratio must be between 0 and 1.') + end +else + Yc = choose_plant(varargin{1}); +end + +function p = choose_plant(num) +if num == 1; + p = tf(1.0, [1.0, 0.0]); +elseif num == 2; + p = tf(1.0, [1.0, 1.0, 0.0]); +elseif num == 3; + p = tf(1.0, [1.0, 0.2, 0.0]); +elseif num == 4; + p = tf(10.0, [1.0, 10.0]); +elseif num == 5; + p = tf(5.0, [1.0, 10.0]); +elseif num == 6; + p = tf(10.0, [1.0, 0.2, 0.0]); +else + display('Invalid plant number.') +end diff --git a/samples/Matlab/test_rk_par.m b/samples/Matlab/test_rk_par.m new file mode 100644 index 00000000..31564189 --- /dev/null +++ b/samples/Matlab/test_rk_par.m @@ -0,0 +1,19 @@ +clear +mu=0.1; +x_0=linspace(-0.8, -0.15, 2) +y_0=zeros(1,2) +vx_0=linspace(-2, 2, 2) +vy_0=zeros(1,2) +ci=[1-mu-0.05 0 0.005 0.5290] +t0=[0;0] +T=[2;2] +tspan=2 +arg1={@f;@f} +%tspan={[0 2],[0 2]}; +arg=[mu;mu] +[X]=arrayfun(RK4_par,t0,T,x_0',y_0',vx_0',vy_0',arg) +% [X]=arrayfun(@f,[0;1],[ci;ci],[mu;mu]); +%Y=RK4(@f,tspan,ci,mu); +% figure +% plot(Y(:,1),Y(:,2)) +% Y(end,1) \ No newline at end of file diff --git a/samples/Matlab/test_system_state_space.m b/samples/Matlab/test_system_state_space.m new file mode 100644 index 00000000..89871cb9 --- /dev/null +++ b/samples/Matlab/test_system_state_space.m @@ -0,0 +1,69 @@ +gains = [76.3808, -0.0516, 7.2456, 0.2632, 0.0708]; +wnm = 30; +zetanm = 0.707; + +data = generate_data('Rigid', 7.0, 'gains', gains, 'neuroFreq', wnm, ... + 'loopTransfer', 0, 'handlingQuality', 0, 'simulate', 0); + +bicycle = ss(data.modelPar.A, data.modelPar.B, data.modelPar.C, ... + data.modelPar.D); + +bicycle.StateName = {'xP', 'yP', 'psi', 'phi', 'thetaB', 'thetaR', 'delta', ... + 'thetaF', 'phiDot', 'thetaRDot', 'deltaDot'}; +bicycle.OutputName = {'xP', 'yP', 'psi', 'phi', 'thetaB', 'thetaR', 'delta', ... + 'thetaF', 'xPDot', 'yPDot', 'psiDot', 'phiDot', ... + 'thetaBDot', 'thetaRDot', 'deltaDot', 'thetaFDot', 'xQ', 'yQ'}; +bicycle.InputName = {'tPhi', 'tDelta', 'fB'}; + +inputs = {'fB'}; +outputs = [bicycle.OutputName; 'tDelta']; + +analytic = system_state_space('lateral', bicycle, gains, [wnm, zetanm], inputs, outputs); + +numeric = ss(data.system.A, data.system.B, data.system.C, data.system.D); +%numeric.StateName = data.bicycle.states; +%numeric.InputName = data.bicycle.inputs; +%numeric.OutputName = data.bicycle.outputs; + +figure() +pzplot(analytic, numeric) + +% plot the transfer function roll-rate/lateral force for both +figure() +hold all +% plot my analytic model +[num, den] = ss2tf(analytic.A, analytic.B, analytic.C, analytic.D, 1); +mine = tf(num(find(strcmp('phiDot', outputs)), :), den); +bode(tf(num(find(strcmp('phiDot', outputs)), :), den)) +% plot the data from the simulink model +bode(tf(data.forceTF.PhiDot.num, data.forceTF.PhiDot.den)) +[num, den] = ss2tf(numeric.A, numeric.B, numeric.C, numeric.D, 1); +bode(tf(num(12, :), den)) + +display('Analytic Eigenvalues') +eig(analytic.A) +display('Numeric Eigenvalues') +eig(numeric.A) + +% Now see if the heading tracking works. +gains = [76.3808, -0.0516, 7.2456, 0.2632]; +wnm = 30; +zetanm = 0.707; + +par = par_text_to_struct('parameters/RigidPar.txt'); +[A, B, C, D] = whipple_pull_force_ABCD(par, 7.0); +bicycle = ss(A([3, 4, 7, 9, 11], [3, 4, 7, 9, 11]), ... + B([3. 4, 7, 9, 11], [2, 3]), eye(5), 0); +bicycle.StateName = {'psi', 'phi', 'delta', 'phiDot', 'deltaDot'}; +bicycle.OutputName = {'psi', 'phi', 'delta', 'phiDot', 'deltaDot'}; +bicycle.InputName = {'tDelta', 'fB'}; + +inputs = {'fB'}; +outputs = [bicycle.OutputName; 'tDelta']; + +analytic = system_state_space('heading', bicycle, gains, [wnm, zetanm], inputs, outputs); +% the following two should be the same +analytic.A(end, :) +bottomRow = [-wnm^2 * prod(gains), -wnm^2 * prod(gains(1:3)), ... + -wnm^2 * gains(1), -wnm^2 * prod(gains(1:2)), 0, -wnm^2, ... + -2 * wnm * zetanm] diff --git a/samples/Matlab/varargin_to_structure.m b/samples/Matlab/varargin_to_structure.m new file mode 100644 index 00000000..ca14794b --- /dev/null +++ b/samples/Matlab/varargin_to_structure.m @@ -0,0 +1,37 @@ +function options = varargin_to_structure(arguments) +% function options = varargin_to_structure(arguments) +% Returns a structure from a cell array of pairs. +% +% Parameters +% ---------- +% arguments : cell array (1, n) +% A cell array where n is an even number greater than or equal to 2. The odd +% cells must be a character string and the even cells can be any data type. +% +% Returns +% ------- +% options : structure +% The fields of the structure correspond to the odd cells in the array and +% the value for that field corresponds to the even cells. +% +% This is useful for functions that have varargin as an input where the +% variable inputs are keyword pairs. + +% make sure there are enough arguments +if length(arguments) <= 1 + error('Please supply 2 or more arguments') +end + +% make sure they provided and even number of inputs +if mod(length(arguments), 2) ~= 0 + error('There must be an even numbers of arguments') +end + +% store the values in the structure +for i = 1:2:length(arguments) + % make sure they have character strings as all the odd cells + if ~ischar(arguments{i}) + error('The odd arguments must be character strings.') + end + options.(arguments{i}) = arguments{i + 1}; +end diff --git a/samples/Matlab/write_gains.m b/samples/Matlab/write_gains.m new file mode 100644 index 00000000..371e5328 --- /dev/null +++ b/samples/Matlab/write_gains.m @@ -0,0 +1,48 @@ +function write_gains(pathToFile, speeds, gains) +% function write_gains(pathToFile, speeds, gains) +% +% Adds the provided gains to the file. +% +% Parameters +% ---------- +% pathToFile : string +% The path to a gain file. +% speeds : matrix(n, 1) +% gains : matrix (n, 5) +% A matrix of gains where each row corresponds to a speed and the columns +% correspond to the loops starting at the innermost loop. + +contents = importdata(pathToFile); + +speedsInFile = contents.data(:, 1); +gainsInFile = contents.data(:, 2:end); + +% remove any speeds that are very close to the speeds provided +sameSpeedIndices = []; +for i = 1:length(speedsInFile) + for j = 1:length(speeds) + if abs(speedsInFile(i) - speeds(j)) < 1e-3 + sameSpeedIndices = [sameSpeedIndices i]; + end + end +end +speedsInFile(sameSpeedIndices) = []; +gainsInFile(sameSpeedIndices, :) = []; + +% concatenate data +allGains = [gainsInFile; gains]; +allSpeeds = [speedsInFile; speeds]; + +% sort the data +[allSpeeds, order] = sort(allSpeeds); +allGains = allGains(order, :); + +% recombine +all = [allSpeeds, allGains]; + +% rewrite the file +fid = fopen(pathToFile, 'w'); +h = contents.colheaders; +fprintf(fid, '%s,%s,%s,%s,%s,%s\n', h{1}, h{2}, h{3}, h{4}, h{5}, h{6}); +fprintf(fid, '%1.3f,%1.4f,%1.4f,%1.4f,%1.4f,%1.4f\n', all'); +fclose(fid); diff --git a/samples/Monkey/example.monkey b/samples/Monkey/example.monkey new file mode 100644 index 00000000..facd3a73 --- /dev/null +++ b/samples/Monkey/example.monkey @@ -0,0 +1,152 @@ +Strict + +' single line comment + +#rem +multi +line +comment +#end + +#rem +nested +#rem +multi +line +#end +comment +#end + +Import mojo + +Const ONECONST:Int = 1 +Const TWOCONST := 2 +Const THREECONST := 3, FOURCONST:Int = 4 + +Global someVariable:Int = 4 + +' sample class from the documentation +Class Game Extends App + + Function New() + End + + Function DrawSpiral(clock) + Local w=DeviceWidth/2 + For Local i#=0 Until w*1.5 Step .2 + Local x#,y# + x=w+i*Sin(i*3+clock) + y=w+i*Cos(i*2+clock) + DrawRect x,y,1,1 + Next + hitbox.Collide(event.pos) + End + + Field updateCount + + Method OnCreate() + Print "spiral" + + SetUpdateRate 60 + End + + Method OnUpdate() + updateCount+=1 + End + + Method OnRender() + Cls + DrawSpiral updateCount + DrawSpiral updateCount*1.1 + End + +End + +Class Enemy + Method Die () Abstract +End + +' extending +Class Hoodlum Extends Enemy + ' field + Field testField:Bool = True + + ' naming class with modulepath + Local currentNode:list.Node + + Method Die () + Print "B'oss, he-- he killed me, b'oss!" + End +End + +' extending with generics +Class VectorNode Extends Node +End + +' interfaces +Interface Computer + Method Boot () + Method Process () + Method Display () +End + +Class PC Implements Computer +End + +' array syntax +Global listOfStuff:String[42] +Global lessStuff:String[5] = listOfStuff[4..8] +Global oneStuff:String = listOfStuff[23] + +'a comma separated sequence +Global scores:Int[]=[10,20,30] +'a comma separated sequence +Global text:String[]=["Hello","There","World"] +Global worstCase:worst.List + +' string type +Global string1:String = "Hello world" +Global string2$ = "Hello world" + +' escape characers in strings +Global string3 := "Hello~zWorld" +Global string4 := "~qHello World~q" +Global string5 := "~tIndented~n" +Global string6 := "tilda is wavey... ~~" + +' string pseudofunctions +Print " Hello World ~n".Trim() ' prints "Hello World" +Print "Hello World".ToUpper() ' prints "HELLO WORLD" + +' Boolean shorttype +Global boolVariable1:Bool = True +Global boolVariable2? = False + +' number formats +Global hexNum1:Int = $3d0dead +Global hexNum2% = $CAFEBABE + +Global floatNum1:Float = 3.141516 +Global floatNum2# = 3.141516 +Global floatNum3 := .141516 + +' preprocessor keywords +#If TARGET = "android" +DoStuff() +#ElseIf TARGET = "ios" +DoOtherStuff() +#End + +' preprocessor variable +#SOMETHING = True +#Print SOMETHING +#If SOMETHING +#End + +' operators +Global a = 32 +Global b = 32 ~ 0 +b ~= 16 +b |= 16 +b &= 16 +Global c = a | b diff --git a/samples/NSIS/bigtest.nsi b/samples/NSIS/bigtest.nsi new file mode 100644 index 00000000..62f5211c --- /dev/null +++ b/samples/NSIS/bigtest.nsi @@ -0,0 +1,308 @@ +; bigtest.nsi +; +; This script attempts to test most of the functionality of the NSIS exehead. + +;-------------------------------- + +!ifdef HAVE_UPX +!packhdr tmp.dat "upx\upx -9 tmp.dat" +!endif + +!ifdef NOCOMPRESS +SetCompress off +!endif + +;-------------------------------- + +Name "BigNSISTest" +Caption "NSIS Big Test" +Icon "${NSISDIR}\Contrib\Graphics\Icons\nsis1-install.ico" +OutFile "bigtest.exe" + +SetDateSave on +SetDatablockOptimize on +CRCCheck on +SilentInstall normal +BGGradient 000000 800000 FFFFFF +InstallColors FF8080 000030 +XPStyle on + +InstallDir "$PROGRAMFILES\NSISTest\BigNSISTest" +InstallDirRegKey HKLM "Software\NSISTest\BigNSISTest" "Install_Dir" + +CheckBitmap "${NSISDIR}\Contrib\Graphics\Checks\classic-cross.bmp" + +LicenseText "A test text, make sure it's all there" +LicenseData "bigtest.nsi" + +RequestExecutionLevel admin + +;-------------------------------- + +Page license +Page components +Page directory +Page instfiles + +UninstPage uninstConfirm +UninstPage instfiles + +;-------------------------------- + +!ifndef NOINSTTYPES ; only if not defined + InstType "Most" + InstType "Full" + InstType "More" + InstType "Base" + ;InstType /NOCUSTOM + ;InstType /COMPONENTSONLYONCUSTOM +!endif + +AutoCloseWindow false +ShowInstDetails show + +;-------------------------------- + +Section "" ; empty string makes it hidden, so would starting with - + + ; write reg info + StrCpy $1 "POOOOOOOOOOOP" + DetailPrint "I like to be able to see what is going on (debug) $1" + WriteRegStr HKLM SOFTWARE\NSISTest\BigNSISTest "Install_Dir" "$INSTDIR" + + ; write uninstall strings + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest" "DisplayName" "BigNSISTest (remove only)" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest" "UninstallString" '"$INSTDIR\bt-uninst.exe"' + + SetOutPath $INSTDIR + File /a "silent.nsi" + CreateDirectory "$INSTDIR\MyProjectFamily\MyProject" ; 2 recursively create a directory for fun. + WriteUninstaller "bt-uninst.exe" + + Nop ; for fun + +SectionEnd + +Section "TempTest" + +SectionIn 1 2 3 + Start: MessageBox MB_OK "Start:" + + MessageBox MB_YESNO "Goto MyLabel" IDYES MyLabel + + MessageBox MB_OK "Right before MyLabel:" + + MyLabel: MessageBox MB_OK "MyLabel:" + + MessageBox MB_OK "Right after MyLabel:" + + MessageBox MB_YESNO "Goto Start:?" IDYES Start + +SectionEnd + +SectionGroup /e SectionGroup1 + +Section "Test Registry/INI functions" + +SectionIn 1 4 3 + + WriteRegStr HKLM SOFTWARE\NSISTest\BigNSISTest "StrTest_INSTDIR" "$INSTDIR" + WriteRegDword HKLM SOFTWARE\NSISTest\BigNSISTest "DwordTest_0xDEADBEEF" 0xdeadbeef + WriteRegDword HKLM SOFTWARE\NSISTest\BigNSISTest "DwordTest_123456" 123456 + WriteRegDword HKLM SOFTWARE\NSISTest\BigNSISTest "DwordTest_0123" 0123 + WriteRegBin HKLM SOFTWARE\NSISTest\BigNSISTest "BinTest_deadbeef01f00dbeef" "DEADBEEF01F00DBEEF" + StrCpy $8 "$SYSDIR\IniTest" + WriteINIStr "$INSTDIR\test.ini" "MySection" "Value1" $8 + WriteINIStr "$INSTDIR\test.ini" "MySectionIni" "Value1" $8 + WriteINIStr "$INSTDIR\test.ini" "MySectionIni" "Value2" $8 + WriteINIStr "$INSTDIR\test.ini" "IniOn" "Value1" $8 + + Call MyFunctionTest + + DeleteINIStr "$INSTDIR\test.ini" "IniOn" "Value1" + DeleteINISec "$INSTDIR\test.ini" "MySectionIni" + + ReadINIStr $1 "$INSTDIR\test.ini" "MySectionIni" "Value1" + StrCmp $1 "" INIDelSuccess + MessageBox MB_OK "DeleteINISec failed" + INIDelSuccess: + + ClearErrors + ReadRegStr $1 HKCR "software\microsoft" xyz_cc_does_not_exist + IfErrors 0 NoError + MessageBox MB_OK "could not read from HKCR\software\microsoft\xyz_cc_does_not_exist" + Goto ErrorYay + NoError: + MessageBox MB_OK "read '$1' from HKCR\software\microsoft\xyz_cc_does_not_exist" + ErrorYay: + +SectionEnd + +Section "Test CreateShortCut" + + SectionIn 1 2 3 + + Call CSCTest + +SectionEnd + +SectionGroup Group2 + +Section "Test Branching" + + BeginTestSection: + SectionIn 1 2 3 + + SetOutPath $INSTDIR + + IfFileExists "$INSTDIR\LogicLib.nsi" 0 BranchTest69 + + MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to overwrite $INSTDIR\LogicLib.nsi?" IDNO NoOverwrite ; skipped if file doesn't exist + + BranchTest69: + + SetOverwrite ifnewer ; NOT AN INSTRUCTION, NOT COUNTED IN SKIPPINGS + + NoOverwrite: + + File "LogicLib.nsi" ; skipped if answered no + SetOverwrite try ; NOT AN INSTRUCTION, NOT COUNTED IN SKIPPINGS + + MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to skip the rest of this section?" IDYES EndTestBranch + MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to go back to the beginning of this section?" IDYES BeginTestSection + MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to hide the installer and wait five seconds?" IDNO NoHide + + HideWindow + Sleep 5000 + BringToFront + + NoHide: + + MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to call the function 5 times?" IDNO NoRecurse + + StrCpy $1 "x" + + LoopTest: + + Call myfunc + StrCpy $1 "x$1" + StrCmp $1 "xxxxxx" 0 LoopTest + + NoRecurse: + + EndTestBranch: + +SectionEnd + +SectionGroupEnd + +Section "Test CopyFiles" + + SectionIn 1 2 3 + + SetOutPath $INSTDIR\cpdest + CopyFiles "$WINDIR\*.ini" "$INSTDIR\cpdest" 0 + +SectionEnd + +SectionGroupEnd + +Section "Test Exec functions" TESTIDX + + SectionIn 1 2 3 + + SearchPath $1 notepad.exe + + MessageBox MB_OK "notepad.exe=$1" + Exec '"$1"' + ExecShell "open" '"$INSTDIR"' + Sleep 500 + BringToFront + +SectionEnd + +Section "Test ActiveX control registration" + + SectionIn 2 + + UnRegDLL "$SYSDIR\spin32.ocx" + Sleep 1000 + RegDLL "$SYSDIR\spin32.ocx" + Sleep 1000 + +SectionEnd + +;-------------------------------- + +Function "CSCTest" + + CreateDirectory "$SMPROGRAMS\Big NSIS Test" + SetOutPath $INSTDIR ; for working directory + CreateShortCut "$SMPROGRAMS\Big NSIS Test\Uninstall BIG NSIS Test.lnk" "$INSTDIR\bt-uninst.exe" ; use defaults for parameters, icon, etc. + ; this one will use notepad's icon, start it minimized, and give it a hotkey (of Ctrl+Shift+Q) + CreateShortCut "$SMPROGRAMS\Big NSIS Test\silent.nsi.lnk" "$INSTDIR\silent.nsi" "" "$WINDIR\notepad.exe" 0 SW_SHOWMINIMIZED CONTROL|SHIFT|Q + CreateShortCut "$SMPROGRAMS\Big NSIS Test\TheDir.lnk" "$INSTDIR\" "" "" 0 SW_SHOWMAXIMIZED CONTROL|SHIFT|Z + +FunctionEnd + +Function myfunc + + StrCpy $2 "MyTestVar=$1" + MessageBox MB_OK "myfunc: $2" + +FunctionEnd + +Function MyFunctionTest + + ReadINIStr $1 "$INSTDIR\test.ini" "MySectionIni" "Value1" + StrCmp $1 $8 NoFailedMsg + MessageBox MB_OK "WriteINIStr failed" + + NoFailedMsg: + +FunctionEnd + +Function .onSelChange + + SectionGetText ${TESTIDX} $0 + StrCmp $0 "" e + SectionSetText ${TESTIDX} "" + Goto e2 +e: + SectionSetText ${TESTIDX} "TextInSection" +e2: + +FunctionEnd + +;-------------------------------- + +; Uninstaller + +UninstallText "This will uninstall example2. Hit next to continue." +UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\nsis1-uninstall.ico" + +Section "Uninstall" + + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\BigNSISTest" + DeleteRegKey HKLM "SOFTWARE\NSISTest\BigNSISTest" + Delete "$INSTDIR\silent.nsi" + Delete "$INSTDIR\LogicLib.nsi" + Delete "$INSTDIR\bt-uninst.exe" + Delete "$INSTDIR\test.ini" + Delete "$SMPROGRAMS\Big NSIS Test\*.*" + RMDir "$SMPROGRAMS\BiG NSIS Test" + + MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to remove the directory $INSTDIR\cpdest?" IDNO NoDelete + Delete "$INSTDIR\cpdest\*.*" + RMDir "$INSTDIR\cpdest" ; skipped if no + NoDelete: + + RMDir "$INSTDIR\MyProjectFamily\MyProject" + RMDir "$INSTDIR\MyProjectFamily" + RMDir "$INSTDIR" + + IfFileExists "$INSTDIR" 0 NoErrorMsg + MessageBox MB_OK "Note: $INSTDIR could not be removed!" IDOK 0 ; skipped if file doesn't exist + NoErrorMsg: + +SectionEnd diff --git a/samples/NSIS/x64.nsh b/samples/NSIS/x64.nsh new file mode 100644 index 00000000..e694c1e6 --- /dev/null +++ b/samples/NSIS/x64.nsh @@ -0,0 +1,54 @@ +; --------------------- +; x64.nsh +; --------------------- +; +; A few simple macros to handle installations on x64 machines. +; +; RunningX64 checks if the installer is running on x64. +; +; ${If} ${RunningX64} +; MessageBox MB_OK "running on x64" +; ${EndIf} +; +; DisableX64FSRedirection disables file system redirection. +; EnableX64FSRedirection enables file system redirection. +; +; SetOutPath $SYSDIR +; ${DisableX64FSRedirection} +; File some.dll # extracts to C:\Windows\System32 +; ${EnableX64FSRedirection} +; File some.dll # extracts to C:\Windows\SysWOW64 +; + +!ifndef ___X64__NSH___ +!define ___X64__NSH___ + +!include LogicLib.nsh + +!macro _RunningX64 _a _b _t _f + !insertmacro _LOGICLIB_TEMP + System::Call kernel32::GetCurrentProcess()i.s + System::Call kernel32::IsWow64Process(is,*i.s) + Pop $_LOGICLIB_TEMP + !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}` +!macroend + +!define RunningX64 `"" RunningX64 ""` + +!macro DisableX64FSRedirection + + System::Call kernel32::Wow64EnableWow64FsRedirection(i0) + +!macroend + +!define DisableX64FSRedirection "!insertmacro DisableX64FSRedirection" + +!macro EnableX64FSRedirection + + System::Call kernel32::Wow64EnableWow64FsRedirection(i1) + +!macroend + +!define EnableX64FSRedirection "!insertmacro EnableX64FSRedirection" + +!endif # !___X64__NSH___ diff --git a/samples/OCaml/example.eliom b/samples/OCaml/example.eliom new file mode 100644 index 00000000..df24934e --- /dev/null +++ b/samples/OCaml/example.eliom @@ -0,0 +1,48 @@ + +{shared{ + + open Eliom_content + open Html5.D + open Eliom_parameter + +}} + +{server{ + + module Example = + Eliom_registration.App + (struct + let application_name = "example" + end) + + let main = + Eliom_service.service + ~path:[] + ~get_params:unit + () + +}} + +{client{ + + let hello_popup () = + Dom_html.window##alert(Js.string ("Hello Popup!")) + +}} + +{server{ + + let _ = + + Example.register + ~service:main + (fun () () -> + Lwt.return + (html + (head (title (pcdata "Hello World of Ocsigen")) []) + (body [h1 [pcdata "Hello World!"]; + p [pcdata "Welcome to my first Ocsigen website."]; + h2 ~a:[a_onclick {{ hello_popup () }}] + [pcdata "Click me!"]]))) + +}} diff --git a/samples/PogoScript/squashy.pogo b/samples/PogoScript/squashy.pogo new file mode 100644 index 00000000..e1d9d999 --- /dev/null +++ b/samples/PogoScript/squashy.pogo @@ -0,0 +1,44 @@ +httpism = require 'httpism' +async = require 'async' +resolve = require 'url'.resolve + +exports.squash (url) ! = + html = httpism.get ! (url).body + squash html ! (html, url) + +squash html (html, url, callback) = + replacements = sort (links in (html).concat(scripts in (html))) + for each @(r) in (replacements) @{ r.url = resolve(url, r.href) } + async.map (replacements, get) @(err, requested) + callback (err, replace (requested) in (html)) + +sort (replacements) = + replacements.sort @(a, b) @{ a.index - b.index } + +get (replacement) = + replacement.body = httpism.get ! (replacement.url).body + replacement + +replace (replacements) in (html) = + i = 0 + parts = "" + for each @(rep) in (replacements) + parts := "#(parts)#(html.substring(i, rep.index))<#(rep.tag)>#(rep.body)" + i := rep.index + rep.length + + parts + html.substr(i) + +links in (html) = + link reg = r/]*href=["']?([^"']+)["'][^\>]*(\/\>|\>\s*\<\/link\>)/gi + elements in (html) matching (link reg) as 'style' + +scripts in (html) = + script reg = r/]*src=["']?([^"']+)["'][^\>]*(\/\>|\>\s*\<\/script\>)/gi + elements in (html) matching (script reg) as 'script' + +elements in (html) matching (reg) as (tag) = + elements = [] + while (m = reg.exec (html)) + elements.push { tag = tag, index = m.index, length = m.0.length, href = m.1 } + + elements diff --git a/samples/Processing/hello.pde b/samples/Processing/hello.pde new file mode 100644 index 00000000..a037cdb8 --- /dev/null +++ b/samples/Processing/hello.pde @@ -0,0 +1,36 @@ +/** + * Shape Primitives. + * + * The basic shape primitive functions are triangle(), + * rect(), quad(), ellipse(), and arc(). Squares are made + * with rect() and circles are made with ellipse(). Each + * of these functions requires a number of parameters to + * determine the shape's position and size. + */ + +void setup() { + size(640, 360); + background(0); + noStroke(); +} + +void draw() { + fill(204); + triangle(18, 18, 18, 360, 81, 360); + + fill(102); + rect(81, 81, 63, 63); + + fill(204); + quad(189, 18, 216, 18, 216, 360, 144, 360); + + fill(255); + ellipse(252, 144, 72, 72); + + fill(204); + triangle(288, 18, 351, 360, 288, 360); + + fill(255); + arc(479, 300, 280, 280, PI, TWO_PI); +} + diff --git a/samples/Ragel in Ruby Host/ephemeris_parser.rl b/samples/Ragel in Ruby Host/ephemeris_parser.rl new file mode 100644 index 00000000..787fd4dd --- /dev/null +++ b/samples/Ragel in Ruby Host/ephemeris_parser.rl @@ -0,0 +1,96 @@ +=begin +%%{ + + machine ephemeris_parser; + + action mark { mark = p } + + action parse_start_time { + parser.start_time = data[mark..p].pack('c*') + } + + action parse_stop_time { + parser.stop_time = data[mark..p].pack('c*') + } + + action parse_step_size { + parser.step_size = data[mark..p].pack('c*') + } + + action parse_ephemeris_table { + fhold; + parser.ephemeris_table = data[mark..p].pack('c*') + } + + ws = [ \t\r\n]; + + adbc = ('A.D.'|'B.C.'); + year = digit{4}; + month = upper lower{2}; + date = digit{2}; + hours = digit{2}; + minutes = digit{2}; + seconds = digit{2} '.' digit{4}; + tz = 'UT'; + datetime = adbc ' ' year '-' month '-' date ' ' hours ':' minutes ':' seconds ' ' tz; + + time_unit = ('minute' [s]? | 'calendar year' [s]?); + + soe = '$$SOE' '\n'; + eoe = '$$EOE' '\n'; + ephemeris_table = (alnum | ws | [*-./:])*; + + start_time = 'Start time' ' '* ':' ' ' datetime >mark %parse_start_time space* '\n'; + stop_time = 'Stop time' ' '* ':' ' ' datetime >mark %parse_stop_time space* '\n'; + step_size = 'Step-size' ' '* ':' ' ' (digit+ ' '* time_unit) >mark $parse_step_size '\n'; + + ephemeris = soe ephemeris_table >mark %parse_ephemeris_table eoe; + + main := ( + any* + start_time + stop_time + step_size + any* + ephemeris + any* + ); + +}%% +=end + +require 'date' + +module Tengai + EPHEMERIS_DATA = Struct.new(:start_time, :stop_time, :step_size, :ephemeris_table).freeze + + class EphemerisParser < EPHEMERIS_DATA + def self.parse(data) + parser = new + data = data.unpack('c*') if data.is_a? String + eof = data.length + + %% write init; + %% write exec; + + parser + end + + def start_time=(time) + super parse_time(time) + end + + def stop_time=(time) + super parse_time(time) + end + + %% write data; + + # % fix syntax highlighting + + private + def parse_time(time) + DateTime.parse(time) + end + end +end \ No newline at end of file diff --git a/samples/Ragel in Ruby Host/simple_scanner.rl b/samples/Ragel in Ruby Host/simple_scanner.rl new file mode 100644 index 00000000..7d22a972 --- /dev/null +++ b/samples/Ragel in Ruby Host/simple_scanner.rl @@ -0,0 +1,69 @@ +=begin +%%{ + machine simple_scanner; + + action Emit { + emit data[(ts+8)..(te-7)].pack('c*') + } + + foo = 'STARTFOO' any+ :>> 'ENDFOO'; + + main := |* + foo => Emit; + any; + *|; +}%% +=end + + +# Scans a file for "STARTFOO[...]ENDFOO" blocks and outputs their contents. +# +# ENV['CHUNK_SIZE'] determines how much of the file to read in at a time, allowing you to control memory usage. +# +# Uses ragel's scanner functionality even though it's not strictly necessary. +class SimpleScanner + attr_reader :path + + def initialize(path) + @path = path + %% write data; + # % (this fixes syntax highlighting) + end + + def emit(foo) + $stdout.puts foo + end + + def perform + # So that ragel doesn't try to get it from data.length + pe = :ignored + eof = :ignored + + %% write init; + # % (this fixes syntax highlighting) + + leftover = [] + + File.open(path) do |f| + while chunk = f.read(ENV['CHUNK_SIZE'].to_i) + data = leftover + chunk.unpack('c*') + p ||= 0 + pe = data.length + + %% write exec; + # % (this fixes syntax highlighting) + if ts + leftover = data[ts..pe] + p = p - ts + ts = 0 + else + leftover = [] + p = 0 + end + end + end + end +end + +s = SimpleScanner.new ARGV[0] +s.perform \ No newline at end of file diff --git a/samples/Ragel in Ruby Host/simple_tokenizer.rl b/samples/Ragel in Ruby Host/simple_tokenizer.rl new file mode 100644 index 00000000..67fc6c79 --- /dev/null +++ b/samples/Ragel in Ruby Host/simple_tokenizer.rl @@ -0,0 +1,73 @@ +=begin +%%{ + machine simple_tokenizer; + + action MyTs { + my_ts = p + } + action MyTe { + my_te = p + } + action Emit { + emit data[my_ts...my_te].pack('c*') + my_ts = nil + my_te = nil + } + + foo = 'STARTFOO' any+ >MyTs :>> 'ENDFOO' >MyTe %Emit; + main := ( foo | any+ )*; + +}%% +=end + +# Scans a file for "STARTFOO[...]ENDFOO" blocks and outputs their contents. +# +# ENV['CHUNK_SIZE'] determines how much of the file to read in at a time, allowing you to control memory usage. +# +# Does not use ragel's scanner functionality because no backtracking is needed. +class SimpleTokenizer + attr_reader :path + + def initialize(path) + @path = path + %% write data; + # % (this fixes syntax highlighting) + end + + def emit(foo) + $stdout.puts foo + end + + def perform + # So that ragel doesn't try to get it from data.length + pe = :ignored + eof = :ignored + + %% write init; + # % (this fixes syntax highlighting) + + leftover = [] + my_ts = nil + my_te = nil + + File.open(path) do |f| + while chunk = f.read(ENV['CHUNK_SIZE'].to_i) + data = leftover + chunk.unpack('c*') + p = 0 + pe = data.length + %% write exec; + # % (this fixes syntax highlighting) + if my_ts + leftover = data[my_ts..-1] + my_te = my_te - my_ts if my_te + my_ts = 0 + else + leftover = [] + end + end + end + end +end + +s = SimpleTokenizer.new ARGV[0] +s.perform diff --git a/samples/Ruby/jenkinsci.pluginspec b/samples/Ruby/jenkinsci.pluginspec new file mode 100644 index 00000000..01d01373 --- /dev/null +++ b/samples/Ruby/jenkinsci.pluginspec @@ -0,0 +1,27 @@ +Jenkins::Plugin::Specification.new do |plugin| + plugin.name = "foo" + plugin.display_name = "Foo Plugin" + plugin.version = '0.0.1' + plugin.description = 'TODO: enter description here' + + # You should create a wiki-page for your plugin when you publish it, see + # https://wiki.jenkins-ci.org/display/JENKINS/Hosting+Plugins#HostingPlugins-AddingaWikipage + # This line makes sure it's listed in your POM. + plugin.url = 'https://wiki.jenkins-ci.org/display/JENKINS/Foo+Plugin' + + # The first argument is your user name for jenkins-ci.org. + plugin.developed_by "david.calavera", "David Calavera " + + # This specifies where your code is hosted. + # Alternatives include: + # :github => 'myuser/foo-plugin' (without myuser it defaults to jenkinsci) + # :git => 'git://repo.or.cz/foo-plugin.git' + # :svn => 'https://svn.jenkins-ci.org/trunk/hudson/plugins/foo-plugin' + plugin.uses_repository :github => "foo-plugin" + + # This is a required dependency for every ruby plugin. + plugin.depends_on 'ruby-runtime', '0.10' + + # This is a sample dependency for a Jenkins plugin, 'git'. + #plugin.depends_on 'git', '1.1.11' +end diff --git a/samples/Rust/hello.rs b/samples/Rust/hello.rs deleted file mode 100644 index 5579f684..00000000 --- a/samples/Rust/hello.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - log "Hello, world!"; -} diff --git a/samples/Rust/task.rs b/samples/Rust/task.rs new file mode 100644 index 00000000..e3bc799d --- /dev/null +++ b/samples/Rust/task.rs @@ -0,0 +1,1212 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +/*! + * Task management. + * + * An executing Rust program consists of a tree of tasks, each with their own + * stack, and sole ownership of their allocated heap data. Tasks communicate + * with each other using ports and channels. + * + * When a task fails, that failure will propagate to its parent (the task + * that spawned it) and the parent will fail as well. The reverse is not + * true: when a parent task fails its children will continue executing. When + * the root (main) task fails, all tasks fail, and then so does the entire + * process. + * + * Tasks may execute in parallel and are scheduled automatically by the + * runtime. + * + * # Example + * + * ~~~ + * do spawn { + * log(error, "Hello, World!"); + * } + * ~~~ + */ + +use cell::Cell; +use cmp::Eq; +use option; +use result::Result; +use comm::{stream, Chan, GenericChan, GenericPort, Port, SharedChan}; +use prelude::*; +use result; +use task::rt::{task_id, sched_id, rust_task}; +use util; +use util::replace; + +mod local_data_priv; +pub mod local_data; +pub mod rt; +pub mod spawn; + +/// A handle to a scheduler +#[deriving_eq] +pub enum Scheduler { + SchedulerHandle(sched_id) +} + +/// A handle to a task +#[deriving_eq] +pub enum Task { + TaskHandle(task_id) +} + +/** + * Indicates the manner in which a task exited. + * + * A task that completes without failing is considered to exit successfully. + * Supervised ancestors and linked siblings may yet fail after this task + * succeeds. Also note that in such a case, it may be nondeterministic whether + * linked failure or successful exit happen first. + * + * If you wish for this result's delivery to block until all linked and/or + * children tasks complete, recommend using a result future. + */ +pub enum TaskResult { + Success, + Failure, +} + +impl Eq for TaskResult { + pure fn eq(&self, other: &TaskResult) -> bool { + match ((*self), (*other)) { + (Success, Success) | (Failure, Failure) => true, + (Success, _) | (Failure, _) => false + } + } + pure fn ne(&self, other: &TaskResult) -> bool { !(*self).eq(other) } +} + +/// Scheduler modes +#[deriving_eq] +pub enum SchedMode { + /// Run task on the default scheduler + DefaultScheduler, + /// Run task on the current scheduler + CurrentScheduler, + /// Run task on a specific scheduler + ExistingScheduler(Scheduler), + /** + * Tasks are scheduled on the main OS thread + * + * The main OS thread is the thread used to launch the runtime which, + * in most cases, is the process's initial thread as created by the OS. + */ + PlatformThread, + /// All tasks run in the same OS thread + SingleThreaded, + /// Tasks are distributed among available CPUs + ThreadPerCore, + /// Each task runs in its own OS thread + ThreadPerTask, + /// Tasks are distributed among a fixed number of OS threads + ManualThreads(uint), +} + +/** + * Scheduler configuration options + * + * # Fields + * + * * sched_mode - The operating mode of the scheduler + * + * * foreign_stack_size - The size of the foreign stack, in bytes + * + * Rust code runs on Rust-specific stacks. When Rust code calls foreign + * code (via functions in foreign modules) it switches to a typical, large + * stack appropriate for running code written in languages like C. By + * default these foreign stacks have unspecified size, but with this + * option their size can be precisely specified. + */ +pub struct SchedOpts { + mode: SchedMode, + foreign_stack_size: Option, +} + +/** + * Task configuration options + * + * # Fields + * + * * linked - Propagate failure bidirectionally between child and parent. + * True by default. If both this and 'supervised' are false, then + * either task's failure will not affect the other ("unlinked"). + * + * * supervised - Propagate failure unidirectionally from parent to child, + * but not from child to parent. False by default. + * + * * notify_chan - Enable lifecycle notifications on the given channel + * + * * sched - Specify the configuration of a new scheduler to create the task + * in + * + * By default, every task is created in the same scheduler as its + * parent, where it is scheduled cooperatively with all other tasks + * in that scheduler. Some specialized applications may want more + * control over their scheduling, in which case they can be spawned + * into a new scheduler with the specific properties required. + * + * This is of particular importance for libraries which want to call + * into foreign code that blocks. Without doing so in a different + * scheduler other tasks will be impeded or even blocked indefinitely. + */ +pub struct TaskOpts { + linked: bool, + supervised: bool, + mut notify_chan: Option>, + sched: SchedOpts +} + +/** + * The task builder type. + * + * Provides detailed control over the properties and behavior of new tasks. + */ +// NB: Builders are designed to be single-use because they do stateful +// things that get weird when reusing - e.g. if you create a result future +// it only applies to a single task, so then you have to maintain Some +// potentially tricky state to ensure that everything behaves correctly +// when you try to reuse the builder to spawn a new task. We'll just +// sidestep that whole issue by making builders uncopyable and making +// the run function move them in. + +// FIXME (#3724): Replace the 'consumed' bit with move mode on self +pub struct TaskBuilder { + opts: TaskOpts, + gen_body: @fn(v: ~fn()) -> ~fn(), + can_not_copy: Option, + mut consumed: bool, +} + +/** + * Generate the base configuration for spawning a task, off of which more + * configuration methods can be chained. + * For example, task().unlinked().spawn is equivalent to spawn_unlinked. + */ +pub fn task() -> TaskBuilder { + TaskBuilder { + opts: default_task_opts(), + gen_body: |body| body, // Identity function + can_not_copy: None, + mut consumed: false, + } +} + +#[doc(hidden)] // FIXME #3538 +priv impl TaskBuilder { + fn consume(&self) -> TaskBuilder { + if self.consumed { + fail!(~"Cannot copy a task_builder"); // Fake move mode on self + } + self.consumed = true; + let notify_chan = replace(&mut self.opts.notify_chan, None); + TaskBuilder { + opts: TaskOpts { + linked: self.opts.linked, + supervised: self.opts.supervised, + notify_chan: notify_chan, + sched: self.opts.sched + }, + gen_body: self.gen_body, + can_not_copy: None, + consumed: false + } + } +} + +pub impl TaskBuilder { + /** + * Decouple the child task's failure from the parent's. If either fails, + * the other will not be killed. + */ + fn unlinked(&self) -> TaskBuilder { + let notify_chan = replace(&mut self.opts.notify_chan, None); + TaskBuilder { + opts: TaskOpts { + linked: false, + supervised: self.opts.supervised, + notify_chan: notify_chan, + sched: self.opts.sched + }, + can_not_copy: None, + .. self.consume() + } + } + /** + * Unidirectionally link the child task's failure with the parent's. The + * child's failure will not kill the parent, but the parent's will kill + * the child. + */ + fn supervised(&self) -> TaskBuilder { + let notify_chan = replace(&mut self.opts.notify_chan, None); + TaskBuilder { + opts: TaskOpts { + linked: false, + supervised: true, + notify_chan: notify_chan, + sched: self.opts.sched + }, + can_not_copy: None, + .. self.consume() + } + } + /** + * Link the child task's and parent task's failures. If either fails, the + * other will be killed. + */ + fn linked(&self) -> TaskBuilder { + let notify_chan = replace(&mut self.opts.notify_chan, None); + TaskBuilder { + opts: TaskOpts { + linked: true, + supervised: false, + notify_chan: notify_chan, + sched: self.opts.sched + }, + can_not_copy: None, + .. self.consume() + } + } + + /** + * Get a future representing the exit status of the task. + * + * Taking the value of the future will block until the child task + * terminates. The future-receiving callback specified will be called + * *before* the task is spawned; as such, do not invoke .get() within the + * closure; rather, store it in an outer variable/list for later use. + * + * Note that the future returning by this function is only useful for + * obtaining the value of the next task to be spawning with the + * builder. If additional tasks are spawned with the same builder + * then a new result future must be obtained prior to spawning each + * task. + * + * # Failure + * Fails if a future_result was already set for this task. + */ + fn future_result(&self, blk: fn(v: Port)) -> TaskBuilder { + // FIXME (#3725): Once linked failure and notification are + // handled in the library, I can imagine implementing this by just + // registering an arbitrary number of task::on_exit handlers and + // sending out messages. + + if self.opts.notify_chan.is_some() { + fail!(~"Can't set multiple future_results for one task!"); + } + + // Construct the future and give it to the caller. + let (notify_pipe_po, notify_pipe_ch) = stream::(); + + blk(notify_pipe_po); + + // Reconfigure self to use a notify channel. + TaskBuilder { + opts: TaskOpts { + linked: self.opts.linked, + supervised: self.opts.supervised, + notify_chan: Some(notify_pipe_ch), + sched: self.opts.sched + }, + can_not_copy: None, + .. self.consume() + } + } + /// Configure a custom scheduler mode for the task. + fn sched_mode(&self, mode: SchedMode) -> TaskBuilder { + let notify_chan = replace(&mut self.opts.notify_chan, None); + TaskBuilder { + opts: TaskOpts { + linked: self.opts.linked, + supervised: self.opts.supervised, + notify_chan: notify_chan, + sched: SchedOpts { mode: mode, foreign_stack_size: None} + }, + can_not_copy: None, + .. self.consume() + } + } + + /** + * Add a wrapper to the body of the spawned task. + * + * Before the task is spawned it is passed through a 'body generator' + * function that may perform local setup operations as well as wrap + * the task body in remote setup operations. With this the behavior + * of tasks can be extended in simple ways. + * + * This function augments the current body generator with a new body + * generator by applying the task body which results from the + * existing body generator to the new body generator. + */ + fn add_wrapper(&self, wrapper: @fn(v: ~fn()) -> ~fn()) -> TaskBuilder { + let prev_gen_body = self.gen_body; + let notify_chan = replace(&mut self.opts.notify_chan, None); + TaskBuilder { + opts: TaskOpts { + linked: self.opts.linked, + supervised: self.opts.supervised, + notify_chan: notify_chan, + sched: self.opts.sched + }, + gen_body: |body| { wrapper(prev_gen_body(body)) }, + can_not_copy: None, + .. self.consume() + } + } + + /** + * Creates and executes a new child task + * + * Sets up a new task with its own call stack and schedules it to run + * the provided unique closure. The task has the properties and behavior + * specified by the task_builder. + * + * # Failure + * + * When spawning into a new scheduler, the number of threads requested + * must be greater than zero. + */ + fn spawn(&self, f: ~fn()) { + let notify_chan = replace(&mut self.opts.notify_chan, None); + let x = self.consume(); + let opts = TaskOpts { + linked: x.opts.linked, + supervised: x.opts.supervised, + notify_chan: notify_chan, + sched: x.opts.sched + }; + spawn::spawn_raw(opts, (x.gen_body)(f)); + } + /// Runs a task, while transfering ownership of one argument to the child. + fn spawn_with(&self, arg: A, f: ~fn(v: A)) { + let arg = Cell(arg); + do self.spawn { + f(arg.take()); + } + } + + /** + * Execute a function in another task and return either the return value + * of the function or result::err. + * + * # Return value + * + * If the function executed successfully then try returns result::ok + * containing the value returned by the function. If the function fails + * then try returns result::err containing nil. + * + * # Failure + * Fails if a future_result was already set for this task. + */ + fn try(&self, f: ~fn() -> T) -> Result { + let (po, ch) = stream::(); + let mut result = None; + + let fr_task_builder = self.future_result(|+r| { + result = Some(r); + }); + do fr_task_builder.spawn || { + ch.send(f()); + } + match option::unwrap(result).recv() { + Success => result::Ok(po.recv()), + Failure => result::Err(()) + } + } +} + + +/* Task construction */ + +pub fn default_task_opts() -> TaskOpts { + /*! + * The default task options + * + * By default all tasks are supervised by their parent, are spawned + * into the same scheduler, and do not post lifecycle notifications. + */ + + TaskOpts { + linked: true, + supervised: false, + notify_chan: None, + sched: SchedOpts { + mode: DefaultScheduler, + foreign_stack_size: None + } + } +} + +/* Spawn convenience functions */ + +pub fn spawn(f: ~fn()) { + /*! + * Creates and executes a new child task + * + * Sets up a new task with its own call stack and schedules it to run + * the provided unique closure. + * + * This function is equivalent to `task().spawn(f)`. + */ + + task().spawn(f) +} + +pub fn spawn_unlinked(f: ~fn()) { + /*! + * Creates a child task unlinked from the current one. If either this + * task or the child task fails, the other will not be killed. + */ + + task().unlinked().spawn(f) +} + +pub fn spawn_supervised(f: ~fn()) { + /*! + * Creates a child task unlinked from the current one. If either this + * task or the child task fails, the other will not be killed. + */ + + task().supervised().spawn(f) +} + +pub fn spawn_with(arg: A, f: ~fn(v: A)) { + /*! + * Runs a task, while transfering ownership of one argument to the + * child. + * + * This is useful for transfering ownership of noncopyables to + * another task. + * + * This function is equivalent to `task().spawn_with(arg, f)`. + */ + + task().spawn_with(arg, f) +} + +pub fn spawn_sched(mode: SchedMode, f: ~fn()) { + /*! + * Creates a new task on a new or existing scheduler + + * When there are no more tasks to execute the + * scheduler terminates. + * + * # Failure + * + * In manual threads mode the number of threads requested must be + * greater than zero. + */ + + task().sched_mode(mode).spawn(f) +} + +pub fn try(f: ~fn() -> T) -> Result { + /*! + * Execute a function in another task and return either the return value + * of the function or result::err. + * + * This is equivalent to task().supervised().try. + */ + + task().supervised().try(f) +} + + +/* Lifecycle functions */ + +pub fn yield() { + //! Yield control to the task scheduler + + unsafe { + let task_ = rt::rust_get_task(); + let killed = rt::rust_task_yield(task_); + if killed && !failing() { + fail!(~"killed"); + } + } +} + +pub fn failing() -> bool { + //! True if the running task has failed + + unsafe { + rt::rust_task_is_unwinding(rt::rust_get_task()) + } +} + +pub fn get_task() -> Task { + //! Get a handle to the running task + + unsafe { + TaskHandle(rt::get_task_id()) + } +} + +pub fn get_scheduler() -> Scheduler { + SchedulerHandle(unsafe { rt::rust_get_sched_id() }) +} + +/** + * Temporarily make the task unkillable + * + * # Example + * + * ~~~ + * do task::unkillable { + * // detach / yield / destroy must all be called together + * rustrt::rust_port_detach(po); + * // This must not result in the current task being killed + * task::yield(); + * rustrt::rust_port_destroy(po); + * } + * ~~~ + */ +pub unsafe fn unkillable(f: fn() -> U) -> U { + struct AllowFailure { + t: *rust_task, + drop { + unsafe { + rt::rust_task_allow_kill(self.t); + } + } + } + + fn AllowFailure(t: *rust_task) -> AllowFailure{ + AllowFailure { + t: t + } + } + + unsafe { + let t = rt::rust_get_task(); + let _allow_failure = AllowFailure(t); + rt::rust_task_inhibit_kill(t); + f() + } +} + +/// The inverse of unkillable. Only ever to be used nested in unkillable(). +pub unsafe fn rekillable(f: fn() -> U) -> U { + struct DisallowFailure { + t: *rust_task, + drop { + unsafe { + rt::rust_task_inhibit_kill(self.t); + } + } + } + + fn DisallowFailure(t: *rust_task) -> DisallowFailure { + DisallowFailure { + t: t + } + } + + unsafe { + let t = rt::rust_get_task(); + let _allow_failure = DisallowFailure(t); + rt::rust_task_allow_kill(t); + f() + } +} + +/** + * A stronger version of unkillable that also inhibits scheduling operations. + * For use with exclusive ARCs, which use pthread mutexes directly. + */ +pub unsafe fn atomically(f: fn() -> U) -> U { + struct DeferInterrupts { + t: *rust_task, + drop { + unsafe { + rt::rust_task_allow_yield(self.t); + rt::rust_task_allow_kill(self.t); + } + } + } + + fn DeferInterrupts(t: *rust_task) -> DeferInterrupts { + DeferInterrupts { + t: t + } + } + + unsafe { + let t = rt::rust_get_task(); + let _interrupts = DeferInterrupts(t); + rt::rust_task_inhibit_kill(t); + rt::rust_task_inhibit_yield(t); + f() + } +} + +#[test] #[should_fail] #[ignore(cfg(windows))] +fn test_cant_dup_task_builder() { + let b = task().unlinked(); + do b.spawn { } + // FIXME(#3724): For now, this is a -runtime- failure, because we haven't + // got move mode on self. When 3724 is fixed, this test should fail to + // compile instead, and should go in tests/compile-fail. + do b.spawn { } // b should have been consumed by the previous call +} + +// The following 8 tests test the following 2^3 combinations: +// {un,}linked {un,}supervised failure propagation {up,down}wards. + +// !!! These tests are dangerous. If Something is buggy, they will hang, !!! +// !!! instead of exiting cleanly. This might wedge the buildbots. !!! + +#[test] #[ignore(cfg(windows))] +fn test_spawn_unlinked_unsup_no_fail_down() { // grandchild sends on a port + let (po, ch) = stream(); + let ch = SharedChan(ch); + do spawn_unlinked { + let ch = ch.clone(); + do spawn_unlinked { + // Give middle task a chance to fail-but-not-kill-us. + for iter::repeat(16) { task::yield(); } + ch.send(()); // If killed first, grandparent hangs. + } + fail!(); // Shouldn't kill either (grand)parent or (grand)child. + } + po.recv(); +} +#[test] #[ignore(cfg(windows))] +fn test_spawn_unlinked_unsup_no_fail_up() { // child unlinked fails + do spawn_unlinked { fail!(); } +} +#[test] #[ignore(cfg(windows))] +fn test_spawn_unlinked_sup_no_fail_up() { // child unlinked fails + do spawn_supervised { fail!(); } + // Give child a chance to fail-but-not-kill-us. + for iter::repeat(16) { task::yield(); } +} +#[test] #[should_fail] #[ignore(cfg(windows))] +fn test_spawn_unlinked_sup_fail_down() { + do spawn_supervised { loop { task::yield(); } } + fail!(); // Shouldn't leave a child hanging around. +} + +#[test] #[should_fail] #[ignore(cfg(windows))] +fn test_spawn_linked_sup_fail_up() { // child fails; parent fails + let (po, _ch) = stream::<()>(); + // Unidirectional "parenting" shouldn't override bidirectional linked. + // We have to cheat with opts - the interface doesn't support them because + // they don't make sense (redundant with task().supervised()). + let opts = { + let mut opts = default_task_opts(); + opts.linked = true; + opts.supervised = true; + opts + }; + + let b0 = task(); + let b1 = TaskBuilder { + opts: opts, + can_not_copy: None, + .. b0 + }; + do b1.spawn { fail!(); } + po.recv(); // We should get punted awake +} +#[test] #[should_fail] #[ignore(cfg(windows))] +fn test_spawn_linked_sup_fail_down() { // parent fails; child fails + // We have to cheat with opts - the interface doesn't support them because + // they don't make sense (redundant with task().supervised()). + let opts = { + let mut opts = default_task_opts(); + opts.linked = true; + opts.supervised = true; + opts + }; + + let b0 = task(); + let b1 = TaskBuilder { + opts: opts, + can_not_copy: None, + .. b0 + }; + do b1.spawn { loop { task::yield(); } } + fail!(); // *both* mechanisms would be wrong if this didn't kill the child +} +#[test] #[should_fail] #[ignore(cfg(windows))] +fn test_spawn_linked_unsup_fail_up() { // child fails; parent fails + let (po, _ch) = stream::<()>(); + // Default options are to spawn linked & unsupervised. + do spawn { fail!(); } + po.recv(); // We should get punted awake +} +#[test] #[should_fail] #[ignore(cfg(windows))] +fn test_spawn_linked_unsup_fail_down() { // parent fails; child fails + // Default options are to spawn linked & unsupervised. + do spawn { loop { task::yield(); } } + fail!(); +} +#[test] #[should_fail] #[ignore(cfg(windows))] +fn test_spawn_linked_unsup_default_opts() { // parent fails; child fails + // Make sure the above test is the same as this one. + do task().linked().spawn { loop { task::yield(); } } + fail!(); +} + +// A couple bonus linked failure tests - testing for failure propagation even +// when the middle task exits successfully early before kill signals are sent. + +#[test] #[should_fail] #[ignore(cfg(windows))] +fn test_spawn_failure_propagate_grandchild() { + // Middle task exits; does grandparent's failure propagate across the gap? + do spawn_supervised { + do spawn_supervised { + loop { task::yield(); } + } + } + for iter::repeat(16) { task::yield(); } + fail!(); +} + +#[test] #[should_fail] #[ignore(cfg(windows))] +fn test_spawn_failure_propagate_secondborn() { + // First-born child exits; does parent's failure propagate to sibling? + do spawn_supervised { + do spawn { // linked + loop { task::yield(); } + } + } + for iter::repeat(16) { task::yield(); } + fail!(); +} + +#[test] #[should_fail] #[ignore(cfg(windows))] +fn test_spawn_failure_propagate_nephew_or_niece() { + // Our sibling exits; does our failure propagate to sibling's child? + do spawn { // linked + do spawn_supervised { + loop { task::yield(); } + } + } + for iter::repeat(16) { task::yield(); } + fail!(); +} + +#[test] #[should_fail] #[ignore(cfg(windows))] +fn test_spawn_linked_sup_propagate_sibling() { + // Middle sibling exits - does eldest's failure propagate to youngest? + do spawn { // linked + do spawn { // linked + loop { task::yield(); } + } + } + for iter::repeat(16) { task::yield(); } + fail!(); +} + +#[test] +fn test_run_basic() { + let (po, ch) = stream::<()>(); + do task().spawn { + ch.send(()); + } + po.recv(); +} + +#[test] +struct Wrapper { + mut f: Option> +} + +#[test] +fn test_add_wrapper() { + let (po, ch) = stream::<()>(); + let b0 = task(); + let ch = Wrapper { f: Some(ch) }; + let b1 = do b0.add_wrapper |body| { + let ch = Wrapper { f: Some(ch.f.swap_unwrap()) }; + let result: ~fn() = || { + let ch = ch.f.swap_unwrap(); + body(); + ch.send(()); + }; + result + }; + do b1.spawn { } + po.recv(); +} + +#[test] +#[ignore(cfg(windows))] +fn test_future_result() { + let mut result = None; + do task().future_result(|+r| { result = Some(r); }).spawn { } + assert option::unwrap(result).recv() == Success; + + result = None; + do task().future_result(|+r| + { result = Some(r); }).unlinked().spawn { + fail!(); + } + assert option::unwrap(result).recv() == Failure; +} + +#[test] #[should_fail] #[ignore(cfg(windows))] +fn test_back_to_the_future_result() { + let _ = task().future_result(util::ignore).future_result(util::ignore); +} + +#[test] +fn test_try_success() { + match do try { + ~"Success!" + } { + result::Ok(~"Success!") => (), + _ => fail!() + } +} + +#[test] +#[ignore(cfg(windows))] +fn test_try_fail() { + match do try { + fail!() + } { + result::Err(()) => (), + result::Ok(()) => fail!() + } +} + +#[test] +#[should_fail] +#[ignore(cfg(windows))] +fn test_spawn_sched_no_threads() { + do spawn_sched(ManualThreads(0u)) { } +} + +#[test] +fn test_spawn_sched() { + let (po, ch) = stream::<()>(); + let ch = SharedChan(ch); + + fn f(i: int, ch: SharedChan<()>) { + let parent_sched_id = unsafe { rt::rust_get_sched_id() }; + + do spawn_sched(SingleThreaded) { + let child_sched_id = unsafe { rt::rust_get_sched_id() }; + assert parent_sched_id != child_sched_id; + + if (i == 0) { + ch.send(()); + } else { + f(i - 1, ch.clone()); + } + }; + + } + f(10, ch); + po.recv(); +} + +#[test] +fn test_spawn_sched_childs_on_default_sched() { + let (po, ch) = stream(); + + // Assuming tests run on the default scheduler + let default_id = unsafe { rt::rust_get_sched_id() }; + + let ch = Wrapper { f: Some(ch) }; + do spawn_sched(SingleThreaded) { + let parent_sched_id = unsafe { rt::rust_get_sched_id() }; + let ch = Wrapper { f: Some(ch.f.swap_unwrap()) }; + do spawn { + let ch = ch.f.swap_unwrap(); + let child_sched_id = unsafe { rt::rust_get_sched_id() }; + assert parent_sched_id != child_sched_id; + assert child_sched_id == default_id; + ch.send(()); + }; + }; + + po.recv(); +} + +#[nolink] +#[cfg(test)] +extern mod testrt { + unsafe fn rust_dbg_lock_create() -> *libc::c_void; + unsafe fn rust_dbg_lock_destroy(lock: *libc::c_void); + unsafe fn rust_dbg_lock_lock(lock: *libc::c_void); + unsafe fn rust_dbg_lock_unlock(lock: *libc::c_void); + unsafe fn rust_dbg_lock_wait(lock: *libc::c_void); + unsafe fn rust_dbg_lock_signal(lock: *libc::c_void); +} + +#[test] +fn test_spawn_sched_blocking() { + unsafe { + + // Testing that a task in one scheduler can block in foreign code + // without affecting other schedulers + for iter::repeat(20u) { + + let (start_po, start_ch) = stream(); + let (fin_po, fin_ch) = stream(); + + let lock = testrt::rust_dbg_lock_create(); + + do spawn_sched(SingleThreaded) { + unsafe { + testrt::rust_dbg_lock_lock(lock); + + start_ch.send(()); + + // Block the scheduler thread + testrt::rust_dbg_lock_wait(lock); + testrt::rust_dbg_lock_unlock(lock); + + fin_ch.send(()); + } + }; + + // Wait until the other task has its lock + start_po.recv(); + + fn pingpong(po: &Port, ch: &Chan) { + let mut val = 20; + while val > 0 { + val = po.recv(); + ch.send(val - 1); + } + } + + let (setup_po, setup_ch) = stream(); + let (parent_po, parent_ch) = stream(); + do spawn { + let (child_po, child_ch) = stream(); + setup_ch.send(child_ch); + pingpong(&child_po, &parent_ch); + }; + + let child_ch = setup_po.recv(); + child_ch.send(20); + pingpong(&parent_po, &child_ch); + testrt::rust_dbg_lock_lock(lock); + testrt::rust_dbg_lock_signal(lock); + testrt::rust_dbg_lock_unlock(lock); + fin_po.recv(); + testrt::rust_dbg_lock_destroy(lock); + } + } +} + +#[cfg(test)] +fn avoid_copying_the_body(spawnfn: &fn(v: ~fn())) { + let (p, ch) = stream::(); + + let x = ~1; + let x_in_parent = ptr::addr_of(&(*x)) as uint; + + do spawnfn || { + let x_in_child = ptr::addr_of(&(*x)) as uint; + ch.send(x_in_child); + } + + let x_in_child = p.recv(); + assert x_in_parent == x_in_child; +} + +#[test] +fn test_avoid_copying_the_body_spawn() { + avoid_copying_the_body(spawn); +} + +#[test] +fn test_avoid_copying_the_body_task_spawn() { + do avoid_copying_the_body |f| { + do task().spawn || { + f(); + } + } +} + +#[test] +fn test_avoid_copying_the_body_try() { + do avoid_copying_the_body |f| { + do try || { + f() + }; + } +} + +#[test] +fn test_avoid_copying_the_body_unlinked() { + do avoid_copying_the_body |f| { + do spawn_unlinked || { + f(); + } + } +} + +#[test] +fn test_platform_thread() { + let (po, ch) = stream(); + do task().sched_mode(PlatformThread).spawn { + ch.send(()); + } + po.recv(); +} + +#[test] +#[ignore(cfg(windows))] +#[should_fail] +fn test_unkillable() { + let (po, ch) = stream(); + + // We want to do this after failing + do spawn_unlinked { + for iter::repeat(10) { yield() } + ch.send(()); + } + + do spawn { + yield(); + // We want to fail after the unkillable task + // blocks on recv + fail!(); + } + + unsafe { + do unkillable { + let p = ~0; + let pp: *uint = cast::transmute(p); + + // If we are killed here then the box will leak + po.recv(); + + let _p: ~int = cast::transmute(pp); + } + } + + // Now we can be killed + po.recv(); +} + +#[test] +#[ignore(cfg(windows))] +#[should_fail] +fn test_unkillable_nested() { + let (po, ch) = comm::stream(); + + // We want to do this after failing + do spawn_unlinked || { + for iter::repeat(10) { yield() } + ch.send(()); + } + + do spawn { + yield(); + // We want to fail after the unkillable task + // blocks on recv + fail!(); + } + + unsafe { + do unkillable { + do unkillable {} // Here's the difference from the previous test. + let p = ~0; + let pp: *uint = cast::transmute(p); + + // If we are killed here then the box will leak + po.recv(); + + let _p: ~int = cast::transmute(pp); + } + } + + // Now we can be killed + po.recv(); +} + +#[test] #[should_fail] #[ignore(cfg(windows))] +fn test_atomically() { + unsafe { do atomically { yield(); } } +} + +#[test] +fn test_atomically2() { + unsafe { do atomically { } } yield(); // shouldn't fail +} + +#[test] #[should_fail] #[ignore(cfg(windows))] +fn test_atomically_nested() { + unsafe { do atomically { do atomically { } yield(); } } +} + +#[test] +fn test_child_doesnt_ref_parent() { + // If the child refcounts the parent task, this will stack overflow when + // climbing the task tree to dereference each ancestor. (See #1789) + // (well, it would if the constant were 8000+ - I lowered it to be more + // valgrind-friendly. try this at home, instead..!) + const generations: uint = 16; + fn child_no(x: uint) -> ~fn() { + return || { + if x < generations { + task::spawn(child_no(x+1)); + } + } + } + task::spawn(child_no(0)); +} + +#[test] +fn test_sched_thread_per_core() { + let (port, chan) = comm::stream(); + + do spawn_sched(ThreadPerCore) || { + unsafe { + let cores = rt::rust_num_threads(); + let reported_threads = rt::rust_sched_threads(); + assert(cores as uint == reported_threads as uint); + chan.send(()); + } + } + + port.recv(); +} + +#[test] +fn test_spawn_thread_on_demand() { + let (port, chan) = comm::stream(); + + do spawn_sched(ManualThreads(2)) || { + unsafe { + let max_threads = rt::rust_sched_threads(); + assert(max_threads as int == 2); + let running_threads = rt::rust_sched_current_nonlazy_threads(); + assert(running_threads as int == 1); + + let (port2, chan2) = comm::stream(); + + do spawn_sched(CurrentScheduler) || { + chan2.send(()); + } + + let running_threads2 = rt::rust_sched_current_nonlazy_threads(); + assert(running_threads2 as int == 2); + + port2.recv(); + chan.send(()); + } + } + + port.recv(); +} diff --git a/samples/SuperCollider/example.scd b/samples/SuperCollider/example.scd new file mode 100644 index 00000000..c88ee9b9 --- /dev/null +++ b/samples/SuperCollider/example.scd @@ -0,0 +1,51 @@ +// SuperCollider Examples + +//boot server +s.boot; + +// SC as system for sound synthesis and sound processing + + +// patching synth moduls by writing synth defs: + +( +SynthDef("mod", { + var sig, resfreq; + sig = Saw.ar(100); + resfreq = SinOsc.kr(2) * 200 + 500; + sig = RLPF.ar(sig, resfreq, 0.1); + sig = sig * 0.3; + Out.ar(0, sig); +}).play; +) + +// SuperCollider: a powerful expressive DSP language: + +( +30.do { arg i; + { Pan2.ar( + SinOsc.ar(exprand(100.0, 3000.0) * LFNoise2.kr(rrand(0.1, 0.2)).range(0.95, 1.1), 0, + LFNoise2.kr(rrand(0.3, 0.7)).range(0,0.5) ** 4), + 1.0.rand2) + }.play +} +) + +// plot envelopes +a = Env.perc(0.05, 1, 1, -4); +b = a.delay(2); +a.test.plot; +b.test.plot; + +a = Env([0.5, 1, 0], [1, 1]).plot; +a.delay(1).plot; + +// examples asStream function +( +{ +e = Env.sine.asStream; +5.do({ +    e.next.postln; +    0.25.wait; +})}.fork +) diff --git a/samples/TXL/Cal.txl b/samples/TXL/Cal.txl new file mode 100644 index 00000000..7a54d3d1 --- /dev/null +++ b/samples/TXL/Cal.txl @@ -0,0 +1,80 @@ +% Calculator.Txl - simple numerical expression evaluator + +% Part I. Syntax specification +define program + [expression] +end define + +define expression + [term] + | [expression] [addop] [term] +end define + +define term + [primary] + | [term] [mulop] [primary] +end define + +define primary + [number] + | ( [expression] ) +end define + +define addop + '+ + | '- +end define + +define mulop + '* + | '/ +end define + + +% Part 2. Transformation rules +rule main + replace [expression] + E [expression] + construct NewE [expression] + E [resolveAddition] [resolveSubtraction] [resolveMultiplication] + [resolveDivision] [resolveParentheses] + where not + NewE [= E] + by + NewE +end rule + +rule resolveAddition + replace [expression] + N1 [number] + N2 [number] + by + N1 [+ N2] +end rule + +rule resolveSubtraction + replace [expression] + N1 [number] - N2 [number] + by + N1 [- N2] +end rule + +rule resolveMultiplication + replace [term] + N1 [number] * N2 [number] + by + N1 [* N2] +end rule + +rule resolveDivision + replace [term] + N1 [number] / N2 [number] + by + N1 [/ N2] +end rule + +rule resolveParentheses + replace [primary] + ( N [number] ) + by + N +end rule diff --git a/samples/Text/cube.stl b/samples/Text/cube.stl new file mode 100644 index 00000000..cd20b5c5 --- /dev/null +++ b/samples/Text/cube.stl @@ -0,0 +1,86 @@ +solid + facet normal 0.000000E+00 -1.000000E+00 0.000000E+00 + outer loop + vertex -1.850000E+01 -2.450000E+01 3.100000E+01 + vertex -1.850000E+01 -2.450000E+01 -1.000000E-03 + vertex 1.250000E+01 -2.450000E+01 -1.000000E-03 + endloop + endfacet + facet normal 0.000000E+00 -1.000000E+00 0.000000E+00 + outer loop + vertex -1.850000E+01 -2.450000E+01 3.100000E+01 + vertex 1.250000E+01 -2.450000E+01 -1.000000E-03 + vertex 1.250000E+01 -2.450000E+01 3.100000E+01 + endloop + endfacet + facet normal -1.000000E+00 0.000000E+00 0.000000E+00 + outer loop + vertex -1.850000E+01 6.500000E+00 3.100000E+01 + vertex -1.850000E+01 6.500000E+00 -1.000000E-03 + vertex -1.850000E+01 -2.450000E+01 -1.000000E-03 + endloop + endfacet + facet normal -1.000000E+00 0.000000E+00 0.000000E+00 + outer loop + vertex -1.850000E+01 6.500000E+00 3.100000E+01 + vertex -1.850000E+01 -2.450000E+01 -1.000000E-03 + vertex -1.850000E+01 -2.450000E+01 3.100000E+01 + endloop + endfacet + facet normal 0.000000E+00 1.000000E+00 0.000000E+00 + outer loop + vertex -1.850000E+01 6.500000E+00 -1.000000E-03 + vertex -1.850000E+01 6.500000E+00 3.100000E+01 + vertex 1.250000E+01 6.500000E+00 3.100000E+01 + endloop + endfacet + facet normal 0.000000E+00 1.000000E+00 0.000000E+00 + outer loop + vertex -1.850000E+01 6.500000E+00 -1.000000E-03 + vertex 1.250000E+01 6.500000E+00 3.100000E+01 + vertex 1.250000E+01 6.500000E+00 -1.000000E-03 + endloop + endfacet + facet normal 1.000000E+00 0.000000E+00 0.000000E+00 + outer loop + vertex 1.250000E+01 6.500000E+00 3.100000E+01 + vertex 1.250000E+01 -2.450000E+01 3.100000E+01 + vertex 1.250000E+01 -2.450000E+01 -1.000000E-03 + endloop + endfacet + facet normal 1.000000E+00 0.000000E+00 0.000000E+00 + outer loop + vertex 1.250000E+01 6.500000E+00 3.100000E+01 + vertex 1.250000E+01 -2.450000E+01 -1.000000E-03 + vertex 1.250000E+01 6.500000E+00 -1.000000E-03 + endloop + endfacet + facet normal 0.000000E+00 0.000000E+00 -1.000000E+00 + outer loop + vertex 1.250000E+01 6.500000E+00 -1.000000E-03 + vertex 1.250000E+01 -2.450000E+01 -1.000000E-03 + vertex -1.850000E+01 -2.450000E+01 -1.000000E-03 + endloop + endfacet + facet normal 0.000000E+00 0.000000E+00 -1.000000E+00 + outer loop + vertex 1.250000E+01 6.500000E+00 -1.000000E-03 + vertex -1.850000E+01 -2.450000E+01 -1.000000E-03 + vertex -1.850000E+01 6.500000E+00 -1.000000E-03 + endloop + endfacet + facet normal 0.000000E+00 0.000000E+00 1.000000E+00 + outer loop + vertex -1.850000E+01 6.500000E+00 3.100000E+01 + vertex -1.850000E+01 -2.450000E+01 3.100000E+01 + vertex 1.250000E+01 -2.450000E+01 3.100000E+01 + endloop + endfacet + facet normal 0.000000E+00 0.000000E+00 1.000000E+00 + outer loop + vertex -1.850000E+01 6.500000E+00 3.100000E+01 + vertex 1.250000E+01 -2.450000E+01 3.100000E+01 + vertex 1.250000E+01 6.500000E+00 3.100000E+01 + endloop + endfacet +endsolid diff --git a/samples/TypeScript/classes.ts b/samples/TypeScript/classes.ts new file mode 100644 index 00000000..545c6cf5 --- /dev/null +++ b/samples/TypeScript/classes.ts @@ -0,0 +1,28 @@ +class Animal { + constructor(public name) { } + move(meters) { + alert(this.name + " moved " + meters + "m."); + } +} + +class Snake extends Animal { + constructor(name) { super(name); } + move() { + alert("Slithering..."); + super.move(5); + } +} + +class Horse extends Animal { + constructor(name) { super(name); } + move() { + alert("Galloping..."); + super.move(45); + } +} + +var sam = new Snake("Sammy the Python") +var tom: Animal = new Horse("Tommy the Palomino") + +sam.move() +tom.move(34) diff --git a/samples/TypeScript/empty.ts b/samples/TypeScript/empty.ts new file mode 100644 index 00000000..e69de29b diff --git a/samples/TypeScript/hello.ts b/samples/TypeScript/hello.ts new file mode 100644 index 00000000..4b65a573 --- /dev/null +++ b/samples/TypeScript/hello.ts @@ -0,0 +1 @@ +console.log "Hello, World!" diff --git a/samples/XProc/xproc.xpl b/samples/XProc/xproc.xpl new file mode 100644 index 00000000..241acd74 --- /dev/null +++ b/samples/XProc/xproc.xpl @@ -0,0 +1,11 @@ + + + + + Hello world! + + + + + \ No newline at end of file diff --git a/samples/Xtend/BasicExpressions.xtend b/samples/Xtend/BasicExpressions.xtend new file mode 100644 index 00000000..f6cdb1a3 --- /dev/null +++ b/samples/Xtend/BasicExpressions.xtend @@ -0,0 +1,93 @@ +/******************************************************************************* + * Copyright (c) 2012 itemis AG (http://www.itemis.eu) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ +package example2 + +import org.junit.Test +import static org.junit.Assert.* + + +class BasicExpressions { + + @Test def void literals() { + // string literals work with single or double quotes + assertEquals('Hello', "Hello") + + // number literals (big decimals in this case) + assertEquals(42, 20 + 20 + 1 * 2) + assertEquals(42.00bd, 0.00bd + 42bd) + + // boolean literals + assertEquals(true, !false) + + // class literals + assertEquals(getClass(), typeof(BasicExpressions)) + } + + @Test def void collections() { + // There are various static methods to create collections + // and numerous extension methods which make working with them + // convenient. + val list = newArrayList('Hello', 'World') + assertEquals('HELLO', list.map[toUpperCase].head) + + val set = newHashSet(1, 3, 5) + assertEquals(2, set.filter[ it >= 3].size) + + val map = newHashMap('one' -> 1, 'two' -> 2, 'three' -> 3) + assertEquals( 2 , map.get('two')) + } + + @Test def void controlStructures() { + // 'if' looks like in Java + if ('text'.length == 4) { + // but it's an expression so it can be used in more flexible ways: + assertEquals( 42 , if ('foo' != 'bar') 42 else -24 ) + } else { + fail('Never happens!') + } + + // in a switch the first match wins + switch (t : 'text') { + // use predicates + case t.length > 8 : + fail('Never happens!') + // use equals + case 'text' : + assertTrue(true) + default : + fail('never happens!') + } + + // switch also supports type guards, which provide a safe + // and convenient alternative to Java's 'instanceof'-cascades. + val Object someValue = 'a string typed to Object' + assertEquals('string', + switch someValue { + Number : 'number' + String : 'string' + }) + } + + @Test def void loops() { + // for loop + var counter = 1 + for (i : 1 .. 10) { + assertEquals(counter, i) + counter = counter + 1 + } + + // while loop + val iterator = newArrayList(1,2,3,4,5).iterator + counter = 1 + while(iterator.hasNext) { + val i = iterator.next + assertEquals(counter, i) + counter = counter + 1 + } + } +} diff --git a/samples/Xtend/Movies.xtend b/samples/Xtend/Movies.xtend new file mode 100644 index 00000000..f243695f --- /dev/null +++ b/samples/Xtend/Movies.xtend @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2012 itemis AG (http://www.itemis.eu) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Author - Sven Efftinge + *******************************************************************************/ +package example6 + +import org.junit.Test +import static org.junit.Assert.* +import java.io.FileReader +import java.util.Set +import static extension com.google.common.io.CharStreams.* + +class Movies { + + /** + * @return the total number of action movies + */ + @Test def void numberOfActionMovies() { + assertEquals(828, movies.filter[categories.contains('Action')].size) + } + + /** + * @return the year the best rated movie of 80ies (1980-1989) was released. + */ + @Test def void yearOfBestMovieFrom80ies() { + assertEquals(1989, movies.filter[(1980..1989).contains(year)].sortBy[rating].last.year) + } + + /** + * @return the sum of the number of votes of the two top rated movies. + */ + @Test def void sumOfVotesOfTop2() { + val long movies = movies.sortBy[-rating].take(2).map[numberOfVotes].reduce[a, b| a + b] + assertEquals(47_229, movies) + } + + val movies = new FileReader('data.csv').readLines.map[ line | + val segments = line.split(' ').iterator + return new Movie( + segments.next, + Integer::parseInt(segments.next), + Double::parseDouble(segments.next), + Long::parseLong(segments.next), + segments.toSet + ) + ] +} + +@Data class Movie { + String title + int year + double rating + long numberOfVotes + Set categories +} diff --git a/samples/edn/bigger-than-pluto.edn b/samples/edn/bigger-than-pluto.edn new file mode 100644 index 00000000..47ce43cd --- /dev/null +++ b/samples/edn/bigger-than-pluto.edn @@ -0,0 +1,76 @@ +[{:db/id #db/id [db.part/db] + :db/ident :object/name + :db/doc "Name of a Solar System object." + :db/valueType :db.type/string + :db/index true + :db/cardinality :db.cardinality/one + :db.install/_attribute :db.part/db} + {:db/id #db/id [db.part/db] + :db/ident :object/meanRadius + :db/doc "Mean radius of an object." + :db/index true + :db/valueType :db.type/double + :db/cardinality :db.cardinality/one + :db.install/_attribute :db.part/db} + {:db/id #db/id [db.part/db] + :db/ident :data/source + :db/doc "Source of the data in a transaction." + :db/valueType :db.type/string + :db/index true + :db/cardinality :db.cardinality/one + :db.install/_attribute :db.part/db}] +[{:db/id #db/id [db.part/tx] + :db/doc "Solar system objects bigger than Pluto."} + {:db/id #db/id [db.part/tx] + :data/source "http://en.wikipedia.org/wiki/List_of_Solar_System_objects_by_size"} + {:db/id #db/id [db.part/user] + :object/name "Sun" + :object/meanRadius 696000.0} + {:db/id #db/id [db.part/user] + :object/name "Jupiter" + :object/meanRadius 69911.0} + {:db/id #db/id [db.part/user] + :object/name "Saturn" + :object/meanRadius 58232.0} + {:db/id #db/id [db.part/user] + :object/name "Uranus" + :object/meanRadius 25362.0} + {:db/id #db/id [db.part/user] + :object/name "Neptune" + :object/meanRadius 24622.0} + {:db/id #db/id [db.part/user] + :object/name "Earth" + :object/meanRadius 6371.0} + {:db/id #db/id [db.part/user] + :object/name "Venus" + :object/meanRadius 6051.8} + {:db/id #db/id [db.part/user] + :object/name "Mars" + :object/meanRadius 3390.0} + {:db/id #db/id [db.part/user] + :object/name "Ganymede" + :object/meanRadius 2631.2} + {:db/id #db/id [db.part/user] + :object/name "Titan" + :object/meanRadius 2576.0} + {:db/id #db/id [db.part/user] + :object/name "Mercury" + :object/meanRadius 2439.7} + {:db/id #db/id [db.part/user] + :object/name "Callisto" + :object/meanRadius 2410.3} + {:db/id #db/id [db.part/user] + :object/name "Io" + :object/meanRadius 1821.5} + {:db/id #db/id [db.part/user] + :object/name "Moon" + :object/meanRadius 1737.1} + {:db/id #db/id [db.part/user] + :object/name "Europa" + :object/meanRadius 1561.0} + {:db/id #db/id [db.part/user] + :object/name "Triton" + :object/meanRadius 1353.4} + {:db/id #db/id [db.part/user] + :object/name "Eris" + :object/meanRadius 1163.0}] diff --git a/samples/fish/config.fish b/samples/fish/config.fish new file mode 100644 index 00000000..af2e15cb --- /dev/null +++ b/samples/fish/config.fish @@ -0,0 +1,98 @@ +# +# Main file for fish command completions. This file contains various +# common helper functions for the command completions. All actual +# completions are located in the completions subdirectory. +# + +# +# Set default field separators +# + +set -g IFS \n\ \t + +# +# Set default search paths for completions and shellscript functions +# unless they already exist +# + +set -l configdir ~/.config + +if set -q XDG_CONFIG_HOME + set configdir $XDG_CONFIG_HOME +end + +# __fish_datadir, __fish_sysconfdir, __fish_help_dir, __fish_bin_dir +# are expected to have been set up by read_init from fish.cpp + +# Set up function and completion paths. Make sure that the fish +# default functions/completions are included in the respective path. + +if not set -q fish_function_path + set fish_function_path $configdir/fish/functions $__fish_sysconfdir/functions $__fish_datadir/functions +end + +if not contains $__fish_datadir/functions $fish_function_path + set fish_function_path[-1] $__fish_datadir/functions +end + +if not set -q fish_complete_path + set fish_complete_path $configdir/fish/completions $__fish_sysconfdir/completions $__fish_datadir/completions +end + +if not contains $__fish_datadir/completions $fish_complete_path + set fish_complete_path[-1] $__fish_datadir/completions +end + +# +# This is a Solaris-specific test to modify the PATH so that +# Posix-conformant tools are used by default. It is separate from the +# other PATH code because this directory needs to be prepended, not +# appended, since it contains POSIX-compliant replacements for various +# system utilities. +# + +if test -d /usr/xpg4/bin + if not contains /usr/xpg4/bin $PATH + set PATH /usr/xpg4/bin $PATH + end +end + +# +# Add a few common directories to path, if they exists. Note that pure +# console programs like makedep sometimes live in /usr/X11R6/bin, so we +# want this even for text-only terminals. +# + +set -l path_list /bin /usr/bin /usr/X11R6/bin /usr/local/bin $__fish_bin_dir + +# Root should also have the sbin directories in the path +switch $USER + case root + set path_list $path_list /sbin /usr/sbin /usr/local/sbin +end + +for i in $path_list + if not contains $i $PATH + if test -d $i + set PATH $PATH $i + end + end +end + +# +# Launch debugger on SIGTRAP +# +function fish_sigtrap_handler --on-signal TRAP --no-scope-shadowing --description "Signal handler for the TRAP signal. Lanches a debug prompt." + breakpoint +end + +# +# Whenever a prompt is displayed, make sure that interactive +# mode-specific initializations have been performed. +# This handler removes itself after it is first called. +# +function __fish_on_interactive --on-event fish_prompt + __fish_config_interactive + functions -e __fish_on_interactive +end + diff --git a/samples/fish/eval.fish b/samples/fish/eval.fish new file mode 100644 index 00000000..432364ea --- /dev/null +++ b/samples/fish/eval.fish @@ -0,0 +1,28 @@ + +function eval -S -d "Evaluate parameters as a command" + + # If we are in an interactive shell, eval should enable full + # job control since it should behave like the real code was + # executed. If we don't do this, commands that expect to be + # used interactively, like less, wont work using eval. + + set -l mode + if status --is-interactive-job-control + set mode interactive + else + if status --is-full-job-control + set mode full + else + set mode none + end + end + if status --is-interactive + status --job-control full + end + + echo "begin; $argv ;end eval2_inner <&3 3<&-" | . 3<&0 + set -l res $status + + status --job-control $mode + return $res +end diff --git a/samples/fish/funced.fish b/samples/fish/funced.fish new file mode 100644 index 00000000..acee5c1a --- /dev/null +++ b/samples/fish/funced.fish @@ -0,0 +1,101 @@ +function funced --description 'Edit function definition' + set -l editor $EDITOR + set -l interactive + set -l funcname + while set -q argv[1] + switch $argv[1] + case -h --help + __fish_print_help funced + return 0 + + case -e --editor + set editor $argv[2] + set -e argv[2] + + case -i --interactive + set interactive 1 + + case -- + set funcname $funcname $argv[2] + set -e argv[2] + + case '-*' + set_color red + printf (_ "%s: Unknown option %s\n") funced $argv[1] + set_color normal + return 1 + + case '*' '.*' + set funcname $funcname $argv[1] + end + set -e argv[1] + end + + if begin; set -q funcname[2]; or not test "$funcname[1]"; end + set_color red + _ "funced: You must specify one function name +" + set_color normal + return 1 + end + + set -l init + switch $funcname + case '-*' + set init function -- $funcname\n\nend + case '*' + set init function $funcname\n\nend + end + + # Break editor up to get its first command (i.e. discard flags) + if test -n "$editor" + set -l editor_cmd + eval set editor_cmd $editor + if not type -f "$editor_cmd[1]" >/dev/null + _ "funced: The value for \$EDITOR '$editor' could not be used because the command '$editor_cmd[1]' could not be found + " + set editor fish + end + end + + # If no editor is specified, use fish + if test -z "$editor" + set editor fish + end + + if begin; set -q interactive[1]; or test "$editor" = fish; end + set -l IFS + if functions -q -- $funcname + # Shadow IFS here to avoid array splitting in command substitution + set init (functions -- $funcname | fish_indent --no-indent) + end + + set -l prompt 'printf "%s%s%s> " (set_color green) '$funcname' (set_color normal)' + # Unshadow IFS since the fish_title breaks otherwise + set -e IFS + if read -p $prompt -c "$init" -s cmd + # Shadow IFS _again_ to avoid array splitting in command substitution + set -l IFS + eval (echo -n $cmd | fish_indent) + end + return 0 + end + + set -q TMPDIR; or set -l TMPDIR /tmp + set -l tmpname (printf "$TMPDIR/fish_funced_%d_%d.fish" %self (random)) + while test -f $tmpname + set tmpname (printf "$TMPDIR/fish_funced_%d_%d.fish" %self (random)) + end + + if functions -q -- $funcname + functions -- $funcname > $tmpname + else + echo $init > $tmpname + end + if eval $editor $tmpname + . $tmpname + end + set -l stat $status + rm -f $tmpname >/dev/null + return $stat +end diff --git a/test/test_blob.rb b/test/test_blob.rb index 966c2743..098ba748 100644 --- a/test/test_blob.rb +++ b/test/test_blob.rb @@ -2,7 +2,7 @@ require 'linguist/file_blob' require 'linguist/samples' require 'test/unit' -require 'mocha' +require 'mocha/setup' require 'mime/types' require 'pygments' @@ -132,6 +132,11 @@ class TestBlob < Test::Unit::TestCase assert !blob("Binary/octocat.psd").image? end + def test_solid + assert blob("Binary/cube.stl").solid? + assert blob("Text/cube.stl").solid? + end + def test_viewable assert blob("Text/README").viewable? assert blob("Ruby/foo.rb").viewable? @@ -169,6 +174,9 @@ class TestBlob < Test::Unit::TestCase # CoffeeScript-generated JS # TODO + # TypeScript-generated JS + # TODO + # PEG.js-generated parsers assert blob("JavaScript/parser.js").generated? @@ -187,7 +195,7 @@ class TestBlob < Test::Unit::TestCase assert !blob("Text/README").vendored? assert !blob("ext/extconf.rb").vendored? - # Node depedencies + # Node dependencies assert blob("node_modules/coffee-script/lib/coffee-script.js").vendored? # Rails vendor/ @@ -196,7 +204,7 @@ class TestBlob < Test::Unit::TestCase # C deps assert blob("deps/http_parser/http_parser.c").vendored? assert blob("deps/v8/src/v8.h").vendored? - + # Debian packaging assert blob("debian/cron.d").vendored? @@ -265,6 +273,10 @@ class TestBlob < Test::Unit::TestCase # NuGet Packages assert blob("packages/Modernizr.2.0.6/Content/Scripts/modernizr-2.0.6-development-only.js").vendored? + + # Test fixtures + assert blob("test/fixtures/random.rkt").vendored? + assert blob("Test/fixtures/random.rkt").vendored? end def test_indexable diff --git a/test/test_language.rb b/test/test_language.rb index 17b2a83a..fb9cc6d9 100644 --- a/test/test_language.rb +++ b/test/test_language.rb @@ -109,6 +109,7 @@ class TestLanguage < Test::Unit::TestCase assert_equal Language['Shell'], Language.find_by_alias('shell') assert_equal Language['Shell'], Language.find_by_alias('zsh') assert_equal Language['TeX'], Language.find_by_alias('tex') + assert_equal Language['TypeScript'], Language.find_by_alias('ts') assert_equal Language['VimL'], Language.find_by_alias('vim') assert_equal Language['VimL'], Language.find_by_alias('viml') assert_equal Language['reStructuredText'], Language.find_by_alias('rst') @@ -132,7 +133,6 @@ class TestLanguage < Test::Unit::TestCase assert_equal Language['Shell'], Language['Gentoo Ebuild'].group assert_equal Language['Shell'], Language['Gentoo Eclass'].group assert_equal Language['Shell'], Language['Tcsh'].group - assert_equal Language['XML'], Language['XSLT'].group # Ensure everyone has a group Language.all.each do |language| @@ -186,6 +186,7 @@ class TestLanguage < Test::Unit::TestCase assert_equal :programming, Language['PowerShell'].type assert_equal :programming, Language['Python'].type assert_equal :programming, Language['Ruby'].type + assert_equal :programming, Language['TypeScript'].type end def test_markup @@ -279,6 +280,7 @@ class TestLanguage < Test::Unit::TestCase assert_equal '#701516', Language['Ruby'].color assert_equal '#3581ba', Language['Python'].color assert_equal '#f15501', Language['JavaScript'].color + assert_equal '#31859c', Language['TypeScript'].color end def test_colors @@ -317,8 +319,9 @@ class TestLanguage < Test::Unit::TestCase assert_equal '.js', Language['JavaScript'].primary_extension assert_equal '.coffee', Language['CoffeeScript'].primary_extension assert_equal '.t', Language['Turing'].primary_extension + assert_equal '.ts', Language['TypeScript'].primary_extension - # This is a nasty requirement, but theres some code in GitHub that + # This is a nasty requirement, but there's some code in GitHub that # expects this. Really want to drop this. Language.all.each do |language| assert language.primary_extension, "#{language} has no primary extension" diff --git a/test/test_repository.rb b/test/test_repository.rb index 0dd29222..26025c09 100644 --- a/test/test_repository.rb +++ b/test/test_repository.rb @@ -24,4 +24,8 @@ class TestRepository < Test::Unit::TestCase def test_linguist_size assert linguist_repo.size > 30_000 end + + def test_binary_override + assert_equal repo(File.expand_path("../../samples/Nimrod", __FILE__)).language, Language["Nimrod"] + end end diff --git a/test/test_samples.rb b/test/test_samples.rb index fb9da10f..5073f7b8 100644 --- a/test/test_samples.rb +++ b/test/test_samples.rb @@ -23,8 +23,6 @@ class TestSamples < Test::Unit::TestCase actual.write Yajl::Encoder.encode(latest, :pretty => true) actual.close - warn `diff #{expected.path} #{actual.path}` - expected.unlink actual.unlink end